aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorMax Horn2009-05-08 09:52:51 +0000
committerMax Horn2009-05-08 09:52:51 +0000
commit76a48947dec0a79ca674948fb199adfdc911d01c (patch)
tree29ac8d5f8194a0185b753a2ee01ef1a42401151b /engines/sci/engine
parentbb03043b165578a1ddc0f813fe07fb5ce1c27794 (diff)
downloadscummvm-rg350-76a48947dec0a79ca674948fb199adfdc911d01c.tar.gz
scummvm-rg350-76a48947dec0a79ca674948fb199adfdc911d01c.tar.bz2
scummvm-rg350-76a48947dec0a79ca674948fb199adfdc911d01c.zip
SCI: Added workaround for Common::Array<T>::resize() not zero-initing newly allocated memory if T is a scaler type, pointer, POD type. At least on OS X
svn-id: r40372
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/seg_manager.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp
index 9d64310ca0..c7b971549e 100644
--- a/engines/sci/engine/seg_manager.cpp
+++ b/engines/sci/engine/seg_manager.cpp
@@ -84,6 +84,8 @@ SegManager::SegManager(bool sci1_1) {
reserved_id--; // reserved_id runs in the reversed direction to make sure no one will use it.
_heap.resize(DEFAULT_SCRIPTS);
+ for (uint i = 0; i < _heap.size(); ++i)
+ _heap[i] = 0;
Clones_seg_id = 0;
Lists_seg_id = 0;
@@ -346,11 +348,14 @@ MemObject *SegManager::memObjAllocate(SegmentId segid, int hash_id, MemObjectTyp
}
if (segid >= (int)_heap.size()) {
- if (segid >= (int)_heap.size() * 2) {
+ const int oldSize = _heap.size();
+ if (segid >= oldSize * 2) {
sciprintf("SegManager: hash_map error or others??");
return NULL;
}
- _heap.resize(_heap.size() * 2);
+ _heap.resize(oldSize * 2);
+ for (int i = oldSize; i < oldSize * 2; ++i)
+ _heap[i] = 0;
}
mem->_segmgrId = hash_id;