1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-17 12:25:03 +00:00

cleanup: remove more warnings

This commit is contained in:
Clément Bœsch 2011-04-28 09:36:00 +02:00 committed by Uoti Urpala
parent 7e65428712
commit 6506d4ad84
21 changed files with 37 additions and 102 deletions

View File

@ -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;

View File

@ -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;
}

View File

@ -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);

View File

@ -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

View File

@ -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) && p<e;)
for(shift=0, e=p+w; (size_t)p&(sizeof(wsum_t)-1) && p<e;)
sum^=*p++<<(shift=(shift-8)&31);
for(wsum=0, e2=e-sizeof(wsum_t)+1; p<e2; p+=sizeof(wsum_t))

View File

@ -63,33 +63,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){
int stride= (width+7)&~7;
SwsVector *vec;
@ -143,7 +116,7 @@ static int config(struct vf_instance *vf,
//__asm__ volatile("emms\n\t");
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);

View File

@ -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);

View File

@ -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,

View File

@ -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 = chunksize<sizeof(*sh_audio->wf)?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 &&

View File

@ -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++ )
{

View File

@ -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;

View File

@ -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 =\

View File

@ -66,6 +66,7 @@
#include "sub/sub.h"
#include "aspect.h"
#include "libmpcodecs/vfcap.h"
#include "ffmpeg_files/bswap.h"
#ifdef CONFIG_X11
#include <X11/Xlib.h>
@ -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

View File

@ -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) {

View File

@ -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, ...)

View File

@ -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);

View File

@ -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 );

View File

@ -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;

View File

@ -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;

View File

@ -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;i<cdd->tracks;i++) {
char track_name[80];
long sec=cdda_track_firstsector(cdd,i+1);

View File

@ -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)) {