[Scummvm-cvs-logs] scummvm master -> e317958d4cdfb5d4cfe934c577be8f06e8689565

bluegr bluegr at gmail.com
Tue Mar 1 00:25:28 CET 2016


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
cdbd7c8add SCI: Use uint32 instead of unsigned int
e317958d4c SCI: Remove superfluous cast to boolean and fix code styling


Commit: cdbd7c8add6ebaad15cc6498b09d806c4f2a3fe1
    https://github.com/scummvm/scummvm/commit/cdbd7c8add6ebaad15cc6498b09d806c4f2a3fe1
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2016-03-01T01:12:58+02:00

Commit Message:
SCI: Use uint32 instead of unsigned int

Changed paths:
    engines/sci/console.cpp
    engines/sci/decompressor.cpp
    engines/sci/engine/kpathing.cpp
    engines/sci/engine/scriptdebug.cpp
    engines/sci/engine/segment.h
    engines/sci/event.cpp
    engines/sci/event.h
    engines/sci/parser/vocabulary.cpp
    engines/sci/parser/vocabulary.h
    engines/sci/resource.cpp
    engines/sci/resource_audio.cpp
    engines/sci/sound/drivers/amigamac.cpp



diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index 450ca13..6cd072e 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -1002,7 +1002,7 @@ bool Console::cmdHexgrep(int argc, const char **argv) {
 	for (; resNumber <= resMax; resNumber++) {
 		script = _engine->getResMan()->findResource(ResourceId(restype, resNumber), 0);
 		if (script) {
-			unsigned int seeker = 0, seekerold = 0;
+			uint32 seeker = 0, seekerold = 0;
 			uint32 comppos = 0;
 			int output_script_name = 0;
 
@@ -1508,7 +1508,7 @@ bool Console::cmdSaid(int argc, const char **argv) {
 	}
 
 	// TODO: Maybe turn this into a proper said spec compiler
-	unsigned int len = 0;
+	uint32 len = 0;
 	for (p++; p < argc; p++) {
 		if (strcmp(argv[p], ",") == 0) {
 			spec[len++] = 0xf0;
@@ -1545,7 +1545,7 @@ bool Console::cmdSaid(int argc, const char **argv) {
 			spec[len++] = 0xfe;
 			spec[len++] = 0xf6;
 		} else {
-			unsigned int s = strtol(argv[p], 0, 16);
+			uint32 s = strtol(argv[p], 0, 16);
 			if (s >= 0xf0 && s <= 0xff) {
 				spec[len++] = s;
 			} else {
@@ -3943,19 +3943,18 @@ bool Console::cmdMapVocab994(int argc, const char **argv) {
 	Resource *resource = _engine->_resMan->findResource(ResourceId(kResourceTypeVocab, 994), 0);
 	const Object *obj = s->_segMan->getObject(reg);
 	uint16 *data = (uint16 *) resource->data;
-	unsigned int first = atoi(argv[2]);
-	unsigned int last  = atoi(argv[3]);
+	uint32 first = atoi(argv[2]);
+	uint32 last  = atoi(argv[3]);
 	Common::Array<bool> markers;
 
 	markers.resize(_engine->getKernel()->getSelectorNamesSize());
 	if (!obj->isClass() && getSciVersion() != SCI_VERSION_3)
 		obj = s->_segMan->getObject(obj->getSuperClassSelector());
 
-	first = MIN(first, (unsigned int) (resource->size / 2 - 2));
-	last =  MIN(last, (unsigned int) (resource->size / 2 - 2));
+	first = MIN(first, (uint32) (resource->size / 2 - 2));
+	last =  MIN(last, (uint32) (resource->size / 2 - 2));
 
-	for (unsigned int i = first; i <= last; ++i)
-	{
+	for (uint32 i = first; i <= last; ++i) {
 		uint16 ofs = data[i];
 
 		if (obj && ofs < obj->getVarCount()) {
diff --git a/engines/sci/decompressor.cpp b/engines/sci/decompressor.cpp
index e65ff14..ca2298e 100644
--- a/engines/sci/decompressor.cpp
+++ b/engines/sci/decompressor.cpp
@@ -257,7 +257,7 @@ int DecompressorLZW::unpackLZW1(Common::ReadStream *src, byte *dest, uint32 nPac
 	init(src, dest, nPacked, nUnpacked);
 
 	byte *stak = (byte *)malloc(0x1014);
-	unsigned int tokensSize = 0x1004 * sizeof(Tokenlist);
+	uint32 tokensSize = 0x1004 * sizeof(Tokenlist);
 	Tokenlist *tokens = (Tokenlist *)malloc(tokensSize);
 	if (!stak || !tokens) {
 		free(stak);
diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp
index 5b2245e..7ac744f 100644
--- a/engines/sci/engine/kpathing.cpp
+++ b/engines/sci/engine/kpathing.cpp
@@ -1943,14 +1943,14 @@ static int liesBefore(const Vertex *v, const Common::Point &p1, const Common::Po
 // indexp1/vertexp1 on the polygon being merged.
 // It ends with the point intersection2, being the analogous intersection.
 struct Patch {
-	unsigned int indexw1;
-	unsigned int indexp1;
+	uint32 indexw1;
+	uint32 indexp1;
 	const Vertex *vertexw1;
 	const Vertex *vertexp1;
 	Common::Point intersection1;
 
-	unsigned int indexw2;
-	unsigned int indexp2;
+	uint32 indexw2;
+	uint32 indexp2;
 	const Vertex *vertexw2;
 	const Vertex *vertexp2;
 	Common::Point intersection2;
@@ -1960,7 +1960,7 @@ struct Patch {
 
 
 // Check if the given vertex on the work polygon is bypassed by this patch.
-static bool isVertexCovered(const Patch &p, unsigned int wi) {
+static bool isVertexCovered(const Patch &p, uint32 wi) {
 
 	//         /             v       (outside)
 	//  ---w1--1----p----w2--2----
@@ -2402,7 +2402,7 @@ reg_t kMergePoly(EngineState *s, int argc, reg_t *argv) {
 
 	// Copy work.vertices into arrayRef
 	Vertex *vertex;
-	unsigned int n = 0;
+	uint32 n = 0;
 	CLIST_FOREACH(vertex, &work.vertices) {
 		if (vertex == work.vertices._head || vertex->v != vertex->_prev->v)
 			writePoint(arrayRef, n++, vertex->v);
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp
index f0157a6..7d70f30 100644
--- a/engines/sci/engine/scriptdebug.cpp
+++ b/engines/sci/engine/scriptdebug.cpp
@@ -499,7 +499,7 @@ void Kernel::dumpScriptClass(char *data, int seeker, int objsize) {
 
 void Kernel::dissectScript(int scriptNumber, Vocabulary *vocab) {
 	int objectctr[11] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
-	unsigned int _seeker = 0;
+	uint32 _seeker = 0;
 	Resource *script = _resMan->findResource(ResourceId(kResourceTypeScript, scriptNumber), 0);
 
 	if (!script) {
@@ -510,7 +510,7 @@ void Kernel::dissectScript(int scriptNumber, Vocabulary *vocab) {
 	while (_seeker < script->size) {
 		int objType = (int16)READ_SCI11ENDIAN_UINT16(script->data + _seeker);
 		int objsize;
-		unsigned int seeker = _seeker + 4;
+		uint32 seeker = _seeker + 4;
 
 		if (!objType) {
 			debugN("End of script object (#0) encountered.\n");
diff --git a/engines/sci/engine/segment.h b/engines/sci/engine/segment.h
index de7f60a..2699bc2 100644
--- a/engines/sci/engine/segment.h
+++ b/engines/sci/engine/segment.h
@@ -203,7 +203,7 @@ struct List {
 
 struct Hunk {
 	void *mem;
-	unsigned int size;
+	uint32 size;
 	const char *type;
 };
 
diff --git a/engines/sci/event.cpp b/engines/sci/event.cpp
index 9a87c6d..3322a27 100644
--- a/engines/sci/event.cpp
+++ b/engines/sci/event.cpp
@@ -328,7 +328,7 @@ void EventManager::updateScreen() {
 	}
 }
 
-SciEvent EventManager::getSciEvent(unsigned int mask) {
+SciEvent EventManager::getSciEvent(uint32 mask) {
 	SciEvent event = { SCI_EVENT_NONE, 0, 0, Common::Point(0, 0) };
 
 	EventManager::updateScreen();
diff --git a/engines/sci/event.h b/engines/sci/event.h
index 76c884a..0d0c550 100644
--- a/engines/sci/event.h
+++ b/engines/sci/event.h
@@ -121,7 +121,7 @@ public:
 	~EventManager();
 
 	void updateScreen();
-	SciEvent getSciEvent(unsigned int mask);
+	SciEvent getSciEvent(uint32 mask);
 
 private:
 	SciEvent getScummVMEvent();
diff --git a/engines/sci/parser/vocabulary.cpp b/engines/sci/parser/vocabulary.cpp
index 828a57a..a09ba8f 100644
--- a/engines/sci/parser/vocabulary.cpp
+++ b/engines/sci/parser/vocabulary.cpp
@@ -121,7 +121,7 @@ bool Vocabulary::loadParserWords() {
 		}
 	}
 
-	unsigned int seeker;
+	uint32 seeker;
 	if (resourceType == kVocabularySCI1)
 		seeker = 255 * 2; // vocab.900 starts with 255 16-bit pointers which we don't use
 	else
@@ -202,7 +202,7 @@ bool Vocabulary::loadSuffixes() {
 	if (!resource)
 		return false; // No vocabulary found
 
-	unsigned int seeker = 1;
+	uint32 seeker = 1;
 
 	while ((seeker < resource->size - 1) && (resource->data[seeker + 1] != 0xff)) {
 		suffix_t suffix;
@@ -288,7 +288,7 @@ bool Vocabulary::loadAltInputs() {
 		AltInput t;
 		t._input = data;
 
-		unsigned int l = strlen(data);
+		uint32 l = strlen(data);
 		t._inputLength = l;
 		data += l + 1;
 
@@ -325,15 +325,15 @@ bool Vocabulary::checkAltInput(Common::String& text, uint16& cursorPos) {
 		return false;
 
 	bool ret = false;
-	unsigned int loopCount = 0;
+	uint32 loopCount = 0;
 	bool changed;
 	do {
 		changed = false;
 
 		const char* t = text.c_str();
-		unsigned int tlen = text.size();
+		uint32 tlen = text.size();
 
-		for (unsigned int p = 0; p < tlen && !changed; ++p) {
+		for (uint32 p = 0; p < tlen && !changed; ++p) {
 			unsigned char s = t[p];
 			if (s >= _altInputs.size() || _altInputs[s].empty())
 				continue;
@@ -351,7 +351,7 @@ bool Vocabulary::checkAltInput(Common::String& text, uint16& cursorPos) {
 						cursorPos = p + strlen(i->_replacement);
 					}
 
-					for (unsigned int j = 0; j < i->_inputLength; ++j)
+					for (uint32 j = 0; j < i->_inputLength; ++j)
 						text.deleteChar(p);
 					const char *r = i->_replacement;
 					while (*r)
diff --git a/engines/sci/parser/vocabulary.h b/engines/sci/parser/vocabulary.h
index f4adee6..59558ce 100644
--- a/engines/sci/parser/vocabulary.h
+++ b/engines/sci/parser/vocabulary.h
@@ -156,7 +156,7 @@ typedef Common::Array<synonym_t> SynonymList;
 struct AltInput {
 	const char *_input;
 	const char *_replacement;
-	unsigned int _inputLength;
+	uint32 _inputLength;
 	bool _prefix;
 };
 
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index 2a4cd95..42afa68 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -307,7 +307,7 @@ bool Resource::loadPatch(Common::SeekableReadStream *file) {
 		error("Can't allocate %d bytes needed for loading %s", res->size + res->_headerSize, res->_id.toString().c_str());
 	}
 
-	unsigned int really_read;
+	uint32 really_read;
 	if (res->_headerSize > 0) {
 		really_read = file->read(res->_header, res->_headerSize);
 		if (really_read != res->_headerSize)
diff --git a/engines/sci/resource_audio.cpp b/engines/sci/resource_audio.cpp
index 6869e63..8209941 100644
--- a/engines/sci/resource_audio.cpp
+++ b/engines/sci/resource_audio.cpp
@@ -139,7 +139,7 @@ bool Resource::loadFromAudioVolumeSCI1(Common::SeekableReadStream *file) {
 		error("Can't allocate %d bytes needed for loading %s", size, _id.toString().c_str());
 	}
 
-	unsigned int really_read = file->read(data, size);
+	uint32 really_read = file->read(data, size);
 	if (really_read != size)
 		warning("Read %d bytes from %s but expected %d", really_read, _id.toString().c_str(), size);
 
diff --git a/engines/sci/sound/drivers/amigamac.cpp b/engines/sci/sound/drivers/amigamac.cpp
index 5ce4908..0f93b19 100644
--- a/engines/sci/sound/drivers/amigamac.cpp
+++ b/engines/sci/sound/drivers/amigamac.cpp
@@ -497,7 +497,7 @@ MidiDriver_AmigaMac::InstrumentSample *MidiDriver_AmigaMac::readInstrumentSCI0(C
 	}
 
 	instrument->samples = (int8 *) malloc(size + 1);
-	if (file.read(instrument->samples, size) < (unsigned int)size) {
+	if (file.read(instrument->samples, size) < (uint32)size) {
 		warning("Amiga/Mac driver: failed to read instrument samples");
 		free(instrument->samples);
 		delete instrument;


Commit: e317958d4cdfb5d4cfe934c577be8f06e8689565
    https://github.com/scummvm/scummvm/commit/e317958d4cdfb5d4cfe934c577be8f06e8689565
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2016-03-01T01:23:55+02:00

Commit Message:
SCI: Remove superfluous cast to boolean and fix code styling

Changed paths:
    engines/sci/engine/object.cpp



diff --git a/engines/sci/engine/object.cpp b/engines/sci/engine/object.cpp
index 65c85a8..0566d69 100644
--- a/engines/sci/engine/object.cpp
+++ b/engines/sci/engine/object.cpp
@@ -272,7 +272,7 @@ void Object::initSelectorsSci3(const byte *buf) {
 			// This object actually has selectors belonging to this group
 			int typeMask = READ_SCI11ENDIAN_UINT32(seeker);
 
-			_mustSetViewVisible[groupNr] = !!(typeMask & 1);
+			_mustSetViewVisible[groupNr] = (typeMask & 1);
 
 			 for (int bit = 2; bit < 32; ++bit) {
 				int value = READ_SCI11ENDIAN_UINT16(seeker + bit * 2);
@@ -285,7 +285,8 @@ void Object::initSelectorsSci3(const byte *buf) {
 				}
 
 			}
-		} else _mustSetViewVisible[groupNr] = false;
+		} else
+			_mustSetViewVisible[groupNr] = false;
 	}
 
 	_variables.resize(properties);






More information about the Scummvm-git-logs mailing list