[Scummvm-cvs-logs] SF.net SVN: scummvm:[49962] scummvm/trunk/engines/sci/engine/seg_manager. cpp

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Fri Jun 18 01:11:56 CEST 2010


Revision: 49962
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49962&view=rev
Author:   fingolfin
Date:     2010-06-17 23:11:56 +0000 (Thu, 17 Jun 2010)

Log Message:
-----------
SCI: Update FIXME in SegmentManager

* Turn one FIXME into a simple comment
* Rewrap comment to 80 columns
* Turn several warnings into errors

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/seg_manager.cpp

Modified: scummvm/trunk/engines/sci/engine/seg_manager.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/seg_manager.cpp	2010-06-17 23:11:34 UTC (rev 49961)
+++ scummvm/trunk/engines/sci/engine/seg_manager.cpp	2010-06-17 23:11:56 UTC (rev 49962)
@@ -100,16 +100,10 @@
 }
 
 SegmentId SegManager::findFreeSegment() const {
-	// FIXME: This is a very crude approach: We find a free segment id by scanning
-	// from the start. This can be slow if the number of segments becomes large.
-	// Optimizations are possible and easy, but I refrain from doing any until this
-	// refactoring is complete.
-	// One very simple yet probably effective approach would be to add
-	// "int firstFreeSegment", which is updated when allocating/freeing segments.
-	// There are some scenarios where it performs badly, but we should first check
-	// whether those occur at all. If so, there are easy refinements that deal
-	// with this. Finally, we could switch to a more elaborate scheme,
-	// such as keeping track of all free segments. But I doubt this is necessary.
+	// The following is a very crude approach: We find a free segment id by
+	// scanning from the start. This can be slow if the number of segments
+	// becomes large. Optimizations are possible and easy, but I'll refrain
+	// from attempting any until we determine we actually need it.
 	uint seg = 1;
 	while (seg < _heap.size() && _heap[seg]) {
 		++seg;
@@ -516,14 +510,14 @@
 
 List *SegManager::lookupList(reg_t addr) {
 	if (getSegmentType(addr.segment) != SEG_TYPE_LISTS) {
-		warning("Attempt to use non-list %04x:%04x as list", PRINT_REG(addr));
+		error("Attempt to use non-list %04x:%04x as list", PRINT_REG(addr));
 		return NULL;
 	}
 
 	ListTable *lt = (ListTable *)_heap[addr.segment];
 
 	if (!lt->isValidEntry(addr.offset)) {
-		warning("Attempt to use non-list %04x:%04x as list", PRINT_REG(addr));
+		error("Attempt to use non-list %04x:%04x as list", PRINT_REG(addr));
 		return NULL;
 	}
 
@@ -535,14 +529,14 @@
 		return NULL; // Non-error null
 
 	if (getSegmentType(addr.segment) != SEG_TYPE_NODES) {
-		warning("Attempt to use non-node %04x:%04x as list node", PRINT_REG(addr));
+		error("Attempt to use non-node %04x:%04x as list node", PRINT_REG(addr));
 		return NULL;
 	}
 
 	NodeTable *nt = (NodeTable *)_heap[addr.segment];
 
 	if (!nt->isValidEntry(addr.offset)) {
-		warning("Attempt to use non-node %04x:%04x as list node", PRINT_REG(addr));
+		error("Attempt to use non-node %04x:%04x as list node", PRINT_REG(addr));
 		return NULL;
 	}
 


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