[MPlayer-advusers] PATCH: FPE in demux_audio.c
Ivo
ivop at euronet.nl
Thu Jul 28 02:57:53 CEST 2005
On Thursday 28 July 2005 02:38, Andrew A. Gill wrote:
> --- main/libmpdemux/demux_audio.c 2005-04-18 16:51:34.000000000 -0400
> +++ main/libmpdemux/demux_audio.c 2005-07-27 20:03:00.000000000 -0400
> @@ -415,7 +415,15 @@
> l = 65535;
> dp = new_demux_packet(l);
> l = stream_read(s,dp->buffer,l);
> - priv->last_pts = priv->last_pts < 0 ? 0 : priv->last_pts +
l/(float)sh_audio->i_bps;
> + switch (sh_audio->i_bps)
> + {
> + case 0:
> + priv->last_pts = 0;
> + break;
> + default:
> + priv->last_pts = priv->last_pts < 0 ? 0 : priv->last_pts +
l/(float)sh_audio->i_bps;
> + break;
> + }
> break;
> }
> default:
Why use a switch statement? You can also do:
+ if (sh_audio->i_bps)
priv->last_pts = priv->last_pts < 0 ? 0 : priv->last_pts +
l/(float)sh_audio->i_bps;
+ else priv->last_pts = 0;
Same for the other switch. It's a lot shorter and also has no cosmetic
changes (which are mostly forbidden, see DOCS/tech/patches.txt).
BTW It's better if you post your patches to mplayer-dev-eng.
--Ivo
More information about the MPlayer-advusers
mailing list