[Libreoffice-commits] .: rsc/source sc/source sfx2/source sw/source vcl/unx
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Nov 14 08:48:37 PST 2012
rsc/source/res/rscrange.cxx | 4 ++--
sc/source/core/data/markarr.cxx | 2 +-
sc/source/core/tool/consoli.cxx | 4 ++--
sc/source/filter/starcalc/collect.cxx | 2 +-
sc/source/ui/view/viewfunc.cxx | 2 +-
sfx2/source/bastyp/minarray.cxx | 10 +++++-----
sw/source/filter/ww8/wrtww8.cxx | 2 +-
vcl/unx/kde/UnxCommandThread.cxx | 2 +-
8 files changed, 14 insertions(+), 14 deletions(-)
New commits:
commit de51745f588a2e2aa933e4c33fae3d9a10385eb1
Author: jailletc36 <christophe.jaillet at wanadoo.fr>
Date: Sun Nov 11 11:51:07 2012 +0100
Turn some memmove into memcpy when it is safe to do so.
Most of the changes are related to newly allocated memory, so we are
sure it can not overlap with the source of the copy.
Change-Id: Ie6ccf1bbb07b792fb18601a38dfaa55755d14b7d
Signed-off-by: jailletc36 <christophe.jaillet at wanadoo.fr>
Reviewed-on: https://gerrit.libreoffice.org/1033
Reviewed-by: Tor Lillqvist <tml at iki.fi>
Tested-by: Caolán McNamara <caolanm at redhat.com>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/rsc/source/res/rscrange.cxx b/rsc/source/res/rscrange.cxx
index ac291b8..7619ee5 100644
--- a/rsc/source/res/rscrange.cxx
+++ b/rsc/source/res/rscrange.cxx
@@ -275,7 +275,7 @@ ERRTYPE RscLongRange::SetNumber( const RSCINST & rInst, sal_Int32 nValue )
if( nMax < nValue || nMin > nValue )
return( ERR_RSCRANGE_OUTDEFSET );
void * pData = &((RscLongRangeInst*)rInst.pData)->nValue;
- memmove( pData, &nValue, sizeof( sal_Int32 ) );
+ memcpy( pData, &nValue, sizeof( sal_Int32 ) );
((RscLongRangeInst *)rInst.pData)->bDflt = sal_False;
return( ERR_OK );
}
@@ -323,7 +323,7 @@ RSCINST RscLongRange::Create( RSCINST * pInst, const RSCINST & rDflt,
else
lDflt = nMin;
void * pData = &((RscLongRangeInst*)aInst.pData)->nValue;
- memmove( pData, &lDflt, sizeof( sal_Int32 ) );
+ memcpy( pData, &lDflt, sizeof( sal_Int32 ) );
((RscLongRangeInst *)aInst.pData)->bDflt = sal_True;
}
diff --git a/sc/source/core/data/markarr.cxx b/sc/source/core/data/markarr.cxx
index 2e57f02..1970700 100644
--- a/sc/source/core/data/markarr.cxx
+++ b/sc/source/core/data/markarr.cxx
@@ -300,7 +300,7 @@ void ScMarkArray::CopyMarksTo( ScMarkArray& rDestMarkArray ) const
if (pData)
{
rDestMarkArray.pData = new ScMarkEntry[nCount];
- memmove( rDestMarkArray.pData, pData, nCount * sizeof(ScMarkEntry) );
+ memcpy( rDestMarkArray.pData, pData, nCount * sizeof(ScMarkEntry) );
}
else
rDestMarkArray.pData = NULL;
diff --git a/sc/source/core/tool/consoli.cxx b/sc/source/core/tool/consoli.cxx
index 2ad2152..649f177 100644
--- a/sc/source/core/tool/consoli.cxx
+++ b/sc/source/core/tool/consoli.cxx
@@ -63,7 +63,7 @@ void ScReferenceList::AddEntry( SCCOL nCol, SCROW nRow, SCTAB nTab )
pData = new ScReferenceEntry[ nFullSize+1 ];
if (pOldData)
{
- memmove( pData, pOldData, nCount * sizeof(ScReferenceEntry) );
+ memcpy( pData, pOldData, nCount * sizeof(ScReferenceEntry) );
delete[] pOldData;
}
while (nCount < nFullSize)
@@ -87,7 +87,7 @@ static void lcl_AddString( String**& pData, T& nCount, const String& rInsert )
pData = new String*[ nCount+1 ];
if (pOldData)
{
- memmove( pData, pOldData, nCount * sizeof(String*) );
+ memcpy( pData, pOldData, nCount * sizeof(String*) );
delete[] pOldData;
}
pData[nCount] = new String(rInsert);
diff --git a/sc/source/filter/starcalc/collect.cxx b/sc/source/filter/starcalc/collect.cxx
index b56faec..e825289 100644
--- a/sc/source/filter/starcalc/collect.cxx
+++ b/sc/source/filter/starcalc/collect.cxx
@@ -102,7 +102,7 @@ sal_Bool ScCollection::AtInsert(sal_uInt16 nIndex, ScDataObject* pScDataObject)
if (!pNewItems)
return false;
nLimit = sal::static_int_cast<sal_uInt16>( nLimit + nDelta );
- memmove(pNewItems, pItems, nCount * sizeof(ScDataObject*));
+ memcpy(pNewItems, pItems, nCount * sizeof(ScDataObject*));
delete[] pItems;
pItems = pNewItems;
}
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 8b13ebd..22f6ecc 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -2066,7 +2066,7 @@ void ScViewFunc::SetWidthOrHeight( sal_Bool bWidth, SCCOLROW nRangeCnt, SCCOLROW
}
pUndoRanges = new SCCOLROW[ 2*nRangeCnt ];
- memmove( pUndoRanges, pRanges, 2*nRangeCnt*sizeof(SCCOLROW) );
+ memcpy( pUndoRanges, pRanges, 2*nRangeCnt*sizeof(SCCOLROW) );
//! outlines from all tab?
ScOutlineTable* pTable = pDoc->GetOutlineTable( nCurTab );
diff --git a/sfx2/source/bastyp/minarray.cxx b/sfx2/source/bastyp/minarray.cxx
index 98225dc..23d2dbe 100644
--- a/sfx2/source/bastyp/minarray.cxx
+++ b/sfx2/source/bastyp/minarray.cxx
@@ -93,7 +93,7 @@ void SfxPtrArr::Append( void* aElem )
if ( pData )
{
DBG_ASSERT( nUsed <= nNewSize, "" );
- memmove( pNewData, pData, sizeof(void*)*nUsed );
+ memcpy( pNewData, pData, sizeof(void*)*nUsed );
delete [] pData;
}
nUnused = sal::static_int_cast< sal_uInt8 >(nNewSize-nUsed);
@@ -139,11 +139,11 @@ sal_uInt16 SfxPtrArr::Remove( sal_uInt16 nPos, sal_uInt16 nLen )
if ( nPos > 0 )
{
DBG_ASSERT( nPos <= nNewSize, "" );
- memmove( pNewData, pData, sizeof(void*)*nPos );
+ memcpy( pNewData, pData, sizeof(void*)*nPos );
}
if ( nNewUsed != nPos )
- memmove( pNewData+nPos, pData+nPos+nLen,
- sizeof(void*)*(nNewUsed-nPos) );
+ memcpy( pNewData+nPos, pData+nPos+nLen,
+ sizeof(void*)*(nNewUsed-nPos) );
delete [] pData;
pData = pNewData;
nUsed = nNewUsed;
@@ -210,7 +210,7 @@ void SfxPtrArr::Insert( sal_uInt16 nPos, void* rElem )
if ( pData )
{
DBG_ASSERT( nUsed < nNewSize, "" );
- memmove( pNewData, pData, sizeof(void*)*nUsed );
+ memcpy( pNewData, pData, sizeof(void*)*nUsed );
delete [] pData;
}
nUnused = sal::static_int_cast< sal_uInt8 >(nNewSize-nUsed);
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 4f2f6bc..f1da99d 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -614,7 +614,7 @@ void WW8_WrPlc1::Append( WW8_CP nCp, const void* pNewData )
if( nDataLen < nInsPos + nStructSiz )
{
sal_uInt8* pNew = new sal_uInt8[ 2 * nDataLen ];
- memmove( pNew, pData, nDataLen );
+ memcpy( pNew, pData, nDataLen );
delete[] pData;
pData = pNew;
nDataLen *= 2;
diff --git a/vcl/unx/kde/UnxCommandThread.cxx b/vcl/unx/kde/UnxCommandThread.cxx
index 8daf3b1..b27a149 100644
--- a/vcl/unx/kde/UnxCommandThread.cxx
+++ b/vcl/unx/kde/UnxCommandThread.cxx
@@ -150,7 +150,7 @@ void SAL_CALL UnxFilePickerCommandThread::run()
nBufferSize *= 2;
sal_Char *pNewBuffer = new sal_Char[nBufferSize];
if ( pEntryBegin < pBufferEnd )
- memmove( pNewBuffer, pEntryBegin, pWhereToReadEnd - pEntryBegin );
+ memcpy( pNewBuffer, pEntryBegin, pWhereToReadEnd - pEntryBegin );
delete[] pBuffer;
pBuffer = pNewBuffer;
More information about the Libreoffice-commits
mailing list