diff options
author | jailletc36 <christophe.jaillet@wanadoo.fr> | 2012-11-11 11:51:07 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-11-14 16:48:17 +0000 |
commit | de51745f588a2e2aa933e4c33fae3d9a10385eb1 (patch) | |
tree | a15f8d5c02080f32df73bf2bbf13170bc7b8ac04 | |
parent | 5b1fcd5262f087e3d1cabb240d1761064baeafc6 (diff) |
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@wanadoo.fr>
Reviewed-on: https://gerrit.libreoffice.org/1033
Reviewed-by: Tor Lillqvist <tml@iki.fi>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | rsc/source/res/rscrange.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/markarr.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/tool/consoli.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/starcalc/collect.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/viewfunc.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/bastyp/minarray.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/kde/UnxCommandThread.cxx | 2 |
8 files changed, 14 insertions, 14 deletions
diff --git a/rsc/source/res/rscrange.cxx b/rsc/source/res/rscrange.cxx index ac291b87a4b0..7619ee5df0a2 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 2e57f02d1e35..1970700b2b14 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 2ad21525fd10..649f1771f150 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 b56faec22dc0..e825289f691a 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 8b13ebd501d2..22f6eccf4120 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 98225dce3c7d..23d2dbe66431 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 4f2f6bc427e4..f1da99d4f3d3 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 8daf3b14c550..b27a149799b3 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; |