[Libreoffice-commits] .: 6 commits - i18npool/source i18nutil/inc i18nutil/source sal/rtl slideshow/source unusedcode.easy

Caolán McNamara caolan at kemper.freedesktop.org
Thu Sep 1 02:16:31 PDT 2011


 i18npool/source/characterclassification/cclass_unicode.cxx         |    2 
 i18npool/source/nativenumber/nativenumbersupplier.cxx              |   69 +++++-----
 i18npool/source/textconversion/textconversion_ko.cxx               |   16 +-
 i18npool/source/textconversion/textconversion_zh.cxx               |   20 +-
 i18npool/source/transliteration/ignoreIandEfollowedByYa_ja_JP.cxx  |    6 
 i18npool/source/transliteration/ignoreIterationMark_ja_JP.cxx      |    6 
 i18npool/source/transliteration/ignoreKiKuFollowedBySa_ja_JP.cxx   |    6 
 i18npool/source/transliteration/ignoreProlongedSoundMark_ja_JP.cxx |    6 
 i18npool/source/transliteration/transliteration_Ignore.cxx         |    6 
 i18npool/source/transliteration/transliteration_Numeric.cxx        |    2 
 i18npool/source/transliteration/transliteration_OneToOne.cxx       |    6 
 i18npool/source/transliteration/transliteration_body.cxx           |    4 
 i18nutil/inc/i18nutil/x_rtl_ustring.h                              |   31 ++--
 i18nutil/source/utility/widthfolding.cxx                           |   11 -
 sal/rtl/source/strtmpl.c                                           |    9 -
 slideshow/source/engine/tools.cxx                                  |   22 ---
 slideshow/source/inc/tools.hxx                                     |   14 --
 unusedcode.easy                                                    |    2 
 18 files changed, 108 insertions(+), 130 deletions(-)

New commits:
commit 586e39352a99508d0023a5958b50a5189b196e82
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Sep 1 08:59:25 2011 +0100

    resync list

