[Scummvm-cvs-logs] SF.net SVN: scummvm:[40290] scummvm/trunk/engines/sci/engine
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Mon May 4 00:45:14 CEST 2009
Revision: 40290
http://scummvm.svn.sourceforge.net/scummvm/?rev=40290&view=rev
Author: fingolfin
Date: 2009-05-03 22:45:13 +0000 (Sun, 03 May 2009)
Log Message:
-----------
SCI: Made SegManager::heap_size unsigned
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/gc.cpp
scummvm/trunk/engines/sci/engine/savegame.cpp
scummvm/trunk/engines/sci/engine/scriptconsole.cpp
scummvm/trunk/engines/sci/engine/scriptdebug.cpp
scummvm/trunk/engines/sci/engine/seg_manager.cpp
scummvm/trunk/engines/sci/engine/seg_manager.h
Modified: scummvm/trunk/engines/sci/engine/gc.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/gc.cpp 2009-05-03 21:53:39 UTC (rev 40289)
+++ scummvm/trunk/engines/sci/engine/gc.cpp 2009-05-03 22:45:13 UTC (rev 40290)
@@ -78,7 +78,7 @@
Common::Array<SegInterface *> interfaces;
reg_t_hash_map *normal_map = NULL;
WorklistManager wm;
- int i;
+ uint i;
interfaces.resize(sm->heap_size);
for (i = 1; i < sm->heap_size; i++)
@@ -105,7 +105,7 @@
#endif
// Init: Execution Stack
- for (i = 0; i <= s->execution_stack_pos; i++) {
+ for (i = 0; (int)i <= s->execution_stack_pos; i++) {
ExecStack &es = s->_executionStack[i];
if (es.type != EXEC_STACK_TYPE_KERNEL) {
@@ -191,7 +191,7 @@
}
void run_gc(EngineState *s) {
- int seg_nr;
+ uint seg_nr;
deallocator_t deallocator;
SegManager *sm = s->seg_manager;
Modified: scummvm/trunk/engines/sci/engine/savegame.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/savegame.cpp 2009-05-03 21:53:39 UTC (rev 40289)
+++ scummvm/trunk/engines/sci/engine/savegame.cpp 2009-05-03 22:45:13 UTC (rev 40290)
@@ -172,8 +172,8 @@
}
void SegManager::saveLoadWithSerializer(Common::Serializer &s) {
- int allocated_heap_size = heap_size;
- s.syncAsSint32LE(heap_size);
+ uint allocated_heap_size = heap_size;
+ s.syncAsUint32LE(heap_size);
s.syncAsSint32LE(reserved_id);
s.syncAsSint32LE(exports_wide);
s.syncAsSint32LE(gc_mark_bits);
@@ -184,7 +184,7 @@
assert(heap);
if (allocated_heap_size != heap_size)
heap = (MemObject**)sci_realloc((void *)heap, heap_size * sizeof(MemObject *));
- for (int i = 0; i < heap_size; ++i)
+ for (uint i = 0; i < heap_size; ++i)
sync_MemObjPtr(s, heap[i]);
s.syncAsSint32LE(Clones_seg_id);
@@ -538,9 +538,7 @@
// FIXME: This should probably be turned into a SegManager method
static SegmentId find_unique_seg_by_type(SegManager *self, int type) {
- int i;
-
- for (i = 0; i < self->heap_size; i++)
+ for (uint i = 0; i < self->heap_size; i++)
if (self->heap[i] &&
self->heap[i]->getType() == type)
return i;
@@ -614,7 +612,7 @@
// FIXME: The following should likely become a SegManager method
static void reconstruct_scripts(EngineState *s, SegManager *self) {
- int i;
+ uint i;
MemObject *mobj;
for (i = 0; i < self->heap_size; i++) {
if (self->heap[i]) {
@@ -694,7 +692,7 @@
// FIXME: The following should likely become a SegManager method
static void reconstruct_clones(EngineState *s, SegManager *self) {
- int i;
+ uint i;
MemObject *mobj;
for (i = 0; i < self->heap_size; i++) {
Modified: scummvm/trunk/engines/sci/engine/scriptconsole.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/scriptconsole.cpp 2009-05-03 21:53:39 UTC (rev 40289)
+++ scummvm/trunk/engines/sci/engine/scriptconsole.cpp 2009-05-03 22:45:13 UTC (rev 40290)
@@ -281,7 +281,7 @@
const char *str_objname;
char *str_suffix;
char suffchar = 0;
- int i;
+ uint i;
// Parse obj by name
tmp = (char *)strchr(str, '+');
Modified: scummvm/trunk/engines/sci/engine/scriptdebug.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/scriptdebug.cpp 2009-05-03 21:53:39 UTC (rev 40289)
+++ scummvm/trunk/engines/sci/engine/scriptdebug.cpp 2009-05-03 22:45:13 UTC (rev 40290)
@@ -283,7 +283,7 @@
const char *(*_debug_get_input)(void) = _debug_get_input_default;
int c_segtable(EngineState *s) {
- int i;
+ uint i;
sciprintf(" ---- segment table ----\n");
for (i = 0; i < s->seg_manager->heap_size; i++) {
@@ -668,12 +668,12 @@
}
int c_seginfo(EngineState *s) {
- unsigned int i = 0;
+ uint i = 0;
if (cmd_paramlength) {
while (i < cmd_paramlength) {
int nr = cmd_params[i++].val;
- if (nr < 0 || nr >= s->seg_manager->heap_size || !s->seg_manager->heap[nr]) {
+ if (nr < 0 || (uint)nr >= s->seg_manager->heap_size || !s->seg_manager->heap[nr]) {
sciprintf("Segment %04x does not exist\n", nr);
return 1;
}
@@ -681,7 +681,7 @@
_c_single_seg_info(s, s->seg_manager->heap[nr]);
}
} else
- for (i = 0; i < (unsigned int)s->seg_manager->heap_size; i++) {
+ for (i = 0; i < s->seg_manager->heap_size; i++) {
if (s->seg_manager->heap[i]) {
sciprintf("[%04x] ", i);
_c_single_seg_info(s, s->seg_manager->heap[i]);
Modified: scummvm/trunk/engines/sci/engine/seg_manager.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/seg_manager.cpp 2009-05-03 21:53:39 UTC (rev 40289)
+++ scummvm/trunk/engines/sci/engine/seg_manager.cpp 2009-05-03 22:45:13 UTC (rev 40290)
@@ -75,8 +75,6 @@
}
SegManager::SegManager(bool sci1_1) {
- int i;
-
// Initialise memory count
mem_allocated = 0;
@@ -97,7 +95,7 @@
isSci1_1 = sci1_1;
// initialize the heap pointers
- for (i = 0; i < heap_size; i++) {
+ for (uint i = 0; i < heap_size; i++) {
heap[i] = NULL;
}
@@ -107,10 +105,8 @@
// Destroy the object, free the memorys if allocated before
SegManager::~SegManager() {
- int i;
-
// Free memory
- for (i = 0; i < heap_size; i++) {
+ for (uint i = 0; i < heap_size; i++) {
if (heap[i])
deallocate(i, false);
}
@@ -347,11 +343,11 @@
return NULL;
}
- if (segid >= heap_size) {
+ if (segid >= (int)heap_size) {
void *temp;
int oldhs = heap_size;
- if (segid >= heap_size * 2) {
+ if (segid >= (int)heap_size * 2) {
sciprintf("SegManager: hash_map error or others??");
return NULL;
}
@@ -443,7 +439,7 @@
Script *SegManager::getScript(const int id, idFlag flag) {
const int seg = (flag == SCRIPT_ID) ? segGet(id) : id;
- if (seg < 0 || seg >= heap_size) {
+ if (seg < 0 || (uint)seg >= heap_size) {
error("SegManager::getScript(%d,%d): seg id %x out of bounds", id, flag, seg);
}
if (!heap[seg]) {
@@ -460,7 +456,7 @@
// false - invalid seg
// true - valid seg
bool SegManager::check(int seg) {
- if (seg < 0 || seg >= heap_size) {
+ if (seg < 0 || (uint)seg >= heap_size) {
return false;
}
if (!heap[seg]) {
Modified: scummvm/trunk/engines/sci/engine/seg_manager.h
===================================================================
--- scummvm/trunk/engines/sci/engine/seg_manager.h 2009-05-03 21:53:39 UTC (rev 40289)
+++ scummvm/trunk/engines/sci/engine/seg_manager.h 2009-05-03 22:45:13 UTC (rev 40290)
@@ -38,13 +38,13 @@
SEG_ID
};
-#define GET_SEGMENT(mgr, index, rtype) (((index) > 0 && (mgr).heap_size > index) ? \
+#define GET_SEGMENT(mgr, index, rtype) (((index) > 0 && (int)(mgr).heap_size > index) ? \
(((mgr).heap[index] && (mgr).heap[index]->getType() == rtype)? (mgr).heap[index] : NULL) : NULL)
-#define GET_SEGMENT_ANY(mgr, index) (((index) > 0 && (mgr).heap_size > index) ? \
+#define GET_SEGMENT_ANY(mgr, index) (((index) > 0 && (int)(mgr).heap_size > index) ? \
(((mgr).heap[index])? (mgr).heap[index] : NULL) : NULL)
-#define GET_OBJECT_SEGMENT(mgr, index) (((index) > 0 && (mgr).heap_size > index) ? \
+#define GET_OBJECT_SEGMENT(mgr, index) (((index) > 0 && (int)(mgr).heap_size > index) ? \
(((mgr).heap[index] && ((mgr).heap[index]->getType() == MEM_OBJ_SCRIPT || (mgr).heap[index]->getType() == MEM_OBJ_CLONES))? (mgr).heap[index] \
: NULL): NULL)
@@ -389,7 +389,7 @@
IntMapper *id_seg_map; // id - script id; seg - index of heap
public: // TODO: make private
MemObject **heap;
- int heap_size; // size of the heap
+ uint heap_size; // size of the heap
int reserved_id;
int exports_wide;
bool isSci1_1;
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