aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2011-04-09 23:14:47 +1000
committerPaul Gilbert2011-04-09 23:14:47 +1000
commit2ed8a255e53b54bfbf2e58ac02f0cfb6b3703b2c (patch)
tree53e46ad34e9cd487b74d167271aa6cd60a1edb39
parent81a5fcb5d16fc5107b4065df33317a0872598939 (diff)
downloadscummvm-rg350-2ed8a255e53b54bfbf2e58ac02f0cfb6b3703b2c.tar.gz
scummvm-rg350-2ed8a255e53b54bfbf2e58ac02f0cfb6b3703b2c.tar.bz2
scummvm-rg350-2ed8a255e53b54bfbf2e58ac02f0cfb6b3703b2c.zip
TSAGE: Fixing uninitialised read errors identified by Valgrind
-rw-r--r--engines/tsage/resources.h36
-rw-r--r--engines/tsage/ringworld_scenes1.cpp2
-rw-r--r--engines/tsage/tsage.cpp2
3 files changed, 34 insertions, 6 deletions
diff --git a/engines/tsage/resources.h b/engines/tsage/resources.h
index 418563261f..5d00e5f70c 100644
--- a/engines/tsage/resources.h
+++ b/engines/tsage/resources.h
@@ -45,27 +45,53 @@ enum ResourceType { RES_LIBRARY, RES_STRIP, RES_IMAGE, RES_PALETTE, RES_VISAGE,
RES_FONT, RES_POINTER, RES_BANK, RES_SND_DRIVER, RES_PRIORITY, RES_CONTROL, RES_WALKRGNS,
RES_BITMAP, RES_SAVE, RES_SEQUENCE };
-struct MemoryHeader {
+class MemoryHeader {
+public:
uint32 id;
int16 index;
int lockCtr;
int criticalCtr;
uint8 tag;
uint32 size;
+
+ MemoryHeader() {
+ id = 0;
+ index = 0;
+ lockCtr = 0;
+ criticalCtr = 0;
+ tag = 0;
+ size = 0;
+ }
};
-struct SectionEntry {
+class SectionEntry {
+public:
ResourceType resType;
uint16 resNum;
uint32 fileOffset;
+
+ SectionEntry() {
+ resType = RES_LIBRARY;
+ resNum = 0;
+ fileOffset = 0;
+ }
};
-struct ResourceEntry {
+class ResourceEntry {
+public:
uint16 id;
bool isCompressed;
uint32 fileOffset;
uint32 size;
uint32 uncompressedSize;
+
+ ResourceEntry() {
+ id = 0;
+ isCompressed = false;
+ fileOffset = 0;
+ size = 0;
+ uncompressedSize = 0;
+ }
};
typedef Common::List<ResourceEntry> ResourceList;
@@ -73,6 +99,10 @@ typedef Common::List<ResourceEntry> ResourceList;
class SectionList: public Common::List<SectionEntry> {
public:
uint32 fileOffset;
+
+ SectionList() {
+ fileOffset = 0;
+ }
};
class MemoryManager {
diff --git a/engines/tsage/ringworld_scenes1.cpp b/engines/tsage/ringworld_scenes1.cpp
index 8eb2d38f53..fc633bf40f 100644
--- a/engines/tsage/ringworld_scenes1.cpp
+++ b/engines/tsage/ringworld_scenes1.cpp
@@ -3197,7 +3197,7 @@ void Scene6100::dispatch() {
if (_action != &_action3) {
// Display the distance remaining to the target
int distance = _probe._floats.sqrt(_rocks._floats);
- Common::String s = Common::String::format("%06lu", distance);
+ Common::String s = Common::String::format("%06d", distance);
_sceneText.setPosition(Common::Point(24, 160));
_sceneText._fontNumber = 0;
diff --git a/engines/tsage/tsage.cpp b/engines/tsage/tsage.cpp
index aff4f051a2..5be5875652 100644
--- a/engines/tsage/tsage.cpp
+++ b/engines/tsage/tsage.cpp
@@ -59,8 +59,6 @@ TSageEngine::~TSageEngine() {
// Remove all of our debug levels here
DebugMan.clearAllDebugChannels();
delete _debugger;
- delete _dataManager;
- delete _tSageManager;
}
bool TSageEngine::hasFeature(EngineFeature f) const {