From 84c47349a9f06057640ddc35c015fdd97b30d839 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 11 May 2019 13:04:00 +1000 Subject: GLK: HUGO: Compilation fixes --- engines/glk/hugo/heglk.cpp | 10 ++++++---- engines/glk/hugo/hemisc.cpp | 4 ++-- engines/glk/hugo/heobject.cpp | 4 ++-- engines/glk/hugo/htokens.cpp | 2 +- engines/glk/hugo/hugo.cpp | 2 +- engines/glk/hugo/hugo.h | 10 +++++----- engines/glk/hugo/hugo_defines.h | 2 +- 7 files changed, 18 insertions(+), 16 deletions(-) (limited to 'engines/glk/hugo') diff --git a/engines/glk/hugo/heglk.cpp b/engines/glk/hugo/heglk.cpp index 1d4586c9ab..4884d0f8cf 100644 --- a/engines/glk/hugo/heglk.cpp +++ b/engines/glk/hugo/heglk.cpp @@ -74,6 +74,8 @@ void Hugo::hugo_getline(const char *prmpt) { gotline = true; } break; + default: + break; } } @@ -82,7 +84,7 @@ void Hugo::hugo_getline(const char *prmpt) { /* Copy the input to the script file (if open) */ if (script) { - Common::String text = Common::String::format("%s%s\n", prompt, buffer); + Common::String text = Common::String::format("%s%s\n", prmpt, buffer); script->putBuffer(text.c_str(), text.size()); } } @@ -122,6 +124,8 @@ int Hugo::hugo_waitforkey() { gotchar = true; } break; + default: + break; } } @@ -278,9 +282,7 @@ void Hugo::hugo_settextwindow(int left, int top, int right, int bottom) { glk_stylehint_set(wintype_TextGrid, style_Subheader, stylehint_ReverseColor, 1); glk_stylehint_set(wintype_TextGrid, style_Emphasized, stylehint_ReverseColor, 1); - winid_t p; - - p = glk_window_get_parent(mainwin); + //winid_t p = glk_window_get_parent(mainwin); secondwin = glk_window_open(mainwin,//p, winmethod_Above | winmethod_Fixed, bottom, diff --git a/engines/glk/hugo/hemisc.cpp b/engines/glk/hugo/hemisc.cpp index c5a77803f7..696b7a2666 100644 --- a/engines/glk/hugo/hemisc.cpp +++ b/engines/glk/hugo/hemisc.cpp @@ -550,7 +550,7 @@ ContextCommandLoop: } else if (context_commands < MAX_CONTEXT_COMMANDS) { - char *cc; + const char *cc; strncpy(context_command[context_commands], cc = GetWord(n), 64); context_command[context_commands][63] = '\0'; @@ -977,7 +977,7 @@ char *Hugo::GetText(long textaddr) { return g; } -char *Hugo::GetWord(unsigned int w) { +const char *Hugo::GetWord(unsigned int w) { static char *b; unsigned short a; diff --git a/engines/glk/hugo/heobject.cpp b/engines/glk/hugo/heobject.cpp index cc1416d98d..931f9a3abd 100644 --- a/engines/glk/hugo/heobject.cpp +++ b/engines/glk/hugo/heobject.cpp @@ -504,7 +504,7 @@ void Hugo::MoveObj(int obj, int p) { } } -char *Hugo::Name(int obj) { +const char *Hugo::Name(int obj) { int p; p = GetProp(obj, 0, 1, 0); @@ -512,7 +512,7 @@ char *Hugo::Name(int obj) { if (p) return GetWord((unsigned int)p); else - return 0; + return nullptr; } int Hugo::Parent(int obj) { diff --git a/engines/glk/hugo/htokens.cpp b/engines/glk/hugo/htokens.cpp index fd913b260e..172c36a160 100644 --- a/engines/glk/hugo/htokens.cpp +++ b/engines/glk/hugo/htokens.cpp @@ -21,7 +21,7 @@ */ #include "glk/hugo/htokens.h" -#include "Common/algorithm.h" +#include "common/algorithm.h" namespace Glk { namespace Hugo { diff --git a/engines/glk/hugo/hugo.cpp b/engines/glk/hugo/hugo.cpp index 0fca43222a..dccf978882 100644 --- a/engines/glk/hugo/hugo.cpp +++ b/engines/glk/hugo/hugo.cpp @@ -86,7 +86,7 @@ Hugo::Hugo(OSystem *syst, const GlkGameDescription &gameDesc) : GlkAPI(syst, gam Common::fill(&buffer[0], &buffer[MAXBUFFER + MAXWORDS], '\0'); Common::fill(&errbuf[0], &errbuf[MAXBUFFER + 1], 0); Common::fill(&line[0], &line[1025], 0); - Common::fill(&word[0], &word[MAXWORDS + 1], nullptr); + Common::fill(&word[0], &word[MAXWORDS + 1], (const char *)nullptr); Common::fill(&wd[0], &wd[MAXWORDS + 1], 0); Common::fill(&parseerr[0], &parseerr[MAXBUFFER + 1], '\0'); Common::fill(&parsestr[0], &parsestr[MAXBUFFER + 1], '\0'); diff --git a/engines/glk/hugo/hugo.h b/engines/glk/hugo/hugo.h index 1f5aaffa3e..a1e2c29494 100644 --- a/engines/glk/hugo/hugo.h +++ b/engines/glk/hugo/hugo.h @@ -144,7 +144,7 @@ private: char line[1025]; ///< line buffer int words; ///< parsed word count - char *word[MAXWORDS + 1]; ///< breakdown into words + const char *word[MAXWORDS + 1]; ///< breakdown into words unsigned int wd[MAXWORDS + 1]; ///< " " dict. entries unsigned int parsed_number; ///< needed for numbers in input @@ -433,7 +433,7 @@ private: /** * From the dictionary table. */ - char *GetWord(unsigned int w); + const char *GetWord(unsigned int w); void HandleTailRecursion(long addr); @@ -597,7 +597,7 @@ private: void MoveObj(int obj, int p); - char *Name(int obj); + const char *Name(int obj); int Parent(int obj); @@ -665,9 +665,9 @@ private: /** * Allocate memory block */ - void *hugo_blockalloc(size_t num) { return new byte[num]; } + void *hugo_blockalloc(size_t num) { return malloc(num); } - void hugo_blockfree(void *block) { delete[] block; } + void hugo_blockfree(void *block) { free(block); } public: /** * Constructor diff --git a/engines/glk/hugo/hugo_defines.h b/engines/glk/hugo/hugo_defines.h index 7809ea19b8..5609601ca8 100644 --- a/engines/glk/hugo/hugo_defines.h +++ b/engines/glk/hugo/hugo_defines.h @@ -153,7 +153,7 @@ browsing. #define CODE_WINDOW 2 #endif -#define PRINTFATALERROR(a) error(a) +#define PRINTFATALERROR(a) error("%s", a) } // End of namespace Hugo } // End of namespace Glk -- cgit v1.2.3