gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r6052 - Extractor/src/plugins


From: gnunet
Subject: [GNUnet-SVN] r6052 - Extractor/src/plugins
Date: Sat, 29 Dec 2007 19:40:12 -0700 (MST)

Author: grothoff
Date: 2007-12-29 19:40:12 -0700 (Sat, 29 Dec 2007)
New Revision: 6052

Modified:
   Extractor/src/plugins/amfparser.c
   Extractor/src/plugins/flvextractor.c
Log:
code cleanup

Modified: Extractor/src/plugins/amfparser.c
===================================================================
--- Extractor/src/plugins/amfparser.c   2007-12-30 02:39:25 UTC (rev 6051)
+++ Extractor/src/plugins/amfparser.c   2007-12-30 02:40:12 UTC (rev 6052)
@@ -83,7 +83,6 @@
                                double *retval)
 {
   const unsigned char *ptr = *data;
-  char *ret;
   double val;
 
   if (*len < 8)
@@ -102,7 +101,6 @@
                                 int *retval)
 {
   const unsigned char *ptr = *data;
-  char *ret;
   int val;
   
   if (*len < 1)
@@ -126,7 +124,6 @@
                              short *zone)
 {
   const unsigned char *ptr = *data;
-  char *ret;
 
   if (*len < 10)
     return -1;

Modified: Extractor/src/plugins/flvextractor.c
===================================================================
--- Extractor/src/plugins/flvextractor.c        2007-12-30 02:39:25 UTC (rev 
6051)
+++ Extractor/src/plugins/flvextractor.c        2007-12-30 02:40:12 UTC (rev 
6052)
@@ -384,6 +384,8 @@
   {
     double n = *((double *)value);
     switch (state->currentAttribute) {
+      case FLV_NONE:
+        break;
       case FLV_WIDTH:
         if (state->streamState->videoWidth == -1)
           state->streamState->videoWidth = n;
@@ -596,28 +598,24 @@
 #define MAX_FLV_FORMAT_LINE 80
 static char * printVideoFormat(FLVStreamState *state)
 {
-  char *s;
+  char s[MAX_FLV_FORMAT_LINE+1];
   int n;
   size_t len = MAX_FLV_FORMAT_LINE;
 
-  s = malloc(len);
-  if (s == NULL)
-    return NULL;
-
   n = 0;
   if (state->videoWidth != -1 || state->videoHeight != -1) {
     if (n < len) {
       if (state->videoWidth != -1)
-        n += snprintf(s+n, len-n, "%dx", state->videoWidth);
+        n += snprintf(s+n, len-n, "%d", state->videoWidth);
       else
-        n += snprintf(s+n, len-n, "?x", state->videoWidth);
+        n += snprintf(s+n, len-n, "%d", state->videoWidth);
     }
 
     if (n < len) {
       if (state->videoHeight != -1)
         n += snprintf(s+n, len-n, "%d", state->videoHeight);
       else
-        n += snprintf(s+n, len-n, "?", state->videoHeight);
+        n += snprintf(s+n, len-n, "%d", state->videoHeight);
     }
   }
 
@@ -643,12 +641,9 @@
       n += snprintf(s+n, len-n, "%.4f kbps", state->videoDataRate);
   }
 
-  if (n == 0) {
-    free(s);
-    s = NULL;
-  }
-
-  return s;
+  if (n == 0) 
+    return NULL;
+  return strdup(s);
 }
 
 static char * printAudioFormat(FLVStreamState *state)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]