From 12af39cf39240f211b0601da3ed68d49db924181 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sun, 29 Jul 2018 12:57:04 +0200 Subject: Use memcpy for string ImplNewCopy functions Change-Id: If0072a2fd7d3111b48413143610025124f365207 Reviewed-on: https://gerrit.libreoffice.org/58275 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sal/rtl/strtmpl.cxx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'sal/rtl') 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; } /* ======================================================================= */ -- cgit