libextractor

GNU libextractor
Log | Files | Refs | Submodules | README | LICENSE

commit 54d41e68a1ff27646a47c0ef12c2a3ae4c11350d
parent f464d65231442f9e6b90220b4c09f04db07a47ae
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sun, 30 Dec 2007 02:40:12 +0000

code cleanup

Diffstat:
Msrc/plugins/amfparser.c | 3---
Msrc/plugins/flvextractor.c | 23+++++++++--------------
2 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/src/plugins/amfparser.c b/src/plugins/amfparser.c @@ -83,7 +83,6 @@ static int readASNumber(const unsigned char **data, double *retval) { const unsigned char *ptr = *data; - char *ret; double val; if (*len < 8) @@ -102,7 +101,6 @@ static int readASBoolean(const unsigned char **data, int *retval) { const unsigned char *ptr = *data; - char *ret; int val; if (*len < 1) @@ -126,7 +124,6 @@ static int readASDate(const unsigned char **data, short *zone) { const unsigned char *ptr = *data; - char *ret; if (*len < 10) return -1; diff --git a/src/plugins/flvextractor.c b/src/plugins/flvextractor.c @@ -384,6 +384,8 @@ static void handleASEnd(unsigned char type, void * value, void * userdata) { 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 @@ static int readFLVTag(const unsigned char **data, #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 @@ static char * printVideoFormat(FLVStreamState *state) 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)