summaryrefslogtreecommitdiffstats
path: root/sal/rtl
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2012-03-13 16:09:25 +0100
committerLuboš Luňák <l.lunak@suse.cz>2012-03-13 16:21:04 +0100
commit3d9f5c856a4a77503695e68ce013ebf859fcb212 (patch)
treeaaa75452b54542a52f746da9782ae6c3d2663453 /sal/rtl
parentResolves: fdo#46728 reference count the overlay managers (diff)
downloadcore-3d9f5c856a4a77503695e68ce013ebf859fcb212.tar.gz
core-3d9f5c856a4a77503695e68ce013ebf859fcb212.zip
make OString work even with old gcc that has SFINAE broken
Since OString already has a ctor accepting const char*, I cannot find out a way to distinguish string literals other than using a template, otherwise const char* somehow takes precedence (all of gcc, clang, msvc). But the template requires the Substitution Is Not A Failure Idiom to actually create only wanted instances. And the compiler can try evaluate the OString ctor as a possibility when comparing an int to an anonymous enum, and anonymous enum as a type without linkage cannot be a template argument before C++11. SFINAE should still work, but not with gcc older than 4.0.2 (which we right now use only on macs). So for that case disable the string literal ctors, which means macs will have one extra strlen call, and also that embedded \0's in string literals will be inconsistent. The tiny performance problem shouldn't matter that much and will eventually go away, the \0 problem should not matter, since before string literal ctors were introduced \0's had not been included anyway unless RTL_CONSTASCII_STRINGPARAM was used. So we should be safe and when removing the CONSTASCII macros \0 cases should be handled by explicitly mentioning the length.
Diffstat (limited to 'sal/rtl')
-rw-r--r--sal/rtl/source/strtmpl.cxx1
1 files changed, 0 insertions, 1 deletions
diff --git a/sal/rtl/source/strtmpl.cxx b/sal/rtl/source/strtmpl.cxx
index a3ef1facdadf..2d8c44bbe4fa 100644
--- a/sal/rtl/source/strtmpl.cxx
+++ b/sal/rtl/source/strtmpl.cxx
@@ -1189,7 +1189,6 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newFromStr_WithLength )( IMPL_RTL_STRINGDATA*
/* ----------------------------------------------------------------------- */
// Used when creating from string literals.
-// Intentionally copies also embedded \0's if present.
void SAL_CALL IMPL_RTL_STRINGNAME( newFromLiteral)( IMPL_RTL_STRINGDATA** ppThis,
const sal_Char* pCharStr,
sal_Int32 nLen )