[Scummvm-cvs-logs] SF.net SVN: scummvm:[44538] scummvm/trunk/engines
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Fri Oct 2 16:32:57 CEST 2009
Revision: 44538
http://scummvm.svn.sourceforge.net/scummvm/?rev=44538&view=rev
Author: fingolfin
Date: 2009-10-02 14:32:54 +0000 (Fri, 02 Oct 2009)
Log Message:
-----------
Fix some cppcheck warnings reported by salty-horse
Modified Paths:
--------------
scummvm/trunk/engines/agos/string.cpp
scummvm/trunk/engines/agos/subroutine.cpp
scummvm/trunk/engines/sci/engine/klists.cpp
Modified: scummvm/trunk/engines/agos/string.cpp
===================================================================
--- scummvm/trunk/engines/agos/string.cpp 2009-10-02 14:11:45 UTC (rev 44537)
+++ scummvm/trunk/engines/agos/string.cpp 2009-10-02 14:32:54 UTC (rev 44538)
@@ -297,8 +297,6 @@
void AGOSEngine::loadTextIntoMem(uint16 stringId) {
byte *p;
- char filename[30];
- int i;
uint16 baseMin = 0x8000, baseMax, size;
_tablesHeapPtr = _tablesheapPtrNew;
@@ -308,13 +306,13 @@
// get filename
while (*p) {
- for (i = 0; *p; p++, i++)
- filename[i] = *p;
- filename[i] = 0;
+ Common::String filename;
+ while (*p)
+ filename += *p++;
p++;
if (getPlatform() == Common::kPlatformAcorn) {
- sprintf(filename, "%s.DAT", filename);
+ filename += ".DAT";
}
baseMax = (p[0] * 256) | p[1];
@@ -330,7 +328,7 @@
_tablesHeapPtr += size;
_tablesHeapCurPos += size;
- size = loadTextFile(filename, _tablesHeapPtr);
+ size = loadTextFile(filename.c_str(), _tablesHeapPtr);
setupLocalStringTable(_tablesHeapPtr, baseMax - baseMin + 1);
Modified: scummvm/trunk/engines/agos/subroutine.cpp
===================================================================
--- scummvm/trunk/engines/agos/subroutine.cpp 2009-10-02 14:11:45 UTC (rev 44537)
+++ scummvm/trunk/engines/agos/subroutine.cpp 2009-10-02 14:32:54 UTC (rev 44538)
@@ -339,9 +339,7 @@
bool AGOSEngine_Waxworks::loadTablesIntoMem(uint16 subrId) {
byte *p;
- int i;
uint min_num, max_num;
- char filename[30];
File *in;
p = _tblList;
@@ -349,13 +347,13 @@
return 0;
while (*p) {
- for (i = 0; *p; p++, i++)
- filename[i] = *p;
- filename[i] = 0;
+ Common::String filename;
+ while (*p)
+ filename += *p++;
p++;
if (getPlatform() == Common::kPlatformAcorn) {
- sprintf(filename, "%s.DAT", filename);
+ filename += ".DAT";
}
for (;;) {
@@ -372,15 +370,20 @@
_stringIdLocalMin = 1;
_stringIdLocalMax = 0;
- in = openTablesFile(filename);
+ in = openTablesFile(filename.c_str());
readSubroutineBlock(in);
closeTablesFile(in);
if (getGameType() == GType_SIMON2) {
- _sound->loadSfxTable(_gameFile, _gameOffsetsPtr[atoi(filename + 6) - 1 + _soundIndexBase]);
+ _sound->loadSfxTable(_gameFile, _gameOffsetsPtr[atoi(filename.c_str() + 6) - 1 + _soundIndexBase]);
} else if (getGameType() == GType_SIMON1 && getPlatform() == Common::kPlatformWindows) {
- memcpy(filename, "SFXXXX", 6);
- if (atoi(filename + 6) != 1 && atoi(filename + 6) != 30)
- _sound->readSfxFile(filename);
+ filename.setChar(0, 'S');
+ filename.setChar(1, 'F');
+ filename.setChar(2, 'X');
+ filename.setChar(3, 'X');
+ filename.setChar(4, 'X');
+ filename.setChar(5, 'X');
+ if (atoi(filename.c_str() + 6) != 1 && atoi(filename.c_str() + 6) != 30)
+ _sound->readSfxFile(filename.c_str());
}
alignTableMem();
Modified: scummvm/trunk/engines/sci/engine/klists.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/klists.cpp 2009-10-02 14:11:45 UTC (rev 44537)
+++ scummvm/trunk/engines/sci/engine/klists.cpp 2009-10-02 14:32:54 UTC (rev 44538)
@@ -433,8 +433,6 @@
int input_size = (int16)GET_SEL32V(source, size);
int i;
- sort_temp_t *temp_array = (sort_temp_t *)malloc(sizeof(sort_temp_t) * input_size);
-
reg_t input_data = GET_SEL32(source, elements);
reg_t output_data = GET_SEL32(dest, elements);
@@ -455,6 +453,8 @@
list = lookup_list(s, input_data);
node = lookup_node(s, list->first);
+ sort_temp_t *temp_array = (sort_temp_t *)malloc(sizeof(sort_temp_t) * input_size);
+
i = 0;
while (node) {
invoke_selector(INV_SEL(order_func, doit, kStopOnInvalidSelector), 1, node->value);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list