Question about OUString::compareToAscii

Christophe JAILLET christophe.jaillet at
Fri Jul 13 13:59:42 PDT 2012


according to my understanding,

OUString::compareToAscii(RTL_CONSTASCII_STRINGPARAM("A string")) gives 
exactly the same result as
OUString::compareToAscii("A string")

However, the first one:
     - is harder to read
     - uses the deprecated RTL_CONSTASCII_STRINGPARAM macro
     - is a bit slower

If you agree with that, I will provide a patch to clean it.

Moreover, and as a 2nd step, I plan to propose a patch that turns:
     s.compareToAscii("A string") == 0
     s.equalsAscii("A string")


     ! s.compareToAscii("A string")
     s.equalsAscii("A string")

I think that equalsAscii is better because:
     - shorter
     - more meaningful
     - doing some ! on sal_Int32 is not as clean as using sal_Bool directly

Do you think that such a clean-up is interesting ?

Best regards,
Christophe Jaillet

More information about the LibreOffice mailing list