[FFmpeg-devel] remove int readers
Ronald S. Bultje
rsbultje
Thu Jun 14 03:18:42 CEST 2007
Hi,
On 6/13/07, Michael Niedermayer <michaelni at gmx.at> wrote:
>
> On Wed, Jun 13, 2007 at 11:43:47AM -0400, Ronald S. Bultje wrote:
> > static int64_t get_pts(const uint8_t *p)
> > {
> > - int64_t pts;
> > - int val;
> > -
> > - pts = (int64_t)((p[0] >> 1) & 0x07) << 30;
> > - val = (p[1] << 8) | p[2];
> > - pts |= (int64_t)(val >> 1) << 15;
> > - val = (p[3] << 8) | p[4];
> > - pts |= (int64_t)(val >> 1);
> > - return pts;
> > + return (int64_t)(((p[0] >> 1) & 0x07) << 30) |
> > + (int64_t) ((AV_RB16(p + 1) >> 1) << 15) |
> > + (int64_t) (AV_RB16(p + 3) >> 1);
> > }
>
> 2/3 of the casts are unneeded and the 3rd is wrongly placed so this
> will not work
> [...]
> > skip_bits(&gb, 7*8); /* 0x80"theora" */
> >
> > - version = get_bits(&gb, 8) << 16;
> > - version |= get_bits(&gb, 8) << 8;
> > - version |= get_bits(&gb, 8);
> > -
> > + version = get_be24(&gb);
>
> this is total nonsense and gcc will give you are warning
> please try to compile your changes and look at the compiler warnings
> before submitting it
Apologies, new patch attached. This one may actually work. :-).
(For the compiler warnings, I guess it's not a good idea to ask for -Werror
to be enabled as long as gcc gives warnings where it's wrong, or would such
patches still be accepted?)
Ronald
-------------- next part --------------
A non-text attachment was scrubbed...
Name: remove-intreaders.patch
Type: application/octet-stream
Size: 9497 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070613/e0ea2bc8/attachment.obj>
More information about the ffmpeg-devel
mailing list