TSAGE: Fixing uninitialised read errors identified by Valgrind

This commit is contained in:
Paul Gilbert 2011-04-09 23:14:47 +10:00
parent 81a5fcb5d1
commit 2ed8a255e5
3 changed files with 34 additions and 6 deletions

View File

@ -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 {

View File

@ -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;

View File

@ -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 {