From 65cc2366a34f3e572be0fa59e7d70f8b57e526ea Mon Sep 17 00:00:00 2001 From: siretart Date: Sun, 9 Jan 2011 20:02:45 +0000 Subject: [PATCH] TOOLS/: minor fixes in tool code Fix printf format string warning fixes this warning: asfinfo.c: In function 'print_video_header': asfinfo.c:158: warning: format '%.4s' expects type 'char *', but argument 3 has type 'long int *' git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32774 b3059339-0415-0410-9bf9-f77b7e298cf2 add missing fclose git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32775 b3059339-0415-0410-9bf9-f77b7e298cf2 add missing fclose() found by cppcheck: [avisubdump.c:199]: (error) Resource leak: f git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32776 b3059339-0415-0410-9bf9-f77b7e298cf2 --- TOOLS/asfinfo.c | 3 ++- TOOLS/avisubdump.c | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/TOOLS/asfinfo.c b/TOOLS/asfinfo.c index 85883b462f..739bbcc0c7 100644 --- a/TOOLS/asfinfo.c +++ b/TOOLS/asfinfo.c @@ -155,7 +155,7 @@ static void print_video_header(BITMAPINFOHEADER *h){ printf(" biHeight %ld\n", h->biHeight); printf(" biPlanes %d\n", h->biPlanes); printf(" biBitCount %d\n", h->biBitCount); - printf(" biCompression %ld='%.4s'\n", h->biCompression, &h->biCompression); + printf(" biCompression %ld='%.4s'\n", h->biCompression, (const char*)&h->biCompression); printf(" biSizeImage %ld\n", h->biSizeImage); printf("===========================\n"); } @@ -284,5 +284,6 @@ int main(int argc, char* argv[]){ fseek(f, pos + objh.size - sizeof(objh), SEEK_SET); } + fclose(f); return 0; } diff --git a/TOOLS/avisubdump.c b/TOOLS/avisubdump.c index 9fc50aff46..da886c4332 100644 --- a/TOOLS/avisubdump.c +++ b/TOOLS/avisubdump.c @@ -180,8 +180,12 @@ int main(int argc,char* argv[]) exit(1); } - if (strcmp(argv[argc-1], "-") == 0) f=stdin; - else f=fopen(argv[argc-1],"rb"); + if (strcmp(argv[argc-1], "-") == 0) { + dump(stdin); + return 0; + } + + f=fopen(argv[argc-1],"rb"); if (!f) { fprintf(stderr, "Could not open '%s': %s\n", @@ -190,6 +194,7 @@ int main(int argc,char* argv[]) } dump(f); + fclose(f); return 0; }