diff options
-rw-r--r-- | sal/rtl/strtmpl.cxx | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/sal/rtl/strtmpl.cxx b/sal/rtl/strtmpl.cxx index a990159331b2..71a2fb2a1e9e 100644 --- a/sal/rtl/strtmpl.cxx +++ b/sal/rtl/strtmpl.cxx @@ -1375,24 +1375,22 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newFromLiteral )( IMPL_RTL_STRINGDATA** ppThi *ppThis = IMPL_RTL_STRINGNAME( ImplAlloc )( nLen + allocExtra ); assert( *ppThis != NULL ); - if ( (*ppThis) ) + + (*ppThis)->length = nLen; // fix after possible allocExtra != 0 + (*ppThis)->buffer[nLen] = 0; + IMPL_RTL_STRCODE* pBuffer = (*ppThis)->buffer; + sal_Int32 nCount; + for( nCount = nLen; nCount > 0; --nCount ) { - (*ppThis)->length = nLen; // fix after possible allocExtra != 0 - (*ppThis)->buffer[nLen] = 0; - IMPL_RTL_STRCODE* pBuffer = (*ppThis)->buffer; - 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" ); - SAL_WARN_IF( ((unsigned char)*pCharStr) == '\0', "rtl.string", - "rtl_uString_newFromLiteral - Found embedded \\0 character" ); - - *pBuffer = *pCharStr; - pBuffer++; - pCharStr++; - } + /* 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++; + pCharStr++; } RTL_LOG_STRING_NEW( *ppThis ); |