[Libreoffice-commits] core.git: svx/source

Caolán McNamara caolanm at redhat.com
Tue Mar 28 15:29:17 UTC 2017


 svx/source/dialog/srchdlg.cxx |   27 ++++++++++-----------------
 1 file changed, 10 insertions(+), 17 deletions(-)

New commits:
commit 16b67b4bd394aee3b46a9d46ea7f919dfb35a855
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Mar 28 16:26:07 2017 +0100

    std::unique_ptr<sal_uInt16[]> -> std::vector
    
    Change-Id: I708e1f24e14bc21f40cf4d5a2d3e6f849b6f7762

diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index 2929c37769cc..1abd869cff8c 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -1974,30 +1974,23 @@ IMPL_LINK_NOARG(SvxSearchDialog, FormatHdl_Impl, Button*, void)
     if ( !pSh || !pImpl->pRanges )
         return;
 
-    sal_sSize nCnt = 0;
-    const sal_uInt16* pPtr = pImpl->pRanges.get();
-    const sal_uInt16* pTmp = pPtr;
-
-    while( *pTmp )
-        pTmp++;
-    nCnt = pTmp - pPtr + 7;
-    std::unique_ptr<sal_uInt16[]> pWhRanges(new sal_uInt16[nCnt]);
-    sal_uInt16 nPos = 0;
+    std::vector<sal_uInt16> aWhRanges;
 
-    while( *pPtr )
+    const sal_uInt16* pPtr = pImpl->pRanges.get();
+    while (*pPtr)
     {
-        pWhRanges[nPos++] = *pPtr++;
+        aWhRanges.push_back(*pPtr++);
     }
 
-    pWhRanges[nPos++] = SID_ATTR_PARA_MODEL;
-    pWhRanges[nPos++] = SID_ATTR_PARA_MODEL;
+    aWhRanges.push_back(SID_ATTR_PARA_MODEL);
+    aWhRanges.push_back(SID_ATTR_PARA_MODEL);
 
     sal_uInt16 nBrushWhich = pSh->GetPool().GetWhich(SID_ATTR_BRUSH);
-    pWhRanges[nPos++] = nBrushWhich;
-    pWhRanges[nPos++] = nBrushWhich;
-    pWhRanges[nPos] = 0;
+    aWhRanges.push_back(nBrushWhich);
+    aWhRanges.push_back(nBrushWhich);
+    aWhRanges.push_back(0);
     SfxItemPool& rPool = pSh->GetPool();
-    SfxItemSet aSet( rPool, pWhRanges.get() );
+    SfxItemSet aSet(rPool, aWhRanges.data());
     OUString aTxt;
 
     aSet.InvalidateAllItems();


More information about the Libreoffice-commits mailing list