[Scummvm-cvs-logs] SF.net SVN: scummvm:[54991] scummvm/trunk/engines/sci/engine
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Tue Dec 21 22:18:25 CET 2010
Revision: 54991
http://scummvm.svn.sourceforge.net/scummvm/?rev=54991&view=rev
Author: thebluegr
Date: 2010-12-21 21:18:25 +0000 (Tue, 21 Dec 2010)
Log Message:
-----------
- SCI: Added code to free the _baseVars value in SCI3 as well. Both free() operations
have been commented out for now, as MSVC complains about heap corruption in SCI3 games
- Code formatting fixes
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/object.cpp
scummvm/trunk/engines/sci/engine/object.h
Modified: scummvm/trunk/engines/sci/engine/object.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/object.cpp 2010-12-21 20:54:33 UTC (rev 54990)
+++ scummvm/trunk/engines/sci/engine/object.cpp 2010-12-21 21:18:25 UTC (rev 54991)
@@ -61,13 +61,13 @@
if (getSciVersion() <= SCI_VERSION_1_LATE) {
_variables.resize(READ_LE_UINT16(data + kOffsetSelectorCounter));
- _baseVars = (const uint16 *)(_baseObj + _variables.size() * 2);
+ _baseVars = (uint16 *)(_baseObj + _variables.size() * 2);
_methodCount = READ_LE_UINT16(data + READ_LE_UINT16(data + kOffsetFunctionArea) - 2);
_baseMethod = Common::Array<uint16>((const uint16 *)(data + READ_LE_UINT16(data + kOffsetFunctionArea)),
_methodCount*2+2);
} else if (getSciVersion() >= SCI_VERSION_1_1 && getSciVersion() <= SCI_VERSION_2_1) {
_variables.resize(READ_SCI11ENDIAN_UINT16(data + 2));
- _baseVars = (const uint16 *)(buf + READ_SCI11ENDIAN_UINT16(data + 4));
+ _baseVars = (uint16 *)(buf + READ_SCI11ENDIAN_UINT16(data + 4));
_methodCount = READ_SCI11ENDIAN_UINT16(buf + READ_SCI11ENDIAN_UINT16(data + 6));
_baseMethod = Common::Array<uint16>((const uint16 *) (buf + READ_SCI11ENDIAN_UINT16(data + 6)),
_methodCount*2+3);
@@ -222,9 +222,9 @@
}
_variables.resize(properties);
- uint16 *propertyIds = (uint16*) malloc(sizeof(uint16)*properties);
-// uint16 *methodOffsets = (uint16*) malloc(sizeof(uint16)*2*methods);
- uint16 *propertyOffsets = (uint16*) malloc(sizeof(uint16)*properties);
+ uint16 *propertyIds = (uint16 *) malloc(sizeof(uint16) * properties);
+// uint16 *methodOffsets = (uint16 *) malloc(sizeof(uint16) * 2 * methods);
+ uint16 *propertyOffsets = (uint16 *) malloc(sizeof(uint16) * properties);
int propertyCounter = 0;
int methodCounter = 0;
Modified: scummvm/trunk/engines/sci/engine/object.h
===================================================================
--- scummvm/trunk/engines/sci/engine/object.h 2010-12-21 20:54:33 UTC (rev 54990)
+++ scummvm/trunk/engines/sci/engine/object.h 2010-12-21 21:18:25 UTC (rev 54991)
@@ -69,7 +69,16 @@
_propertyOffsetsSci3 = 0;
}
- ~Object() { free(_propertyOffsetsSci3); }
+ ~Object() {
+ if (getSciVersion() == SCI_VERSION_3) {
+ // FIXME: memory leak! Commented out because of reported heap
+ // corruption by MSVC (e.g. in LSL7, when it starts)
+ //free(_baseVars);
+ //_baseVars = 0;
+ //free(_propertyOffsetsSci3);
+ //_propertyOffsetsSci3 = 0;
+ }
+ }
reg_t getSpeciesSelector() const {
if (getSciVersion() <= SCI_VERSION_2_1)
@@ -229,7 +238,7 @@
void initSelectorsSci3(const byte *buf);
const byte *_baseObj; /**< base + object offset within base */
- const uint16 *_baseVars; /**< Pointer to the varselector area for this object */
+ uint16 *_baseVars; /**< Pointer to the varselector area for this object */
Common::Array<uint16> _baseMethod; /**< Pointer to the method selector area for this object */
uint16 *_propertyOffsetsSci3; /**< This is used to enable relocation of property valuesa in SCI3 */
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