[Scummvm-cvs-logs] SF.net SVN: scummvm:[40079] scummvm/trunk/engines/sci/scicore/vocab_debug. cpp

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Wed Apr 22 19:53:46 CEST 2009


Revision: 40079
          http://scummvm.svn.sourceforge.net/scummvm/?rev=40079&view=rev
Author:   fingolfin
Date:     2009-04-22 17:53:46 +0000 (Wed, 22 Apr 2009)

Log Message:
-----------
SCI: getInt -> READ_LE_UINT16

Modified Paths:
--------------
    scummvm/trunk/engines/sci/scicore/vocab_debug.cpp

Modified: scummvm/trunk/engines/sci/scicore/vocab_debug.cpp
===================================================================
--- scummvm/trunk/engines/sci/scicore/vocab_debug.cpp	2009-04-22 17:53:29 UTC (rev 40078)
+++ scummvm/trunk/engines/sci/scicore/vocab_debug.cpp	2009-04-22 17:53:46 UTC (rev 40079)
@@ -280,10 +280,6 @@
 	/*0x7d*/ "IsItSkip"
 };
 
-int getInt(unsigned char* d) {
-	return d[0] | (d[1] << 8);
-}
-
 int *vocabulary_get_classes(ResourceManager *resmgr, int* count) {
 	Resource* r;
 	int *c;
@@ -294,7 +290,7 @@
 
 	c = (int *)sci_malloc(sizeof(int) * r->size / 2);
 	for (i = 2; i < r->size; i += 4) {
-		c[i/4] = getInt(r->data + i);
+		c[i/4] = READ_LE_UINT16(r->data + i);
 	}
 	*count = r->size / 4;
 
@@ -318,11 +314,11 @@
 	if (!r) // No such resource?
 		return false;
 
-	count = getInt(r->data) + 1; // Counter is slightly off
+	count = READ_LE_UINT16(r->data) + 1; // Counter is slightly off
 
 	for (int i = 0; i < count; i++) {
-		int offset = getInt(r->data + 2 + i * 2);
-		int len = getInt(r->data + offset);
+		int offset = READ_LE_UINT16(r->data + 2 + i * 2);
+		int len = READ_LE_UINT16(r->data + offset);
 		
 		Common::String tmp((const char *)r->data + offset + 2, len);
 		selectorNames.push_back(tmp);
@@ -356,13 +352,13 @@
 		return NULL;
 	}
 
-	count = getInt(r->data);
+	count = READ_LE_UINT16(r->data);
 
 	o = (opcode*)sci_malloc(sizeof(opcode) * 256);
 	for (i = 0; i < count; i++) {
-		int offset = getInt(r->data + 2 + i * 2);
-		int len = getInt(r->data + offset) - 2;
-		o[i].type = getInt(r->data + offset + 2);
+		int offset = READ_LE_UINT16(r->data + 2 + i * 2);
+		int len = READ_LE_UINT16(r->data + offset) - 2;
+		o[i].type = READ_LE_UINT16(r->data + offset + 2);
 		o[i].number = i;
 		o[i].name = (char *)sci_malloc(len + 1);
 		memcpy(o[i].name, r->data + offset + 4, len);
@@ -417,7 +413,7 @@
 		return;
 	}
 
-	count = getInt(r->data);
+	count = READ_LE_UINT16(r->data);
 
 	if (count > 1023) {
 		_vocabulary_get_knames0alt(r, names);
@@ -432,8 +428,8 @@
 	names.resize(count + 1 + empty_to_add);
 
 	for (i = 0; i < count; i++) {
-		int offset = getInt(r->data + index);
-		int len = getInt(r->data + offset);
+		int offset = READ_LE_UINT16(r->data + index);
+		int len = READ_LE_UINT16(r->data + offset);
 		//fprintf(stderr,"Getting name %d of %d...\n", i, count);
 		index += 2;
 		names[i] = Common::String((const char *)r->data + offset + 2, len);


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