There are two overloads of rtl::OUString::compareToAscii:

* compareToAscii(char const * asciiStr) does a full comparison of *this and the given asciiStr.

* compareToAscii(char cosnt * asciiStr, sal_Int32 maxLength) does a shortened comparison of only up to maxLength characters of *this and the given asciiStr.

That is,

  s.compareToAscii(RTL_CONSTASCII_STRINGPARAM("foo")) == 0

translates to

  s.startsWith("foo")

rather than any of

  s.compareTo("foo") == 0

  s == "foo"

This subtlety has introduced various bugs with recent string clean-up commits, so I tried to systematically scrutinize the output of "git log -ScompareToAscii --patch" now, at least the range of master commits from recent 7cd539319943f43b6f66b72ad85ecc0012d3e007 back through the start of 2011.

Please be very careful when you create or review commits that involve clean-up of compareToAscii.

Stephan
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to