diff options
Diffstat (limited to 'sal')
-rw-r--r-- | sal/inc/rtl/string.hxx | 4 | ||||
-rw-r--r-- | sal/inc/rtl/ustring.hxx | 3 | ||||
-rw-r--r-- | sal/rtl/source/strtmpl.cxx | 2 |
3 files changed, 8 insertions, 1 deletions
diff --git a/sal/inc/rtl/string.hxx b/sal/inc/rtl/string.hxx index 8dbb41373a1c..a00e1861aa8c 100644 --- a/sal/inc/rtl/string.hxx +++ b/sal/inc/rtl/string.hxx @@ -196,7 +196,9 @@ public: New string from a string literal. If there are any embedded \0's in the string literal, the result is undefined. - Use the overload that explicitly accepts length. + Use the overload that explicitly accepts length or cast the literal + explicitly to const char*. + @since LibreOffice 3.6 @param literal a string literal diff --git a/sal/inc/rtl/ustring.hxx b/sal/inc/rtl/ustring.hxx index 8035bdc50252..518ef3d96625 100644 --- a/sal/inc/rtl/ustring.hxx +++ b/sal/inc/rtl/ustring.hxx @@ -190,6 +190,9 @@ public: is not pure ASCII, it needs to be converted to OUString by explicitly providing the encoding to use for the conversion. + If there are any embedded \0's in the string literal, the result is undefined. + Use the overload that explicitly accepts length or fromAscii(). + @param literal the 8-bit ASCII string literal @since LibreOffice 3.6 diff --git a/sal/rtl/source/strtmpl.cxx b/sal/rtl/source/strtmpl.cxx index 2a339079a89f..be86ab305d7a 100644 --- a/sal/rtl/source/strtmpl.cxx +++ b/sal/rtl/source/strtmpl.cxx @@ -1220,6 +1220,8 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newFromLiteral)( IMPL_RTL_STRINGDATA** ppThis /* Check ASCII range */ SAL_WARN_IF( ((unsigned char)*pCharStr) > 127, "rtl.string", "rtl_uString_newFromLiteral - Found char > 127" ); + SAL_WARN_IF( ((unsigned char)*pCharStr) == '\0', "rtl.string", + "rtl_uString_newFromLiteral - Found embedded \\0 character" ); *pBuffer = *pCharStr; pBuffer++; |