On Sun, 3 Aug 2014 14:37:21 +0200, Diego Biurrun <[email protected]> wrote:
> On Sun, Aug 03, 2014 at 02:35:35PM +0200, Diego Biurrun wrote:
> > --- a/libavcodec/svq1dec.c
> > +++ b/libavcodec/svq1dec.c
> > @@ -60,6 +60,10 @@ typedef struct SVQ1Context {
> >      AVFrame *prev;
> > +
> > +    uint8_t *pkt_swapped;
> > +    int pkt_swapped_allocated;
> > +
> >      int width;
> > @@ -626,7 +630,24 @@ static int svq1_decode_frame(AVCodecContext *avctx, 
> > void *data,
> >  
> >      /* swap some header bytes (why?) */
> >      if (s->frame_code != 0x20) {
> > -        uint32_t *src = (uint32_t *)(buf + 4);
> > +        uint32_t *src;
> > +
> > +        memcpy(s->pkt_swapped, buf, buf_size);
> > +        buf = s->pkt_swapped;
> > +        init_get_bits(&s->gb, buf, buf_size * 8);
> > +        skip_bits(&s->gb, 22);
> > +
> > +        src = (uint32_t *)(s->pkt_swapped + 4);
> >  
> 
> I have locally changed pkt_swapped to a union of uint8_t and uint32_t,
> which eliminates the cast.  Do you agree that is preferable?
> 

No it's not.

Just get over your hate of casts already, they are not always inherently bad.
Using a union just obscures what's going on (and is still the same thing as a
cast).

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to