2009-02-11 Juan Manuel Guerrero * libvo/ideo_out_pgm.c (md5_draw_frame): Use the correct conversion specifier qualifier. * src/mpeg2dec.c (print_fps): Use the correct conversion specifier qualifier. * src/extract_mpeg2.c (handle_args): Include local getopt.h. * src/dump_state.c (dump_state): Use the correct conversion specifier qualifier. * src/getopt.h [__GNU_LIBRARY__, __DJGPP__]: For DJGPP do not declare getopt() as extern and include unistd.h for getopt() prototype. * src/getopt.c [__GNU_LIBRARY__, __DJGPP__]: Also for DJGPP include stdlib.h to provide the getenv() prototype. [getenv]: For DJGPP do not declare getenv() as extern. * src/corrupt_mpeg2.c (handle_args): Use the correct conversion specifier qualifier. (main): Use the correct conversion specifier qualifier. diff -aprNU5 libmpeg2-0.5.1.orig/libvo/video_out_pgm.c libmpeg2-0.5.1/libvo/video_out_pgm.c --- libmpeg2-0.5.1.orig/libvo/video_out_pgm.c 2008-07-09 22:00:08 +0000 +++ libmpeg2-0.5.1/libvo/video_out_pgm.c 2009-02-11 19:52:04 +0000 @@ -332,13 +332,13 @@ static void md5_draw_frame (vo_instance_ instance->md5_block[14] = instance->md5_bytes << 3; instance->md5_block[15] = instance->md5_bytes >> 29; little_endian (instance->md5_block, 14); md5_transform (instance->md5_hash, instance->md5_block); - printf ("%08x%08x%08x%08x *%d.pgm\n", swap (instance->md5_hash[0]), - swap (instance->md5_hash[1]) , swap (instance->md5_hash[2]), - swap (instance->md5_hash[3]), instance->framenum++); + printf ("%08jx%08jx%08jx%08jx *%d.pgm\n", (uintmax_t)swap (instance->md5_hash[0]), + (uintmax_t)swap (instance->md5_hash[1]) , (uintmax_t)swap (instance->md5_hash[2]), + (uintmax_t)swap (instance->md5_hash[3]), instance->framenum++); } vo_instance_t * vo_md5_open (void) { return internal_open (md5_draw_frame, md5_writer); diff -aprNU5 libmpeg2-0.5.1.orig/src/corrupt_mpeg2.c libmpeg2-0.5.1/src/corrupt_mpeg2.c --- libmpeg2-0.5.1.orig/src/corrupt_mpeg2.c 2008-07-11 19:48:04 +0000 +++ libmpeg2-0.5.1/src/corrupt_mpeg2.c 2009-02-12 21:40:56 +0000 @@ -167,12 +167,12 @@ static void handle_args (int argc, char while ((c = getopt (argc, argv, "hl:s:r:v:")) != -1) switch (c) { case 'l': if (seed_file || seed_loaded) print_usage (argv); - if (sscanf (optarg, "%08x%08x%08x%08x", - rsl, rsl+1, rsl+2, rsl+3) != 4) + if (sscanf (optarg, "%08jx%08jx%08jx%08jx", + (uintmax_t *)rsl, (uintmax_t *)(rsl+1), (uintmax_t *)(rsl+2), (uintmax_t *)(rsl+3)) != 4) print_usage (argv); seed_loaded = 1; break; case 's': @@ -328,12 +328,12 @@ int main (int argc, char ** argv) if (!seed_loaded) { srand (time (NULL)); for (i = 0; i < 4; i++) rsl[i] = rand (); - fprintf (seed_file, "%08x%08x%08x%08x\n", - rsl[0], rsl[1], rsl[2], rsl[3]); + fprintf (seed_file, "%08jx%08jx%08jx%08jx\n", + (uintmax_t)rsl[0], (uintmax_t)rsl[1], (uintmax_t)rsl[2], (uintmax_t)rsl[3]); fclose (seed_file); } for (i = 4; i < 55; i++) rsl[i] = 0; diff -aprNU5 libmpeg2-0.5.1.orig/src/dump_state.c libmpeg2-0.5.1/src/dump_state.c --- libmpeg2-0.5.1.orig/src/dump_state.c 2008-07-11 17:27:00 +0000 +++ libmpeg2-0.5.1/src/dump_state.c 2009-02-11 19:52:06 +0000 @@ -381,14 +381,14 @@ void dump_state (FILE * f, mpeg2_state_t fprintf (f, " SKIP"); fprintf (f, " fields %d", pic->nb_fields); if (pic->flags & PIC_FLAG_TOP_FIELD_FIRST) fprintf (f, " TFF"); if (pic->flags & PIC_FLAG_TAGS) - fprintf (f, " pts %08x dts %08x", pic->tag, pic->tag2); + fprintf (f, " pts %08jx dts %08jx", (uintmax_t)(pic->tag), (uintmax_t)(pic->tag2)); fprintf (f, " time_ref %d", pic->temporal_reference); if (pic->flags & PIC_FLAG_COMPOSITE_DISPLAY) - fprintf (f, " composite %05x", pic->flags >> 12); + fprintf (f, " composite %05jx", (uintmax_t)(pic->flags >> 12)); fprintf (f, " offset"); nb_pos = pic->nb_fields; if (seq->flags & SEQ_FLAG_PROGRESSIVE_SEQUENCE) nb_pos >>= 1; for (i = 0; i < nb_pos; i++) diff -aprNU5 libmpeg2-0.5.1.orig/src/extract_mpeg2.c libmpeg2-0.5.1/src/extract_mpeg2.c --- libmpeg2-0.5.1.orig/src/extract_mpeg2.c 2008-07-09 18:28:24 +0000 +++ libmpeg2-0.5.1/src/extract_mpeg2.c 2009-02-11 23:18:54 +0000 @@ -25,11 +25,11 @@ #include #include #include #include -#include +#include "getopt.h" #ifdef HAVE_IO_H #include #include #endif #include diff -aprNU5 libmpeg2-0.5.1.orig/src/getopt.c libmpeg2-0.5.1/src/getopt.c --- libmpeg2-0.5.1.orig/src/getopt.c 2008-07-09 18:28:24 +0000 +++ libmpeg2-0.5.1/src/getopt.c 2009-02-11 23:18:56 +0000 @@ -60,11 +60,11 @@ #ifndef ELIDE_CODE /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ -#ifdef __GNU_LIBRARY__ +#if defined (__GNU_LIBRARY__) || defined (__DJGPP__) /* Don't include stdlib.h for non-GNU C libraries because some of them contain conflicting prototypes for getopt. */ # include # include #endif /* GNU C library. */ @@ -205,18 +205,16 @@ static char *posixly_correct; # endif /* Avoid depending on library functions or files whose names are inconsistent. */ -#ifndef getenv +#if !defined (getenv) && !defined (__DJGPP__) extern char *getenv (); #endif static char * -my_index (str, chr) - const char *str; - int chr; +my_index (const char *str, int chr) { while (*str) { if (*str == chr) return (char *) str; diff -aprNU5 libmpeg2-0.5.1.orig/src/getopt.h libmpeg2-0.5.1/src/getopt.h --- libmpeg2-0.5.1.orig/src/getopt.h 2008-07-09 18:28:24 +0000 +++ libmpeg2-0.5.1/src/getopt.h 2009-02-12 21:00:50 +0000 @@ -131,11 +131,16 @@ struct option /* Many other libraries have conflicting prototypes for getopt, with differences in the consts, in stdlib.h. To avoid compilation errors, only prototype getopt for the GNU C library. */ extern int getopt (int __argc, char *const *__argv, const char *__shortopts); # else /* not __GNU_LIBRARY__ */ +# ifdef __DJGPP__ +/* For getopt() declaration. */ +# include +# else extern int getopt (); +# endif # endif /* __GNU_LIBRARY__ */ # ifndef __need_getopt extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts, const struct option *__longopts, int *__longind); diff -aprNU5 libmpeg2-0.5.1.orig/src/mpeg2dec.c libmpeg2-0.5.1/src/mpeg2dec.c --- libmpeg2-0.5.1.orig/src/mpeg2dec.c 2008-07-09 19:16:04 +0000 +++ libmpeg2-0.5.1/src/mpeg2dec.c 2009-02-12 21:53:22 +0000 @@ -95,12 +95,12 @@ static void print_fps (int final) if (total_elapsed) tfps = frame_counter * 100.0 / total_elapsed; else tfps = 0; - fprintf (stderr,"\n%d frames decoded in %.2f seconds (%.2f fps)\n", - frame_counter, total_elapsed / 100.0, tfps); + fprintf (stderr,"\n%ju frames decoded in %.2f seconds (%.2f fps)\n", + (uintmax_t)frame_counter, total_elapsed / 100.0, tfps); return; } frame_counter++; @@ -112,12 +112,12 @@ static void print_fps (int final) frames = frame_counter - last_count; fps = frames * 100.0 / elapsed; tfps = frame_counter * 100.0 / total_elapsed; - fprintf (stderr, "%d frames in %.2f sec (%.2f fps), " - "%d last %.2f sec (%.2f fps)\033[K\r", frame_counter, + fprintf (stderr, "%ju frames in %.2f sec (%.2f fps), " + "%d last %.2f sec (%.2f fps)\033[K\r", (uintmax_t)frame_counter, total_elapsed / 100.0, tfps, frames, elapsed / 100.0, fps); last_count = frame_counter; }