diff options
author | Torbjörn Andersson | 2009-05-12 20:03:10 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2009-05-12 20:03:10 +0000 |
commit | 0cc6b88f581a565c2b94f638e1b759c2608ba9f1 (patch) | |
tree | 8e0f0e4203130b8f0d2a8ec458987ec30b49cee1 /engines | |
parent | 536bdeacd49dd5bbf0185133a172d803b27b8610 (diff) | |
download | scummvm-rg350-0cc6b88f581a565c2b94f638e1b759c2608ba9f1.tar.gz scummvm-rg350-0cc6b88f581a565c2b94f638e1b759c2608ba9f1.tar.bz2 scummvm-rg350-0cc6b88f581a565c2b94f638e1b759c2608ba9f1.zip |
When source and destination are the same, there is no need to strcpy(). In fact
it may even be harmful when source and destination overlap. (This happens when
loading savegames.)
svn-id: r40508
Diffstat (limited to 'engines')
-rw-r--r-- | engines/cruise/background.cpp | 3 | ||||
-rw-r--r-- | engines/cruise/ctp.cpp | 3 | ||||
-rw-r--r-- | engines/cruise/dataLoader.cpp | 3 |
3 files changed, 6 insertions, 3 deletions
diff --git a/engines/cruise/background.cpp b/engines/cruise/background.cpp index 21e4052dcd..3c16388f74 100644 --- a/engines/cruise/background.cpp +++ b/engines/cruise/background.cpp @@ -206,7 +206,8 @@ int loadBackground(const char *name, int idx) { } - strcpy(backgroundTable[idx].name, name); + if (name != backgroundTable[idx].name) + strcpy(backgroundTable[idx].name, name); return (0); } diff --git a/engines/cruise/ctp.cpp b/engines/cruise/ctp.cpp index 80bd4ffe16..e40df8ad0f 100644 --- a/engines/cruise/ctp.cpp +++ b/engines/cruise/ctp.cpp @@ -325,7 +325,8 @@ int initCt(const char *ctpName) { } free(ptr); - strcpy(currentCtpName, ctpName); + if (ctpName != currentCtpName) + strcpy(currentCtpName, ctpName); numberOfWalkboxes = segementSizeTable[6] / 2; // get the number of walkboxes diff --git a/engines/cruise/dataLoader.cpp b/engines/cruise/dataLoader.cpp index b458bee9d3..69fcc12b1e 100644 --- a/engines/cruise/dataLoader.cpp +++ b/engines/cruise/dataLoader.cpp @@ -499,7 +499,8 @@ int loadSetEntry(const char *name, uint8 *ptr, int currentEntryIdx, int currentD } } - strcpy(filesDatabase[fileIndex].subData.name, name); + if (name != filesDatabase[fileIndex].subData.name) + strcpy(filesDatabase[fileIndex].subData.name, name); // create the mask switch (localBuffer.type) { |