aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2016-05-17 06:50:43 +0200
committerStrangerke2016-05-17 06:50:43 +0200
commite024a26ccdd95893839a35325c17276a7a01107e (patch)
tree73707d06df6177a997e2341a3e481da372191021
parent090c178214867009ded91ba7cab4b658da3e7b6d (diff)
downloadscummvm-rg350-e024a26ccdd95893839a35325c17276a7a01107e.tar.gz
scummvm-rg350-e024a26ccdd95893839a35325c17276a7a01107e.tar.bz2
scummvm-rg350-e024a26ccdd95893839a35325c17276a7a01107e.zip
GNAP: Replace memcpy on overlapping memory area by memmove. Thanks to eriktorbjorn for suggesting it
-rw-r--r--engines/gnap/gamesys.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp
index 76f7fa44b3..4c603c53fb 100644
--- a/engines/gnap/gamesys.cpp
+++ b/engines/gnap/gamesys.cpp
@@ -443,7 +443,7 @@ void GameSys::seqInsertGfx(int index, int duration) {
seqLocateGfx(seqItem->_sequenceId, seqItem->_id, &gfxIndex);
if (gfxIndex != _gfxItemsCount)
- memcpy(&_gfxItems[gfxIndex + sequenceResource->_animationsCount], &_gfxItems[gfxIndex], sizeof(GfxItem) * (_gfxItemsCount - gfxIndex));
+ memmove(&_gfxItems[gfxIndex + sequenceResource->_animationsCount], &_gfxItems[gfxIndex], sizeof(GfxItem) * (_gfxItemsCount - gfxIndex));
_gfxItemsCount += sequenceResource->_animationsCount;
for (int i = 0; i < sequenceResource->_animationsCount; ++i) {
@@ -523,7 +523,7 @@ void GameSys::seqRemoveGfx(int sequenceId, int id) {
if (gfxItem->_prevFrame._spriteId == -1) {
--_gfxItemsCount;
if (gfxIndex != _gfxItemsCount)
- memcpy(&_gfxItems[gfxIndex], &_gfxItems[gfxIndex + 1], sizeof(GfxItem) * (_gfxItemsCount - gfxIndex));
+ memmove(&_gfxItems[gfxIndex], &_gfxItems[gfxIndex + 1], sizeof(GfxItem) * (_gfxItemsCount - gfxIndex));
} else {
gfxItem->_sequenceId = -1;
gfxItem->_animation = nullptr;
@@ -945,7 +945,7 @@ void GameSys::handleReqRemoveSequenceItem() {
++gfxIndex2a;
_gfxItemsCount -= gfxIndex2a - gfxIndex2;
if (_gfxItemsCount != gfxIndex2)
- memcpy(&_gfxItems[gfxIndex2], &_gfxItems[gfxIndex2a], sizeof(GfxItem) * (_gfxItemsCount - gfxIndex2));
+ memmove(&_gfxItems[gfxIndex2], &_gfxItems[gfxIndex2a], sizeof(GfxItem) * (_gfxItemsCount - gfxIndex2));
}
}
}
@@ -1095,7 +1095,7 @@ void GameSys::fatUpdateFrame() {
} else if (v20 && gfxItem->_prevFrame._spriteId == -1) {
--_gfxItemsCount;
if (_gfxItemsCount != i)
- memcpy(&_gfxItems[i], &_gfxItems[i + 1], sizeof(GfxItem) * (_gfxItemsCount - i));
+ memmove(&_gfxItems[i], &_gfxItems[i + 1], sizeof(GfxItem) * (_gfxItemsCount - i));
--i;
} else {
gfxItem->_updFlag = false;
@@ -1112,7 +1112,7 @@ void GameSys::fatUpdateFrame() {
} else {
--_gfxItemsCount;
if (_gfxItemsCount != i)
- memcpy(&_gfxItems[i], &_gfxItems[i + 1], sizeof(GfxItem) * (_gfxItemsCount - i));
+ memmove(&_gfxItems[i], &_gfxItems[i + 1], sizeof(GfxItem) * (_gfxItemsCount - i));
--i;
}
}
@@ -1124,7 +1124,7 @@ void GameSys::fatUpdateFrame() {
int insertIndex;
seqLocateGfx(-1, _newSpriteDrawItems[k]._id, &insertIndex);
if (_gfxItemsCount != insertIndex)
- memcpy(&_gfxItems[insertIndex + 1], &_gfxItems[insertIndex], sizeof(GfxItem) * (_gfxItemsCount - insertIndex));
+ memmove(&_gfxItems[insertIndex + 1], &_gfxItems[insertIndex], sizeof(GfxItem) * (_gfxItemsCount - insertIndex));
++_gfxItemsCount;
GfxItem *gfxItem = &_gfxItems[insertIndex];
gfxItem->_sequenceId = -1;