[Scummvm-git-logs] scummvm master -> 58498cf5f21375c3ab89a8486175ff8de087bdf7

dreammaster paulfgilbert at gmail.com
Thu Jul 25 05:32:20 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:
58498cf5f2 GLK: Fixing some gcc 8 warnings


Commit: 58498cf5f21375c3ab89a8486175ff8de087bdf7
    https://github.com/scummvm/scummvm/commit/58498cf5f21375c3ab89a8486175ff8de087bdf7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-07-24T20:32:14-07:00

Commit Message:
GLK: Fixing some gcc 8 warnings

Changed paths:
    engines/glk/alan3/main.cpp
    engines/glk/detection.h
    engines/glk/glulxe/glulxe.h
    engines/glk/hugo/hemisc.cpp
    engines/glk/tads/tads2/memory_cache.cpp
    engines/glk/window_text_buffer.cpp


diff --git a/engines/glk/alan3/main.cpp b/engines/glk/alan3/main.cpp
index 7b09840..d20ec44 100644
--- a/engines/glk/alan3/main.cpp
+++ b/engines/glk/alan3/main.cpp
@@ -228,8 +228,8 @@ char *decodedGameVersion(const byte version[]) {
 
 /*----------------------------------------------------------------------*/
 static void incompatibleDevelopmentVersion(ACodeHeader *hdr) {
-	char str[80];
-	sprintf(str, "Incompatible version of ACODE program. Development versions always require exact match. Game is %ld.%ld%s%ld, interpreter %ld.%ld%s%ld!",
+	Common::String msg = Common::String::format("Incompatible version of ACODE program. "
+		"Development versions always require exact match. Game is %ld.%ld%s%ld, interpreter %ld.%ld%s%ld!",
 	        (long)(hdr->version[0]),
 	        (long)(hdr->version[1]),
 	        decodeState(hdr->version[3]),
@@ -238,19 +238,18 @@ static void incompatibleDevelopmentVersion(ACodeHeader *hdr) {
 	        (long)alan.version.revision,
 	        alan.version.state,
 	        (long)alan.version.correction);
-	apperr(str);
+	apperr(msg.c_str());
 }
 
 
 /*----------------------------------------------------------------------*/
 static void incompatibleVersion(ACodeHeader *hdr) {
-	char str[80];
-	sprintf(str, "Incompatible version of ACODE program. Game is %ld.%ld, interpreter %ld.%ld.",
+	Common::String msg = Common::String::format("Incompatible version of ACODE program. Game is %ld.%ld, interpreter %ld.%ld.",
 	        (long)(hdr->version[0]),
 	        (long)(hdr->version[1]),
 	        (long)alan.version.version,
 	        (long)alan.version.revision);
-	apperr(str);
+	apperr(msg.c_str());
 }
 
 
diff --git a/engines/glk/detection.h b/engines/glk/detection.h
index 96f2970..f3ed374 100644
--- a/engines/glk/detection.h
+++ b/engines/glk/detection.h
@@ -130,7 +130,7 @@ struct GlkDetectionEntry {
 #define DT_ENTRYL0(ID, LANG, MD5, FILESIZE) { ID, "", MD5, FILESIZE, LANG }
 #define DT_ENTRYL1(ID, LANG, EXTRA, MD5, FILESIZE) { ID, EXTRA, MD5, FILESIZE, LANG }
 
-#define DT_END_MARKER { nullptr, nullptr, nullptr, Common::EN_ANY }
+#define DT_END_MARKER { nullptr, nullptr, nullptr, 0, Common::EN_ANY }
 
 } // End of namespace Glk
 
diff --git a/engines/glk/glulxe/glulxe.h b/engines/glk/glulxe/glulxe.h
index 150decd..ab7a3d3 100644
--- a/engines/glk/glulxe/glulxe.h
+++ b/engines/glk/glulxe/glulxe.h
@@ -426,7 +426,7 @@ public:
 	/**
 	 * Display an error in the error window, and then exit.
 	 */
-	void fatal_error_handler(const char *str, const char *arg, bool useVal, int val);
+	void NORETURN_PRE fatal_error_handler(const char *str, const char *arg, bool useVal, int val);
 
 	/**
 	 * Display a warning in the error window, and then continue.
diff --git a/engines/glk/hugo/hemisc.cpp b/engines/glk/hugo/hemisc.cpp
index 8803050..50ff4f7 100644
--- a/engines/glk/hugo/hemisc.cpp
+++ b/engines/glk/hugo/hemisc.cpp
@@ -635,8 +635,6 @@ unsigned int Hugo::Dict() {
 }
 
 void Hugo::FatalError(int n) {
-	char fatalerrorline[64];
-
 #if defined (DEBUGGER)
 	hugo_stopmusic();
 	hugo_stopsample();
@@ -732,8 +730,8 @@ if (n==UNKNOWN_OP_E || n==ILLEGAL_OP_E || n==EXPECT_VAL_E || n==OVERFLOW_E)
 	fprintf(stderr, "\n");
 }
 */
-	sprintf(fatalerrorline, "\nFatal Error:  %s", line);
-	PRINTFATALERROR(fatalerrorline);
+	Common::String msg = Common::String::format("\nFatal Error:  %s", line);
+	PRINTFATALERROR(msg.c_str());
 
 	hugo_closefiles();
 	hugo_blockfree(mem);
diff --git a/engines/glk/tads/tads2/memory_cache.cpp b/engines/glk/tads/tads2/memory_cache.cpp
index 359f1b3..d6f2e3c 100644
--- a/engines/glk/tads/tads2/memory_cache.cpp
+++ b/engines/glk/tads/tads2/memory_cache.cpp
@@ -807,9 +807,7 @@ static uchar *mcmhalo(mcmcx1def *ctx)
 {
     uchar  *chunk;
     int     err;
-#   define  size (MCMCHUNK + sizeof(mcmhdef) + 2*osrndsz(sizeof(mcmon)))
-
-    VARUSED(err);
+#define  size (MCMCHUNK + sizeof(mcmhdef) + 2*osrndsz(sizeof(mcmon)))
 
     MCMGLBCTX(ctx);
 
@@ -829,9 +827,11 @@ static uchar *mcmhalo(mcmcx1def *ctx)
     ctx->mcmcxhpch = (mcmhdef *)chunk;
 /*@@@@*/
     *(mcmon *)(chunk + osrndsz(sizeof(mcmhdef) + MCMCHUNK)) = MCMONINV;
-    return(chunk + sizeof(mcmhdef));
+	VARUSED(err);
+
+	return(chunk + sizeof(mcmhdef));
 
-#   undef size
+#undef size
 }
 
 /* "use" an object - move to most-recent position in LRU chain */
diff --git a/engines/glk/window_text_buffer.cpp b/engines/glk/window_text_buffer.cpp
index 2638302..b182643 100644
--- a/engines/glk/window_text_buffer.cpp
+++ b/engines/glk/window_text_buffer.cpp
@@ -1566,7 +1566,9 @@ void TextBufferWindow::scrollOneLine(bool forced) {
 	_lines[0]._rHyper = 0;
 	
 	Common::fill(_chars, _chars + TBLINELEN, ' ');
-	memset(_attrs, 0, TBLINELEN * sizeof(Attributes));
+	Attributes *a = _attrs;
+	for (int i = 0; i < TBLINELEN; ++i, ++a)
+		a->clear();
 
 	_numChars = 0;
 





More information about the Scummvm-git-logs mailing list