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

Vitor Sessak vitor1001
Sun Oct 26 22:51:41 CET 2008


Michael Niedermayer wrote:
> 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 ...

Ok, attached.

-Vitor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sws_warns3.diff
Type: text/x-diff
Size: 553 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081026/47fb1559/attachment.diff>



More information about the ffmpeg-devel mailing list