changeset 82:033f011d8152 src

Improve some debug messages. Add some comments about dvdnav_open memory leaks.
author jcdutton
date Sat, 31 Aug 2002 02:50:27 +0000
parents 740552dd7668
children 5716523464dd
files dvdnav.c vm.c
diffstat 2 files changed, 21 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/dvdnav.c	Thu Aug 29 11:53:25 2002 +0000
+++ b/dvdnav.c	Sat Aug 31 02:50:27 2002 +0000
@@ -177,11 +177,17 @@
   dvdnav_t *this;
   
   /* Create a new structure */
+  fprintf(MSG_OUT, "libdvdnav: Using dvdnav version from http://dvd.sf.net\n");
+
+  /* FIXME: We malloc() here, but if an error occurs inside dvdnav_open(),
+   * we return but never free() it.
+   */
   (*dest) = NULL;
   this = (dvdnav_t*)malloc(sizeof(dvdnav_t));
   if(!this)
    return S_ERR;
   memset(this, 0, (sizeof(dvdnav_t) ) ); /* Make sure this structure is clean */
+  (*dest) = this;
 
   pthread_mutex_init(&this->vm_lock, NULL);
   /* Initialise the error string */
@@ -208,16 +214,9 @@
   if (this->file) DVDCloseFile(this->file);
   this->file = NULL;
     
-  //if(!this->started) {
-  //  /* Start the VM */
-  //  vm_start(this->vm);
-  //  this->started = 1;
-  //}
-
   /* Start the read-ahead cache. */
   this->cache = dvdnav_read_cache_new(this);
   
-  (*dest) = this;
   return S_OK;
 }
 
@@ -288,14 +287,6 @@
 #endif
   result=dvdnav_clear(this);
 #ifdef LOG_DEBUG
-  fprintf(MSG_OUT, "libdvdnav: starting vm\n");
-#endif
-//  if(!this->started) {
-//    /* Start the VM */
-//    vm_start(this->vm);
-//    this->started = 1;
-//  }
-#ifdef LOG_DEBUG
   fprintf(MSG_OUT, "libdvdnav: unlocking\n");
 #endif
   pthread_mutex_unlock(&this->vm_lock); 
@@ -999,6 +990,10 @@
 
 /*
  * $Log$
+ * Revision 1.32  2002/08/31 02:50:27  jcdutton
+ * Improve some debug messages.
+ * Add some comments about dvdnav_open memory leaks.
+ *
  * Revision 1.31  2002/08/27 19:15:08  mroi
  * more consistent console output
  *
--- a/vm.c	Thu Aug 29 11:53:25 2002 +0000
+++ b/vm.c	Sat Aug 31 02:50:27 2002 +0000
@@ -42,9 +42,9 @@
 #include "vm.h"
 #include "dvdnav_internal.h"
 
-/*
+
 #define STRICT
-*/
+
 
 /* Local prototypes */
 
@@ -1158,17 +1158,18 @@
 {
   /* FIXME $$$ Move this to a separate function? */
   vm->badness_counter++;
-  if (vm->badness_counter > 1) fprintf(MSG_OUT, "libdvdnav: **** process_command re-entered %d*****\n",vm->badness_counter);
+  if (vm->badness_counter > 1) fprintf(MSG_OUT, "libdvdnav: **** WARNING: process_command re-entered %d*****\n",vm->badness_counter);
   while(link_values.command != PlayThis) {
     
 #ifdef TRACE
+    fprintf(MSG_OUT, "libdvdnav: Before printout starts:\n");
     vmPrint_LINK(link_values);
     
     fprintf(MSG_OUT, "libdvdnav: Link values %i %i %i %i\n", link_values.command, 
 	    link_values.data1, link_values.data2, link_values.data3);
      
-    fprintf(MSG_OUT, "libdvdnav: Before:");
     vm_print_current_domain_state(vm);
+    fprintf(MSG_OUT, "libdvdnav: Before printout ends.\n");
 #endif
     
     switch(link_values.command) {
@@ -1500,8 +1501,9 @@
     }
 
 #ifdef TRACE
-  fprintf(MSG_OUT, "libdvdnav: After:");
+  fprintf(MSG_OUT, "libdvdnav: After printout starts:\n");
   vm_print_current_domain_state(vm);
+  fprintf(MSG_OUT, "libdvdnav: After printout ends.\n");
 #endif
     
   }
@@ -1824,6 +1826,10 @@
 
 /*
  * $Log$
+ * Revision 1.29  2002/08/31 02:50:27  jcdutton
+ * Improve some debug messages.
+ * Add some comments about dvdnav_open memory leaks.
+ *
  * Revision 1.28  2002/08/29 05:33:54  jcdutton
  * Slight changes to help debugging.
  *