tdf#163691 Use std::copy_n() instead of memcpy() in FilterContainer.cxx

Change-Id: I951feec6eb86c7532b9619ef3b354dc3e33d0883
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204341
Reviewed-by: Neil Roberts <nroberts@libreoffice.org>
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
Asim Raza
2026-04-29 10:31:51 +02:00
committed by Neil Roberts
parent a0ab0ae18f
commit 4f54b40041
+6 -12
View File
@@ -220,12 +220,6 @@ static sal_uInt32 getTotalFilterLength( CFilterContainer& aFilterContainer )
return ( totalLength > 0 ) ? totalLength + 1 : totalLength;
}
static
void wcsmemcpy( sal_Unicode* pDest, const sal_Unicode* pSrc, sal_uInt32 nLength )
{
memcpy( pDest, pSrc, nLength * sizeof( sal_Unicode ) );
}
// a helper trivial helper function to create a filter buffer in the
// format the Win32 API requires,
// e.g. "Text\0*.txt\0Doc\0*.doc;*xls\0\0"
@@ -252,17 +246,17 @@ OUString makeWinFilterBuffer( CFilterContainer& aFilterContainer )
while( aFilterContainer.getNextFilter( nextFilter ) )
{
wcsmemcpy(
pBuff.get() + memPos,
std::copy_n(
nextFilter.first.getStr( ),
nextFilter.first.getLength( ) );
nextFilter.first.getLength( ),
pBuff.get() + memPos );
memPos += nextFilter.first.getLength( ) + 1;
wcsmemcpy(
pBuff.get() + memPos,
std::copy_n(
nextFilter.second.getStr( ),
nextFilter.second.getLength( ) );
nextFilter.second.getLength( ),
pBuff.get() + memPos );
memPos += nextFilter.second.getLength( ) + 1 ;
}