[MPlayer-dev-eng] [PATCH] trivial changes to suppress compiler warnings
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Thu Oct 22 15:25:19 CEST 2009
On Thu, Oct 22, 2009 at 02:00:30PM +0200, Diego Biurrun wrote:
> Index: libmpcodecs/vf_pp7.c
> ===================================================================
> --- libmpcodecs/vf_pp7.c (revision 29789)
> +++ libmpcodecs/vf_pp7.c (working copy)
> @@ -286,8 +286,8 @@
> int x, y;
> const int stride= is_luma ? p->temp_stride : ((width+16+15)&(~15));
> uint8_t *p_src= p->src + 8*stride;
> - DCTELEM *block= p->src;
> - DCTELEM *temp= p->src + 32;
> + DCTELEM *block= (DCTELEM*)p->src;
> + DCTELEM *temp= (DCTELEM*)p->src + 32;
I think this breaks it.
> @@ -268,7 +268,7 @@
> struct rv_init_t init_data;
>
> if(extrahdr_size < 8) {
> - mp_msg(MSGT_DECVIDEO,MSGL_ERR,"realvideo: extradata too small (%u)\n", sh->bih->biSize - sizeof(BITMAPINFOHEADER));
> + mp_msg(MSGT_DECVIDEO,MSGL_ERR,"realvideo: extradata too small (%lu)\n", sh->bih->biSize - sizeof(BITMAPINFOHEADER));
That's wrong e.g. on 64 Windows systems.
%zu probably would be right, but I find casting to int preferable.
> Index: stream/http.c
> ===================================================================
> --- stream/http.c (revision 29789)
> +++ stream/http.c (working copy)
> @@ -654,7 +654,7 @@
> mp_msg(MSGT_NETWORK,MSGL_V,"method: [%s]\n", http_hdr->method );
> mp_msg(MSGT_NETWORK,MSGL_V,"status code: [%d]\n", http_hdr->status_code );
> mp_msg(MSGT_NETWORK,MSGL_V,"reason phrase: [%s]\n", http_hdr->reason_phrase );
> - mp_msg(MSGT_NETWORK,MSGL_V,"body size: [%d]\n", http_hdr->body_size );
> + mp_msg(MSGT_NETWORK,MSGL_V,"body size: [%zu]\n", http_hdr->body_size );
IMO body_size and buffer_size shouldn't be size_t in the first place, though
that would need to check in detail if it is correct or would cause more issues.
> Index: libvo/x11_common.c
> ===================================================================
> --- libvo/x11_common.c (revision 29789)
> +++ libvo/x11_common.c (working copy)
> @@ -1341,7 +1341,7 @@
>
> void vo_x11_fullscreen(void)
> {
> - int x, y, w, h;
> + int x=0, y=0, w=0, h=0;
The whole code of this function should probably be written in a better
way, but here specifically I'd suggest just moving the
x = vo_old_x;
y = vo_old_y;
w = vo_old_width;
h = vo_old_height;
part up here.
> Index: loader/qtx/qtxsdk/components.h
> ===================================================================
> --- loader/qtx/qtxsdk/components.h (revision 29789)
> +++ loader/qtx/qtxsdk/components.h (working copy)
> @@ -728,15 +728,15 @@
> if(cd->wantedDestinationPixelTypes){
> unsigned int* p=cd->wantedDestinationPixelTypes;
Doesn't that assignment cause a waning, too?
> printf("screenFloodMethod=%d value=%d preferredOffscreenPixelSize=%d\n",
> cd->screenFloodMethod, cd->screenFloodValue, cd->preferredOffscreenPixelSize);
> printf("callbacks: progress=%p compl=%p data=%p ftime=%p srcdata=%p sync=%p\n",
> - cd->progressProcRecord, cd->completionProcRecord,
> - cd->dataProcRecord, cd->frameTime, cd->sourceData, cd->syncFrameTime);
> + (void*)cd->progressProcRecord, (void*)cd->completionProcRecord,
> + (void*)cd->dataProcRecord, cd->frameTime, cd->sourceData, cd->syncFrameTime);
I think the format string should be changed instead.
> Index: libmpdemux/demux_lmlm4.c
> ===================================================================
> --- libmpdemux/demux_lmlm4.c (revision 29789)
> +++ libmpdemux/demux_lmlm4.c (working copy)
> @@ -72,7 +72,7 @@
> if ( frame->channelNo > 7 ||
> frame->frameSize > MAX_PACKET_SIZE || frame->frameSize <= 0)
> {
> - mp_msg(MSGT_DEMUX, MSGL_V, "Invalid packet in LMLM4 stream: ch=%d size=%d\n", frame->channelNo, frame->frameSize);
> + mp_msg(MSGT_DEMUX, MSGL_V, "Invalid packet in LMLM4 stream: ch=%d size=%zd\n", frame->channelNo, frame->frameSize);
> return 0;
> }
> switch (frame->frameType) {
> @@ -156,7 +156,7 @@
> frameInfo->frameSize = packetSize - 8; //sizeof(IME6400Header);
> frameInfo->paddingSize = (packetSize & PACKET_BLOCK_LAST) ? PACKET_BLOCK_SIZE - (packetSize & PACKET_BLOCK_LAST) : 0;
>
> - mp_msg(MSGT_DEMUX, MSGL_DBG2, "typ: %d chan: %d size: %d pad: %d\n",
> + mp_msg(MSGT_DEMUX, MSGL_DBG2, "typ: %d chan: %d size: %zd pad: %zd\n",
> frameInfo->frameType,
> frameInfo->channelNo,
> frameInfo->frameSize,
Using size_t for frameSize IMO is a bad idea.
Same for the rest of those changes.
More information about the MPlayer-dev-eng
mailing list