rtl::OUString::compareToAscii is dangerous

Stephan Bergmann sbergman at redhat.com
Tue Mar 19 10:37:42 PDT 2013


On 03/19/2013 06:29 PM, Noel Grandin wrote:
> On Tue, Mar 19, 2013 at 6:54 PM, Stephan Bergmann <sbergman at redhat.com> wrote:
>> * compareToAscii(char cosnt * asciiStr, sal_Int32 maxLength) does a
>> shortened comparison of only up to maxLength characters of *this and the
>> given asciiStr.
>>
>
> Maybe this one should be renamed to something like "compareLeftToAscii" ?

I was musing about marking it as

   SAL_DEPRECATED_INTERNAL("use startsWith")

but that would only apply for the cases where the return value is 
compared against zero, so dismissed it.

But then again, there are hopefully no legitimate cases that do not 
compare the return value against zero anyway, so this might still be the 
most attractive approach.  I'll give it a try.

Stephan


More information about the LibreOffice mailing list