summaryrefslogtreecommitdiff
path: root/sal/rtl/ustring.cxx
AgeCommit message (Collapse)Author
2017-07-17RTL_UNICODETOTEXT_INFO_{DEST|SCR}BUFFERTOSMALL should use TOO, not TOChris Sherlock
I have kept the old mispelled constant for backwards compatibility Change-Id: I128a2eec76d00cc5ef058cd6a0c35a7474d2411e Reviewed-on: https://gerrit.libreoffice.org/39995 Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com> Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
2017-07-06loplugin unnecessaryparan improvementsNoel Grandin
Change-Id: I73e945d6ec53537a0da45f6b6291018c7f251a7e Reviewed-on: https://gerrit.libreoffice.org/39587 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-07sal: use thread safe local static in getInternMutexJochen Nitschke
Change-Id: Iac7ca87e05228f3a2a187646496869a8b1bff602 Reviewed-on: https://gerrit.libreoffice.org/38436 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-06add COVERITY_NOEXCEPT_FALSECaolán McNamara
to markup dtors that coverity warns might throw exceptions which won't throw in practice, or where std::terminate is an acceptable response if they do Change-Id: I32b94814e8245372e1d1dc36be0d81e3564042f4 Reviewed-on: https://gerrit.libreoffice.org/38318 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-04-12clang-tidy: readability-else-after-returnNoel Grandin
run it against sal,cppu,cppuhelper I had to run this multiple times to catch all the cases in each module, and it requires some hand-tweaking of the resulting output - clang-tidy is not very good about cleaning up trailing spaces, and aligning things nicely. Change-Id: I00336345f5f036e12422b98d66526509380c497a Reviewed-on: https://gerrit.libreoffice.org/36194 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-10-07New rtl::splitSurrogates, remove code duplicationStephan Bergmann
Change-Id: Ic96b64244f817196ccdfe06b97f7f31291adf372
2016-08-29Support ConstCharArrayDetector also for UTF-16 arraysStephan Bergmann
The long-term benefit will be support of C++11 char16_t string literals (for cases of string literals with non-ASCII content) once we drop any compilers that don't support those yet. The short-term benefit is support for an improved OUStringLiteral1 that accepts any sal_Unicode value, not just ASCII ones (see next commit). Change-Id: I3f8f6697d7eb62b5176b7e812b5a5113c53b83a4 Reviewed-on: https://gerrit.libreoffice.org/28445 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2016-04-20loplugin:salbool: Automatic rewrite of sal_False/TrueStephan Bergmann
Change-Id: I6c656f991999791469015500aff1905fdb16ba65
2016-02-15Rename rtl::isValidCodePoint -> rtl::isUnicodeCodePointStephan Bergmann
...and fix its documentation, and use it throughout the code base. Change-Id: I349bc2009b1b0aa7115ea90bc6ecd0a812f63698
2015-11-10loplugin:nullptr (automatic rewrite)Stephan Bergmann
Change-Id: I1bc6c87fcd6e5e96362623be94c59be216a3b2b8
2015-07-07performance tuning of rtl_ustr_indexOfAscii_WithLength()Norbert Thiebaud
lcov over make check showed 98 4699997 : sal_Int32 rtl_ustr_indexOfAscii_WithLength( 99 : sal_Unicode const * str, sal_Int32 len, 100 : char const * subStr, sal_Int32 subLen) SAL_THROW_EXTERN_C() 101 : { 102 4699997 : assert(len >= 0); 103 4699997 : assert(subLen >= 0); 104 4699997 : if (subLen > 0 && subLen <= len) { 105 : sal_Int32 i; 106 54014537 : for (i = 0; i <= len - subLen; ++i) { 107 51036513 : if (rtl_ustr_asciil_reverseEquals_WithLength( 108 51036523 : str + i, subStr, subLen)) 109 : { 110 205482 : return i; 111 : } 112 : } 113 : } 114 4494505 : return -1; 115 : } so 1/ in 95% of the cases the result is not-found.. _that_ is the hot path 2/ we are calling rtl_ustr_asciil_reverseEquals_WithLength close to 11 times per call.. (average ~ len - subLen, due to the high miss ratio) so let's first search for the first byte of the substring to optimize the 'miss' case, which is the most common one. Change-Id: I20ef0821db2ff0db5935dd562844a947a14aff64 Reviewed-on: https://gerrit.libreoffice.org/16763 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2015-06-26Add optimized OUString += literal overloadStephan Bergmann
Change-Id: Ib34196185f90204a71598f2c659c3fddce7a0e4d
2015-06-25Do not forget to actually set newStr to an empty stringStephan Bergmann
Change-Id: I745b09d8a248f08afdd3387f4cfcf69d71ec3c39
2015-06-23Implement full set of OUString::replaceFirst/All literal overloadsStephan Bergmann
Change-Id: I5f525d91ce24d1d2653a6855f1c4fffc039ae398
2015-04-20Clean up new rtl/surrogates.hStephan Bergmann
Change-Id: Iec781bdbbf216cb14c9ba5be5955123273d7699c
2015-04-20duplicate surrogate codeCaolán McNamara
Change-Id: I9fad024e4b5c8a4ca272f2387df07351198cf5dc
2015-03-02typoStephan Bergmann
Change-Id: Ifc03631b126ec19cb98cb42a258ca4880e868385
2015-02-12coverity#1268298 mark up codeCaolán McNamara
Change-Id: I6e48e2593f93efd71e84a076a99457c3daf7d9e0
2015-02-08make this a comment a coverity quellerCaolán McNamara
Change-Id: I0eccec058f506be69f6c95a1a6d97be64cb734bc
2015-02-07coverity#1268297 Logically dead codeCaolán McNamara
Change-Id: Ie9a37e7eb837abf0d2783a9a0f8c2b33a6772d33
2015-02-05sal: add some argument checking assertions for strings and buffersMichael Stahl
Also remove some now redundant asserts from headers. Some of these actually trigger on unit tests so are commented out. Change-Id: I07c6b2b2bd175361691a141f22eec584e3ab8f0b
2015-01-06-Werror,-Wmacro-redefined (under Clang -fsanitize=*)Stephan Bergmann
Change-Id: Ifd23373b1ac4919793d1b4251ed90cf2dd6f2bda
2014-12-19constants via #define must be integer if used in #if statementChristian Lohmaier
breaks windows build otherwise (fatal erro C1017) Change-Id: Idae78c621bfb8f989eb33220f015e17a7b7fb92f
2014-12-19Assert ASCII precond of rtl_uString_newFromAscii/LiteralStephan Bergmann
...and there is no reason for such a precond for rtl_string_newFromLiteral Change-Id: I27f7217c8db17cef860c37886d0f7e561dc852f8
2014-12-19IMPL_RTL_INTERN -> IMPL_RTL_IS_USTRINGStephan Bergmann
Change-Id: I9793f697f14118340bc6db89540fe50ad0b8ccbd
2014-12-19fdo#39440 sal: reduce scope of local variablesMichael Weghorn
This addresses some cppcheck warnings. Change-Id: Id5f90757571e76a2c05a4cbd37020e1f6a6b2033 Reviewed-on: https://gerrit.libreoffice.org/13544 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
2014-11-06Early return missingStephan Bergmann
Change-Id: I0d4f9b14f2a41a3acb08ba1b6c13fdf1174021e7
2014-11-06sal: it is impossible to have non-ASCII char hereMichael Stahl
...because rtl_ImplGetFastUTF8UnicodeLen has already checked that. Change-Id: I17f2b80f374073934a8f0b1a97099d4dec89ce4e
2014-11-06sal: do not ignore conversion flags for RTL_TEXTENCODING_ASCII_USMichael Stahl
Keep the fast path fast, fall back to the text encoder in case there's a fly in the ointment. Change-Id: I94507856a7f3170f770adb741aa1e282d0d2400c
2014-07-01Clean up surrogates.hxxStephan Bergmann
Change-Id: I0eae089be1bde9db822a77bea482c10650c8a137
2014-05-22Work around undef conversion of large double to floatStephan Bergmann
...as flagged by -fsanitize=undefined. But is it really undefined? [conv.double] "If the source value is between two adjacent destination values, the result of the conversion is an implementation-defined choice of either of those values." So if the double is between std::numeric_limits<float>::max() and std::numeric_limits<float>::infinity()... Change-Id: I6389c8ac4a922991e240638d231dd2a39e173882
2014-04-04Fix ASCII-only checkStephan Bergmann
...which did not work e.g. for broken single-byte input 0x80. Change-Id: I4dff41e4f18dfce376695b438004c2af853cf4fa
2014-02-17sal: sal_Bool -> boolStephan Bergmann
Change-Id: I071a931660dafc1ee5950da527b042fb175255b8
2014-02-10Do not do RTL_LOG_STRING_NEW on null pointerStephan Bergmann
Change-Id: Ie972599650620324fa7af5ed2b2843bfc1f34c43
2013-12-02Drop duplicate #includeTakeshi Abe
Change-Id: Ife8ebbb5e46704c5d2ff46cc345b4ed926e7dc12
2013-11-27Unwind occurrences of deprecated sal_sChar, sal_uCharStephan Bergmann
Change-Id: I76be464200d486efef9c8a7e957c310c9adae3b8
2013-11-12document the use of the strtmpl.cxx and remove unnecessary macro usageNoel Grandin
Document the "calling" macros for the strtmpl.cxx template file. And remove unnecessary use of those macros in the calling file. Change-Id: I20e0dd74150773363b9fb557884b84692ce22f11 Reviewed-on: https://gerrit.libreoffice.org/6504 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
2013-10-28Related: fdo#69641 convert OSL_ASSERT into assertCaolán McNamara
Change-Id: I63c32289c7ac6a428c8c50e49650fbac98c8c5e3
2013-08-20rtl::compareAsciiIgnoreCase cannot be used hereStephan Bergmann
...as its assert requires that both input characters are ASCII, which need not be the case in these compareIgnoreAsciiCase functions. (Even if they take one literal argument that must be strictly ASCII, the other argument can be an arbitrary Unicode string in the case of OUString or an arbitrary 8-bit string in the case of OString). The logically correct version of rtl::compareAsciiIgnoreCase would arguably be one that requires its two arguments to be valid UTF-32 code units, but that could not be used in these places either, as for OUString they operate on individual UTF-16 code units. rtl::compareAsciiIgnoreCase likely makes less sense after all than assumed in c8e39e66528affb66f1ae121fa36dd4ab31a9b0b "Introduce rtl::compareIgnoreCase and deprecate rtl/character.hxx equivalents," which this commit partly reverts. Change-Id: Ib2eed3a1896e83d9c66b0479a03f9ec51e1c4dc0
2013-08-19Introduce rtl::compareIgnoreCase and deprecate rtl/character.hxx equivalents.Arnaud Versini
Change-Id: Id90935fd2b0f904f89477792edc8140cfc31e91f Reviewed-on: https://gerrit.libreoffice.org/5412 Reviewed-by: Petr Mladek <pmladek@suse.cz> Tested-by: Petr Mladek <pmladek@suse.cz>
2013-08-08Add SDT probes for interning rtl_uStrings.Mark Wielaard
This adds RTL_LOG_STRING_INTERN_NEW and RTL_LOG_STRING_INTERN_DELETE which are connected to SDT probes if available. It introduces two new SDT probes. new_string_intern_16 and delete_string_intern_16 (there is currently no interning for 8-bit rtl_Strings). For consistency both have the same 4 arguments as new_string_(8|16) and delete_string_(8|16). new_string_intern_16 has as 5th argument the address of the original rtl_uString being interned (which may or may not be the same as $arg1). Change-Id: Ib117bba932c1908abc70a7fdd4140c0af76d54cb Reviewed-on: https://gerrit.libreoffice.org/5308 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2013-08-03Add SDT probes for RTL_LOG_STRING_NEW/DELETE.Mark Wielaard
Change-Id: I938259f90aee9d277c9ff5b72c9120b93311cbd3 Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
2013-02-22Bin pointless single-child directory levelTor Lillqvist
Change-Id: I03de46fb6c095bb176fd25fc5f803be6d2d89bcf