From b35c555e1b3361156addc58a87826f936ced7fde Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 5 Sep 2016 08:12:47 +0200 Subject: [PATCH] DIRECTOR: Fix warnings --- engines/director/lingo/lingo-builtins.cpp | 2 +- engines/director/lingo/lingo-code.cpp | 10 +++++----- engines/director/lingo/lingo-codegen.cpp | 4 ++-- engines/director/lingo/lingo.cpp | 4 ++-- engines/director/lingo/lingo.h | 8 ++++---- engines/director/score.cpp | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp index bad585cfe15..9220b14f097 100644 --- a/engines/director/lingo/lingo-builtins.cpp +++ b/engines/director/lingo/lingo-builtins.cpp @@ -183,7 +183,7 @@ void Lingo::dropStack(int nargs) { pop(); } -void Lingo::drop(int num) { +void Lingo::drop(uint num) { if (num > _stack.size() - 1) { warning("Incorrect number of elements to drop from stack: %d > %d", num, _stack.size() - 1); return; diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp index 66f16536f8d..19361354a22 100644 --- a/engines/director/lingo/lingo-code.cpp +++ b/engines/director/lingo/lingo-code.cpp @@ -778,7 +778,7 @@ void Lingo::c_whencode() { g_lingo->define(eventname, start, 0, NULL, end); if (debugChannelSet(3, kDebugLingoExec)) { - int pc = start; + uint pc = start; while (pc <= end) { Common::String instr = g_lingo->decodeInstruction(pc, &pc); debugC(3, kDebugLingoExec, "[%5d] %s", pc, instr.c_str()); @@ -855,7 +855,7 @@ void Lingo::c_call() { } void Lingo::call(Common::String name, int nargs) { - bool drop = false; + bool dropArgs = false; Symbol *sym; @@ -869,7 +869,7 @@ void Lingo::call(Common::String name, int nargs) { if (!g_lingo->_handlers.contains(name)) { warning("Call to undefined handler '%s'. Dropping %d stack items", name.c_str(), nargs); - drop = true; + dropArgs = true; } else { sym = g_lingo->_handlers[name]; @@ -879,11 +879,11 @@ void Lingo::call(Common::String name, int nargs) { else warning("Incorrect number of arguments to handler '%s', expecting %d or %d. Dropping %d stack items", name.c_str(), sym->nargs, sym->maxArgs, nargs); - drop = true; + dropArgs = true; } } - if (drop) { + if (dropArgs) { for (int i = 0; i < nargs; i++) g_lingo->pop(); diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp index 440efb5b44c..ba39d104476 100644 --- a/engines/director/lingo/lingo-codegen.cpp +++ b/engines/director/lingo/lingo-codegen.cpp @@ -51,7 +51,7 @@ namespace Director { -void Lingo::execute(int pc) { +void Lingo::execute(uint pc) { for(_pc = pc; (*_currentScript)[_pc] != STOP && !_returning;) { Common::String instr = decodeInstruction(_pc); @@ -79,7 +79,7 @@ void Lingo::printStack(const char *s) { debugC(5, kDebugLingoExec, "%s", stack.c_str()); } -Common::String Lingo::decodeInstruction(int pc, int *newPc) { +Common::String Lingo::decodeInstruction(uint pc, uint *newPc) { Symbol sym; Common::String res; diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp index 30714deec1b..cef7f330a19 100644 --- a/engines/director/lingo/lingo.cpp +++ b/engines/director/lingo/lingo.cpp @@ -197,7 +197,7 @@ void Lingo::addCode(const char *code, ScriptType type, uint16 id) { parse(chunk.c_str()); if (debugChannelSet(3, kDebugLingoCompile)) { - int pc = 0; + uint pc = 0; while (pc < _currentScript->size()) { Common::String instr = decodeInstruction(pc, &pc); debugC(3, kDebugLingoCompile, "[%5d] %s", pc, instr.c_str()); @@ -225,7 +225,7 @@ void Lingo::addCode(const char *code, ScriptType type, uint16 id) { if (_currentScript->size() && !_hadError) Common::hexdump((byte *)&_currentScript->front(), _currentScript->size() * sizeof(inst)); - int pc = 0; + uint pc = 0; while (pc < _currentScript->size()) { Common::String instr = decodeInstruction(pc, &pc); debugC(3, kDebugLingoCompile, "[%5d] %s", pc, instr.c_str()); diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h index 05c73f98863..931ac7b6da7 100644 --- a/engines/director/lingo/lingo.h +++ b/engines/director/lingo/lingo.h @@ -175,7 +175,7 @@ public: void addCode(const char *code, ScriptType type, uint16 id); void executeScript(ScriptType type, uint16 id); void printStack(const char *s); - Common::String decodeInstruction(int pc, int *newPC = NULL); + Common::String decodeInstruction(uint pc, uint *newPC = NULL); ScriptType event2script(LEvent ev); @@ -193,7 +193,7 @@ private: const char *findNextDefinition(const char *s); public: - void execute(int pc); + void execute(uint pc); void pushContext(); void popContext(); Symbol *lookupVar(const char *name, bool create = true, bool putInGlobalList = false); @@ -296,7 +296,7 @@ public: void printStubWithArglist(const char *funcname, int nargs); void convertVOIDtoString(int arg, int nargs); void dropStack(int nargs); - void drop(int num); + void drop(uint num); static void b_abs(int nargs); static void b_atan(int nargs); @@ -445,7 +445,7 @@ private: FuncHash _functions; - int _pc; + uint _pc; StackData _stack; diff --git a/engines/director/score.cpp b/engines/director/score.cpp index 3e6ac7c81fd..fa4f4345b5a 100644 --- a/engines/director/score.cpp +++ b/engines/director/score.cpp @@ -820,7 +820,7 @@ void Score::processEvents() { Common::Event event; - int endTime = g_system->getMillis() + 200; + uint endTime = g_system->getMillis() + 200; while (g_system->getMillis() < endTime) { while (g_system->getEventManager()->pollEvent(event)) {