From 6506d4ad84eac67e69437def2c8ee69fcfc14ed5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Thu, 28 Apr 2011 09:36:00 +0200 Subject: [PATCH] cleanup: remove more warnings --- codec-cfg.c | 6 ++++-- input/input.c | 2 +- libmpcodecs/vd_xvid4.c | 2 +- libmpcodecs/vf_bmovl.c | 7 +++---- libmpcodecs/vf_divtc.c | 2 +- libmpcodecs/vf_sab.c | 29 +---------------------------- libmpcodecs/vf_smartblur.c | 29 +---------------------------- libmpcodecs/vf_tfields.c | 22 ++++++++-------------- libmpdemux/aviheader.c | 4 ++-- libmpdemux/mf.c | 2 +- libmpdemux/video.c | 2 +- libvo/video_out_internal.h | 1 - libvo/vo_sdl.c | 10 +++------- m_config.c | 6 +++--- mp_msg.c | 2 +- stream/ai_alsa1x.c | 1 - stream/asf_streaming.c | 2 +- stream/pnm.c | 2 -- stream/stream.h | 3 ++- stream/stream_cdda.c | 2 +- stream/vcd_read.h | 3 ++- 21 files changed, 37 insertions(+), 102 deletions(-) diff --git a/codec-cfg.c b/codec-cfg.c index a7d958ebc1..792972fa3e 100644 --- a/codec-cfg.c +++ b/codec-cfg.c @@ -477,8 +477,10 @@ int parse_codec_cfg(const char *cfgfile) #ifdef CODECS2HTML return 0; #else - video_codecs = builtin_video_codecs; - audio_codecs = builtin_audio_codecs; + /* following casts are harmless since {video,audio}_codecs will stay + * untouched in this case */ + video_codecs = (codecs_t *)builtin_video_codecs; + audio_codecs = (codecs_t *)builtin_audio_codecs; nr_vcodecs = sizeof(builtin_video_codecs)/sizeof(codecs_t); nr_acodecs = sizeof(builtin_audio_codecs)/sizeof(codecs_t); return 1; diff --git a/input/input.c b/input/input.c index 9a74abcdfb..808b197603 100644 --- a/input/input.c +++ b/input/input.c @@ -1471,7 +1471,7 @@ int mp_input_get_key_from_name(const char *name) const char *p; while (p = strchr(name, '+')) { for (struct mp_key_name *m = modifier_names; m->name; m++) - if (!bstrcasecmp(BSTR(m->name), (struct bstr){name, p - name})) { + if (!bstrcasecmp(BSTR(m->name), (struct bstr){(char *)name, p - name})) { modifiers |= m->key; goto found; } diff --git a/libmpcodecs/vd_xvid4.c b/libmpcodecs/vd_xvid4.c index 779baef105..c5e25cd1d6 100644 --- a/libmpcodecs/vd_xvid4.c +++ b/libmpcodecs/vd_xvid4.c @@ -287,7 +287,7 @@ static mp_image_t* decode(sh_video_t *sh, void* data, int len, int flags) } /* Don't forget to update buffer position and buffer length */ - dec.bitstream += consumed; + dec.bitstream = (char *)dec.bitstream + consumed; dec.length -= consumed; } while ((stats.type == XVID_TYPE_VOL || stats.type == XVID_TYPE_NOTHING) && dec.length > 0); diff --git a/libmpcodecs/vf_bmovl.c b/libmpcodecs/vf_bmovl.c index b6b9940832..da5dc97f50 100644 --- a/libmpcodecs/vf_bmovl.c +++ b/libmpcodecs/vf_bmovl.c @@ -219,7 +219,6 @@ put_image(struct vf_instance *vf, mp_image_t* mpi, double pts){ int have, got, want; int xpos=0, ypos=0, pos=0; unsigned char red=0, green=0, blue=0; - int alpha; mp_image_t* dmpi; dmpi = vf_get_image(vf->next, mpi->imgfmt, MP_IMGTYPE_TEMP, @@ -349,6 +348,8 @@ put_image(struct vf_instance *vf, mp_image_t* mpi, double pts){ for( buf_y=0 ; (buf_y < imgh) && (buf_y < (vf->priv->h-imgy)) ; buf_y++ ) { for( buf_x=0 ; (buf_x < (imgw*pxsz)) && (buf_x < ((vf->priv->w+imgx)*pxsz)) ; buf_x += pxsz ) { + int alpha = 0xff; + if(command & IS_RAWIMG) buf_pos = (buf_y * imgw * pxsz) + buf_x; pos = ((buf_y+imgy) * vf->priv->w) + ((buf_x/pxsz)+imgx); @@ -369,13 +370,11 @@ put_image(struct vf_instance *vf, mp_image_t* mpi, double pts){ red = buffer[buf_pos+0]; green = buffer[buf_pos+1]; blue = buffer[buf_pos+2]; - alpha = 0xFF; break; case IMG_BGR24: blue = buffer[buf_pos+0]; green = buffer[buf_pos+1]; red = buffer[buf_pos+2]; - alpha = 0xFF; break; case CMD_ALPHA: vf->priv->bitmap.a[pos] = INRANGE((vf->priv->bitmap.oa[pos]+imgalpha),0,255); @@ -423,7 +422,7 @@ put_image(struct vf_instance *vf, mp_image_t* mpi, double pts){ for ( xpos=vf->priv->x1 ; xpos < vf->priv->x2 ; xpos++ ) { pos = (ypos * dmpi->stride[0]) + xpos; - alpha = vf->priv->bitmap.a[pos]; + int alpha = vf->priv->bitmap.a[pos]; if (alpha == 0) continue; // Completly transparent pixel diff --git a/libmpcodecs/vf_divtc.c b/libmpcodecs/vf_divtc.c index b3d84d200f..3a4f2169ab 100644 --- a/libmpcodecs/vf_divtc.c +++ b/libmpcodecs/vf_divtc.c @@ -156,7 +156,7 @@ static unsigned int checksum_plane(unsigned char *p, unsigned char *z, for(sum=0; h; h--, p+=s-w) { - for(shift=0, e=p+w; (int)p&(sizeof(wsum_t)-1) && ppriv->luma, width, height); - getSubSampleFactors(&sw, &sh, outfmt); + mp_get_chroma_shift(outfmt, &sw, &sh); allocStuff(&vf->priv->chroma, width>>sw, height>>sh); return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); diff --git a/libmpcodecs/vf_smartblur.c b/libmpcodecs/vf_smartblur.c index f0b7f36b3c..4083dfbda0 100644 --- a/libmpcodecs/vf_smartblur.c +++ b/libmpcodecs/vf_smartblur.c @@ -50,33 +50,6 @@ struct vf_priv_s { /***************************************************************************/ -//FIXME stupid code duplication -static void getSubSampleFactors(int *h, int *v, int format){ - switch(format){ - case IMGFMT_YV12: - case IMGFMT_I420: - *h=1; - *v=1; - break; - case IMGFMT_YVU9: - *h=2; - *v=2; - break; - case IMGFMT_444P: - *h=0; - *v=0; - break; - case IMGFMT_422P: - *h=1; - *v=0; - break; - case IMGFMT_411P: - *h=2; - *v=0; - break; - } -} - static int allocStuff(FilterParam *f, int width, int height){ SwsVector *vec; SwsFilter swsF; @@ -102,7 +75,7 @@ static int config(struct vf_instance *vf, allocStuff(&vf->priv->luma, width, height); - getSubSampleFactors(&sw, &sh, outfmt); + mp_get_chroma_shift(outfmt, &sw, &sh); allocStuff(&vf->priv->chroma, width>>sw, height>>sh); return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); diff --git a/libmpcodecs/vf_tfields.c b/libmpcodecs/vf_tfields.c index 52cd0b5684..4823ef463c 100644 --- a/libmpcodecs/vf_tfields.c +++ b/libmpcodecs/vf_tfields.c @@ -343,7 +343,7 @@ static int continue_buffered_image(struct vf_instance *vf) mp_image_t *mpi = vf->priv->buffered_mpi; int ret=0; mp_image_t *dmpi; - void (*qpel)(unsigned char *, unsigned char *, int, int, int, int, int); + void (*qpel)(unsigned char *, unsigned char *, int, int, int, int, int) = NULL; int bpp=1; int tff; @@ -360,19 +360,6 @@ static int continue_buffered_image(struct vf_instance *vf) } else tff = (vf->priv->parity&1)^1; - switch (vf->priv->mode) { - case 2: - qpel = qpel_li; - break; - case 3: - // TODO: add 3tap filter - qpel = qpel_4tap; - break; - case 4: - qpel = qpel_4tap; - break; - } - switch (vf->priv->mode) { case 0: for (; i<2; i++) { @@ -419,8 +406,15 @@ static int continue_buffered_image(struct vf_instance *vf) } break; case 2: + qpel = qpel_li; case 3: + // TODO: add 3tap filter + if (!qpel) + qpel = qpel_4tap; case 4: + if (!qpel) + qpel = qpel_4tap; + for (; i<2; i++) { dmpi = vf_get_image(vf->next, mpi->imgfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, diff --git a/libmpdemux/aviheader.c b/libmpdemux/aviheader.c index 27d2fd5fdb..cd2db91726 100644 --- a/libmpdemux/aviheader.c +++ b/libmpdemux/aviheader.c @@ -267,7 +267,7 @@ while(1){ if(last_fccType==streamtypeVIDEO){ sh_video->bih=calloc(FFMAX(chunksize, sizeof(*sh_video->bih)), 1); // sh_video->bih=malloc(chunksize); memset(sh_video->bih,0,chunksize); - mp_tmsg(MSGT_HEADER,MSGL_V,"Found 'bih', %u bytes of %d\n",chunksize,sizeof(*sh_video->bih)); + mp_tmsg(MSGT_HEADER,MSGL_V,"Found 'bih', %u bytes of %zu\n",chunksize,sizeof(*sh_video->bih)); stream_read(demuxer->stream,(char*) sh_video->bih,chunksize); le2me_BITMAPINFOHEADER(sh_video->bih); // swap to machine endian if (sh_video->bih->biSize > chunksize && sh_video->bih->biSize > sizeof(*sh_video->bih)) @@ -323,7 +323,7 @@ while(1){ unsigned wf_size = chunksizewf)?sizeof(*sh_audio->wf):chunksize; sh_audio->wf=calloc(wf_size,1); // sh_audio->wf=malloc(chunksize); memset(sh_audio->wf,0,chunksize); - mp_tmsg(MSGT_HEADER,MSGL_V,"Found 'wf', %d bytes of %d\n",chunksize,sizeof(*sh_audio->wf)); + mp_tmsg(MSGT_HEADER,MSGL_V,"Found 'wf', %d bytes of %zu\n",chunksize,sizeof(*sh_audio->wf)); stream_read(demuxer->stream,(char*) sh_audio->wf,chunksize); le2me_WAVEFORMATEX(sh_audio->wf); if (sh_audio->wf->cbSize != 0 && diff --git a/libmpdemux/mf.c b/libmpdemux/mf.c index 3127176f6e..6b22c6147d 100644 --- a/libmpdemux/mf.c +++ b/libmpdemux/mf.c @@ -126,7 +126,7 @@ mf_t* open_mf(char * filename){ mf->nr_of_files=gg.gl_pathc; mf->names=calloc( gg.gl_pathc, sizeof( char* ) ); - mp_msg( MSGT_STREAM,MSGL_INFO,"[mf] number of files: %d (%d)\n",mf->nr_of_files, gg.gl_pathc * sizeof( char* ) ); + mp_msg( MSGT_STREAM,MSGL_INFO,"[mf] number of files: %d (%zd)\n",mf->nr_of_files, gg.gl_pathc * sizeof( char* ) ); for( i=0;i < gg.gl_pathc;i++ ) { diff --git a/libmpdemux/video.c b/libmpdemux/video.c index 3244624e77..2e41cf0b4b 100644 --- a/libmpdemux/video.c +++ b/libmpdemux/video.c @@ -387,7 +387,7 @@ mpeg_header_parser: if(mp_vc1_decode_sequence_header(&picture, &videobuffer[4], videobuf_len-4)) { sh_video->bih = calloc(1, sizeof(*sh_video->bih) + videobuf_len); if(sh_video->bih == NULL) { - mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Couldn't alloc %d bytes for VC-1 extradata!\n", sizeof(*sh_video->bih) + videobuf_len); + mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Couldn't alloc %zu bytes for VC-1 extradata!\n", sizeof(*sh_video->bih) + videobuf_len); return 0; } sh_video->bih->biSize= sizeof(*sh_video->bih) + videobuf_len; diff --git a/libvo/video_out_internal.h b/libvo/video_out_internal.h index 8595d4ef05..263a94e695 100644 --- a/libvo/video_out_internal.h +++ b/libvo/video_out_internal.h @@ -40,7 +40,6 @@ static void draw_osd(void); static void flip_page(void); static void check_events(void); static void uninit(void); -static int query_format(uint32_t format); static int preinit(const char *); #define LIBVO_EXTERN(x) struct vo_driver video_out_##x =\ diff --git a/libvo/vo_sdl.c b/libvo/vo_sdl.c index be6e741295..ae16d0e599 100644 --- a/libvo/vo_sdl.c +++ b/libvo/vo_sdl.c @@ -66,6 +66,7 @@ #include "sub/sub.h" #include "aspect.h" #include "libmpcodecs/vfcap.h" +#include "ffmpeg_files/bswap.h" #ifdef CONFIG_X11 #include @@ -1185,13 +1186,10 @@ static void erase_rectangle(int x, int y, int w, int h) case IMGFMT_YUY2: case IMGFMT_YVYU: { - /* yuy2 and yvyu represent black the same way */ - uint8_t yuy2_black[] = {0, 128, 0, 128}; - SDL_OVR_LOCK((void) 0) erase_area_4(x*2, w*2, h, priv->overlay->pitches[0], - *((uint32_t*) yuy2_black), + be2me_32(0x00800080), /* yuy2 and yvyu represent black the same way */ priv->overlay->pixels[0] + priv->overlay->pitches[0]*y); SDL_OVR_UNLOCK @@ -1200,12 +1198,10 @@ static void erase_rectangle(int x, int y, int w, int h) case IMGFMT_UYVY: { - uint8_t uyvy_black[] = {128, 0, 128, 0}; - SDL_OVR_LOCK((void) 0) erase_area_4(x*2, w*2, h, priv->overlay->pitches[0], - *((uint32_t*) uyvy_black), + be2me_32(0x80008000), priv->overlay->pixels[0] + priv->overlay->pitches[0]*y); SDL_OVR_UNLOCK diff --git a/m_config.c b/m_config.c index 0f5151aed5..914bfcecb7 100644 --- a/m_config.c +++ b/m_config.c @@ -308,10 +308,10 @@ m_config_add_option(m_config_t *config, const m_option_t *arg, const char* prefi co->opt = arg; // Fill in the full name - if(prefix && strlen(prefix) > 0) { + if (prefix && *prefix) co->name = talloc_asprintf(co, "%s:%s", prefix, arg->name); - } else - co->name = arg->name; + else + co->name = (char *)arg->name; // Option with children -> add them if(arg->type->flags & M_OPT_TYPE_HAS_CHILD) { diff --git a/mp_msg.c b/mp_msg.c index cff4decb75..d069b1d019 100644 --- a/mp_msg.c +++ b/mp_msg.c @@ -311,7 +311,7 @@ char *mp_gtext(const char *string) string = gettext(string); setlocale(LC_MESSAGES, "C"); #endif - return string; + return (char *)string; } void mp_tmsg(int mod, int lev, const char *format, ...) diff --git a/stream/ai_alsa1x.c b/stream/ai_alsa1x.c index 3b9e878730..412e87ce05 100644 --- a/stream/ai_alsa1x.c +++ b/stream/ai_alsa1x.c @@ -108,7 +108,6 @@ int ai_alsa_setup(audio_in_t *ai) } snd_pcm_sw_params_current(ai->alsa.handle, swparams); - err = snd_pcm_sw_params_set_sleep_min(ai->alsa.handle, swparams,0); err = snd_pcm_sw_params_set_avail_min(ai->alsa.handle, swparams, ai->alsa.chunk_size); err = snd_pcm_sw_params_set_start_threshold(ai->alsa.handle, swparams, 0); diff --git a/stream/asf_streaming.c b/stream/asf_streaming.c index 891f519d28..73197f4f54 100644 --- a/stream/asf_streaming.c +++ b/stream/asf_streaming.c @@ -672,7 +672,7 @@ static int asf_http_parse_response(asf_http_streaming_ctrl_t *asf_http_ctrl, HTT len = (unsigned int)(end-pragma); } if(len > sizeof(features) - 1) { - mp_tmsg(MSGT_NETWORK,MSGL_WARN,"ASF HTTP PARSE WARNING : Pragma %s cut from %zd bytes to %d\n",pragma,len,sizeof(features) - 1); + mp_tmsg(MSGT_NETWORK,MSGL_WARN,"ASF HTTP PARSE WARNING : Pragma %s cut from %zd bytes to %zd\n",pragma,len,sizeof(features) - 1); len = sizeof(features) - 1; } strncpy( features, pragma, len ); diff --git a/stream/pnm.c b/stream/pnm.c index 14ffa5d1c1..46c22361d9 100644 --- a/stream/pnm.c +++ b/stream/pnm.c @@ -417,7 +417,6 @@ static int pnm_write_chunk(uint16_t chunk_id, uint16_t length, static void pnm_send_request(pnm_t *p, uint32_t bandwidth) { - uint16_t i16; int c=sizeof(pnm_header); char fixme[]={0,1}; @@ -453,7 +452,6 @@ static void pnm_send_request(pnm_t *p, uint32_t bandwidth) { /* client id string */ p->buffer[c]=PNA_CLIENT_STRING; AV_WB16(&p->buffer[c+1], strlen(client_string)-1); /* don't know why do we have -1 here */ - memcpy(&p->buffer[c+1],&i16,2); memcpy(&p->buffer[c+3],client_string,strlen(client_string)+1); c=c+3+strlen(client_string)+1; diff --git a/stream/stream.h b/stream/stream.h index 94bfb0e343..77319871c0 100644 --- a/stream/stream.h +++ b/stream/stream.h @@ -229,7 +229,8 @@ inline static unsigned int stream_read_word_le(stream_t *s){ return (y<<8)|x; } -inline static unsigned int stream_read_dword_le(stream_t *s){ +inline static uint32_t stream_read_dword_le(stream_t *s) +{ unsigned int y; y=stream_read_char(s); y|=stream_read_char(s)<<8; diff --git a/stream/stream_cdda.c b/stream/stream_cdda.c index aa459a7e3d..b768d25682 100644 --- a/stream/stream_cdda.c +++ b/stream/stream_cdda.c @@ -355,7 +355,7 @@ static int open_cdda(stream_t *st,int m, void* opts, int* file_format) { } cd_info = cd_info_new(); - mp_tmsg(MSGT_OPEN,MSGL_INFO,"Found audio CD with %d tracks.\n",cdda_tracks(cdd)); + mp_tmsg(MSGT_OPEN,MSGL_INFO,"Found audio CD with %ld tracks.\n",cdda_tracks(cdd)); for(i=0;itracks;i++) { char track_name[80]; long sec=cdda_track_firstsector(cdd,i+1); diff --git a/stream/vcd_read.h b/stream/vcd_read.h index 910561ad74..8b8d2ab817 100644 --- a/stream/vcd_read.h +++ b/stream/vcd_read.h @@ -62,7 +62,8 @@ static inline unsigned int vcd_get_msf(mp_vcd_priv_t* vcd){ vcd->entry.cdte_addr.msf.minute*60)*75 - 150; } -int vcd_seek_to_track(mp_vcd_priv_t* vcd,int track){ +static int vcd_seek_to_track(mp_vcd_priv_t* vcd, int track) +{ vcd->entry.cdte_format = CDROM_MSF; vcd->entry.cdte_track = track; if (ioctl(vcd->fd, CDROMREADTOCENTRY, &vcd->entry)) {