[FFmpeg-devel] [PATCH] fix some warnings in swscale.c

Michael Niedermayer michaelni
Sun Oct 26 17:46:08 CET 2008


On Sun, Oct 26, 2008 at 04:42:25PM +0100, Vitor Sessak wrote:
> Michael Niedermayer wrote:
>> On Sat, Oct 25, 2008 at 10:26:45PM +0200, Vitor Sessak wrote:
>>> $Subj.
>>>
>>> -Vitor
>>> Index: libswscale/swscale.c
>>> ===================================================================
>>> --- libswscale/swscale.c	(revision 27818)
>>> +++ libswscale/swscale.c	(working copy)
>>> @@ -1741,7 +1741,7 @@
>>>        for (i=0; i<srcSliceH; i++) {
>>> -        conv(srcPtr, dstPtr, c->srcW, c->pal_rgb);
>>> +        conv(srcPtr, dstPtr, c->srcW, (uint8_t *) c->pal_rgb);
>>>          srcPtr+= srcStride[0];
>>>          dstPtr+= dstStride[0];
>>>      }
>> ok
>
> Applied this part.
>
>>> @@ -2717,27 +2717,34 @@
>>>      if (usePal(c->srcFormat)){
>>>          for (i=0; i<256; i++){
>>>              int p, r, g, b,y,u,v;
>>> -            if(c->srcFormat == PIX_FMT_PAL8){
>>> +            switch(c->srcFormat) {
>>> +            case PIX_FMT_PAL8:
>> this does not look like a warning fix
>
> No, but I find that using a switch() the warning fix is more readable. 
> Attached is the straightforward version.

i am not arguing in favor or against either if or switch but changing from
one to the other does not belong in a warning fix IMHO

[...]
> Index: libswscale/swscale.c
> ===================================================================
> --- libswscale/swscale.c	(revision 27834)
> +++ libswscale/swscale.c	(working copy)
> @@ -2734,7 +2734,7 @@
>                  r= (i>>3    )*255;
>                  g= ((i>>1)&3)*85;
>                  b= (i&1     )*255;
> -            }else if(c->srcFormat == PIX_FMT_BGR4_BYTE){
> +            }else { //if(c->srcFormat == PIX_FMT_BGR4_BYTE){

id write it as an assert() instead of a comment, has the advantage that
it might catch a bug ...

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081026/0b6397ba/attachment.pgp>



More information about the ffmpeg-devel mailing list