summaryrefslogtreecommitdiff
path: root/sal/rtl
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-12-19 15:44:25 +0100
committerStephan Bergmann <sbergman@redhat.com>2014-12-19 15:46:35 +0100
commit2171c3dd49694b4928b0a04b76d3c42a2b18f6cc (patch)
tree29442caa34cb013bebf0e0e017cf44feb2d10dc5 /sal/rtl
parent80131c795f1f9e9fcfb5a85243fb8585b083f8b1 (diff)
Assert ASCII precond of rtl_uString_newFromAscii/Literal
...and there is no reason for such a precond for rtl_string_newFromLiteral Change-Id: I27f7217c8db17cef860c37886d0f7e561dc852f8
Diffstat (limited to 'sal/rtl')
-rw-r--r--sal/rtl/strtmpl.cxx6
-rw-r--r--sal/rtl/ustring.cxx5
2 files changed, 4 insertions, 7 deletions
diff --git a/sal/rtl/strtmpl.cxx b/sal/rtl/strtmpl.cxx
index 07258b6a90ed..1a1e74f8827f 100644
--- a/sal/rtl/strtmpl.cxx
+++ b/sal/rtl/strtmpl.cxx
@@ -1374,9 +1374,9 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newFromLiteral )( IMPL_RTL_STRINGDATA** ppThi
sal_Int32 nCount;
for( nCount = nLen; nCount > 0; --nCount )
{
- /* Check ASCII range */
- SAL_WARN_IF( ((unsigned char)*pCharStr) > 127, "rtl.string",
- "rtl_uString_newFromLiteral - Found char > 127" );
+#if IMPL_RTL_IS_USTRING
+ assert(static_cast<unsigned char>(*pCharStr) < 0x80); // ASCII range
+#endif
SAL_WARN_IF( ((unsigned char)*pCharStr) == '\0', "rtl.string",
"rtl_uString_newFromLiteral - Found embedded \\0 character" );
diff --git a/sal/rtl/ustring.cxx b/sal/rtl/ustring.cxx
index 26aa5d9d7f89..0fc9e06ad783 100644
--- a/sal/rtl/ustring.cxx
+++ b/sal/rtl/ustring.cxx
@@ -501,10 +501,7 @@ void SAL_CALL rtl_uString_newFromAscii( rtl_uString** ppThis,
sal_Unicode* pBuffer = (*ppThis)->buffer;
do
{
- /* Check ASCII range */
- SAL_WARN_IF( ((unsigned char)*pCharStr) > 127, "rtl.string",
- "rtl_uString_newFromAscii - Found char > 127" );
-
+ assert(static_cast<unsigned char>(*pCharStr) < 0x80); // ASCII range
*pBuffer = *pCharStr;
pBuffer++;
pCharStr++;