[Scummvm-git-logs] scummvm master -> 17f0937f000a162e43b99f141d7040660a8451c8

dreammaster paulfgilbert at gmail.com
Mon Apr 29 08:25:57 CEST 2019


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

Summary:
17f0937f00 GLK: Fix warnings


Commit: 17f0937f000a162e43b99f141d7040660a8451c8
    https://github.com/scummvm/scummvm/commit/17f0937f000a162e43b99f141d7040660a8451c8
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2019-04-29T16:25:54+10:00

Commit Message:
GLK: Fix warnings

Changed paths:
    engines/glk/alan2/execute.cpp
    engines/glk/alan2/interpreter.cpp
    engines/glk/alan2/parse.cpp
    engines/glk/alan2/rules.cpp
    engines/glk/alan2/saveload.cpp
    engines/glk/alan2/util.h
    engines/glk/frotz/glk_interface.cpp
    engines/glk/glulxe/serial.cpp


diff --git a/engines/glk/alan2/execute.cpp b/engines/glk/alan2/execute.cpp
index fa7bdd7..8359c47 100644
--- a/engines/glk/alan2/execute.cpp
+++ b/engines/glk/alan2/execute.cpp
@@ -503,17 +503,17 @@ Aint Execute::agrsum(Aword atr, Aword whr) {
 
 Aint Execute::agrcount(Aword whr) {
 	Aword i;
-	Aword count = 0;
+	Aword countVal = 0;
 
 	for (i = OBJMIN; i <= OBJMAX; i++) {
 		if (isLoc(whr)) {
 			if (where(i) == whr)
-				count++;
+				countVal++;
 		} else if (_objs[i-OBJMIN].loc == whr)
-			count++;
+			countVal++;
 	}
 
-	return(count);
+	return(countVal);
 }
 
 void Execute::locobj(Aword obj, Aword whr) {
diff --git a/engines/glk/alan2/interpreter.cpp b/engines/glk/alan2/interpreter.cpp
index 2f0775e..b8906d2 100644
--- a/engines/glk/alan2/interpreter.cpp
+++ b/engines/glk/alan2/interpreter.cpp
@@ -165,7 +165,7 @@ void Interpreter::curVar(Aword i) {
 	switch (I_OP(i)) {
 	case V_PARAM:
 		if (stpflg)
-			debug("PARAM \t%5ld\t\t(%ld)", _stack->top(), _vm->params[_stack->top() - 1].code);
+			debug("PARAM \t%5ld\t\t(%d)", _stack->top(), _vm->params[_stack->top() - 1].code);
 		_stack->push(_vm->params[_stack->pop() - 1].code);
 		break;
 	case V_CURLOC:
@@ -290,7 +290,7 @@ void Interpreter::stMop(Aword i, Aaddr oldpc) {
 	case I_SCORE:
 		arg1 = _stack->pop();	// score
 		if (stpflg)
-			debug("SCORE \t%5ld\t\t(%ld)", arg1, _vm->scores[arg1 - 1]);
+			debug("SCORE \t%5ld\t\t(%d)", arg1, _vm->scores[arg1 - 1]);
 		_execute->score(arg1);
 		break;
 	case I_VISITS:
@@ -428,8 +428,9 @@ void Interpreter::stMop(Aword i, Aaddr oldpc) {
 		if (stpflg)
 			debug("IN \t%5ld, %5ld ", arg1, arg2);
 		_stack->push(_execute->in(arg1, arg2));
-		if (stpflg)
+		if (stpflg) {
 			if (_stack->top()) debug("\t(TRUE)"); else debug("\t(FALSE)");
+		}
 		break;
 	case I_DESCRIBE:
 		arg1 = _stack->pop();	// id
@@ -489,8 +490,9 @@ void Interpreter::stMop(Aword i, Aaddr oldpc) {
 			if (rh) debug("TRUE"); else debug("FALSE");
 		}
 		_stack->push(lh && rh);
-		if (stpflg)
+		if (stpflg) {
 			if (_stack->top()) debug("\t(TRUE)"); else debug("\t(FALSE)");
+		}
 		break;
 	case I_OR:
 		rh = _stack->pop();
@@ -514,8 +516,9 @@ void Interpreter::stMop(Aword i, Aaddr oldpc) {
 		if (stpflg)
 			debug("NE \t%5ld, %5ld", lh, rh);
 		_stack->push(lh != rh);
-		if (stpflg)
+		if (stpflg) {
 			if (_stack->top()) debug("\t(TRUE)"); else debug("\t(FALSE)");
+		}
 		break;
 	case I_EQ:
 		rh = _stack->pop();
@@ -536,8 +539,9 @@ void Interpreter::stMop(Aword i, Aaddr oldpc) {
 		if (stpflg)
 			debug("STREQ \t%5ld, %5ld", lh, rh);
 		_stack->push(_execute->streq((char *)lh, (char *)rh));
-		if (stpflg)
+		if (stpflg) {
 			if (_stack->top()) debug("\t(TRUE)"); else debug("\t(FALSE)");
+		}
 		break;
 	case I_STREXACT:
 		rh = _stack->pop();
@@ -545,8 +549,9 @@ void Interpreter::stMop(Aword i, Aaddr oldpc) {
 		if (stpflg)
 			debug("STREXACT \t%5ld, %5ld", lh, rh);
 		_stack->push(strcmp((char *)lh, (char *)rh) == 0);
-		if (stpflg)
+		if (stpflg) {
 			if (_stack->top()) debug("\t(TRUE)"); else debug("\t(FALSE)");
+		}
 		free((void *)lh);
 		free((void *)rh);
 		break;
@@ -556,8 +561,9 @@ void Interpreter::stMop(Aword i, Aaddr oldpc) {
 		if (stpflg)
 			debug("LE \t%5ld, %5ld", lh, rh);
 		_stack->push(lh <= rh);
-		if (stpflg)
+		if (stpflg) {
 			if (_stack->top()) debug("\t(TRUE)"); else debug("\t(FALSE)");
+		}
 		break;
 	case I_GE:
 		rh = _stack->pop();
@@ -565,8 +571,9 @@ void Interpreter::stMop(Aword i, Aaddr oldpc) {
 		if (stpflg)
 			debug("GE \t%5ld, %5ld", lh, rh);
 		_stack->push(lh >= rh);
-		if (stpflg)
+		if (stpflg) {
 			if (_stack->top()) debug("\t(TRUE)"); else debug("\t(FALSE)");
+		}
 		break;
 	case I_LT:
 		rh = _stack->pop();
@@ -574,8 +581,9 @@ void Interpreter::stMop(Aword i, Aaddr oldpc) {
 		if (stpflg)
 			debug("LT \t%5ld, %5ld", lh, rh);
 		_stack->push((signed int)lh < (signed int)rh);
-		if (stpflg)
+		if (stpflg) {
 			if (_stack->top()) debug("\t(TRUE)"); else debug("\t(FALSE)");
+		}
 		break;
 	case I_GT:
 		rh = _stack->pop();
@@ -583,8 +591,9 @@ void Interpreter::stMop(Aword i, Aaddr oldpc) {
 		if (stpflg)
 			debug("GT \t%5ld, %5ld", lh, rh);
 		_stack->push(lh > rh);
-		if (stpflg)
+		if (stpflg) {
 			if (_stack->top()) debug("\t(TRUE)"); else debug("\t(FALSE)");
+		}
 		break;
 	case I_PLUS:
 		rh = _stack->pop();
@@ -629,8 +638,9 @@ void Interpreter::stMop(Aword i, Aaddr oldpc) {
 			if (arg1) debug("TRUE"); else debug("FALSE");
 		}
 		_stack->push(!arg1);
-		if (stpflg)
+		if (stpflg) {
 			if (_stack->top()) debug("\t\t(TRUE)"); else debug("\t\t(FALSE)");
+		}
 		break;
 	case I_MAX:
 		arg1 = _stack->pop();	// atr
@@ -749,7 +759,7 @@ void Interpreter::interpret(Aaddr adr) {
 		switch (I_CLASS(i)) {
 		case C_CONST:
 			if (stpflg)
-				debug("PUSH  \t%5ld", I_OP(i));
+				debug("PUSH  \t%5d", I_OP(i));
 			_stack->push(I_OP(i));
 			break;
 		case C_CURVAR:
diff --git a/engines/glk/alan2/parse.cpp b/engines/glk/alan2/parse.cpp
index 17e4dc9..aac858a 100644
--- a/engines/glk/alan2/parse.cpp
+++ b/engines/glk/alan2/parse.cpp
@@ -103,8 +103,8 @@ char *Parser::gettoken(char *tokenBuffer) {
 }
 
 void Parser::agetline() {
-	static char buf[LISTLEN + 1];	// The input buffer
-	static char isobuf[LISTLEN + 1];	// The input buffer in ISO
+	// static char buf[LISTLEN + 1];	// The input buffer
+	// static char isobuf[LISTLEN + 1];	// The input buffer in ISO
 
 	_vm->paragraph();
 
@@ -163,7 +163,7 @@ void Parser::agetline() {
 
 void Parser::scan() {
 	uint i;
-	int w;
+	// int w;
 
 	agetline();
 	wrds[0] = 0;
@@ -180,7 +180,7 @@ void Parser::scan() {
 			tmp.toLowercase();
 			strcpy(token, tmp.c_str());
 
-			w = lookup(token);
+			// w = lookup(token);
 
 			// TODO
 			//if (!isNoise(w))
@@ -295,7 +295,7 @@ void Parser::buildall(ParamElem list[]) {
 void Parser::listCopy(ParamElem a[], ParamElem b[]) {
 	int i;
 
-	for (i = 0; b[i].code != EOF; i++)
+	for (i = 0; b[i].code != (Aword)EOF; i++)
 		a[i] = b[i];
 
 	a[i].code = (Aword)EOF;
@@ -304,7 +304,7 @@ void Parser::listCopy(ParamElem a[], ParamElem b[]) {
 bool Parser::listContains(ParamElem l[], Aword e) {
 	int i;
 
-	for (i = 0; l[i].code != EOF && l[i].code != e; i++);
+	for (i = 0; l[i].code != (Aword)EOF && l[i].code != e; i++);
 
 	return (l[i].code == e);
 }
@@ -312,7 +312,7 @@ bool Parser::listContains(ParamElem l[], Aword e) {
 void Parser::listIntersection(ParamElem a[], ParamElem b[]) {
 	int i, last = 0;
 
-	for (i = 0; a[i].code != EOF; i++)
+	for (i = 0; a[i].code != (Aword)EOF; i++)
 		if (listContains(b, a[i].code))
 			a[last++] = a[i];
 
@@ -322,7 +322,7 @@ void Parser::listIntersection(ParamElem a[], ParamElem b[]) {
 void Parser::listCopyFromDictionary(ParamElem p[], Aword r[]) {
 	int i;
 
-	for (i = 0; r[i] != EOF; i++) {
+	for (i = 0; r[i] != (Aword)EOF; i++) {
 		p[i].code = r[i];
 		p[i].firstWord = (Aword)EOF;
 	}
@@ -333,7 +333,7 @@ void Parser::listCopyFromDictionary(ParamElem p[], Aword r[]) {
 int Parser::listLength(ParamElem a[]) {
 	int i = 0;
 
-	while (a[i].code != EOF)
+	while (a[i].code != (Aword)EOF)
 		i++;
 
 	return (i);
@@ -342,7 +342,7 @@ int Parser::listLength(ParamElem a[]) {
 void Parser::listCompact(ParamElem a[]) {
 	int i, j;
 
-	for (i = 0, j = 0; a[j].code != EOF; j++)
+	for (i = 0, j = 0; a[j].code != (Aword)EOF; j++)
 		if (a[j].code != 0)
 			a[i++] = a[j];
 
@@ -352,9 +352,9 @@ void Parser::listCompact(ParamElem a[]) {
 void Parser::listMerge(ParamElem a[], ParamElem b[]) {
 	int i, last;
 
-	for (last = 0; a[last].code != EOF; last++); // Find end of list
+	for (last = 0; a[last].code != (Aword)EOF; last++); // Find end of list
 
-	for (i = 0; b[i].code != EOF; i++) {
+	for (i = 0; b[i].code != (Aword)EOF; i++) {
 		if (!listContains(a, b[i].code)) {
 			a[last++] = b[i];
 			a[last].code = (Aword)EOF;
@@ -363,7 +363,7 @@ void Parser::listMerge(ParamElem a[], ParamElem b[]) {
 }
 
 void Parser::listSubtract(ParamElem a[], ParamElem b[]) {
-	for (int i = 0; a[i].code != EOF; i++)
+	for (int i = 0; a[i].code != (Aword)EOF; i++)
 		if (listContains(b, a[i].code))
 			a[i].code = 0;		// Mark empty
 
@@ -454,7 +454,7 @@ void Parser::unambig(ParamElem plst[]) {
 			listCopy(plst, savlst);	// Restore to before last adjective
 			listCopyFromDictionary(refs, (Aword *)addrTo(dict[wrds[wrdidx-1]].nounrefs));
 			
-			if (plst[0].code == EOF)
+			if (plst[0].code == (Aword)EOF)
 				listCopy(plst, refs);
 			else
 				listIntersection(plst, refs);
@@ -466,7 +466,7 @@ void Parser::unambig(ParamElem plst[]) {
 
 	// Allow remote objects, but resolve ambiguities by presence
 	if (listLength(plst) > 1) {
-		for (i=0; plst[i].code != EOF; i++)
+		for (i=0; plst[i].code != (Aword)EOF; i++)
 			if (!isHere(plst[i].code))
 				plst[i].code = 0;
 
@@ -504,7 +504,7 @@ void Parser::simple(ParamElem olst[]) {
 		if (isThem(wrds[wrdidx])) {
 			plural = true;
 
-			for (i = 0; pmlst[i].code != EOF; i++)
+			for (i = 0; pmlst[i].code != (Aword)EOF; i++)
 				if (!isHere(pmlst[i].code))
 					pmlst[i].code = 0;
 
@@ -602,7 +602,7 @@ void Parser::resolve(ParamElem plst[]) {
 		return;	// ALL has already done this
 
 	// Resolve ambiguities by presence
-	for (int i = 0; plst[i].code != EOF; i++)  {
+	for (int i = 0; plst[i].code != (Aword)EOF; i++)  {
 		if (plst[i].code < LITMIN) { // Literals are always 'here'
 			if (!isHere(plst[i].code)) {
 				params[0] = plst[i];	// Copy error param as first one for message
@@ -615,37 +615,37 @@ void Parser::resolve(ParamElem plst[]) {
 
 bool Parser::endOfTable(StxElem *addr) {
 	Aword *x = (Aword *)addr;
-	return *x == EOF;
+	return *x == (Aword)EOF;
 }
 
 bool Parser::endOfTable(ElmElem *addr) {
 	Aword *x = (Aword *)addr;
-	return *x == EOF;
+	return *x == (Aword)EOF;
 }
 
 bool Parser::endOfTable(ClaElem *addr) {
 	Aword *x = (Aword *)addr;
-	return *x == EOF;
+	return *x == (Aword)EOF;
 }
 
 bool Parser::endOfTable(VrbElem *addr) {
 	Aword *x = (Aword *)addr;
-	return *x == EOF;
+	return *x == (Aword)EOF;
 }
 
 bool Parser::endOfTable(AltElem *addr) {
 	Aword *x = (Aword *)addr;
-	return *x == EOF;
+	return *x == (Aword)EOF;
 }
 
 bool Parser::endOfTable(ChkElem *addr) {
 	Aword *x = (Aword *)addr;
-	return *x == EOF;
+	return *x == (Aword)EOF;
 }
 
 bool Parser::endOfTable(WrdElem *addr) {
 	Aword *x = (Aword *)addr;
-	return *x == EOF;
+	return *x == (Aword)EOF;
 }
 
 AltElem *Parser::findalt(Aword vrbsadr, Aword param) {
@@ -708,7 +708,7 @@ bool Parser::possible() {
 		if (!trycheck(alt[1]->checks, false))
 			return false;
 
-	for (i = 0; params[i].code != EOF; i++) {
+	for (i = 0; params[i].code != (Aword)EOF; i++) {
 		alt[i + 2] = findalt(objs[params[i].code - OBJMIN].vrbs, i + 1);
 		// CHECKs in a possible parameter
 		if (alt[i + 2] != 0 && alt[i + 2]->checks != 0)
@@ -716,10 +716,10 @@ bool Parser::possible() {
 				return false;
 	}
 
-	for (i = 0; i < 2 || params[i - 2].code != EOF; i++)
+	for (i = 0; i < 2 || params[i - 2].code != (Aword)EOF; i++)
 		if (alt[i] != 0 && alt[i]->action != 0)
 			break;
-	if (i >= 2 && params[i - 2].code == EOF)
+	if (i >= 2 && params[i - 2].code == (Aword)EOF)
 		// Didn't find any code for this verb/object combination
 		return false;
 	else
@@ -752,13 +752,13 @@ void Parser::tryMatch(ParamElem mlstArr[]) {
 	while (true) {
 		// End of input?
 		if (wrds[wrdidx] == EOF || isConj(wrds[wrdidx])) {
-			while (!endOfTable(elms) && elms->code != EOS)
+			while (!endOfTable(elms) && elms->code != (Aword)EOS)
 				elms++;
 
-				if (endOfTable(elms))
-					_vm->printError(M_WHAT);
-				else
-					break;
+			if (endOfTable(elms))
+				_vm->printError(M_WHAT);
+			else
+				break;
 		} else {
 			// A preposition?
 			if (isPrep(wrds[wrdidx])) {
@@ -811,13 +811,13 @@ void Parser::tryMatch(ParamElem mlstArr[]) {
 	if (elms->next == 0)	// No verb code, verb not declared!
 		_vm->printError(M_CANT0);
 
-	for (p = 0; params[p].code != EOF; p++) /* Mark all parameters unchecked */
+	for (p = 0; params[p].code != (Aword)EOF; p++) /* Mark all parameters unchecked */
 		checked[p] = false;
 
 	for (cla = (ClaElem *) addrTo(elms->next); !endOfTable(cla); cla++) {
 		if (params[cla->code - 1].code == 0) {
 			// This was a multiple parameter, so check all and remove failing
-			for (i = 0; mlstArr[i].code != EOF; i++) {
+			for (i = 0; mlstArr[i].code != (Aword)EOF; i++) {
 				params[cla->code-1] = mlstArr[i];
 				if (!claCheck(cla)) {
 					// Multiple could be both an explicit list of params and an ALL
@@ -847,11 +847,11 @@ void Parser::tryMatch(ParamElem mlstArr[]) {
 	}
 
 	// Now check the rest of the parameters, must be objects
-	for (p = 0; params[p].code != EOF; p++) {
+	for (p = 0; params[p].code != (Aword)EOF; p++) {
 		if (!checked[p]) {
 			if (params[p].code == 0) {
 				// This was a multiple parameter, check all and remove failing
-				for (i = 0; mlstArr[i].code != EOF; i++) {
+				for (i = 0; mlstArr[i].code != (Aword)EOF; i++) {
 					if (mlstArr[i].code != 0 && !isObj(mlstArr[i].code)) // Skip any empty slots
 						mlstArr[i].code = 0;
 				}
@@ -915,12 +915,12 @@ void Parser::action(ParamElem plst[]) {
 		
 		sprintf(marker, "($%d)", mpos + 1); // Prepare a printout with $1/2/3
 
-		for (i = 0; plst[i].code != EOF; i++) {
+		for (i = 0; plst[i].code != (Aword)EOF; i++) {
 			params[mpos] = plst[i];
 			_vm->output(marker);
 			//do_it();	// TODO
 
-			if (plst[i + 1].code != EOF)
+			if (plst[i + 1].code != (Aword)EOF)
 				_vm->paragraph();
 		}
 
diff --git a/engines/glk/alan2/rules.cpp b/engines/glk/alan2/rules.cpp
index 1d20429..973bd23 100644
--- a/engines/glk/alan2/rules.cpp
+++ b/engines/glk/alan2/rules.cpp
@@ -59,14 +59,15 @@ void Rules::parseRules() {
 					change = true;
 					_ruls[i - 1].run = true;
 
-					if (trcflg)
-						if (!stpflg)
+					if (trcflg) {
+						if (!stpflg) {
 							debug(", Executing:>\n");
-						else {
+						} else {
 							debug("\nRULE %d (at ", i);
 							//debugsay(cur.loc);	// TODO
 							debug("), Executing:>\n");
 						}
+					}
 
 					_interpreter->interpret(_ruls[i - 1].stms);
 					
@@ -80,7 +81,7 @@ void Rules::parseRules() {
 
 bool Rules::endOfTable(RulElem *addr) {
 	Aword *x = (Aword *)addr;
-	return *x == EOF;
+	return *x == (Aword)EOF;
 }
 
 } // End of namespace Alan2
diff --git a/engines/glk/alan2/saveload.cpp b/engines/glk/alan2/saveload.cpp
index 2e7e3d5..2d92d34 100644
--- a/engines/glk/alan2/saveload.cpp
+++ b/engines/glk/alan2/saveload.cpp
@@ -211,7 +211,7 @@ void SaveLoad::restore() {
 
 bool SaveLoad::endOfTable(AtrElem *addr) {
 	Aword *x = (Aword *)addr;
-	return *x == EOF;
+	return *x == (Aword)EOF;
 }
 
 } // End of namespace Alan2
diff --git a/engines/glk/alan2/util.h b/engines/glk/alan2/util.h
index 73d65e2..5ea1410 100644
--- a/engines/glk/alan2/util.h
+++ b/engines/glk/alan2/util.h
@@ -69,17 +69,17 @@ inline bool isLit(Aword x) {
 
 inline bool endOfTable(LimElem *addr) {
 	Aword *x = (Aword *)addr;
-	return *x == EOF;
+	return *x == (Aword)EOF;
 }
 
 inline bool endOfTable(ScrElem *addr) {
 	Aword *x = (Aword *)addr;
-	return *x == EOF;
+	return *x == (Aword)EOF;
 }
 
 inline bool endOfTable(ExtElem *addr) {
 	Aword *x = (Aword *)addr;
-	return *x == EOF;
+	return *x == (Aword)EOF;
 }
 
 } // End of namespace Alan2
diff --git a/engines/glk/frotz/glk_interface.cpp b/engines/glk/frotz/glk_interface.cpp
index 330c8be..a474875 100644
--- a/engines/glk/frotz/glk_interface.cpp
+++ b/engines/glk/frotz/glk_interface.cpp
@@ -565,7 +565,7 @@ int GlkInterface::os_peek_color() {
 		return (_reverseVideo) ? h_default_foreground : h_default_background;
 	}
 /*
- if (u_setup.color_enabled) {
+ if (u_setup.color_enabled) { */
 #ifdef COLOR_SUPPORT
 	short fg, bg;
 	pair_content(PAIR_NUMBER(inch() & A_COLOR), &fg, &bg);
diff --git a/engines/glk/glulxe/serial.cpp b/engines/glk/glulxe/serial.cpp
index 01848fc..d138027 100644
--- a/engines/glk/glulxe/serial.cpp
+++ b/engines/glk/glulxe/serial.cpp
@@ -503,7 +503,7 @@ int Glulxe::write_buffer(dest_t *dest, const byte *ptr, uint len) {
 		}
 		memcpy(dest->ptr + dest->pos, ptr, len);
 	} else {
-		glk_put_buffer_stream(dest->str, (char *)ptr, len);
+		glk_put_buffer_stream(dest->str, (const char *)ptr, len);
 	}
 
 	dest->pos += len;
@@ -740,8 +740,8 @@ uint Glulxe::write_heapstate_sub(uint sumlen, uint *sumarray, dest_t *dest, int
 }
 
 int Glulxe::sort_heap_summary(const void *p1, const void *p2) {
-	uint v1 = *(uint *)p1;
-	uint v2 = *(uint *)p2;
+	uint v1 = *(const uint *)p1;
+	uint v2 = *(const uint *)p2;
 
 	if (v1 < v2)
 		return -1;





More information about the Scummvm-git-logs mailing list