From 88b2b3a166333eac02803c0a7231f9f6c9b44c4e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 11 May 2019 16:38:31 +1000 Subject: [PATCH] GLK: HUGO: Compilation fixes --- engines/glk/hugo/hemisc.cpp | 4 +++- engines/glk/hugo/heparse.cpp | 13 ++++++++----- engines/glk/hugo/herun.cpp | 11 +++++------ engines/glk/hugo/hugo.h | 6 ++++++ engines/glk/hugo/stringfn.cpp | 6 ++++++ engines/glk/hugo/stringfn.h | 2 ++ 6 files changed, 30 insertions(+), 12 deletions(-) diff --git a/engines/glk/hugo/hemisc.cpp b/engines/glk/hugo/hemisc.cpp index 07800bbcf85..c380fbbe6a9 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 2a70fed89d8..03693853984 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; igetTimeAndDate(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 d022b1f2b01..98fbf9058a2 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 79886aca870..4e94b3e495e 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 bb339fc0478..2ee6e3ed74a 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); };