summaryrefslogtreecommitdiffstats
path: root/sal/rtl
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2012-04-06 13:45:47 +0200
committerLuboš Luňák <l.lunak@suse.cz>2012-04-06 13:46:21 +0200
commit066dbfd1970b8ea58ba16b07b2a57f61c0cb8e36 (patch)
tree635b7cdbca8b31e82fedbead441dfd298b53718b /sal/rtl
parentReview of some RTL_CONSTASCII_USTRINGPARAM removal (diff)
downloadcore-066dbfd1970b8ea58ba16b07b2a57f61c0cb8e36.tar.gz
core-066dbfd1970b8ea58ba16b07b2a57f61c0cb8e36.zip
string literal O(U)StringBuffer ctors too, after all
Diffstat (limited to 'sal/rtl')
-rw-r--r--sal/rtl/source/strtmpl.cxx11
1 files changed, 7 insertions, 4 deletions
diff --git a/sal/rtl/source/strtmpl.cxx b/sal/rtl/source/strtmpl.cxx
index be86ab305d7a..a6cfa18a2410 100644
--- a/sal/rtl/source/strtmpl.cxx
+++ b/sal/rtl/source/strtmpl.cxx
@@ -1195,9 +1195,10 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newFromStr_WithLength )( IMPL_RTL_STRINGDATA*
/* ----------------------------------------------------------------------- */
// Used when creating from string literals.
-void SAL_CALL IMPL_RTL_STRINGNAME( newFromLiteral)( IMPL_RTL_STRINGDATA** ppThis,
- const sal_Char* pCharStr,
- sal_Int32 nLen )
+void SAL_CALL IMPL_RTL_STRINGNAME( newFromLiteral )( IMPL_RTL_STRINGDATA** ppThis,
+ const sal_Char* pCharStr,
+ sal_Int32 nLen,
+ sal_Int32 allocExtra )
SAL_THROW_EXTERN_C()
{
if ( !nLen )
@@ -1209,10 +1210,12 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newFromLiteral)( IMPL_RTL_STRINGDATA** ppThis
if ( *ppThis )
IMPL_RTL_STRINGNAME( release )( *ppThis );
- *ppThis = IMPL_RTL_STRINGNAME( ImplAlloc )( nLen );
+ *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 )