[Scummvm-cvs-logs] SF.net SVN: scummvm:[44539] scummvm/trunk

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Fri Oct 2 16:42:24 CEST 2009


Revision: 44539
          http://scummvm.svn.sourceforge.net/scummvm/?rev=44539&view=rev
Author:   fingolfin
Date:     2009-10-02 14:42:24 +0000 (Fri, 02 Oct 2009)

Log Message:
-----------
Fix more cppcheck warnings/errors; some code formatting; and fixes to our tools

Modified Paths:
--------------
    scummvm/trunk/backends/platform/dc/selector.cpp
    scummvm/trunk/tools/create_kyradat/create_kyradat.cpp
    scummvm/trunk/tools/create_kyradat/games.cpp
    scummvm/trunk/tools/create_kyradat/search.h
    scummvm/trunk/tools/create_kyradat/util.h
    scummvm/trunk/tools/create_lure/create_lure_dat.cpp
    scummvm/trunk/tools/create_lure/process_actions.cpp
    scummvm/trunk/tools/md5table.c

Modified: scummvm/trunk/backends/platform/dc/selector.cpp
===================================================================
--- scummvm/trunk/backends/platform/dc/selector.cpp	2009-10-02 14:32:54 UTC (rev 44538)
+++ scummvm/trunk/backends/platform/dc/selector.cpp	2009-10-02 14:42:24 UTC (rev 44539)
@@ -451,7 +451,7 @@
   if (selected >= 0)
     the_game = games[selected];
 
