cleanup: avoid various GCC warnings

This commit is contained in:
Clément Bœsch 2011-03-07 21:50:45 +01:00 committed by Uoti Urpala
parent b17a1cf70c
commit 52743acba3
14 changed files with 32 additions and 33 deletions

View File

@ -23,6 +23,7 @@
#include <stdlib.h>
#include <stdbool.h>
#include "av_log.h"
#include "config.h"
#include "mp_msg.h"
#include <libavutil/log.h>

View File

@ -623,7 +623,7 @@ const m_option_t common_opts[] = {
{"lavfdopts", (void *) lavfdopts_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL},
#endif
#ifdef CONFIG_XVID4
{"xvidopts", xvid_dec_opts, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
{"xvidopts", (void *)xvid_dec_opts, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
#endif
{"codecs-file", &codecs_file, CONF_TYPE_STRING, 0, 0, 0, NULL},
// ------------------------- subtitles options --------------------

View File

@ -510,6 +510,7 @@ static int control(struct af_instance_s *af, int cmd, void *arg) {
return af_test_output(af, (af_data_t*)arg);
case AF_CONTROL_COMMAND_LINE: {
char *buf;
char *line = arg;
mp_msg(MSGT_AFILTER, MSGL_V, "%s: parse suboptions\n", setup->myname);
@ -517,46 +518,46 @@ static int control(struct af_instance_s *af, int cmd, void *arg) {
* format is (ladspa=)file:label:controls....
*/
if (!arg) {
if (!line) {
mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname,
_("No suboptions specified."));
return AF_ERROR;
}
buf = malloc(strlen(arg)+1);
buf = malloc(strlen(line)+1);
if (!buf) return af_ladspa_malloc_failed(setup->myname);
/* file... */
buf[0] = '\0';
sscanf(arg, "%[^:]", buf);
sscanf(line, "%[^:]", buf);
if (buf[0] == '\0') {
mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname,
_("No library file specified."));
free(buf);
return AF_ERROR;
}
arg += strlen(buf);
line += strlen(buf);
setup->file = strdup(buf);
if (!setup->file) return af_ladspa_malloc_failed(setup->myname);
mp_msg(MSGT_AFILTER, MSGL_V, "%s: file --> %s\n", setup->myname,
setup->file);
if (*(char*)arg != '\0') arg++; /* read ':' */
if (*line != '\0') line++; /* read ':' */
/* label... */
buf[0] = '\0';
sscanf(arg, "%[^:]", buf);
sscanf(line, "%[^:]", buf);
if (buf[0] == '\0') {
mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname,
_("No filter label specified."));
free(buf);
return AF_ERROR;
}
arg += strlen(buf);
line += strlen(buf);
setup->label = strdup(buf);
if (!setup->label) return af_ladspa_malloc_failed(setup->myname);
mp_msg(MSGT_AFILTER, MSGL_V, "%s: label --> %s\n", setup->myname,
setup->label);
/* if (*(char*)arg != '0') arg++; */ /* read ':' */
/* if (*line != '0') line++; */ /* read ':' */
free(buf); /* no longer needed */
@ -581,20 +582,20 @@ static int control(struct af_instance_s *af, int cmd, void *arg) {
/* ninputcontrols is set by now, read control values from arg */
for(i=0; i<setup->ninputcontrols; i++) {
if (!arg || (*(char*)arg != ':') ) {
if (!line || *line != ':') {
mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname,
_("Not enough controls specified on the command line."));
return AF_ERROR;
}
arg++;
r = sscanf(arg, "%f", &val);
line++;
r = sscanf(line, "%f", &val);
if (r!=1) {
mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname,
_("Not enough controls specified on the command line."));
return AF_ERROR;
}
setup->inputcontrols[setup->inputcontrolsmap[i]] = val;
arg = strchr(arg, ':');
line = strchr(line, ':');
}
mp_msg(MSGT_AFILTER, MSGL_V, "%s: input controls: ", setup->myname);

View File

@ -119,7 +119,7 @@ static void uninit(struct af_instance_s* af)
static af_data_t* play(struct af_instance_s* af, af_data_t* data)
{
af_resample_t *s = af->setup;
int i, j, consumed, ret;
int i, j, consumed, ret = 0;
int16_t *in = (int16_t*)data->audio;
int16_t *out;
int chans = data->nch;

View File

@ -161,7 +161,7 @@ static int init(int rate_hz, int channels, int format, int flags)
int bytes_per_sample;
int fl;
char *server = ao_subdevice; /* NULL for localhost */
float lag_seconds, lag_net, lag_serv;
float lag_seconds, lag_net = 0., lag_serv;
struct timeval proto_start, proto_end;
if (esd_fd < 0) {

View File

@ -288,8 +288,8 @@ static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, int dst_stri
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);
if (!src || !dst) return; // HACK avoid crash for Y8 colourspace
for(y=0; y<height; y++){

View File

@ -376,7 +376,7 @@ static int config(struct vf_instance *vf,
vf->priv->stride[i]= w;
for(j=0; j<3; j++)
vf->priv->ref[j][i]= malloc(w*h*sizeof(uint8_t))+3*w;
vf->priv->ref[j][i]= (char *)malloc(w*h*sizeof(uint8_t))+3*w;
}
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);

View File

@ -1412,7 +1412,7 @@ static void demux_ogg_seek(demuxer_t *demuxer, float rel_seek_secs,
demux_stream_t *ds;
ogg_packet op;
float rate;
int i, sp, first, precision = 1, do_seek = 1;
int i, sp, first = 1, precision = 1, do_seek = 1;
vorbis_info *vi = NULL;
int64_t gp = 0, old_gp;
off_t pos, old_pos;

View File

@ -746,7 +746,6 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
{
struct fb_cmap *cmap;
int vm = flags & VOFLAG_MODESWITCHING;
int zoom = flags & VOFLAG_SWSCALE;
fs = flags & VOFLAG_FULLSCREEN;

View File

@ -711,7 +711,7 @@ void vo_x11_classhint(struct vo *vo, Window window, const char *name)
XClassHint wmClass;
pid_t pid = getpid();
wmClass.res_name = opts->vo_winname ? opts->vo_winname : name;
wmClass.res_name = opts->vo_winname ? opts->vo_winname : (char *)name;
wmClass.res_class = "MPlayer";
XSetClassHint(x11->display, window, &wmClass);
XChangeProperty(x11->display, window, x11->XA_NET_WM_PID, XA_CARDINAL,
@ -1088,7 +1088,6 @@ void vo_x11_create_vo_window(struct vo *vo, XVisualInfo *vis, int x, int y,
goto final;
if (x11->window_state & VOFLAG_HIDDEN) {
XSizeHints hint;
XEvent xev;
x11->window_state &= ~VOFLAG_HIDDEN;
vo_x11_classhint(vo, x11->window, classname);
XStoreName(mDisplay, x11->window, title);
@ -1832,7 +1831,7 @@ static int transform_color(float val,
return (unsigned short) (s * 65535);
}
uint32_t vo_x11_set_equalizer(struct vo *vo, char *name, int value)
uint32_t vo_x11_set_equalizer(struct vo *vo, const char *name, int value)
{
float gamma, brightness, contrast;
float rf, gf, bf;
@ -1883,7 +1882,7 @@ uint32_t vo_x11_set_equalizer(struct vo *vo, char *name, int value)
return VO_TRUE;
}
uint32_t vo_x11_get_equalizer(char *name, int *value)
uint32_t vo_x11_get_equalizer(const char *name, int *value)
{
if (cmap == None)
return VO_NOTAVAIL;
@ -1899,7 +1898,7 @@ uint32_t vo_x11_get_equalizer(char *name, int *value)
}
#ifdef CONFIG_XV
int vo_xv_set_eq(struct vo *vo, uint32_t xv_port, char *name, int value)
int vo_xv_set_eq(struct vo *vo, uint32_t xv_port, const char *name, int value)
{
XvAttribute *attributes;
int i, howmany, xv_atom;
@ -1973,7 +1972,7 @@ int vo_xv_set_eq(struct vo *vo, uint32_t xv_port, char *name, int value)
return VO_FALSE;
}
int vo_xv_get_eq(struct vo *vo, uint32_t xv_port, char *name, int *value)
int vo_xv_get_eq(struct vo *vo, uint32_t xv_port, const char *name, int *value)
{
XvAttribute *attributes;

View File

@ -130,8 +130,8 @@ int vo_x11_update_geometry(struct vo *vo, bool update_pos);
void vo_x11_setlayer(struct vo *vo, Window vo_window, int layer);
void vo_x11_uninit(struct vo *vo);
Colormap vo_x11_create_colormap(struct vo *vo, XVisualInfo *vinfo);
uint32_t vo_x11_set_equalizer(struct vo *vo, char *name, int value);
uint32_t vo_x11_get_equalizer(char *name, int *value);
uint32_t vo_x11_set_equalizer(struct vo *vo, const char *name, int value);
uint32_t vo_x11_get_equalizer(const char *name, int *value);
void fstype_help(void);
void vo_x11_create_vo_window(struct vo *vo, XVisualInfo *vis,
int x, int y, unsigned int width, unsigned int height, int flags,
@ -145,8 +145,8 @@ void vo_x11_ewmh_fullscreen(struct vo_x11_state *x11, int action);
#endif
int vo_xv_set_eq(struct vo *vo, uint32_t xv_port, char * name, int value);
int vo_xv_get_eq(struct vo *vo, uint32_t xv_port, char * name, int *value);
int vo_xv_set_eq(struct vo *vo, uint32_t xv_port, const char *name, int value);
int vo_xv_get_eq(struct vo *vo, uint32_t xv_port, const char *name, int *value);
int vo_xv_enable_vsync(struct vo *vo);

View File

@ -503,7 +503,7 @@ static int pnm_get_headers(pnm_t *p, int *need_response) {
uint8_t *ptr=p->header;
uint8_t *prop_hdr=NULL;
int chunk_size,size=0;
int nr;
int nr = 0;
/* rmff_header_t *h; */
*need_response=0;

View File

@ -109,7 +109,6 @@ static void close_f(stream_t *s){
}
static int open_f (stream_t *stream, int mode, void *opts, int* file_format) {
struct stream_priv_s *p = (struct stream_priv_s*)opts;
char *filename;
mode_t m = 0;
off_t len;

View File

@ -718,7 +718,7 @@ inline static void vo_update_text_sub(struct osd_state *osd, mp_osd_obj_t* obj,i
// reading the subtitle words from vo_sub->text[]
while (*t) {
if (sub_utf8)
c = utf8_get_char(&t);
c = utf8_get_char((const char **)&t);
else if ((c = *t++) >= 0x80 && sub_unicode)
c = (c<<8) + *t++;
if (k==MAX_UCS){