Port MPlayer fixes for coverity issues in libmpcodecs.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
This commit is contained in:
Reimar Döffinger 2012-10-26 21:13:18 +02:00
parent 425c30ddae
commit 5f9cbad603
7 changed files with 10 additions and 7 deletions

View File

@ -413,7 +413,7 @@ static int analyze(struct vf_priv_s *p)
n++; n++;
} }
if(!n) if(n <= 15)
{ {
mp_msg(MSGT_VFILTER, MSGL_FATAL, "%s: Empty 2-pass log file.\n", mp_msg(MSGT_VFILTER, MSGL_FATAL, "%s: Empty 2-pass log file.\n",
vf_info_divtc.name); vf_info_divtc.name);

View File

@ -103,7 +103,7 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
// hope we'll get DR buffer: // hope we'll get DR buffer:
dmpi=vf_get_image(vf->next, IMGFMT_YV12, dmpi=vf_get_image(vf->next, IMGFMT_YV12,
MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE |
(vf->priv->scaleh == 1) ? MP_IMGFLAG_READABLE : 0, ((vf->priv->scaleh == 1) ? MP_IMGFLAG_READABLE : 0),
mpi->w * vf->priv->scalew, mpi->w * vf->priv->scalew,
mpi->h / vf->priv->scaleh - vf->priv->skipline); mpi->h / vf->priv->scaleh - vf->priv->skipline);

View File

@ -437,6 +437,7 @@ static int vf_open(vf_instance_t *vf, char *args)
mp_msg(MSGT_VFILTER, MSGL_WARN, mp_msg(MSGT_VFILTER, MSGL_WARN,
"ilpack: unknown mode %d (fallback to linear)\n", "ilpack: unknown mode %d (fallback to linear)\n",
vf->priv->mode); vf->priv->mode);
/* Fallthrough */
case 1: case 1:
vf->priv->pack[0] = pack_li_0; vf->priv->pack[0] = pack_li_0;
vf->priv->pack[1] = pack_li_1; vf->priv->pack[1] = pack_li_1;

View File

@ -242,6 +242,8 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
static void uninit(struct vf_instance *vf) static void uninit(struct vf_instance *vf)
{ {
if (!vf->priv)
return;
free(vf->priv->buf[0]); free(vf->priv->buf[0]);
free(vf->priv->buf[1]); free(vf->priv->buf[1]);
free(vf->priv->buf[2]); free(vf->priv->buf[2]);

View File

@ -144,12 +144,11 @@ static void uninit(struct vf_instance *vf)
static int vf_open(vf_instance_t *vf, char *args) static int vf_open(vf_instance_t *vf, char *args)
{ {
struct vf_priv_s *p;
vf->config = config; vf->config = config;
vf->put_image = put_image; vf->put_image = put_image;
vf->uninit = uninit; vf->uninit = uninit;
vf->default_reqs = VFCAP_ACCEPT_STRIDE; vf->default_reqs = VFCAP_ACCEPT_STRIDE;
vf->priv = p = calloc(1, sizeof(struct vf_priv_s)); vf->priv = calloc(1, sizeof(struct vf_priv_s));
vf->priv->state = 0; vf->priv->state = 0;
return 1; return 1;
} }

View File

@ -62,6 +62,7 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
dmpi->stride[2]*2, mpi->stride[2]*2); dmpi->stride[2]*2, mpi->stride[2]*2);
} }
ret = vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); ret = vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE);
/* Fallthrough */
case 1: case 1:
case 2: case 2:
memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h,

View File

@ -218,10 +218,10 @@ static int vf_open(vf_instance_t *vf, char *args)
vf->uninit = uninit; vf->uninit = uninit;
vf->default_reqs = VFCAP_ACCEPT_STRIDE; vf->default_reqs = VFCAP_ACCEPT_STRIDE;
vf->priv = p = calloc(1, sizeof(struct vf_priv_s)); vf->priv = p = calloc(1, sizeof(struct vf_priv_s));
vf->priv->mode = 0; p->mode = 0;
if (args) if (args)
sscanf(args, "%d", &vf->priv->mode); sscanf(args, "%d", &p->mode);
vf->priv->frame = 0; p->frame = 0;
return 1; return 1;
} }