[MPlayer-dev-eng] [PATCH] printf warning fixes (REPOST)
Reimar Döffinger
Reimar.Doeffinger at stud.uni-karlsruhe.de
Sun Jan 8 13:21:24 CET 2006
Hi,
On Tue, Jan 03, 2006 at 03:50:55AM +0100, Dominik 'Rathann' Mierzejewski wrote:
> Here's a current version of my patch that attempts to silence
> most (if not all) printf format-related warnings.
Things I am not sure about:
1) Does %ld work on MinGW? Maybe it would be better to just cast to int.
2) Take care that everything that you use PRId64 etc. for actually is 64
bit (off_t and size_t do not have to be AFAIK), if in doubt just cast
those variables, too.
3) even though correct, I'm not sure if those %x -> %p changes are
desirable or if we should think up some other way.
> --- MPlayer-20051225/liba52/parse.c.printf 2005-04-07 22:07:53.000000000 +0200
> +++ MPlayer-20051225/liba52/parse.c 2005-12-25 14:09:37.000000000 +0100
> @@ -37,6 +37,8 @@
> #include "tables.h"
> #include "mm_accel.h"
>
> +#include "mp_msg.h"
> +
> #ifdef HAVE_MEMALIGN
> /* some systems have memalign() but no declaration for it */
> void * memalign (size_t align, size_t size);
> @@ -71,7 +73,7 @@
> #endif
> if(((int)samples%16) && (mm_accel&MM_ACCEL_X86_SSE)){
> mm_accel &=~MM_ACCEL_X86_SSE;
> - printf("liba52: unable to get 16 byte aligned memory disabling usage of SSE instructions\n");
> + mp_msg(MSGT_DECAUDIO,MSGL_V,"liba52: unable to get 16 byte aligned memory disabling usage of SSE instructions\n");
Unrelated?
> --- MPlayer-20051225/libaf/af_resample.c.printf 2005-02-28 01:17:05.000000000 +0100
> +++ MPlayer-20051225/libaf/af_resample.c 2005-12-25 14:09:37.000000000 +0100
> @@ -182,7 +182,7 @@
> if((s->setup & RSMP_MASK) == RSMP_LIN){
> s->pt=0LL;
> s->step=((uint64_t)n->rate<<STEPACCURACY)/(uint64_t)af->data->rate+1LL;
> - af_msg(AF_MSG_DEBUG0,"[resample] Linear interpolation step: 0x%016X.\n",
> + af_msg(AF_MSG_DEBUG0,"[resample] Linear interpolation step: 0x%016llX.\n",
> s->step);
ll prefix is not acceptable
> printf(" Input format:\n");
> - printf(" biSize %d\n", input_bih->biSize);
> - printf(" biWidth %d\n", input_bih->biWidth);
> - printf(" biHeight %d\n", input_bih->biHeight);
> + printf(" biSize %ld\n", input_bih->biSize);
> + printf(" biWidth %ld\n", input_bih->biWidth);
> + printf(" biHeight %ld\n", input_bih->biHeight);
Why?? From all I can see these are int, not long.
> - printf("videocodec: libavcodec (%dx%d fourcc=%x [%.4s])\n",
> + mp_msg(MSGT_MENCODER, MSGL_INFO,"videocodec: libavcodec (%dx%d fourcc=%x [%.4s])\n",
> mux_v->bih->biWidth, mux_v->bih->biHeight, mux_v->bih->biCompression,
> (char *)&mux_v->bih->biCompression);
Unrelated as well.
> - mp_msg(MSGT_MENCODER,MSGL_INFO,"videocodec: XViD (%dx%d fourcc=%x [%.4s])\n",
> + mp_msg(MSGT_MENCODER,MSGL_INFO,"videocodec: XViD (%dx%d fourcc=%lx [%.4s])\n",
> width, height, fp->mux->bih->biCompression, (char *)&fp->mux->bih->biCompression);
And why once %x and once %lx for the exact same thing??
> --- MPlayer-20051225/libmpcodecs/vd_vfw.c.printf 2005-06-15 18:07:32.000000000 +0200
> +++ MPlayer-20051225/libmpcodecs/vd_vfw.c 2005-12-25 14:09:37.000000000 +0100
> @@ -184,7 +184,7 @@
> ret = ICDecompressGetFormat(priv->handle, sh->bih, priv->o_bih);
> if(ret < 0){
> mp_msg(MSGT_WIN32,MSGL_ERR,"ICDecompressGetFormat failed: Error %d\n", (int)ret);
> - for (i=0; i < o_bih_len; i++) mp_msg(MSGT_WIN32, MSGL_DBG2, "%02x ", priv->o_bih[i]);
> + for (i=0; i < o_bih_len; i++) mp_msg(MSGT_WIN32, MSGL_DBG2, "%02x ", priv->o_bih[i].biSize);
I'm a bit unsure about what this is supposed to do anyway...
> - mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"ImageCodecInitialize->%p size=%d (%d)\n",cres,icap.recordSize,icap.decompressRecordSize);
> + mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"ImageCodecInitialize->%#x size=%d (%d)\n",cres,icap.recordSize,icap.decompressRecordSize);
Sure that %#x is not some weird extension?
> --- MPlayer-20051225/libmpcodecs/vf_remove_logo.c.printf 2005-11-20 01:06:17.000000000 +0100
> +++ MPlayer-20051225/libmpcodecs/vf_remove_logo.c 2005-12-25 14:09:37.000000000 +0100
> @@ -552,9 +552,9 @@
> pnm_number = fgetc(input) - '0';
> if (pnm_number != 5 && pnm_number != 6) REMOVE_LOGO_LOAD_PGM_ERROR_MESSAGE("[vf]remove-logo: Invalid PNM file. Only raw PGM (Portable Gray Map) and raw PPM (Portable Pixel Map) subtypes are allowed.\n");
> load_pgm_skip(input);
> - if (fscanf(input, "%i", &(new_pgm->width)) != 1) REMOVE_LOGO_LOAD_PGM_ERROR_MESSAGE("[vf]remove-logo: Invalid PGM/PPM header.\n");
> + if (fscanf(input, "%hu", &(new_pgm->width)) != 1) REMOVE_LOGO_LOAD_PGM_ERROR_MESSAGE("[vf]remove-logo: Invalid PGM/PPM header.\n");
> load_pgm_skip(input);
> - if (fscanf(input, "%i", &(new_pgm->height)) != 1) REMOVE_LOGO_LOAD_PGM_ERROR_MESSAGE("[vf]remove-logo: Invalid PGM/PPM header.\n");
> + if (fscanf(input, "%hu", &(new_pgm->height)) != 1) REMOVE_LOGO_LOAD_PGM_ERROR_MESSAGE("[vf]remove-logo: Invalid PGM/PPM header.\n");
I personally would prefer the width and height values to be made int
instead.
> --- MPlayer-20051225/libmpdemux/muxer_mpeg.c.printf 2005-12-07 22:52:33.000000000 +0100
> +++ MPlayer-20051225/libmpdemux/muxer_mpeg.c 2005-12-25 14:09:37.000000000 +0100
> @@ -1874,7 +1874,7 @@
> case 60060:
> return 1536000;
> default:
> - mp_msg(MSGT_MUXER, MSGL_ERR, "ERROR! unknown fps code: %d", fps);
> + mp_msg(MSGT_MUXER, MSGL_ERR, "ERROR! unknown fps code: %5.2f", fps);
Not sure if this was supposed to print the fps value or (int)(fps*1001+0.5)
> - mp_msg (MSGT_HEADER, MSGL_V, "ODML (%.4s): [%d] 0x%016llx 0x%04lx %ld\n",
> + mp_msg (MSGT_HEADER, MSGL_V, "ODML (%.4s): [%d] 0x%016llx 0x%04x %u\n",
Another ll missed.
> - chunksize, (int)chunksize+stream_tell(demuxer->stream));
> + chunksize, chunksize+(int)stream_tell(demuxer->stream));
maybe better (int)(chunksize+stream_tell(demuxer->stream)) - if not
(uint64_t) and PRI?64
> @@ -623,7 +623,7 @@
> /* disable seeking */
> demuxer->seekable = 0;
>
> - printf("VIVO Video stream %d size: display: %dx%d, codec: %ux%u\n",
> + mp_msg(MSGT_DEMUX,MSGL_STATUS,"VIVO Video stream %d size: display: %dx%d, codec: %ux%u\n",
> demuxer->video->id, sh->disp_w, sh->disp_h, sh->bih->biWidth,
> sh->bih->biHeight);
Unrelated as well.
Greetings,
Reimar Döffinger
More information about the MPlayer-dev-eng
mailing list