[Scummvm-git-logs] scummvm master -> 88b2b3a166333eac02803c0a7231f9f6c9b44c4e

dreammaster paulfgilbert at gmail.com
Sat May 11 08:38:54 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:
88b2b3a166 GLK: HUGO: Compilation fixes


Commit: 88b2b3a166333eac02803c0a7231f9f6c9b44c4e
    https://github.com/scummvm/scummvm/commit/88b2b3a166333eac02803c0a7231f9f6c9b44c4e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-05-11T16:38:31+10:00

Commit Message:
GLK: HUGO: Compilation fixes

Changed paths:
    engines/glk/hugo/hemisc.cpp
    engines/glk/hugo/heparse.cpp
    engines/glk/hugo/herun.cpp
    engines/glk/hugo/hugo.h
    engines/glk/hugo/stringfn.cpp
    engines/glk/hugo/stringfn.h


diff --git a/engines/glk/hugo/hemisc.cpp b/engines/glk/hugo/hemisc.cpp
index 07800bb..c380fbb 100644
--- a/engines/glk/hugo/hemisc.cpp
+++ b/engines/glk/hugo/hemisc.cpp
@@ -25,6 +25,8 @@
 namespace Glk {
 namespace Hugo {
 
+static char EMPTY[1] = { 0 };
+
 void Hugo::AP(const char *a) {
 	char sticky = false, skipspchar = false, startofline = 0;
 	int i, alen, plen, cwidth;
@@ -461,6 +463,7 @@ int Hugo::CallRoutine(unsigned int addr) {
 #endif
 	arg = 0;
 	tail_recursion = 0;
+	Common::fill(&temppass[0], &temppass[MAXLOCALS], 0);
 
 	/* Pass local variables to routine, if specified */
 	if (MEM(codeptr)==OPEN_BRACKET_T)
@@ -980,7 +983,6 @@ char *Hugo::GetText(long textaddr) {
 char *Hugo::GetWord(unsigned int w) {
 	char *b;
 	unsigned short a;
-	static char *EMPTY = "";
 
 	a = w;
 
diff --git a/engines/glk/hugo/heparse.cpp b/engines/glk/hugo/heparse.cpp
index 2a70fed..0369385 100644
--- a/engines/glk/hugo/heparse.cpp
+++ b/engines/glk/hugo/heparse.cpp
@@ -27,6 +27,8 @@ namespace Hugo {
 
 #define STARTS_AS_NUMBER(a) (((a[0]>='0' && a[0]<='9') || a[0]=='-')?1:0)
 
+static char EMPTY[1] = { 0 };
+
 void Hugo::AddAllObjects(int loc) {
 	int i;
 
@@ -363,7 +365,7 @@ void Hugo::KillWord(int a) {
 
 	for (i=a; i<words; i++)
 		word[i] = word[i+1];
-	word[words] = "";
+	word[words] = EMPTY;
 
 	RemoveWord(a);
 	words--;
@@ -371,7 +373,7 @@ void Hugo::KillWord(int a) {
 
 int Hugo::MatchCommand() {
 	int i, j, flag, a, mw = 0, gotspeaker = 0;
-	int wordnum;
+	int wordnum = 0;
 	int numverbs = 0;
 	bool nextverb = false;
 	unsigned int ptr, verbptr, nextgrammar;
@@ -2102,7 +2104,8 @@ NextSyn:
 		{
 			if (strcmp(word[i+1], "~and"))
 			{
-				word[i] = "~and";
+				static char *END = "~and";
+				word[i] = END;
 				wd[i] = FindWord("~and");
 			}
 			else
@@ -2112,7 +2115,7 @@ NextSyn:
 		if (wd[i]==period)
 		{
 			wd[i] = 0;
-			word[i] = "";
+			word[i] = EMPTY;
 		}
 	}
 
@@ -2331,7 +2334,7 @@ void Hugo::SeparateWords() {
 
 	for (i=0; i<MAXWORDS+1; i++)
 	{
-		word[i] = "";
+		word[i] = EMPTY;
 		wd[i] = 0;
 	}
 	word[1] = buffer;
diff --git a/engines/glk/hugo/herun.cpp b/engines/glk/hugo/herun.cpp
index 6466f88..8a6d9cd 100644
--- a/engines/glk/hugo/herun.cpp
+++ b/engines/glk/hugo/herun.cpp
@@ -721,7 +721,7 @@ NormalTermination:
 #endif
 }
 
-void Hugo::RunIf(char override) {
+void Hugo::RunIf(char ovrride) {
 	char t, tempinexpr;
 	long enterptr, skip;
 
@@ -741,8 +741,7 @@ void Hugo::RunIf(char override) {
 			codeptr += 2;
 
 			/* Check if we've already done an elseif */
-			if (override && t==ELSEIF_T)
-			{
+			if (ovrride && (t == ELSEIF_T)) {
 				codeptr = skip+enterptr;
 				return;
 			}
@@ -789,7 +788,7 @@ PasstoBlock:
 			enterptr = codeptr;
 			codeptr += 2;
 
-			if (override)
+			if (ovrride)
 			{
 				codeptr = skip+enterptr;
 				return;
@@ -2528,7 +2527,7 @@ int Hugo::RunSystem() {
 #ifndef NO_STRFTIME
 			TimeDate td;
 			g_system->getTimeAndDate(td);
-			sprintf(parseerr, "%Y-%m-%d %H:%M:%S", td.tm_year, td.tm_mon, td.tm_mday,
+			sprintf(parseerr, "%d-%.2d-%.2d %d:%.2d:%.2d", td.tm_year, td.tm_mon, td.tm_mday,
 				td.tm_hour, td.tm_min, td.tm_sec);
 #else
 			hugo_gettimeformatted(parseerr);
@@ -2606,7 +2605,7 @@ void Hugo::RunWindow() {
 	temp_current_text_y = current_text_y;
 
 	tempscript = script;
-	script = false;
+	script = nullptr;
 	restore_default_bgcolor = default_bgcolor;
 
 	/* v2.4 is the first version to support proper windowing */
diff --git a/engines/glk/hugo/hugo.h b/engines/glk/hugo/hugo.h
index d022b1f..98fbf90 100644
--- a/engines/glk/hugo/hugo.h
+++ b/engines/glk/hugo/hugo.h
@@ -1010,6 +1010,12 @@ private:
 		return _random.getRandomNumber(0xffffff);
 	}
 
+	char *itoa(int value, char *str, int base) {
+		assert(base == 10);
+		sprintf(str, "%d", value);
+		return str;
+	}
+
 	/**@}*/
 private:
 	/**
diff --git a/engines/glk/hugo/stringfn.cpp b/engines/glk/hugo/stringfn.cpp
index 79886ac..4e94b3e 100644
--- a/engines/glk/hugo/stringfn.cpp
+++ b/engines/glk/hugo/stringfn.cpp
@@ -106,5 +106,11 @@ char *StringFunctions::GetTempString() {
 	return r;
 }
 
+char *StringFunctions::strlwr(char *s) {
+	for (char *sp = s; *sp; ++sp)
+		*sp = tolower(*sp);
+	return s;
+}
+
 } // End of namespace Hugo
 } // End of namespace Glk
diff --git a/engines/glk/hugo/stringfn.h b/engines/glk/hugo/stringfn.h
index bb339fc..2ee6e3e 100644
--- a/engines/glk/hugo/stringfn.h
+++ b/engines/glk/hugo/stringfn.h
@@ -56,6 +56,8 @@ public:
 	char *Rtrim(char a[]);
 
 	char *hugo_strcpy(char *s, const char *t);
+
+	char *strlwr(char *s);
 };
 
 





More information about the Scummvm-git-logs mailing list