Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


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

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.