[xiph-cvs] cvs commit: vorbis-tools/ogginfo ogginfo.c

Stan Seibert volsung at xiph.org
Tue Dec 18 19:47:42 PST 2001



volsung     01/12/18 19:47:41

  Modified:    ogg123   buffer.c
               ogginfo  ogginfo.c
  Removed:     ogg123   ao_interface.c
  Log:
  Warning fix on ogginfo
  More mutex unlock checks

Revision  Changes    Path
1.10      +62 -2     vorbis-tools/ogg123/buffer.c

Index: buffer.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/buffer.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- buffer.c	2001/12/19 02:52:53	1.9
+++ buffer.c	2001/12/19 03:47:40	1.10
@@ -11,7 +11,7 @@
  *                                                                  *
  ********************************************************************
 
- last mod: $Id: buffer.c,v 1.9 2001/12/19 02:52:53 volsung Exp $
+ last mod: $Id: buffer.c,v 1.10 2001/12/19 03:47:40 volsung Exp $
 
  ********************************************************************/
 
@@ -94,6 +94,14 @@
 }
 
 
+void buffer_mutex_unlock (void *arg)
+{
+  buf_t *buf = (buf_t *)arg;
+
+  UNLOCK_MUTEX(buf->mutex);
+}
+
+
 action_t *malloc_action (action_func_t action_func, void *action_arg)
 {
   action_t *action;
@@ -270,6 +278,8 @@
 
   DEBUG("Enter submit_data_chunk, size %d", size);
 
+  pthread_cleanup_push(buffer_mutex_unlock, buf);
+
   /* Put the data into the buffer as space is made available */
   while (size > 0) {
     
@@ -318,6 +328,8 @@
     UNLOCK_MUTEX(buf->mutex);
   }
 
+  pthread_cleanup_pop(0);
+
   DEBUG("Exit submit_data_chunk");
 }
 
@@ -437,9 +449,13 @@
 {
   DEBUG("Pausing playback thread");
 
+  pthread_cleanup_push(buffer_mutex_unlock, buf);
+
   LOCK_MUTEX(buf->mutex);
   buf->paused = 1;
   UNLOCK_MUTEX(buf->mutex);
+
+  pthread_cleanup_pop(0);
 }
 
 
@@ -447,10 +463,14 @@
 {
   DEBUG("Unpausing playback thread");
   
+  pthread_cleanup_push(buffer_mutex_unlock, buf);
+
   LOCK_MUTEX(buf->mutex);
   buf->paused = 0;
   COND_SIGNAL(buf->playback_cond);
   UNLOCK_MUTEX(buf->mutex);
+
+  pthread_cleanup_pop(0);
 }
 
 
@@ -488,6 +508,8 @@
 
   DEBUG("Enter buffer_get_data");
 
+  pthread_cleanup_push(buffer_mutex_unlock, buf);
+
   LOCK_MUTEX(buf->mutex);
 
   /* Put the data into the buffer as space is made available */
@@ -536,6 +558,8 @@
   }
 
   UNLOCK_MUTEX(buf->mutex);
+
+  pthread_cleanup_pop(0);
   
   pthread_testcancel();
 
@@ -548,21 +572,29 @@
 {
   DEBUG("buffer_mark_eos");
 
+  pthread_cleanup_push(buffer_mutex_unlock, buf);
+
   LOCK_MUTEX(buf->mutex);
   buf->eos = 1;
   buf->prebuffering = 0;
   COND_SIGNAL(buf->playback_cond);
   UNLOCK_MUTEX(buf->mutex);
+
+  pthread_cleanup_pop(0);
 }
 
 void buffer_abort_write (buf_t *buf)
 {
   DEBUG("buffer_mark_eos");
 
+  pthread_cleanup_push(buffer_mutex_unlock, buf);
+
   LOCK_MUTEX(buf->mutex);
   buf->abort_write = 1;
   COND_SIGNAL(buf->write_cond);
   UNLOCK_MUTEX(buf->mutex);  
+
+  pthread_cleanup_pop(0);
 }
 
 
@@ -575,6 +607,8 @@
   
   action = malloc_action(action_func, action_arg);
 
+  pthread_cleanup_push(buffer_mutex_unlock, buf);
+
   LOCK_MUTEX(buf->mutex);
 
   action->position = buf->position;
