aboutsummaryrefslogtreecommitdiff
path: root/engines/glk/alan3
diff options
context:
space:
mode:
authorPaul Gilbert2019-06-26 19:37:00 -0700
committerPaul Gilbert2019-07-06 15:27:07 -0700
commit2de068a98aaeb8a1e9e8f2e719b5ff6ebf858b44 (patch)
tree8b3d3f2a5839adfbac135682de9966913463ff9f /engines/glk/alan3
parent305330bda7e755f141805a4e0e45f74820e980e1 (diff)
downloadscummvm-rg350-2de068a98aaeb8a1e9e8f2e719b5ff6ebf858b44.tar.gz
scummvm-rg350-2de068a98aaeb8a1e9e8f2e719b5ff6ebf858b44.tar.bz2
scummvm-rg350-2de068a98aaeb8a1e9e8f2e719b5ff6ebf858b44.zip
GLK: ALAN3: Further warning fixes
Diffstat (limited to 'engines/glk/alan3')
-rw-r--r--engines/glk/alan3/alan3.cpp4
-rw-r--r--engines/glk/alan3/args.cpp4
-rw-r--r--engines/glk/alan3/container.cpp2
-rw-r--r--engines/glk/alan3/debug.cpp32
-rw-r--r--engines/glk/alan3/decode.cpp2
-rw-r--r--engines/glk/alan3/exe.cpp46
-rw-r--r--engines/glk/alan3/glkstart.cpp2
-rw-r--r--engines/glk/alan3/glkstart.h6
-rw-r--r--engines/glk/alan3/instance.cpp4
-rw-r--r--engines/glk/alan3/inter.cpp14
-rw-r--r--engines/glk/alan3/main.cpp6
-rw-r--r--engines/glk/alan3/output.cpp26
-rw-r--r--engines/glk/alan3/parse.cpp4
-rw-r--r--engines/glk/alan3/readline.cpp4
-rw-r--r--engines/glk/alan3/reverse.cpp12
-rw-r--r--engines/glk/alan3/scan.cpp2
-rw-r--r--engines/glk/alan3/sysdep.cpp4
-rw-r--r--engines/glk/alan3/syserr.cpp18
-rw-r--r--engines/glk/alan3/syserr.h8
-rw-r--r--engines/glk/alan3/utils.cpp4
-rw-r--r--engines/glk/alan3/utils.h4
21 files changed, 106 insertions, 102 deletions
diff --git a/engines/glk/alan3/alan3.cpp b/engines/glk/alan3/alan3.cpp
index d5a062b76a..c7c4c6c48e 100644
--- a/engines/glk/alan3/alan3.cpp
+++ b/engines/glk/alan3/alan3.cpp
@@ -25,6 +25,7 @@
#include "glk/alan3/main.h"
#include "glk/alan3/glkio.h"
#include "glk/alan3/options.h"
+#include "glk/alan3/syserr.h"
#include "common/system.h"
#include "common/config-manager.h"
#include "common/translation.h"
@@ -58,6 +59,9 @@ Alan3::Alan3(OSystem *syst, const GlkGameDescription &gameDesc) : GlkAPI(syst, g
logOption = false;
statusLineOption = true;
regressionTestOption = false;
+
+ // syserr
+ setSyserrHandler(nullptr);
}
void Alan3::runGame() {
diff --git a/engines/glk/alan3/args.cpp b/engines/glk/alan3/args.cpp
index 7a020cd1f0..12cf1e885c 100644
--- a/engines/glk/alan3/args.cpp
+++ b/engines/glk/alan3/args.cpp
@@ -37,7 +37,7 @@ char *adventureName; /* The name of the game */
char *adventureFileName;
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-
+#if 0
/*======================================================================*/
char *gameName(char *fullPathName) {
char *foundGameName = "";
@@ -148,7 +148,7 @@ static void switches(int argc, char *argv[])
}
}
}
-
+#endif
/*----------------------------------------------------------------------*/
bool differentInterpreterName(char *string) {
diff --git a/engines/glk/alan3/container.cpp b/engines/glk/alan3/container.cpp
index b9508f55db..365455c0ce 100644
--- a/engines/glk/alan3/container.cpp
+++ b/engines/glk/alan3/container.cpp
@@ -101,7 +101,7 @@ bool passesContainerLimits(Aint theContainer, Aint theAddedInstance) {
if (containers[props].limits != 0) { /* Any limits at all? */
for (limit = (LimitEntry *) pointerTo(containers[props].limits); !isEndOfArray(limit); limit++)
- if (limit->atr == 1-I_COUNT) { /* TODO This is actually some encoding of the attribute number, right? */
+ if ((int)limit->atr == 1-I_COUNT) { /* TODO This is actually some encoding of the attribute number, right? */
if (countInContainer(theContainer) >= (int)limit->val) {
interpret(limit->stms);
return(FALSE);
diff --git a/engines/glk/alan3/debug.cpp b/engines/glk/alan3/debug.cpp
index c196897531..25de184a7b 100644
--- a/engines/glk/alan3/debug.cpp
+++ b/engines/glk/alan3/debug.cpp
@@ -118,7 +118,7 @@ static void sayInstanceNumberAndName(int ins) {
/*----------------------------------------------------------------------*/
-static void sayLocationOfInstance(int ins, char *prefix) {
+static void sayLocationOfInstance(int ins, const char *prefix) {
if (admin[ins].location == 0)
return;
else {
@@ -598,7 +598,7 @@ static void setBreakpoint(int file, int line) {
int lineIndex = findSourceLineIndex((SourceLineEntry *)pointerTo(header->sourceLineTable), file, line);
SourceLineEntry *entry = (SourceLineEntry *)pointerTo(header->sourceLineTable);
char leadingText[100] = "Breakpoint";
- if (entry[lineIndex].file == EOD) {
+ if (entry[lineIndex].file == (Aint)EOD) {
printf("Line %d not available\n", line);
} else {
if (entry[lineIndex].line != line)
@@ -684,13 +684,13 @@ void restoreInfo(void)
#define TRACE_STACK_COMMAND 't'
typedef struct DebugParseEntry {
- char *command;
- char *parameter;
+ const char *command;
+ const char *parameter;
char code;
- char *helpText;
+ const char *helpText;
} DebugParseEntry;
-static DebugParseEntry commandEntries[] = {
+static const DebugParseEntry commandEntries[] = {
{"help", "", HELP_COMMAND, "this help"},
{"?", "", HELP_COMMAND, "d:o"},
{"break", "[[file:]n]", BREAK_COMMAND, "set breakpoint at source line [n] (optionally in [file])"},
@@ -708,16 +708,16 @@ static DebugParseEntry commandEntries[] = {
{"exit", "", EXIT_COMMAND, "exit to game, enter 'debug' to get back"},
{"x", "", EXIT_COMMAND, "d:o"},
{"quit", "", QUIT_COMMAND, "quit game"},
- {NULL, NULL}
+ {NULL, NULL, '\0', NULL}
};
-static DebugParseEntry traceSubcommand[] = {
+static const DebugParseEntry traceSubcommand[] = {
{"source", "", TRACE_SOURCE_COMMAND, ""},
{"section", "", TRACE_SECTION_COMMAND, ""},
{"instructions", "", TRACE_INSTRUCTION_COMMAND, ""},
{"pushs", "", TRACE_PUSH_COMMAND, ""},
{"stacks", "", TRACE_STACK_COMMAND, ""},
- {NULL, NULL}
+ {NULL, NULL, '\0', NULL}
};
@@ -733,7 +733,7 @@ static char *spaces(int length) {
/*----------------------------------------------------------------------*/
-static char *padding(DebugParseEntry *entry, int maxLength) {
+static char *padding(const DebugParseEntry *entry, int maxLength) {
return spaces(maxLength-strlen(entry->command)-strlen(entry->parameter));
}
@@ -743,7 +743,7 @@ static void handleHelpCommand() {
if (!regressionTestOption)
output(alan.longHeader);
- DebugParseEntry *entry = commandEntries;
+ const DebugParseEntry *entry = commandEntries;
int maxLength = 0;
for (entry = commandEntries; entry->command != NULL; entry++) {
@@ -761,7 +761,7 @@ static void handleHelpCommand() {
/*----------------------------------------------------------------------*/
-static DebugParseEntry *findEntry(char *command, DebugParseEntry *entry) {
+static const DebugParseEntry *findEntry(char *command, const DebugParseEntry *entry) {
while (entry->command != NULL) {
if (strncasecmp(command, entry->command, strlen(command)) == 0)
return entry;
@@ -773,7 +773,7 @@ static DebugParseEntry *findEntry(char *command, DebugParseEntry *entry) {
/*----------------------------------------------------------------------*/
static char parseDebugCommand(char *command) {
- DebugParseEntry *entry = findEntry(command, commandEntries);
+ const DebugParseEntry *entry = findEntry(command, commandEntries);
if (entry != NULL) {
if (strlen(command) < strlen(entry->command)) {
/* See if there are any more partial matches */
@@ -812,7 +812,7 @@ static void readCommand(char buf[]) {
/*----------------------------------------------------------------------*/
static void displaySourceLocation(int line, int fileNumber) {
- char *cause;
+ const char *cause;
if (anyOutput) newline();
if (breakpointIndex(fileNumber, line) != -1)
cause = "Breakpoint hit at";
@@ -871,7 +871,7 @@ static void toggleStackTrace() {
/*----------------------------------------------------------------------*/
static int parseTraceCommand() {
char *subcommand = strtok(NULL, "");
- DebugParseEntry *entry;
+ const DebugParseEntry *entry;
if (subcommand == 0)
return UNKNOWN_COMMAND;
else {
@@ -889,7 +889,7 @@ static int parseTraceCommand() {
/*----------------------------------------------------------------------*/
-static char *printTraceState(bool state) {
+static const char *printTraceState(bool state) {
if (state)
return "on - Traces";
else
diff --git a/engines/glk/alan3/decode.cpp b/engines/glk/alan3/decode.cpp
index 4fe2af7df1..41afbddca6 100644
--- a/engines/glk/alan3/decode.cpp
+++ b/engines/glk/alan3/decode.cpp
@@ -48,7 +48,7 @@ static int inputBit(void)
if (!bitsToGo) {
/* No, so get more */
decodeBuffer = (textFile->pos() >= textFile->size()) ? EOD : textFile->readByte();
- if (decodeBuffer == EOD) {
+ if (decodeBuffer == (int)EOD) {
garbageBits++;
if (garbageBits > VALUEBITS-2)
syserr("Error in encoded data file.");
diff --git a/engines/glk/alan3/exe.cpp b/engines/glk/alan3/exe.cpp
index 7f0fe2b687..f37cc2f661 100644
--- a/engines/glk/alan3/exe.cpp
+++ b/engines/glk/alan3/exe.cpp
@@ -340,8 +340,10 @@ void schedule(Aword event, Aword where, Aword after)
cancelEvent(event);
/* Check for overflow */
- if (eventQueue == NULL || eventQueueTop == eventQueueSize)
+ if (eventQueue == nullptr || eventQueueTop == eventQueueSize) {
increaseEventQueue();
+ assert(eventQueue);
+ }
/* Bubble this event down */
for (i = eventQueueTop; i >= 1 && eventQueue[i-1].after <= (int)after; i--) {
@@ -713,35 +715,33 @@ bool streq(char a[], char b[])
/*======================================================================*/
void startTranscript(void) {
- if (logFile != NULL)
- return;
-
- Common::String filename = g_vm->getTargetName() + ".log";
-
- uint fileUsage = transcriptOption ? fileusage_Transcript : fileusage_InputRecord;
- frefid_t logFileRef = g_vm->glk_fileref_create_by_name(fileUsage, filename.c_str(), 0);
- logFile = g_vm->glk_stream_open_file(logFileRef, filemode_Write, 0);
-
- if (logFile == NULL) {
- transcriptOption = FALSE;
- logOption = FALSE;
- } else {
- transcriptOption = TRUE;
+ if (logFile == NULL) {
+ Common::String filename = g_vm->getTargetName() + ".log";
+
+ uint fileUsage = transcriptOption ? fileusage_Transcript : fileusage_InputRecord;
+ frefid_t logFileRef = g_vm->glk_fileref_create_by_name(fileUsage, filename.c_str(), 0);
+ logFile = g_vm->glk_stream_open_file(logFileRef, filemode_Write, 0);
+
+ if (logFile == NULL) {
+ transcriptOption = FALSE;
+ logOption = FALSE;
+ } else {
+ transcriptOption = TRUE;
+ }
}
}
/*======================================================================*/
void stopTranscript(void) {
- if (logFile == NULL)
- return;
-
- if (transcriptOption|| logOption)
- delete logFile;
+ if (logFile != NULL) {
+ if (transcriptOption|| logOption)
+ delete logFile;
- logFile = NULL;
- transcriptOption = FALSE;
- logOption = FALSE;
+ logFile = NULL;
+ transcriptOption = FALSE;
+ logOption = FALSE;
+ }
}
} // End of namespace Alan3
diff --git a/engines/glk/alan3/glkstart.cpp b/engines/glk/alan3/glkstart.cpp
index 0c54cfd447..da20f0fd66 100644
--- a/engines/glk/alan3/glkstart.cpp
+++ b/engines/glk/alan3/glkstart.cpp
@@ -42,7 +42,7 @@
namespace Glk {
namespace Alan3 {
-glkunix_argumentlist_t glkunix_arguments[] = {
+const glkunix_argumentlist_t glkunix_arguments[] = {
{ "-l", glkunix_arg_NoValue, "-l: log player command and game output" },
{ "-c", glkunix_arg_NoValue, "-c: log player commands to a file" },
{ "-n", glkunix_arg_NoValue, "-n: no status line" },
diff --git a/engines/glk/alan3/glkstart.h b/engines/glk/alan3/glkstart.h
index 4420bea2f9..2bc2e9c9dc 100644
--- a/engines/glk/alan3/glkstart.h
+++ b/engines/glk/alan3/glkstart.h
@@ -60,9 +60,9 @@ namespace Alan3 {
#define glkunix_arg_NumberValue (4)
struct glkunix_argumentlist_t {
- char *name;
+ const char *name;
int argtype;
- char *desc;
+ const char *desc;
};
struct glkunix_startup_t {
@@ -71,7 +71,7 @@ struct glkunix_startup_t {
};
/* The list of command-line arguments; this should be defined in your code. */
-extern glkunix_argumentlist_t glkunix_arguments[];
+extern const glkunix_argumentlist_t glkunix_arguments[];
/* The external function; this should be defined in your code. */
extern int glkunix_startup_code(glkunix_startup_t *data);
diff --git a/engines/glk/alan3/instance.cpp b/engines/glk/alan3/instance.cpp
index a761b5603d..d2670f3b46 100644
--- a/engines/glk/alan3/instance.cpp
+++ b/engines/glk/alan3/instance.cpp
@@ -202,7 +202,7 @@ Set *getInstanceSetAttribute(int instance, int attribute)
/*----------------------------------------------------------------------*/
-static void verifyInstance(int instance, char *action) {
+static void verifyInstance(int instance, const char *action) {
char message[200];
if (instance == 0) {
@@ -1053,7 +1053,7 @@ static void locateActor(Aint movingActor, Aint whr)
/*----------------------------------------------------------------------*/
-static void traceExtract(int instance, int containerId, char *what) {
+static void traceExtract(int instance, int containerId, const char *what) {
if (traceSectionOption) {
printf("\n<EXTRACT from ");
traceSay(instance);
diff --git a/engines/glk/alan3/inter.cpp b/engines/glk/alan3/inter.cpp
index e4e98fd81c..457f75dc71 100644
--- a/engines/glk/alan3/inter.cpp
+++ b/engines/glk/alan3/inter.cpp
@@ -71,7 +71,7 @@ void setInterpreterStack(Stack theStack)
/*----------------------------------------------------------------------*/
-static void traceInstruction(char *str, ...) {
+static void traceInstruction(const char *str, ...) {
va_list args;
if (traceInstructionOption) {
@@ -236,7 +236,7 @@ static void depexec(Aword v)
{
int lev = 1;
Aword i;
- char *instructionString = "DEPELSE";
+ const char *instructionString = "DEPELSE";
if (!v) {
/* The expression was not true, skip to next CASE on the same
@@ -306,13 +306,13 @@ static void depcase(void)
/*----------------------------------------------------------------------*/
-static char *booleanValue(Abool value) {
+static const char *booleanValue(Abool value) {
if (value) return " TRUE";
else return " FALSE";
}
/*----------------------------------------------------------------------*/
-static char *stringValue(Aptr address) {
+static const char *stringValue(Aptr address) {
static char string[1000];
sprintf(string, "0x%lx (\"%s\")\t\t", (unsigned long) address, (char *)fromAptr(address));
@@ -320,7 +320,7 @@ static char *stringValue(Aptr address) {
}
/*----------------------------------------------------------------------*/
-static char *pointerValue(Aptr address) {
+static const char *pointerValue(Aptr address) {
static char string[100];
sprintf(string, "@%6lx",(unsigned long) address);
@@ -365,7 +365,7 @@ static void traceInstanceTopValue() {
}
/*----------------------------------------------------------------------*/
-static char *transitivityFlag(ATrans value) {
+static const char *transitivityFlag(ATrans value) {
switch (value) {
case TRANSITIVE:
return "Transitive";
@@ -379,7 +379,7 @@ static char *transitivityFlag(ATrans value) {
}
/*----------------------------------------------------------------------*/
-static char *printForm(SayForm form) {
+static const char *printForm(SayForm form) {
switch (form) {
case SAY_SIMPLE: return "-";
case SAY_INDEFINITE: return "An";
diff --git a/engines/glk/alan3/main.cpp b/engines/glk/alan3/main.cpp
index a3be710c7d..030579f97c 100644
--- a/engines/glk/alan3/main.cpp
+++ b/engines/glk/alan3/main.cpp
@@ -153,11 +153,7 @@ static void runPendingEvents(void)
\*----------------------------------------------------------------------*/
-
Common::SeekableReadStream *codfil;
-static char codfnm[256] = "";
-static char txtfnm[256] = "";
-
/*----------------------------------------------------------------------
Calculate where to start calculating the CRC. Is different for
@@ -255,7 +251,7 @@ static void loadAndCheckMemory(ACodeHeader tmphdr, Aword crc, char err[]) {
/*----------------------------------------------------------------------*/
-static char *decodeState(int c) {
+static const char *decodeState(int c) {
static char state[3] = "\0\0";
switch (c) {
case 0: return ".";
diff --git a/engines/glk/alan3/output.cpp b/engines/glk/alan3/output.cpp
index e6f921ec2e..be27484b96 100644
--- a/engines/glk/alan3/output.cpp
+++ b/engines/glk/alan3/output.cpp
@@ -142,14 +142,15 @@ void clear(void)
/*----------------------------------------------------------------------*/
-static void capitalizeFirst(char *str) {
+static void capitalizeFirst(Common::String &str) {
uint i = 0;
- /* Skip over space... */
- while (i < strlen(str) && isSpace(str[i])) i++;
- if (i < strlen(str)) {
- str[i] = toUpper(str[i]);
- capitalize = FALSE;
+ // Skip over space...
+ while (i < str.size() && isSpace(str[i])) i++;
+
+ if (i < str.size()) {
+ str.setChar(toUpper(str[i]), i);
+ capitalize = false;
}
}
@@ -194,13 +195,14 @@ void printAndLog(const char *string)
/*----------------------------------------------------------------------*/
-static void justify(char str[])
-{
+static void justify(const char *str) {
+ Common::String tempStr(str);
+
if (capitalize)
- capitalizeFirst(str);
+ capitalizeFirst(tempStr);
#ifdef HAVE_GLK
- printAndLog(str);
+ printAndLog(tempStr.c_str());
#else
int i;
char ch;
@@ -230,7 +232,7 @@ static void justify(char str[])
}
printAndLog(str); /* Print tail */
#endif
- col = col + strlen(str); /* Update column */
+ col = col + tempStr.size(); // Update column
}
@@ -370,7 +372,7 @@ static char *printSymbol(char str[]) /* IN - The string starting with '$' */
break;
case 'v':
space();
- justify((char *)pointerTo(dictionary[verbWord].string));
+ justify((const char *)pointerTo(dictionary[verbWord].string));
needSpace = TRUE; /* We did print something non-white */
break;
case 'p':
diff --git a/engines/glk/alan3/parse.cpp b/engines/glk/alan3/parse.cpp
index 5faa50ca1f..a1967e6a60 100644
--- a/engines/glk/alan3/parse.cpp
+++ b/engines/glk/alan3/parse.cpp
@@ -224,7 +224,7 @@ static void errorNoSuch(Parameter parameter) {
/* If there was no instance, assume the last word used is the noun,
* then find any instance with the noun he used */
- if (parameter.instance == -1)
+ if (parameter.instance == (Aid)-1)
parameter.instance = 0;
if (parameter.instance == 0)
parameter.instance = findInstanceForNoun(playerWords[parameter.lastWord].code);
@@ -745,7 +745,7 @@ static ElementEntry *elementForParameter(ElementEntry *elms) {
/*----------------------------------------------------------------------*/
static ElementEntry *elementForEndOfSyntax(ElementEntry *elms) {
- while (!isEndOfArray(elms) && elms->code != EOS)
+ while (!isEndOfArray(elms) && (Aword)elms->code != EOS)
elms++;
if (isEndOfArray(elms)) /* No match for EOS! */
return NULL;
diff --git a/engines/glk/alan3/readline.cpp b/engines/glk/alan3/readline.cpp
index 552e3b5627..fa965bbd76 100644
--- a/engines/glk/alan3/readline.cpp
+++ b/engines/glk/alan3/readline.cpp
@@ -147,7 +147,9 @@ bool readline(char buffer[])
}
break;
#endif
- }
+ default:
+ break;
+ }
} while (event.type != evtype_LineInput);
if (buffer[0] == '@') {
buffer[event.val1] = 0;
diff --git a/engines/glk/alan3/reverse.cpp b/engines/glk/alan3/reverse.cpp
index d31e7c3f2f..2a0cd427ad 100644
--- a/engines/glk/alan3/reverse.cpp
+++ b/engines/glk/alan3/reverse.cpp
@@ -78,7 +78,7 @@ Aword reversed(Aword w) /* IN - The ACODE word to swap bytes of */
#else
Aword s; /* The swapped ACODE word */
char *wp, *sp;
- int i;
+ uint i;
wp = (char *) &w;
sp = (char *) &s;
@@ -109,7 +109,7 @@ static void reverseTable(Aword adr, int elementSize)
Aword *e = &memory[adr];
uint i;
- if (elementSize < sizeof(Aword) || elementSize % sizeof(Aword) != 0)
+ if (elementSize < (int)sizeof(Aword) || elementSize % (int)sizeof(Aword) != 0)
syserr("***Wrong size in 'reverseTable()' ***");
if (adr == 0) return;
@@ -351,7 +351,7 @@ static void reverseElms(Aword adr)
if (!isEndOfArray(e)) {
reverseTable(adr, sizeof(ElementEntry));
while (!isEndOfArray(e)) {
- if (e->code == EOS) reverseRestrictions(e->next);
+ if ((uint)e->code == EOS) reverseRestrictions(e->next);
else reverseElms(e->next);
e++;
}
@@ -520,7 +520,7 @@ static void reverseSetInitTable(Aaddr adr)
/*----------------------------------------------------------------------*/
static void reversePreAlpha5Header(Pre3_0alpha5Header *hdr)
{
- int i;
+ uint i;
/* Reverse all words in the header except the tag */
for (i = 1; i < sizeof(*hdr)/sizeof(Aword); i++)
@@ -561,7 +561,7 @@ static void reversePreAlpha5() {
/*----------------------------------------------------------------------*/
static void reversePreBeta2Header(Pre3_0beta2Header *hdr)
{
- int i;
+ uint i;
/* Reverse all words in the header except the tag */
for (i = 1; i < sizeof(*hdr)/sizeof(Aword); i++)
@@ -602,7 +602,7 @@ static void reversePreBeta2() {
/*======================================================================*/
void reverseHdr(ACodeHeader *hdr)
{
- int i;
+ uint i;
/* Reverse all words in the header except the tag and the version marking */
for (i = 1; i < sizeof(*hdr)/sizeof(Aword); i++)
diff --git a/engines/glk/alan3/scan.cpp b/engines/glk/alan3/scan.cpp
index 4f3855abc8..64c0e6234c 100644
--- a/engines/glk/alan3/scan.cpp
+++ b/engines/glk/alan3/scan.cpp
@@ -78,7 +78,7 @@ static void unknown(char tok[]) {
static int number(char tok[]) {
int i;
- sscanf(tok, "%d", &i);
+ (void)sscanf(tok, "%d", &i);
return i;
}
diff --git a/engines/glk/alan3/sysdep.cpp b/engines/glk/alan3/sysdep.cpp
index 7e9dc48ce9..6b663938d7 100644
--- a/engines/glk/alan3/sysdep.cpp
+++ b/engines/glk/alan3/sysdep.cpp
@@ -140,7 +140,7 @@ static const byte upperCaseCharacters[] =
int isSpace(unsigned int c) /* IN - Native character to test */
{
- return (c != '\0' && strchr((char *)spaceCharacters, c) != 0);
+ return (c != '\0' && strchr((const char *)spaceCharacters, c) != 0);
}
@@ -471,7 +471,7 @@ int littleEndian() {
/*======================================================================*/
char *baseNameStart(char *fullPathName) {
- static char *delimiters = "\\>]/:";
+ const char *delimiters = "\\>]/:";
int i;
for (i = strlen(fullPathName)-1; i > 0; i--)
diff --git a/engines/glk/alan3/syserr.cpp b/engines/glk/alan3/syserr.cpp
index 2fceba6059..9ebd397380 100644
--- a/engines/glk/alan3/syserr.cpp
+++ b/engines/glk/alan3/syserr.cpp
@@ -30,10 +30,10 @@
namespace Glk {
namespace Alan3 {
-static void (*handler)(char *) = NULL;
+static void (*handler)(const char *);
/*----------------------------------------------------------------------*/
-static void runtimeError(char *errorClassification, char *errorDescription, char *blurb) {
+static void runtimeError(const char *errorClassification, const char *errorDescription, const char *blurb) {
output("$n$nAs you enter the twilight zone of Adventures, you stumble \
and fall to your knees. In front of you, you can vaguely see the outlines \
of an Adventure that never was.$n$n");
@@ -54,7 +54,7 @@ of an Adventure that never was.$n$n");
/*======================================================================*/
-void setSyserrHandler(void (*f)(char *))
+void setSyserrHandler(void (*f)(const char *))
{
handler = f;
}
@@ -62,11 +62,11 @@ void setSyserrHandler(void (*f)(char *))
/*======================================================================*/
// TODO Make syserr() use ... as printf()
-void syserr(char *description)
+void syserr(const char *description)
{
lin = 0;
if (handler == NULL) {
- char *blurb = "<If you are the creator of this piece of Interactive Fiction, \
+ const char *blurb = "<If you are the creator of this piece of Interactive Fiction, \
please help debug this Alan system error. Collect *all* the sources, and, if possible, an \
exact transcript of the commands that led to this error, in a zip-file and send \
it to support@alanif.se. Thank you!>";
@@ -77,10 +77,10 @@ it to support@alanif.se. Thank you!>";
/*======================================================================*/
-void apperr(char *description)
+void apperr(const char *description)
{
if (handler == NULL) {
- char *blurb = "<If you are playing this piece of Interactive Fiction, \
+ const char *blurb = "<If you are playing this piece of Interactive Fiction, \
please help the author to debug this programming error. Send an exact \
transcript of the commands that led to this error to the author. Thank you! \
If you *are* the author, then you have to figure this out before releasing the game.>";
@@ -90,10 +90,10 @@ If you *are* the author, then you have to figure this out before releasing the g
}
/*======================================================================*/
-void playererr(char *description)
+void playererr(const char *description)
{
if (handler == NULL) {
- char *blurb = "<You have probably done something that is not exactly right.>";
+ const char *blurb = "<You have probably done something that is not exactly right.>";
runtimeError("PLAYER ERROR: ", description, blurb);
} else
handler(description);
diff --git a/engines/glk/alan3/syserr.h b/engines/glk/alan3/syserr.h
index 84c2178ddb..3202600bd5 100644
--- a/engines/glk/alan3/syserr.h
+++ b/engines/glk/alan3/syserr.h
@@ -29,10 +29,10 @@ namespace Glk {
namespace Alan3 {
/* Functions: */
-extern void syserr(char *msg);
-extern void apperr(char *msg);
-extern void playererr(char *msg);
-extern void setSyserrHandler(void (*handler)(char *));
+extern void syserr(const char *msg);
+extern void apperr(const char *msg);
+extern void playererr(const char *msg);
+extern void setSyserrHandler(void (*handler)(const char *));
} // End of namespace Alan3
} // End of namespace Glk
diff --git a/engines/glk/alan3/utils.cpp b/engines/glk/alan3/utils.cpp
index bcbaa47cb0..9b9b6edbef 100644
--- a/engines/glk/alan3/utils.cpp
+++ b/engines/glk/alan3/utils.cpp
@@ -69,7 +69,7 @@ void printVersion(int buildNumber) {
/*======================================================================*/
-void usage(char *programName)
+void usage(const char *programName)
{
#if (BUILD+0) != 0
printVersion(BUILD);
@@ -100,7 +100,7 @@ void usage(char *programName)
#define FNM_CASEFOLD 0
#endif
/*======================================================================*/
-bool match(char *pattern, char *input) {
+bool match(const char *pattern, char *input) {
return fnmatch(pattern, input, FNM_CASEFOLD) == 0;
}
diff --git a/engines/glk/alan3/utils.h b/engines/glk/alan3/utils.h
index 1a6d470504..f103436e86 100644
--- a/engines/glk/alan3/utils.h
+++ b/engines/glk/alan3/utils.h
@@ -32,9 +32,9 @@ namespace Alan3 {
/* FUNCTIONS: */
extern void terminate(int code);
-extern void usage(char *programName);
+extern void usage(const char *programName);
extern void printVersion(int buildNumber);
-extern bool match(char *pattern, char *input);
+extern bool match(const char *pattern, char *input);
} // End of namespace Alan3
} // End of namespace Glk