[PATCH sis 04/15] Fix "suggest parentheses around operand of ‘!’" compiler warnings.

Mark Kettenis mark.kettenis at xs4all.nl
Wed Apr 6 13:14:49 PDT 2011


> From: Timo Aaltonen <tjaalton at ubuntu.com>
> Date: Wed,  6 Apr 2011 19:50:06 +0300
> 
> Signed-off-by: Timo Aaltonen <timo.aaltonen at canonical.com>
> ---
>  src/sis_cursor.c  |    2 +-
>  src/sis_utility.c |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/sis_cursor.c b/src/sis_cursor.c
> index 13eddc4..67a3402 100644
> --- a/src/sis_cursor.c
> +++ b/src/sis_cursor.c
> @@ -759,7 +759,7 @@ SiS300LoadCursorImage(ScrnInfoPtr pScrn, UChar *src)
>      }
>  
>      if(pSiS->VBFlags & CRT2_ENABLE) {
> -       if((pSiS->UseHWARGBCursor) && (!pSiS->VBFlags & DISPTYPE_CRT1)) {
> +       if((pSiS->UseHWARGBCursor) && ((!pSiS->VBFlags) & DISPTYPE_CRT1)) {

Hmm, while your change is correct in the sense that it doesn't change
the meaning of the code, I do think that what's actually meant here is:

       if((pSiS->UseHWARGBCursor) && (!(pSiS->VBFlags & DISPTYPE_CRT1))) {

What's there now, just doesn't make sense, since it will always
evaluate to false.  See also SiS310LoadCursorImage.

> diff --git a/src/sis_utility.c b/src/sis_utility.c
> index 64d8919..0892cf5 100644
> --- a/src/sis_utility.c
> +++ b/src/sis_utility.c
> @@ -523,7 +523,7 @@ SISSwitchCRT2Type(ScrnInfoPtr pScrn, ULong newvbflags, Bool quiet)
>      }
>  #endif
>  
> -    if((!(newvbflags & CRT2_ENABLE)) && (!newvbflags & DISPTYPE_CRT1)) {
> +    if((!(newvbflags & CRT2_ENABLE)) && ((!newvbflags) & DISPTYPE_CRT1)) {

And this should probably be

    if((!(newvbflags & CRT2_ENABLE)) && (!(newvbflags & DISPTYPE_CRT1))) {

Cheers,

Mark


More information about the xorg-devel mailing list