From b5e9b8dee5030829b7e694277a86dc54e14e8f8e Mon Sep 17 00:00:00 2001 From: malaterre Date: Wed, 26 Oct 2005 20:51:54 +0000 Subject: [PATCH] ENH: Compile now on C90 compilers --- src/gdcmmpeg2/src/mpeg2dec/global.h | 1 + src/gdcmmpeg2/src/mpeg2dec/mpeg2dec.c | 21 +++++++++------------ src/gdcmmpeg2/src/mpeg2dec/mpeg2dec.h | 2 -- src/gdcmmpeg2/src/mpeg2dec/store.c | 11 ++++------- 4 files changed, 14 insertions(+), 21 deletions(-) diff --git a/src/gdcmmpeg2/src/mpeg2dec/global.h b/src/gdcmmpeg2/src/mpeg2dec/global.h index 10159af8..0d592ba8 100644 --- a/src/gdcmmpeg2/src/mpeg2dec/global.h +++ b/src/gdcmmpeg2/src/mpeg2dec/global.h @@ -118,6 +118,7 @@ void form_predictions _ANSI_ARGS_((int bx, int by, int macroblock_type, void Spatial_Prediction _ANSI_ARGS_((void)); /* store.c */ +void FreeStaticBuffer _ANSI_ARGS_((void)); void Write_Frame _ANSI_ARGS_((unsigned char *src[], int frame)); #ifdef DISPLAY diff --git a/src/gdcmmpeg2/src/mpeg2dec/mpeg2dec.c b/src/gdcmmpeg2/src/mpeg2dec/mpeg2dec.c index dbfe0f3f..5211f3f7 100644 --- a/src/gdcmmpeg2/src/mpeg2dec/mpeg2dec.c +++ b/src/gdcmmpeg2/src/mpeg2dec/mpeg2dec.c @@ -83,7 +83,7 @@ int my_fopenr(const char *path, const char *mode, istream *os) if(fd) { os->InFd = fd; - return 1; //success + return 1; /*success*/ } else os->InFd = NULL; @@ -96,7 +96,7 @@ int my_fopen(const char *path, const char *mode, ostream *os) if(fd) { os->OutFd = fd; - return 1; //success + return 1; /*success*/ } else os->OutFd = NULL; @@ -134,7 +134,6 @@ int my_fclose(ostream *fp) int my_printf(const char *format, ...) { - //return printf(format, ...); va_list argptr; int ret; @@ -147,7 +146,6 @@ int my_printf(const char *format, ...) int my_sprintf(char *str, const char *format, ...) { - //return sprintf(str, format, ...); va_list argptr; int ret; @@ -160,7 +158,6 @@ int my_sprintf(char *str, const char *format, ...) int my_fprintf(const char *format, ...) { - //return fprintf(stderr, format, ...); va_list argptr; int ret; @@ -311,10 +308,10 @@ static void Initialize_Decoder() static void DeInitialize_Decoder() { - free(Clip-384); // WTF !!! + free(Clip-384); /* I love magic number */ } -/* mostly IMPLEMENTAION specific rouintes */ +/* mostly IMPLEMENTAION specific routines */ static void Initialize_Sequence() { int cc, size; @@ -438,16 +435,16 @@ char *argv[]; /* argument vector */ " -f store/display interlaced video in frame format\n" " -g concatenated file format for substitution method (-x)\n" " -in file information & statistics report (n: level)\n" -" -l file file name pattern for lower layer sequence\n" -" (for spatial scalability)\n" +" -l file file name pattern for lower layer sequence\n"); +printf(" (for spatial scalability)\n" " -on file output format (0:YUV 1:SIF 2:TGA 3:PPM 4:X11 5:X11HiQ)\n" " -q disable warnings to stderr\n" " -r use double precision reference IDCT\n" " -t enable low level tracing to stdout\n" " -u file print user_data to stdio or file\n" " -vn verbose output (n: level)\n" -" -x file filename pattern of picture substitution sequence\n\n" -"File patterns: for sequential filenames, \"printf\" style, e.g. rec%%d\n" +" -x file filename pattern of picture substitution sequence\n\n"); +printf("File patterns: for sequential filenames, \"printf\" style, e.g. rec%%d\n" " or rec%%d%%c for fieldwise storage\n" "Levels: 0:none 1:sequence 2:picture 3:slice 4:macroblock 5:block\n\n" "Example: mpeg2decode -b bitstream.mpg -f -r -o0 rec%%d\n" @@ -769,7 +766,7 @@ static void Deinitialize_Sequence() { int i; - /* First clenup the static buffer in store.c */ + /* First cleanup the static buffer in store.c */ FreeStaticBuffer(); /* clear flags */ diff --git a/src/gdcmmpeg2/src/mpeg2dec/mpeg2dec.h b/src/gdcmmpeg2/src/mpeg2dec/mpeg2dec.h index 6cf7ebe7..acca1687 100644 --- a/src/gdcmmpeg2/src/mpeg2dec/mpeg2dec.h +++ b/src/gdcmmpeg2/src/mpeg2dec/mpeg2dec.h @@ -137,12 +137,10 @@ typedef struct FILE* OutFd; } ostream; -//int my_open(char *filename); int my_printf(const char *format, ...); int my_fprintf(const char *format, ...); int my_sprintf(char *str, const char *format, ...); void my_exit(int status); -//ostream *my_fopen(const char *path, const char *mode); int my_fopenr(const char *path, const char *mode, istream *os); int my_fopen(const char *path, const char *mode, ostream *os); int my_fseek(ostream *stream, long offset, int whence); diff --git a/src/gdcmmpeg2/src/mpeg2dec/store.c b/src/gdcmmpeg2/src/mpeg2dec/store.c index 61366c09..852b8435 100644 --- a/src/gdcmmpeg2/src/mpeg2dec/store.c +++ b/src/gdcmmpeg2/src/mpeg2dec/store.c @@ -53,7 +53,7 @@ static void conv420to422 _ANSI_ARGS_((unsigned char *src, unsigned char *dst)); static unsigned char obfr[OBFRSIZE]; static unsigned char *optr; static ostream *outfile; -unsigned char *static_malloc[6] = {0,0,0,0,0,0}; //worse case there is 6 buffer in this impl unit. +unsigned char *static_malloc[6] = {0,0,0,0,0,0}; /*worse case there is 6 buffer in this impl unit.*/ void FreeStaticBuffer() { @@ -160,12 +160,11 @@ int offset,incr,width,height; { int i, j; unsigned char *p; + ostream file; if (!Quiet_Flag) my_fprintf("saving %s\n",name); - //if ((outfile = open(name,O_CREAT|O_TRUNC|O_WRONLY|O_BINARY,0666))==-1) - ostream file; outfile = &file; if(!my_fopen(name, "wb", outfile)) { @@ -199,6 +198,7 @@ int offset, incr, height; int i,j; unsigned char *py, *pu, *pv; static unsigned char *u422, *v422; + ostream file; if (chroma_format==CHROMA444) Error("4:4:4 not supported for SIF format"); @@ -231,8 +231,6 @@ int offset, incr, height; if (!Quiet_Flag) my_fprintf("saving %s\n",outname); - //if ((outfile = open(outname,O_CREAT|O_TRUNC|O_WRONLY|O_BINARY,0666))==-1) - ostream file; outfile = &file; if(!my_fopen(outname, "wb", outfile)) { @@ -279,6 +277,7 @@ int tgaflag; static unsigned char tga24[14] = {0,0,2,0,0,0,0, 0,0,0,0,0,24,32}; char header[FILENAME_LENGTH]; static unsigned char *u422, *v422, *u444, *v444; + ostream file; if (chroma_format==CHROMA444) { @@ -331,8 +330,6 @@ int tgaflag; if (!Quiet_Flag) my_fprintf("saving %s\n",outname); - //if ((outfile = open(outname,O_CREAT|O_TRUNC|O_WRONLY|O_BINARY,0666))==-1) - ostream file; outfile = &file; if(! my_fopen(outname, "wb", outfile)) { -- 2.48.1