Hi,
I use char type for variable cC before and it should be signed as
default in GCC
as far as I remember. but we can modify that with -funsigned-char, so it is
reasonable
to use sal_Unicode when we handle Unicode string. The comparison is
previously
used with char, and I have no change the condition properly after
replacement.
Thanks for your careful check and explanation.
Regards - Zuojun
2012/8/14 Oliver-Rainer Wittmann <[email protected]>
> Hi Pavel,
>
>
> On 14.08.2012 16:27, Pavel Janík wrote:
>
>> Hi Oliver,
>>
>> On Aug 14, 2012, at 4:15 PM, Oliver-Rainer Wittmann wrote:
>>
>> --- incubator/ooo/trunk/main/sw/**source/filter/ww8/ww8par5.cxx
>>>>> (original)
>>>>> +++ incubator/ooo/trunk/main/sw/**source/filter/ww8/ww8par5.cxx Mon
>>>>> Aug 13 13:04:34 2012
>>>>>
>>>>
>>>> + const sal_Unicode cC =
>>>>> sPart.GetChar(nBegin+1);
>>>>> + if ( (-1 < cC) && (cC < 32) )
>>>>>
>>>>
>>>> This code results in this warning:
>>>>
>>>> sw/source/filter/ww8/ww8par5.**cxx:2588: warning: comparison is always
>>>> true due to limited range of data type
>>>>
>>>> Please fix this.
>>>>
>>>>
>>> Hm.
>>>
>>> This the first sample document attached to issue 119440 I am observing
>>> that this comparison is not always true. I debugged the this code during my
>>> patch review.
>>> The string <sPart> contains data from an imported Microsoft Word
>>> document which is not a fix.
>>>
>>> May be I have overseen something.
>>> Pavel, can you provide further information why in your environment this
>>> comparison is always true?
>>>
>>
>>
>> I think that
>>
>> Pavel-Janiks-MacBook-Pro:ooo_**trunk_src pavel$ grep -r sal_Unicode sal
>> | grep typedef
>> ...
>> sal/inc/sal/types.h: typedef sal_uInt16 sal_Unicode;
>> ...
>> Pavel-Janiks-MacBook-Pro:ooo_**trunk_src pavel$
>>
>> and thus sal_Unicode is unsigned here...
>>
>> Maybe on Windows it is not:
>>
>> sal/inc/sal/types.h: typedef wchar_t sal_Unicode;
>>
>>
> Now, I got it.
> I thought that you meant that the complete camparison condition is
> reported to be always true.
> I will take of this.
>
> Thanks for opening my eyes.
>
> Best regards, Oliver.
>