diff --git a/unusedcode.easy b/unusedcode.easy
index 14f1b9f..9f37a24 100644
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -2056,6 +2056,8 @@ binfilter::SwDestroyList::Insert(binfilter::SwSectionFrm* const*, unsigned short
 binfilter::SwDestroyList::Remove(binfilter::SwSectionFrm* const&, unsigned short)
 binfilter::SwDestroyList::Remove(unsigned short, unsigned short)
 binfilter::SwInsHardBlankSoftHyph::~SwInsHardBlankSoftHyph()
+binfilter::SwLayAction::SwLayAction(binfilter::SwRootFrm*, binfilter::SwViewImp*)
+binfilter::SwLayAction::~SwLayAction()
 binfilter::SwOLELRUCache::Remove(binfilter::SwOLEObj&)
 binfilter::SwOutlineNodes::Insert(binfilter::SwNode* const&, unsigned short&)
 binfilter::SwOutlineNodes::Insert(binfilter::SwNode* const*, unsigned short)
commit 0a90cb6510a0d6e1889569035ae78085637c9133
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Aug 31 23:21:49 2011 +0100

    micro-opt, just use memset

diff --git a/sal/rtl/source/strtmpl.c b/sal/rtl/source/strtmpl.c
index bf3f4fd..830521d 100644
--- a/sal/rtl/source/strtmpl.c
+++ b/sal/rtl/source/strtmpl.c
@@ -31,6 +31,8 @@
 /* String-Class                                                            */
 /* ======================================================================= */
 
+#include <string.h>
+
 /*
 inline void rtl_str_ImplCopy( IMPL_RTL_STRCODE* pDest,
                               const IMPL_RTL_STRCODE* pSrc,
@@ -1049,12 +1051,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( new_WithLength )( IMPL_RTL_STRINGDATA** ppThi
 
         {
         IMPL_RTL_STRCODE* pTempStr = (*ppThis)->buffer;
-        while ( nLen >= 0 )
-        {
-            *pTempStr = 0;
-            pTempStr++;
-            nLen--;
-        }
+        memset(pTempStr, 0, nLen*sizeof(IMPL_RTL_STRCODE));
         }
     }
 }
commit 822a77a0c33be1a58140c8a2dcec2a02ef0cc5e7
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Aug 31 23:06:51 2011 +0100

    ditch x_rtl_uString_release

diff --git a/i18nutil/inc/i18nutil/x_rtl_ustring.h b/i18nutil/inc/i18nutil/x_rtl_ustring.h
index 406817a..f4bec8d 100644
--- a/i18nutil/inc/i18nutil/x_rtl_ustring.h
+++ b/i18nutil/inc/i18nutil/x_rtl_ustring.h
@@ -59,15 +59,6 @@ I18NUTIL_DLLPUBLIC inline rtl_uString * SAL_CALL x_rtl_uString_new_WithLength( s
     return newStr;
 }
 
-/**
- * Release <code>rtl_uString</code> regardless its reference count.
- */
-I18NUTIL_DLLPUBLIC inline void SAL_CALL x_rtl_uString_release( rtl_uString * value )
-{
-  rtl_freeMemory(value);
-}
-
-
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 23854ea235ef32232f34c6ff121f005310f8c01b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Aug 31 23:00:49 2011 +0100

    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

diff --git a/i18npool/source/characterclassification/cclass_unicode.cxx b/i18npool/source/characterclassification/cclass_unicode.cxx
index 2db8575..9acdd9b 100644
--- a/i18npool/source/characterclassification/cclass_unicode.cxx
+++ b/i18npool/source/characterclassification/cclass_unicode.cxx
@@ -99,7 +99,7 @@ cclass_Unicode::toTitle( const OUString& Text, sal_Int32 nPos, sal_Int32 nCount,
         nCount = len - nPos;
 
     trans->setMappingType(MappingTypeToTitle, rLocale);
-    rtl_uString* pStr = x_rtl_uString_new_WithLength( nCount, 1 );
+    rtl_uString* pStr = x_rtl_uString_new_WithLength(nCount);
     sal_Unicode* out = pStr->buffer;
     BreakIteratorImpl brk(xMSF);
     Boundary bdy = brk.getWordBoundary(Text, nPos, rLocale,
diff --git a/i18npool/source/nativenumber/nativenumbersupplier.cxx b/i18npool/source/nativenumber/nativenumbersupplier.cxx
index 933a2f5..6d0a1d4 100644
--- a/i18npool/source/nativenumber/nativenumbersupplier.cxx
+++ b/i18npool/source/nativenumber/nativenumbersupplier.cxx
@@ -83,7 +83,8 @@ OUString SAL_CALL AsciiToNativeChar( const OUString& inStr, sal_Int32 startPos,
         if (useOffset)
             offset.realloc(nCount);
 
-        for (sal_Int32 i = 0; i < nCount; i++) {
+        for (sal_Int32 i = 0; i < nCount; i++)
+        {
             sal_Unicode ch = src[i];
             if (isNumber(ch))
                 newStr->buffer[i] = NumberChar[number][ ch - NUMBER_ZERO ];
@@ -99,7 +100,7 @@ OUString SAL_CALL AsciiToNativeChar( const OUString& inStr, sal_Int32 startPos,
             if (useOffset)
                 offset[i] = startPos + i;
         }
-        return OUString(newStr->buffer, nCount);
+        return OUString(newStr, SAL_NO_ACQUIRE); // take ownership
 }
 
 sal_Bool SAL_CALL AsciiToNative_numberMaker(const sal_Unicode *str, sal_Int32 begin, sal_Int32 len,
diff --git a/i18npool/source/textconversion/textconversion_zh.cxx b/i18npool/source/textconversion/textconversion_zh.cxx
index b9460eb..507f102 100644
--- a/i18npool/source/textconversion/textconversion_zh.cxx
+++ b/i18npool/source/textconversion/textconversion_zh.cxx
@@ -86,11 +86,11 @@ TextConversion_zh::getCharConversion(const OUString& aText, sal_Int32 nStartPos,
         Index = ((const sal_uInt16* (*)())getFunctionBySymbol("getSTC_CharIndex_S2T"))();
     }
 
-    rtl_uString * newStr = x_rtl_uString_new_WithLength( nLength ); // defined in x_rtl_ustring.h
+    rtl_uString * newStr = x_rtl_uString_new_WithLength(nLength);
     for (sal_Int32 i = 0; i < nLength; i++)
         newStr->buffer[i] =
             getOneCharConversion(aText[nStartPos+i], Data, Index);
-    return OUString( newStr->buffer, nLength);
+    return OUString(newStr, SAL_NO_ACQUIRE); //take ownership
 }
 
 OUString SAL_CALL
diff --git a/i18npool/source/transliteration/ignoreIandEfollowedByYa_ja_JP.cxx b/i18npool/source/transliteration/ignoreIandEfollowedByYa_ja_JP.cxx
index 4ecfbf0..15395d4 100644
--- a/i18npool/source/transliteration/ignoreIandEfollowedByYa_ja_JP.cxx
+++ b/i18npool/source/transliteration/ignoreIandEfollowedByYa_ja_JP.cxx
@@ -87,8 +87,8 @@ ignoreIandEfollowedByYa_ja_JP::folding( const OUString& inStr, sal_Int32 startPo
   throw(RuntimeException)
 {
     // Create a string buffer which can hold nCount + 1 characters.
-    // 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);
     sal_Unicode * dst = newStr->buffer;
     const sal_Unicode * src = inStr.getStr() + startPos;
 
@@ -145,7 +145,7 @@ ignoreIandEfollowedByYa_ja_JP::folding( const OUString& inStr, sal_Int32 startPo
     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
 }
 
 } } } }
diff --git a/i18npool/source/transliteration/ignoreIterationMark_ja_JP.cxx b/i18npool/source/transliteration/ignoreIterationMark_ja_JP.cxx
index 59872eb..cc79da1 100644
--- a/i18npool/source/transliteration/ignoreIterationMark_ja_JP.cxx
+++ b/i18npool/source/transliteration/ignoreIterationMark_ja_JP.cxx
@@ -102,8 +102,8 @@ ignoreIterationMark_ja_JP::folding( const OUString& inStr, sal_Int32 startPos, s
     oneToOneMapping aTable(ignoreIterationMark_ja_JP_mappingTable, sizeof(ignoreIterationMark_ja_JP_mappingTable));
 
     // Create a string buffer which can hold nCount + 1 characters.
-    // 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);
     sal_Unicode * dst = newStr->buffer;
     const sal_Unicode * src = inStr.getStr() + startPos;
 
@@ -152,7 +152,7 @@ ignoreIterationMark_ja_JP::folding( const OUString& inStr, sal_Int32 startPos, 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
 
 }
 
diff --git a/i18npool/source/transliteration/ignoreKiKuFollowedBySa_ja_JP.cxx b/i18npool/source/transliteration/ignoreKiKuFollowedBySa_ja_JP.cxx
index f8d5cfd..57abcff 100644
--- a/i18npool/source/transliteration/ignoreKiKuFollowedBySa_ja_JP.cxx
+++ b/i18npool/source/transliteration/ignoreKiKuFollowedBySa_ja_JP.cxx
@@ -47,8 +47,8 @@ ignoreKiKuFollowedBySa_ja_JP::folding( const OUString& inStr, sal_Int32 startPos
   throw(RuntimeException)
 {
     // Create a string buffer which can hold nCount + 1 characters.
-    // 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);
     sal_Unicode * dst = newStr->buffer;
     const sal_Unicode * src = inStr.getStr() + startPos;
 
@@ -102,7 +102,7 @@ ignoreKiKuFollowedBySa_ja_JP::folding( const OUString& inStr, sal_Int32 startPos
     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
 }
 
 } } } }
diff --git a/i18npool/source/transliteration/ignoreProlongedSoundMark_ja_JP.cxx b/i18npool/source/transliteration/ignoreProlongedSoundMark_ja_JP.cxx
index 9689b6b..fd309ec 100644
--- a/i18npool/source/transliteration/ignoreProlongedSoundMark_ja_JP.cxx
+++ b/i18npool/source/transliteration/ignoreProlongedSoundMark_ja_JP.cxx
@@ -309,8 +309,8 @@ ignoreProlongedSoundMark_ja_JP::folding( const OUString& inStr, sal_Int32 startP
   throw(RuntimeException)
 {
     // Create a string buffer which can hold nCount + 1 characters.
-    // 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);
     sal_Unicode * dst = newStr->buffer;
     const sal_Unicode * src = inStr.getStr() + startPos;
 
@@ -360,7 +360,7 @@ ignoreProlongedSoundMark_ja_JP::folding( const OUString& inStr, sal_Int32 startP
     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
 
 }
 
diff --git a/i18npool/source/transliteration/transliteration_Ignore.cxx b/i18npool/source/transliteration/transliteration_Ignore.cxx
index 4c68197..3d81272 100644
--- a/i18npool/source/transliteration/transliteration_Ignore.cxx
+++ b/i18npool/source/transliteration/transliteration_Ignore.cxx
@@ -137,8 +137,8 @@ transliteration_Ignore::folding( const OUString& inStr, sal_Int32 startPos,
     throw(RuntimeException)
 {
     // Create a string buffer which can hold nCount + 1 characters.
-    // 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);
     sal_Unicode * dst = newStr->buffer;
     const sal_Unicode * src = inStr.getStr() + startPos;
 
@@ -209,7 +209,7 @@ transliteration_Ignore::folding( const OUString& inStr, sal_Int32 startPos,
       offset.realloc(newStr->length);
     *dst = (sal_Unicode) 0;
 
-    return OUString( newStr ); // defined in rtl/usrting. The reference count is increased from 0 to 1.
+    return OUString(newStr, SAL_NO_ACQUIRE); // take ownership
 }
 
 sal_Unicode SAL_CALL
diff --git a/i18npool/source/transliteration/transliteration_Numeric.cxx b/i18npool/source/transliteration/transliteration_Numeric.cxx
index 5a1de03..f2250fb 100644
--- a/i18npool/source/transliteration/transliteration_Numeric.cxx
+++ b/i18npool/source/transliteration/transliteration_Numeric.cxx
@@ -78,7 +78,7 @@ transliteration_Numeric::transliterateBullet( const OUString& inStr, sal_Int32 s
         if (endPos >  inStr.getLength())
             endPos = inStr.getLength();
 
-        rtl_uString* pStr = x_rtl_uString_new_WithLength( nCount, 1 );  // our x_rtl_ustring.h
+        rtl_uString* pStr = x_rtl_uString_new_WithLength(nCount);
         sal_Unicode* out = pStr->buffer;
 
         if (useOffset)
diff --git a/i18npool/source/transliteration/transliteration_OneToOne.cxx b/i18npool/source/transliteration/transliteration_OneToOne.cxx
index f22e57a..26f0732 100644
--- a/i18npool/source/transliteration/transliteration_OneToOne.cxx
+++ b/i18npool/source/transliteration/transliteration_OneToOne.cxx
@@ -74,8 +74,8 @@ transliteration_OneToOne::transliterate( const OUString& inStr, sal_Int32 startP
     throw(RuntimeException)
 {
     // Create a string buffer which can hold nCount + 1 characters.
-    // 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);
     sal_Unicode * dst = newStr->buffer;
     const sal_Unicode * src = inStr.getStr() + startPos;
 
@@ -97,7 +97,7 @@ transliteration_OneToOne::transliterate( const OUString& inStr, sal_Int32 startP
     }
     *dst = (sal_Unicode) 0;
 
-    return OUString( newStr ); // defined in rtl/usrting. The reference count is increased from 0 to 1.
+    return OUString(newStr, SAL_NO_ACQUIRE); // take ownership
 }
 
 sal_Unicode SAL_CALL
diff --git a/i18npool/source/transliteration/transliteration_body.cxx b/i18npool/source/transliteration/transliteration_body.cxx
index 84ae113..294f0a1 100644
--- a/i18npool/source/transliteration/transliteration_body.cxx
+++ b/i18npool/source/transliteration/transliteration_body.cxx
@@ -129,7 +129,7 @@ Transliteration_body::transliterate(
             const Mapping &map = casefolding::getValue( in, i, nCount, aLocale, nTmpMappingType );
             nOffCount += map.nmap;
         }
-        rtl_uString* pStr = x_rtl_uString_new_WithLength( nOffCount, 1 );  // our x_rtl_ustring.h
+        rtl_uString* pStr = x_rtl_uString_new_WithLength(nOffCount);
         sal_Unicode* out = pStr->buffer;
 
         if ( nOffCount != offset.getLength() )
@@ -199,7 +199,7 @@ OUString SAL_CALL
 Transliteration_body::transliterateChar2String( sal_Unicode inChar ) throw(RuntimeException)
 {
         const Mapping &map = casefolding::getValue(&inChar, 0, 1, aLocale, nMappingType);
-        rtl_uString* pStr = x_rtl_uString_new_WithLength( map.nmap, 1 );  // our x_rtl_ustring.h
+        rtl_uString* pStr = x_rtl_uString_new_WithLength(map.nmap);
         sal_Unicode* out = pStr->buffer;
         sal_Int32 i;
 
diff --git a/i18nutil/inc/i18nutil/x_rtl_ustring.h b/i18nutil/inc/i18nutil/x_rtl_ustring.h
index 848cc9e..406817a 100644
--- a/i18nutil/inc/i18nutil/x_rtl_ustring.h
+++ b/i18nutil/inc/i18nutil/x_rtl_ustring.h
@@ -38,19 +38,25 @@
  * Allocates a new <code>rtl_uString</code> with capacity of nLen + 1
  * characters.
  *
- * The reference count is 0. The characters of the capacity are not cleared,
+ * The reference count is 1. The characters of the capacity are not cleared,
  * unlike the similar method of rtl_uString_new_WithLength in rtl/ustring.h, so
- * is more efficient for allocating a new string. You need to "acquire" by such
- * as OUString( rtl_uString * value ) if you intend to use it for a while.
+ * is more efficient for allocating a new string.
+ *
+ * call rtl_uString_release to release the string
+ * alternatively pass ownership to an OUString with
+ * rtl::OUString(newStr, SAL_NO_ACQUIRE);
+ *
  * @param   nLen
  * @return  newStr
  */
-I18NUTIL_DLLPUBLIC inline rtl_uString * SAL_CALL x_rtl_uString_new_WithLength( sal_Int32 nLen, sal_Int32 _refCount = 0 )
+I18NUTIL_DLLPUBLIC inline rtl_uString * SAL_CALL x_rtl_uString_new_WithLength( sal_Int32 nLen )
 {
-  rtl_uString *newStr = (rtl_uString*) rtl_allocateMemory ( sizeof(rtl_uString) + sizeof(sal_Unicode) * nLen);
-  newStr->refCount = _refCount;
-  newStr->length = nLen;
-  return newStr;
+    //rtl_uString contains sal_Unicode buffer[1], so an input of nLen allocates
+    //a buffer of nLen + 1
+    rtl_uString *newStr = (rtl_uString*) rtl_allocateMemory ( sizeof(rtl_uString) + sizeof(sal_Unicode) * nLen);
+    newStr->refCount = 1;
+    newStr->length = nLen;
+    return newStr;
 }
 
 /**
diff --git a/i18nutil/source/utility/widthfolding.cxx b/i18nutil/source/utility/widthfolding.cxx
index ed636b2..edfe573 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)
commit 5e51cc84d9a9885cc081dd409697244dcd7a67c8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Aug 31 22:38:04 2011 +0100

    these don't actually take ownership, just copy and leak original

diff --git a/i18npool/source/nativenumber/nativenumbersupplier.cxx b/i18npool/source/nativenumber/nativenumbersupplier.cxx
index cb170b6..933a2f5 100644
--- a/i18npool/source/nativenumber/nativenumbersupplier.cxx
+++ b/i18npool/source/nativenumber/nativenumbersupplier.cxx
@@ -177,32 +177,36 @@ sal_Bool SAL_CALL AsciiToNative_numberMaker(const sal_Unicode *str, sal_Int32 be
 OUString SAL_CALL AsciiToNative( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount,
         Sequence< sal_Int32 >& offset, sal_Bool useOffset, Number* number ) throw(RuntimeException)
 {
+        rtl::OUString aRet;
+
         sal_Int32 strLen = inStr.getLength() - startPos;
         sal_Unicode *numberChar = NumberChar[number->number];
 
         if (nCount > strLen)
             nCount = strLen;
 
-        if (nCount > 0) {
+        if (nCount > 0)
+        {
             const sal_Unicode *str = inStr.getStr() + startPos;
-            rtl_uString *newStr = x_rtl_uString_new_WithLength(nCount * 2);
-            rtl_uString *srcStr = x_rtl_uString_new_WithLength(nCount); // for keeping number without comma
+            sal_Unicode *newStr = new sal_Unicode[nCount * 2 + 1];
+            sal_Unicode *srcStr = new sal_Unicode[nCount + 1]; // for keeping number without comma
             sal_Int32 i, len = 0, count = 0;
 
             if (useOffset)
                 offset.realloc( nCount * 2 );
             sal_Bool doDecimal = sal_False;
 
-            for (i = 0; i <= nCount; i++) {
+            for (i = 0; i <= nCount; i++)
+            {
                 if (i < nCount && isNumber(str[i])) {
                     if (doDecimal) {
-                        newStr->buffer[count] = numberChar[str[i] - NUMBER_ZERO];
+                        newStr[count] = numberChar[str[i] - NUMBER_ZERO];
                         if (useOffset)
                             offset[count] = i + startPos;
                         count++;
                     }
                     else
-                        srcStr->buffer[len++] = str[i];
+                        srcStr[len++] = str[i];
                 } else {
                     if (len > 0) {
                         if (isSeparator(str[i]) && i < nCount-1 && isNumber(str[i+1]))
@@ -212,14 +216,14 @@ OUString SAL_CALL AsciiToNative( const OUString& inStr, sal_Int32 startPos, sal_
                                 end <= len; begin = end, end += number->multiplierExponent[0]) {
                             if (end == 0) continue;
                             sal_Int32 _count = count;
-                            notZero |= AsciiToNative_numberMaker(srcStr->buffer, begin, end - begin, newStr->buffer, count,
+                            notZero |= AsciiToNative_numberMaker(srcStr, begin, end - begin, newStr, count,
                                         end == len ? -1 : 0, offset, useOffset, i - len + startPos, number, numberChar);
                             if (count > 0 && number->multiplierExponent[number->exponentCount-1] == 1 &&
-                                        newStr->buffer[count-1] == numberChar[0])
+                                        newStr[count-1] == numberChar[0])
                                 count--;
                             if (notZero && _count == count) {
                                 if (end != len) {
-                                    newStr->buffer[count] = number->multiplierChar[0];
+                                    newStr[count] = number->multiplierChar[0];
                                     if (useOffset)
                                         offset[count] = i - len + startPos;
                                     count++;
@@ -227,7 +231,7 @@ OUString SAL_CALL AsciiToNative( const OUString& inStr, sal_Int32 startPos, sal_
                             }
                         }
                         if (! notZero && ! (number->numberFlag & NUMBER_OMIT_ONLY_ZERO)) {
-                            newStr->buffer[count] = numberChar[0];
+                            newStr[count] = numberChar[0];
                             if (useOffset)
                                 offset[count] = i - len + startPos;
                             count++;
@@ -236,13 +240,13 @@ OUString SAL_CALL AsciiToNative( const OUString& inStr, sal_Int32 startPos, sal_
                     }
                     if (i < nCount) {
                         if ((doDecimal = (!doDecimal && isDecimal(str[i]) && i < nCount-1 && isNumber(str[i+1]))) != sal_False)
-                            newStr->buffer[count] = (DecimalChar[number->number] ? DecimalChar[number->number] : str[i]);
+                            newStr[count] = (DecimalChar[number->number] ? DecimalChar[number->number] : str[i]);
                         else if (isMinus(str[i]) && i < nCount-1 && isNumber(str[i+1]))
-                            newStr->buffer[count] = (MinusChar[number->number] ? MinusChar[number->number] : str[i]);
+                            newStr[count] = (MinusChar[number->number] ? MinusChar[number->number] : str[i]);
                         else if (isSeparator(str[i]) && i < nCount-1 && isNumber(str[i+1]))
-                            newStr->buffer[count] = (SeparatorChar[number->number] ? SeparatorChar[number->number] : str[i]);
+                            newStr[count] = (SeparatorChar[number->number] ? SeparatorChar[number->number] : str[i]);
                         else
-                            newStr->buffer[count] = str[i];
+                            newStr[count] = str[i];
                         if (useOffset)
                             offset[count] = i + startPos;
                         count++;
@@ -250,11 +254,14 @@ OUString SAL_CALL AsciiToNative( const OUString& inStr, sal_Int32 startPos, sal_
                 }
             }
 
+            delete[] srcStr;
+
             if (useOffset)
                 offset.realloc(count);
-            return OUString(newStr->buffer, count);
+            aRet = OUString(newStr, count);
+            delete[] newStr;
         }
-        return OUString();
+        return aRet;
 }
 static void SAL_CALL NativeToAscii_numberMaker(sal_Int16 max, sal_Int16 prev, const sal_Unicode *str,
         sal_Int32& i, sal_Int32 nCount, sal_Unicode *dst, sal_Int32& count, Sequence< sal_Int32 >& offset, sal_Bool useOffset,
@@ -308,6 +315,8 @@ static void SAL_CALL NativeToAscii_numberMaker(sal_Int16 max, sal_Int16 prev, co
 static OUString SAL_CALL NativeToAscii(const OUString& inStr,
         sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset, sal_Bool useOffset ) throw(RuntimeException)
 {
+        OUString aRet;
+
         sal_Int32 strLen = inStr.getLength() - startPos;
 
         if (nCount > strLen)
@@ -315,7 +324,7 @@ static OUString SAL_CALL NativeToAscii(const OUString& inStr,
 
         if (nCount > 0) {
             const sal_Unicode *str = inStr.getStr() + startPos;
-            rtl_uString *newStr = x_rtl_uString_new_WithLength(nCount * MultiplierExponent_7_CJK[0] + 1);
+            sal_Unicode *newStr = new sal_Unicode[nCount * MultiplierExponent_7_CJK[0] + 2];
             if (useOffset)
                 offset.realloc( nCount * MultiplierExponent_7_CJK[0] + 1 );
             sal_Int32 count = 0, index;
@@ -330,8 +339,8 @@ static OUString SAL_CALL NativeToAscii(const OUString& inStr,
 
             for ( i = 0; i < nCount; i++) {
                 if ((index = multiplierChar.indexOf(str[i])) >= 0) {
-                    if (count == 0 || !isNumber(newStr->buffer[count-1])) { // add 1 in front of multiplier
-                        newStr->buffer[count] = NUMBER_ONE;
+                    if (count == 0 || !isNumber(newStr[count-1])) { // add 1 in front of multiplier
+                        newStr[count] = NUMBER_ONE;
                         if (useOffset)
                             offset[count] = i;
                         count++;
@@ -339,29 +348,29 @@ static OUString SAL_CALL NativeToAscii(const OUString& inStr,
                     index = MultiplierExponent_7_CJK[index % ExponentCount_7_CJK];
                     NativeToAscii_numberMaker(
                                 sal::static_int_cast<sal_Int16>( index ), sal::static_int_cast<sal_Int16>( index ),
-                                str, i, nCount, newStr->buffer, count, offset, useOffset,
+                                str, i, nCount, newStr, count, offset, useOffset,
                                 numberChar, multiplierChar);
                 } else {
                     if ((index = numberChar.indexOf(str[i])) >= 0)
-                        newStr->buffer[count] = sal::static_int_cast<sal_Unicode>( (index % 10) + NUMBER_ZERO );
+                        newStr[count] = sal::static_int_cast<sal_Unicode>( (index % 10) + NUMBER_ZERO );
                     else if ((index = separatorChar.indexOf(str[i])) >= 0 &&
                             (i < nCount-1 && (numberChar.indexOf(str[i+1]) >= 0 ||
                                             multiplierChar.indexOf(str[i+1]) >= 0)))
-                        newStr->buffer[count] = SeparatorChar[NumberChar_HalfWidth];
+                        newStr[count] = SeparatorChar[NumberChar_HalfWidth];
                     else if ((index = decimalChar.indexOf(str[i])) >= 0 &&
                             (i < nCount-1 && (numberChar.indexOf(str[i+1]) >= 0 ||
                                             multiplierChar.indexOf(str[i+1]) >= 0)))
                         // Only when decimal point is followed by numbers,
                         // it will be convert to ASCII decimal point
-                        newStr->buffer[count] = DecimalChar[NumberChar_HalfWidth];
+                        newStr[count] = DecimalChar[NumberChar_HalfWidth];
                     else if ((index = minusChar.indexOf(str[i])) >= 0 &&
                             (i < nCount-1 && (numberChar.indexOf(str[i+1]) >= 0 ||
                                             multiplierChar.indexOf(str[i+1]) >= 0)))
                         // Only when minus is followed by numbers,
                         // it will be convert to ASCII minus sign
-                        newStr->buffer[count] = MinusChar[NumberChar_HalfWidth];
+                        newStr[count] = MinusChar[NumberChar_HalfWidth];
                     else
-                        newStr->buffer[count] = str[i];
+                        newStr[count] = str[i];
                     if (useOffset)
                         offset[count] = i;
                     count++;
@@ -373,9 +382,10 @@ static OUString SAL_CALL NativeToAscii(const OUString& inStr,
                 for (i = 0; i < count; i++)
                     offset[i] += startPos;
             }
-            return OUString(newStr->buffer, count);
+            aRet = OUString(newStr, count);
+            delete[] newStr;
         }
-        return OUString();
+        return aRet;
 }
 
 static Number natnum4[4] = {
diff --git a/i18npool/source/textconversion/textconversion_ko.cxx b/i18npool/source/textconversion/textconversion_ko.cxx
index 8ebda80..9cdc070 100644
--- a/i18npool/source/textconversion/textconversion_ko.cxx
+++ b/i18npool/source/textconversion/textconversion_ko.cxx
@@ -159,24 +159,28 @@ TextConversion_ko::getCharConversions(const OUString& aText, sal_Int32 nStartPos
                 break;
             }
         }
-    } else if (! toHanja && getHanja2HangulIndex && getHanja2HangulData) {
-        rtl_uString * newStr = x_rtl_uString_new_WithLength( nLength ); // defined in x_rtl_ustring.h
+    } else if (! toHanja && getHanja2HangulIndex && getHanja2HangulData)
+    {
+        sal_Unicode *newStr = new sal_Unicode[nLength+1];
         sal_Int32 count = 0;
-        while (count < nLength) {
+        while (count < nLength)
+        {
             ch = aText[nStartPos + count];
             sal_Unicode address = getHanja2HangulIndex()[ch>>8];
             if (address != 0xFFFF)
                 address = getHanja2HangulData()[address + (ch & 0xFF)];
 
             if (address != 0xFFFF)
-                newStr->buffer[count++] = address;
+                newStr[count++] = address;
             else
                 break;
         }
-        if (count > 0) {
+        if (count > 0)
+        {
             output.realloc(1);
-            output[0] = OUString( newStr->buffer, count);
+            output[0] = OUString(newStr, count);
         }
+        delete[] newStr;
     }
     return output;
 }
diff --git a/i18npool/source/textconversion/textconversion_zh.cxx b/i18npool/source/textconversion/textconversion_zh.cxx
index ddb8a02..b9460eb 100644
--- a/i18npool/source/textconversion/textconversion_zh.cxx
+++ b/i18npool/source/textconversion/textconversion_zh.cxx
@@ -125,7 +125,7 @@ TextConversion_zh::getWordConversion(const OUString& aText, sal_Int32 nStartPos,
     if ((!wordData || !index || !entry) && !xCDL.is()) // no word mapping defined, do char2char conversion.
         return getCharConversion(aText, nStartPos, nLength, toSChinese, nConversionOptions);
 
-    rtl_uString * newStr = x_rtl_uString_new_WithLength( nLength * 2 ); // defined in x_rtl_ustring.h
+    sal_Unicode *newStr = new sal_Unicode[nLength * 2 + 1];
     sal_Int32 currPos = 0, count = 0;
     while (currPos < nLength) {
         sal_Int32 len = nLength - currPos;
@@ -161,12 +161,12 @@ TextConversion_zh::getWordConversion(const OUString& aText, sal_Int32 nStartPos,
                         while (current < conversions[0].getLength()) {
                             offset[count] = nStartPos + currPos + (current *
                                     word.getLength() / conversions[0].getLength());
-                            newStr->buffer[count++] = conversions[0][current++];
+                            newStr[count++] = conversions[0][current++];
                         }
                         // offset[count-1] = nStartPos + currPos + word.getLength() - 1;
                     } else {
                         while (current < conversions[0].getLength())
-                            newStr->buffer[count++] = conversions[0][current++];
+                            newStr[count++] = conversions[0][current++];
                     }
                     currPos += word.getLength();
                     found = sal_True;
@@ -197,12 +197,12 @@ TextConversion_zh::getWordConversion(const OUString& aText, sal_Int32 nStartPos,
                             while (wordData[current]) {
                                 offset[count]=nStartPos + currPos + ((current-start) *
                                     word.getLength() / convertedLength);
-                                newStr->buffer[count++] = wordData[current++];
+                                newStr[count++] = wordData[current++];
                             }
                             // offset[count-1]=nStartPos + currPos + word.getLength() - 1;
                         } else {
                             while (wordData[current])
-                                newStr->buffer[count++] = wordData[current++];
+                                newStr[count++] = wordData[current++];
                         }
                         currPos += word.getLength();
                         found = sal_True;
@@ -213,14 +213,16 @@ TextConversion_zh::getWordConversion(const OUString& aText, sal_Int32 nStartPos,
         if (!found) {
             if (offset.getLength() > 0)
                 offset[count]=nStartPos+currPos;
-            newStr->buffer[count++] =
+            newStr[count++] =
                 getOneCharConversion(aText[nStartPos+currPos], charData, charIndex);
             currPos++;
         }
     }
     if (offset.getLength() > 0)
         offset.realloc(one2one ? 0 : count);
-    return OUString( newStr->buffer, count);
+    OUString aRet(newStr, count);
+    delete[] newStr;
+    return aRet;
 }
 
 TextConversionResult SAL_CALL
commit 5ba602cbf06a51c8889a3e6357442d32ffb792ab
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Aug 31 21:37:11 2011 +0100

    callcatcher: another layer of unused

diff --git a/slideshow/source/engine/tools.cxx b/slideshow/source/engine/tools.cxx
index f7417e1..9d66391 100644
--- a/slideshow/source/engine/tools.cxx
+++ b/slideshow/source/engine/tools.cxx
@@ -480,28 +480,6 @@ namespace slideshow
             return true;
         }
 
-        bool findNamedValue( beans::NamedValue*                         o_pRet,
-                             const uno::Sequence< beans::NamedValue >&  rSequence,
-                             const ::rtl::OUString&                     rSearchString )
-        {
-            const beans::NamedValue*    pArray = rSequence.getConstArray();
-            const size_t                nLen( rSequence.getLength() );
-
-            if( nLen == 0 )
-                return false;
-
-            const beans::NamedValue* pFound = ::std::find_if( pArray,
-                                                              pArray + nLen,
-                                                              NamedValueStringComparator( rSearchString ) );
-            if( pFound == pArray + nLen )
-                return false;
-
-            if( o_pRet )
-                *o_pRet = *pFound;
-
-            return true;
-        }
-
         basegfx::B2DRange calcRelativeShapeBounds( const basegfx::B2DVector& rPageSize,
                                                    const basegfx::B2DRange&  rShapeBounds )
         {
diff --git a/slideshow/source/inc/tools.hxx b/slideshow/source/inc/tools.hxx
index cbe612b..0293fb8 100644
--- a/slideshow/source/inc/tools.hxx
+++ b/slideshow/source/inc/tools.hxx
@@ -177,20 +177,6 @@ namespace slideshow
                                  ::com::sun::star::beans::NamedValue > const& rSequence,
                              const ::com::sun::star::beans::NamedValue& rSearchKey );
 
-        /** Search a sequence of NamedValues for an element with a given name.
-
-            @param o_pRet
-            If non-NULL, receives the full NamedValue found (if it was
-            found, that is).
-
-            @return true, if the sequence contains the specified
-            element.
-         */
-        bool findNamedValue( ::com::sun::star::beans::NamedValue*       o_pRet,
-                             const ::com::sun::star::uno::Sequence<
-                                 ::com::sun::star::beans::NamedValue >&     rSequence,
-                             const ::rtl::OUString&                     rSearchString );
-
         basegfx::B2DRange calcRelativeShapeBounds( const basegfx::B2DVector& rPageSize,
                                                    const basegfx::B2DRange&  rShapeBounds );
 


More information about the Libreoffice-commits mailing list