From 395174301b7a3b00a34e3c42176f64089990fed5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 28 Jun 2019 19:48:56 -0700 Subject: GLK: ALAN3: Change header version field from char[4] to byte[4] --- engines/glk/alan3/acode.h | 6 +++--- engines/glk/alan3/compatibility.cpp | 16 ++++++++-------- engines/glk/alan3/compatibility.h | 12 ++++++------ engines/glk/alan3/main.cpp | 6 +++--- engines/glk/alan3/reverse.cpp | 4 ++-- engines/glk/alan3/rules.cpp | 2 +- engines/glk/alan3/rules.h | 2 +- 7 files changed, 24 insertions(+), 24 deletions(-) diff --git a/engines/glk/alan3/acode.h b/engines/glk/alan3/acode.h index 03391b1986..7aa1d8e92d 100644 --- a/engines/glk/alan3/acode.h +++ b/engines/glk/alan3/acode.h @@ -505,7 +505,7 @@ struct DictionaryEntry { /* Dictionary */ struct ACodeHeader { /* Important info */ char tag[4]; /* "ALAN" */ - char version[4]; /* Version of compiler */ + byte version[4]; /* Version of compiler */ Aword uid; /* Unique id of the compiled game */ Aword size; /* Size of ACD-file in Awords */ /* Options */ @@ -562,7 +562,7 @@ struct ACodeHeader { struct Pre3_0beta2Header { /* Important info */ char tag[4]; /* "ALAN" */ - char version[4]; /* Version of compiler */ + byte version[4]; /* Version of compiler */ Aword uid; /* Unique id of the compiled game */ Aword size; /* Size of ACD-file in Awords */ /* Options */ @@ -618,7 +618,7 @@ struct Pre3_0beta2Header { struct Pre3_0alpha5Header { /* Important info */ char tag[4]; /* "ALAN" */ - char version[4]; /* Version of compiler */ + byte version[4]; /* Version of compiler */ Aword uid; /* Unique id of the compiled game */ Aword size; /* Size of ACD-file in Awords */ /* Options */ diff --git a/engines/glk/alan3/compatibility.cpp b/engines/glk/alan3/compatibility.cpp index 4668d6ea82..aedfae86ec 100644 --- a/engines/glk/alan3/compatibility.cpp +++ b/engines/glk/alan3/compatibility.cpp @@ -26,42 +26,42 @@ namespace Glk { namespace Alan3 { /*----------------------------------------------------------------------*/ -static bool is3_0Alpha(char version[]) { +static bool is3_0Alpha(const byte version[]) { return version[3] == 3 && version[2] == 0 && version[0] == 'a'; } /*----------------------------------------------------------------------*/ -static bool is3_0Beta(char version[]) { +static bool is3_0Beta(const byte version[]) { return version[3] == 3 && version[2] == 0 && version[0] == 'b'; } /*----------------------------------------------------------------------*/ -static int correction(char version[]) { +static int correction(const byte version[]) { return version[1]; } /*======================================================================*/ -bool isPreAlpha5(char version[4]) { +bool isPreAlpha5(const byte version[4]) { return is3_0Alpha(version) && correction(version) < 5; } /*======================================================================*/ -bool isPreBeta2(char version[4]) { +bool isPreBeta2(const byte version[4]) { return is3_0Alpha(version) || (is3_0Beta(version) && correction(version) == 1); } /*======================================================================*/ -bool isPreBeta3(char version[4]) { +bool isPreBeta3(const byte version[4]) { return is3_0Alpha(version) || (is3_0Beta(version) && correction(version) <= 2); } /*======================================================================*/ -bool isPreBeta4(char version[4]) { +bool isPreBeta4(const byte version[4]) { return is3_0Alpha(version) || (is3_0Beta(version) && correction(version) <= 3); } /*======================================================================*/ -bool isPreBeta5(char version[4]) { +bool isPreBeta5(const byte version[4]) { return is3_0Alpha(version) || (is3_0Beta(version) && correction(version) <= 4); } diff --git a/engines/glk/alan3/compatibility.h b/engines/glk/alan3/compatibility.h index 0187c72ff8..8b759c5232 100644 --- a/engines/glk/alan3/compatibility.h +++ b/engines/glk/alan3/compatibility.h @@ -29,12 +29,12 @@ namespace Glk { namespace Alan3 { /* FUNCTIONS: */ -extern bool isPreAlpha5(char version[4]); -extern bool isPreBeta2(char version[4]); -extern bool isPreBeta3(char version[4]); -extern bool isPreBeta4(char version[4]); -extern bool isPreBeta5(char version[4]); -extern char *decodedGameVersion(char version[]); +extern bool isPreAlpha5(const byte version[4]); +extern bool isPreBeta2(const byte version[4]); +extern bool isPreBeta3(const byte version[4]); +extern bool isPreBeta4(const byte version[4]); +extern bool isPreBeta5(const byte version[4]); +extern char *decodedGameVersion(const byte version[]); } // End of namespace Alan3 } // End of namespace Glk diff --git a/engines/glk/alan3/main.cpp b/engines/glk/alan3/main.cpp index 6fc5e014a6..f09a54c6be 100644 --- a/engines/glk/alan3/main.cpp +++ b/engines/glk/alan3/main.cpp @@ -120,7 +120,7 @@ Common::SeekableReadStream *codfil; be compatible. If header size changes this should return beta2 header size for later versions. */ -static int crcStart(char version[4]) { +static int crcStart(const byte version[4]) { /* Some earlier versions had a shorter header */ if (isPreAlpha5(version)) return sizeof(Pre3_0alpha5Header) / sizeof(Aword); @@ -229,7 +229,7 @@ static const char *decodeState(int c) { } /*======================================================================*/ -char *decodedGameVersion(char version[]) { +char *decodedGameVersion(const byte version[]) { static char str[100]; sprintf(str, "%d.%d%s%d", (int)version[3], @@ -278,7 +278,7 @@ static void alphaRunningLaterGame(char gameState) { } /*----------------------------------------------------------------------*/ -static void nonDevelopmentRunningDevelopmentStateGame(char version[]) { +static void nonDevelopmentRunningDevelopmentStateGame(const byte version[]) { char errorMessage[200]; char versionString[100]; diff --git a/engines/glk/alan3/reverse.cpp b/engines/glk/alan3/reverse.cpp index 6fa7aa56a3..4dcba1258a 100644 --- a/engines/glk/alan3/reverse.cpp +++ b/engines/glk/alan3/reverse.cpp @@ -368,7 +368,7 @@ static void reverseSyntaxTablePreBeta2(Aword adr) { } -static void reverseSyntaxTable(Aword adr, char version[]) { +static void reverseSyntaxTable(Aword adr, byte version[]) { if (!adr || alreadyDone(adr)) return; if (isPreBeta2(version)) @@ -634,7 +634,7 @@ static void reverseNative() { */ void reverseACD(void) { ACodeHeader *hdr = (ACodeHeader *)memory; - char version[4]; + byte version[4]; int i; /* Make a copy of the version marking to reverse */ diff --git a/engines/glk/alan3/rules.cpp b/engines/glk/alan3/rules.cpp index de64a8db9a..b589168fa9 100644 --- a/engines/glk/alan3/rules.cpp +++ b/engines/glk/alan3/rules.cpp @@ -243,7 +243,7 @@ void evaluateRules(RuleEntry ruleList[]) { /*=======================================================================*/ -void resetAndEvaluateRules(RuleEntry ruleList[], char *version) { +void resetAndEvaluateRules(RuleEntry ruleList[], const byte *version) { if (isPreBeta2(version)) evaluateRulesPreBeta2(); else if (isPreBeta3(version)) diff --git a/engines/glk/alan3/rules.h b/engines/glk/alan3/rules.h index 849fc506ae..65291a0a70 100644 --- a/engines/glk/alan3/rules.h +++ b/engines/glk/alan3/rules.h @@ -36,7 +36,7 @@ extern bool anyRuleRun; /* Did any rule run? */ /* FUNCTIONS */ extern void initRules(Aaddr rulesTableAddress); -extern void resetAndEvaluateRules(RuleEntry rules[], char *version); +extern void resetAndEvaluateRules(RuleEntry rules[], const byte *version); extern void resetRules(void); extern void evaluateRules(RuleEntry rules[]); -- cgit v1.2.3