[Libreoffice-commits] core.git: sal/rtl

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Aug 2 08:32:50 UTC 2018


 sal/rtl/strtmpl.cxx |   11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

New commits:
commit 12af39cf39240f211b0601da3ed68d49db924181
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sun Jul 29 12:57:04 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Aug 2 10:32:26 2018 +0200

    Use memcpy for string ImplNewCopy functions
    
    Change-Id: If0072a2fd7d3111b48413143610025124f365207
    Reviewed-on: https://gerrit.libreoffice.org/58275
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sal/rtl/strtmpl.cxx b/sal/rtl/strtmpl.cxx
index e1ab1dce278c..c4f8fa605efa 100644
--- a/sal/rtl/strtmpl.cxx
+++ b/sal/rtl/strtmpl.cxx
@@ -1165,18 +1165,13 @@ static IMPL_RTL_STRCODE* IMPL_RTL_STRINGNAME( ImplNewCopy )( IMPL_RTL_STRINGDATA
 
     pDest   = pData->buffer;
     pSrc    = pStr->buffer;
-    while ( nCount > 0 )
-    {
-        *pDest = *pSrc;
-        pDest++;
-        pSrc++;
-        nCount--;
-    }
+
+    memcpy( pDest, pSrc, nCount * sizeof(IMPL_RTL_STRCODE));
 
     *ppThis = pData;
 
     RTL_LOG_STRING_NEW( pData );
-    return pDest;
+    return pDest + nCount;
 }
 
 /* ======================================================================= */


More information about the Libreoffice-commits mailing list