@@ -584,6 +618,8 @@
   buf->actions = action;
 
   UNLOCK_MUTEX(buf->mutex);
+
+  pthread_cleanup_pop(0);
 }
 
 
@@ -594,6 +630,8 @@
 
   action = malloc_action(action_func, action_arg);
 
+  pthread_cleanup_push(buffer_mutex_unlock, buf);
+
   LOCK_MUTEX(buf->mutex);
 
   /* Stick after the last item in the buffer */
@@ -602,6 +640,8 @@
   in_order_add_action(&buf->actions, action, INSERT);
 
   UNLOCK_MUTEX(buf->mutex);
+
+  pthread_cleanup_pop(0);
 }
 
 
@@ -612,6 +652,8 @@
 
   action = malloc_action(action_func, action_arg);
 
+  pthread_cleanup_push(buffer_mutex_unlock, buf);
+
   LOCK_MUTEX(buf->mutex);
 
   /* Stick after the last item in the buffer */
@@ -620,6 +662,8 @@
   in_order_add_action(&buf->actions, action, APPEND);
 
   UNLOCK_MUTEX(buf->mutex);
+
+  pthread_cleanup_pop(0);
 }
 
 
@@ -630,6 +674,8 @@
 
   action = malloc_action(action_func, action_arg);
 
+  pthread_cleanup_push(buffer_mutex_unlock, buf);
+
   LOCK_MUTEX(buf->mutex);
   
   action->position = position;
@@ -637,6 +683,8 @@
   in_order_add_action(&buf->actions, action, INSERT);
 
   UNLOCK_MUTEX(buf->mutex);  
+
+  pthread_cleanup_pop(0);
 }
 
 
@@ -647,13 +695,17 @@
 
   action = malloc_action(action_func, action_arg);
 
+  pthread_cleanup_push(buffer_mutex_unlock, buf);
+
   LOCK_MUTEX(buf->mutex);
   
   action->position = position;
 
   in_order_add_action(&buf->actions, action, APPEND);
 
-  UNLOCK_MUTEX(buf->mutex);  
+  UNLOCK_MUTEX(buf->mutex);
+
+  pthread_cleanup_pop(0);
 }
 
 
@@ -664,6 +716,8 @@
   int empty = 0;
 
   DEBUG("Enter buffer_wait_for_empty");
+
+  pthread_cleanup_push(buffer_mutex_unlock, buf);
   
   LOCK_MUTEX(buf->mutex);
   while (!empty) {
@@ -676,6 +730,8 @@
   }
   UNLOCK_MUTEX(buf->mutex);
 
+  pthread_cleanup_pop(0);
+
   DEBUG("Exit buffer_wait_for_empty");
 }
 
@@ -689,6 +745,8 @@
 buffer_stats_t *buffer_statistics (buf_t *buf)
 {
   buffer_stats_t *stats;
+
+  pthread_cleanup_push(buffer_mutex_unlock, buf);
   
   LOCK_MUTEX(buf->mutex);
 
@@ -701,6 +759,8 @@
   stats->eos = buf->eos;
 
   UNLOCK_MUTEX(buf->mutex);
+
+  pthread_cleanup_pop(0);
 
   return stats;
 }

1.7       +2 -3      vorbis-tools/ogginfo/ogginfo.c

Index: ogginfo.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogginfo/ogginfo.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ogginfo.c	2001/09/09 03:12:12	1.6
+++ ogginfo.c	2001/12/19 03:47:41	1.7
@@ -46,7 +46,7 @@
 
 void print_header_info(vorbis_comment *vc, vorbis_info *vi)
 {
-  int rc,i;
+  int i;
 
   for (i=0; i < vc->comments; i++) {
     printf("%s\n",vc->user_comments[i]);
@@ -102,7 +102,6 @@
   ogg_packet       op; /* one raw packet of data for decode */
   char *buffer;
   int bytes;
-  int eos=0;
   int i;
   
   /* grab some data at the head of the stream.  We want the first page
@@ -304,7 +303,7 @@
 
     /* Output test results */
     if (header_state == 1) {
-      printf("\nserial=%d\n", serialno);
+      printf("\nserial=%ld\n", serialno);
       printf("header_integrity=pass\n");
       print_header_info(&vc, &vi);
     } else

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list