-  delete games;
+  delete[] games;
 
   if (selected>=0) {
 #if 0

Modified: scummvm/trunk/tools/create_kyradat/create_kyradat.cpp
===================================================================
--- scummvm/trunk/tools/create_kyradat/create_kyradat.cpp	2009-10-02 14:32:54 UTC (rev 44538)
+++ scummvm/trunk/tools/create_kyradat/create_kyradat.cpp	2009-10-02 14:42:24 UTC (rev 44539)
@@ -1063,8 +1063,6 @@
 
 bool setupSearch(const int *needList, Search &search, DataIdList &dataIdList) {
 	for (const int *entry = needList; *entry != -1; ++entry) {
-		bool found = false;
-
 		ExtractEntryList providers = getProvidersForId(*entry);
 
 		if (providers.empty()) {

Modified: scummvm/trunk/tools/create_kyradat/games.cpp
===================================================================
--- scummvm/trunk/tools/create_kyradat/games.cpp	2009-10-02 14:32:54 UTC (rev 44538)
+++ scummvm/trunk/tools/create_kyradat/games.cpp	2009-10-02 14:42:24 UTC (rev 44539)
@@ -880,7 +880,7 @@
 	{ kLol, kPlatformPC, kTalkieFile1, lolCDFile1Need },
 	{ kLol, kPlatformPC, kTalkieFile2, lolCDFile2Need },
 
-	{ -1, -1, 0 }
+	{ -1, -1, -1, 0 }
 };
 
 } // end of anonymous namespace

Modified: scummvm/trunk/tools/create_kyradat/search.h
===================================================================
--- scummvm/trunk/tools/create_kyradat/search.h	2009-10-02 14:32:54 UTC (rev 44538)
+++ scummvm/trunk/tools/create_kyradat/search.h	2009-10-02 14:42:24 UTC (rev 44539)
@@ -65,8 +65,6 @@
 
 	typedef std::map<uint32, uint32> SumMap;
 	SumMap _sums;
-	typedef std::map<uint32, uint> SumCount;
-	SumCount _sumCount;
 };
 
 class Search {

Modified: scummvm/trunk/tools/create_kyradat/util.h
===================================================================
--- scummvm/trunk/tools/create_kyradat/util.h	2009-10-02 14:32:54 UTC (rev 44538)
+++ scummvm/trunk/tools/create_kyradat/util.h	2009-10-02 14:42:24 UTC (rev 44539)
@@ -53,9 +53,10 @@
 typedef signed int int32;
 
 #if !defined(__cplusplus)
-typedef uint8 bool;
-#define false 0
-#define true 1
+enum bool {
+	false = 0,
+	true = 1
+};
 
 /* If your C compiler doesn't support 'inline', please add a check for it. */
 #if defined(_MSC_VER)

Modified: scummvm/trunk/tools/create_lure/create_lure_dat.cpp
===================================================================
--- scummvm/trunk/tools/create_lure/create_lure_dat.cpp	2009-10-02 14:32:54 UTC (rev 44538)
+++ scummvm/trunk/tools/create_lure/create_lure_dat.cpp	2009-10-02 14:42:24 UTC (rev 44539)
@@ -778,7 +778,7 @@
 	uint16 startOffset;
 	int ctr, dirCtr;
 	int movementSize = 0;
-	bool *includeAnim = (bool *) malloc(animIndex);
+	bool *includeAnim = (bool *)malloc(animIndex);
 
 	// Loop to figure out the total number of movement records there are
 	for (ctr = 0; ctr < animIndex; ++ctr) {
@@ -886,7 +886,7 @@
 	}
 
 	rec->animRecordId = TO_LE_16(0xffff);
-	delete includeAnim;
+	free(includeAnim);
 }
 
 void read_script_data(byte *&data, uint16 &totalSize) {

Modified: scummvm/trunk/tools/create_lure/process_actions.cpp
===================================================================
--- scummvm/trunk/tools/create_lure/process_actions.cpp	2009-10-02 14:32:54 UTC (rev 44538)
+++ scummvm/trunk/tools/create_lure/process_actions.cpp	2009-10-02 14:42:24 UTC (rev 44539)
@@ -344,8 +344,7 @@
 	RoomRandomActionEntry *entries;
 };
 
-void read_action_sequence(byte *&data, uint16 &totalSize)
-{
+void read_action_sequence(byte *&data, uint16 &totalSize) {
 	uint16 hotspotIndex;
 	HotspotHeaderEntry entryHeader;
 	CurrentActionInput action;
@@ -381,8 +380,7 @@
 	}
 
 	// Next get the set of offsetes for the start of each sequence
-	for (roomIndex = 0; roomIndex < RANDOM_ROOM_NUM_ENTRIES; ++roomIndex)
-	{
+	for (roomIndex = 0; roomIndex < RANDOM_ROOM_NUM_ENTRIES; ++roomIndex) {
 		if (randomActions[roomIndex].offset == 0)
 			continue;
 
@@ -393,8 +391,7 @@
 
 		// Loop through the entries
 		uint16 offset = randomActions[roomIndex].offset + 1;
-		for (uint8 entryCtr = 0; entryCtr < randomActions[roomIndex].numEntries; ++entryCtr)
-		{
+		for (uint8 entryCtr = 0; entryCtr < randomActions[roomIndex].numEntries; ++entryCtr) {
 			randomActions[roomIndex].entries[entryCtr].repeatable = lureExe.readWord() == 1;
 			offset += 2;
 
@@ -485,12 +482,9 @@
 
 	// Finally process each of the random room actions
 
-	for (roomIndex = 0; roomIndex < RANDOM_ROOM_NUM_ENTRIES; ++roomIndex)
-	{
-		for (index = 0; index < randomActions[roomIndex].numEntries; ++index)
-		{
-			if (randomActions[roomIndex].entries[index].offset != 0xfffe)
-			{
+	for (roomIndex = 0; roomIndex < RANDOM_ROOM_NUM_ENTRIES; ++roomIndex) {
+		for (index = 0; index < randomActions[roomIndex].numEntries; ++index) {
+			if (randomActions[roomIndex].entries[index].offset != 0xfffe) {
 //printf("room=%d entry=%xh\n", roomIndex+1, randomActions[roomIndex].entries[index].offset);
 				process_entry(randomActions[roomIndex].entries[index].offset, data, totalSize);
 			}
@@ -509,8 +503,7 @@
 
 	// Output the data for the random room actions
 
-	for (roomIndex = 0; roomIndex < RANDOM_ROOM_NUM_ENTRIES; ++roomIndex)
-	{
+	for (roomIndex = 0; roomIndex < RANDOM_ROOM_NUM_ENTRIES; ++roomIndex) {
 		if (randomActions[roomIndex].numEntries == 0)
 			continue;
 
@@ -540,10 +533,9 @@
 	*pHeader++ = TO_LE_16(0xffff);
 
 	// Free up the random room action array
-	for (roomIndex = 0; roomIndex < 1; ++roomIndex)
-	{
+	for (roomIndex = 0; roomIndex < 1; ++roomIndex) {
 		if (randomActions[roomIndex].entries != NULL)
-			delete randomActions[roomIndex].entries;
+			delete[] randomActions[roomIndex].entries;
 	}
-	delete randomActions;
+	delete[] randomActions;
 }

Modified: scummvm/trunk/tools/md5table.c
===================================================================
--- scummvm/trunk/tools/md5table.c	2009-10-02 14:32:54 UTC (rev 44538)
+++ scummvm/trunk/tools/md5table.c	2009-10-02 14:42:24 UTC (rev 44539)
@@ -214,7 +214,7 @@
 	int err;
 	int i;
 	time_t theTime;
-	const char *generationDate;
+	char *generationDate;
 
 	const int entrySize = 256;
 	int numEntries = 0, maxEntries = 1;
@@ -368,6 +368,7 @@
 	}
 
 	free(entriesBuffer);
+	free(generationDate);
 
 	return 0;
 }


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