Cppcheck reports "Logical conjunction always evaluates to false" in text_gfx.cxx

Stephan Bergmann sbergman at redhat.com
Mon Mar 19 03:55:27 PDT 2012


On 03/18/2012 02:39 PM, julien2412 wrote:
> Cppcheck reports this :
> [generic/print/text_gfx.cxx:105]: (warning) Logical conjunction always

Would be helpful if you gave the complete path, 
vcl/generic/print/text_gfx.cxx.

> evaluates to false: nChar<  65380&&  nChar>= 65387
>
> Here are the lines :
>     103         if( ( nChar>= 0x3008&&  nChar<  0x3019&&  nChar != 0x3012 )
> ||
>      104             nChar == 0xff3b || nChar == 0xff3d ||
>      105             (nChar>= 0xff6b&&  nChar<  0xff64 ) ||
>      106             nChar == 0xffe3
>      107             )
>      108             nAngle = 0;
>
> Shoud the line 105 just be replaced by :
>   (nChar>= 0xff64&&  nChar<  0xff6b ) ||
>
> Or is it less obvious/more tricky than that ?

 From those Unicode characters (mostly CJK brackets), it looks like that 
should probably be

   nChar >= 0xff62 && nChar < 0xff64

i.e., matching U+FF62 HALFWIDTH LEFT CORNER BRACKET and U+FF63 HALFWIDTH 
RIGHT CORNER BRACKET.

Stephan


More information about the LibreOffice mailing list