summaryrefslogtreecommitdiffstats
path: root/i18nutil/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-08-31 23:00:49 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-09-01 09:53:36 +0100
commit23854ea235ef32232f34c6ff121f005310f8c01b (patch)
tree82d2ba080d849cc5cdd801c0d98fc1ccd014ea39 /i18nutil/source
parentthese don't actually take ownership, just copy and leak original (diff)
downloadcore-23854ea235ef32232f34c6ff121f005310f8c01b.tar.gz
core-23854ea235ef32232f34c6ff121f005310f8c01b.zip
refactor x_rtl_uString_new_WithLength to be consistent
i.e. change x_rtl_uString_new_WithLength to always create a rtl_uString with ref count of 1, like rtl_uString_new_WithLength, so requiring: either the explicit use of rtl_uString_release or passing ownership to an OUString via OUString(pStr, SAL_NO_ACQUIRE) which will do the same in its dtor
Diffstat (limited to 'i18nutil/source')
-rw-r--r--i18nutil/source/utility/widthfolding.cxx11
1 files changed, 6 insertions, 5 deletions
diff --git a/i18nutil/source/utility/widthfolding.cxx b/i18nutil/source/utility/widthfolding.cxx
index ed636b2e5cc4..edfe573e70be 100644
--- a/i18nutil/source/utility/widthfolding.cxx
+++ b/i18nutil/source/utility/widthfolding.cxx
@@ -55,7 +55,8 @@ OUString widthfolding::decompose_ja_voiced_sound_marks (const OUString& inStr, s
{
// Create a string buffer which can hold nCount * 2 + 1 characters.
// Its size may become double of nCount.
- rtl_uString * newStr = x_rtl_uString_new_WithLength(nCount * 2 ); // defined in x_rtl_ustring.h The reference count is 0 now.
+ // The reference count is 1 now.
+ rtl_uString * newStr = x_rtl_uString_new_WithLength(nCount * 2);
sal_Int32 *p = NULL;
sal_Int32 position = 0;
@@ -99,7 +100,7 @@ OUString widthfolding::decompose_ja_voiced_sound_marks (const OUString& inStr, s
newStr->length = sal_Int32(dst - newStr->buffer);
if (useOffset)
offset.realloc(newStr->length);
- return OUString( newStr ); // defined in rtl/usrting. The reference count is increased from 0 to 1.
+ return OUString(newStr, SAL_NO_ACQUIRE); // take ownership
}
oneToOneMapping& widthfolding::getfull2halfTable(void)
@@ -116,8 +117,8 @@ OUString widthfolding::compose_ja_voiced_sound_marks (const OUString& inStr, sal
{
// Create a string buffer which can hold nCount + 1 characters.
// Its size may become equal to nCount or smaller.
- // The reference count is 0 now.
- rtl_uString * newStr = x_rtl_uString_new_WithLength( nCount ); // defined in x_rtl_ustring.h
+ // The reference count is 1 now.
+ rtl_uString * newStr = x_rtl_uString_new_WithLength(nCount);
// Prepare pointers of unicode character arrays.
const sal_Unicode* src = inStr.getStr() + startPos;
@@ -204,7 +205,7 @@ OUString widthfolding::compose_ja_voiced_sound_marks (const OUString& inStr, sal
}
if (useOffset)
offset.realloc(newStr->length);
- return OUString( newStr ); // defined in rtl/usrting. The reference count is increased from 0 to 1.
+ return OUString(newStr, SAL_NO_ACQUIRE); // take ownership
}
oneToOneMapping& widthfolding::gethalf2fullTable(void)