DIRECTOR: Fix warnings

This commit is contained in:
Eugene Sandulenko 2016-09-05 08:12:47 +02:00
parent 5727c9099b
commit b35c555e1b
6 changed files with 15 additions and 15 deletions

View File

@ -183,7 +183,7 @@ void Lingo::dropStack(int nargs) {
pop(); pop();
} }
void Lingo::drop(int num) { void Lingo::drop(uint num) {
if (num > _stack.size() - 1) { if (num > _stack.size() - 1) {
warning("Incorrect number of elements to drop from stack: %d > %d", num, _stack.size() - 1); warning("Incorrect number of elements to drop from stack: %d > %d", num, _stack.size() - 1);
return; return;

View File

@ -778,7 +778,7 @@ void Lingo::c_whencode() {
g_lingo->define(eventname, start, 0, NULL, end); g_lingo->define(eventname, start, 0, NULL, end);
if (debugChannelSet(3, kDebugLingoExec)) { if (debugChannelSet(3, kDebugLingoExec)) {
int pc = start; uint pc = start;
while (pc <= end) { while (pc <= end) {
Common::String instr = g_lingo->decodeInstruction(pc, &pc); Common::String instr = g_lingo->decodeInstruction(pc, &pc);
debugC(3, kDebugLingoExec, "[%5d] %s", pc, instr.c_str()); 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) { void Lingo::call(Common::String name, int nargs) {
bool drop = false; bool dropArgs = false;
Symbol *sym; Symbol *sym;
@ -869,7 +869,7 @@ void Lingo::call(Common::String name, int nargs) {
if (!g_lingo->_handlers.contains(name)) { if (!g_lingo->_handlers.contains(name)) {
warning("Call to undefined handler '%s'. Dropping %d stack items", name.c_str(), nargs); warning("Call to undefined handler '%s'. Dropping %d stack items", name.c_str(), nargs);
drop = true; dropArgs = true;
} else { } else {
sym = g_lingo->_handlers[name]; sym = g_lingo->_handlers[name];
@ -879,11 +879,11 @@ void Lingo::call(Common::String name, int nargs) {
else 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); 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++) for (int i = 0; i < nargs; i++)
g_lingo->pop(); g_lingo->pop();

View File

@ -51,7 +51,7 @@
namespace Director { namespace Director {
void Lingo::execute(int pc) { void Lingo::execute(uint pc) {
for(_pc = pc; (*_currentScript)[_pc] != STOP && !_returning;) { for(_pc = pc; (*_currentScript)[_pc] != STOP && !_returning;) {
Common::String instr = decodeInstruction(_pc); Common::String instr = decodeInstruction(_pc);
@ -79,7 +79,7 @@ void Lingo::printStack(const char *s) {
debugC(5, kDebugLingoExec, "%s", stack.c_str()); 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; Symbol sym;
Common::String res; Common::String res;

View File

@ -197,7 +197,7 @@ void Lingo::addCode(const char *code, ScriptType type, uint16 id) {
parse(chunk.c_str()); parse(chunk.c_str());
if (debugChannelSet(3, kDebugLingoCompile)) { if (debugChannelSet(3, kDebugLingoCompile)) {
int pc = 0; uint pc = 0;
while (pc < _currentScript->size()) { while (pc < _currentScript->size()) {
Common::String instr = decodeInstruction(pc, &pc); Common::String instr = decodeInstruction(pc, &pc);
debugC(3, kDebugLingoCompile, "[%5d] %s", pc, instr.c_str()); 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) if (_currentScript->size() && !_hadError)
Common::hexdump((byte *)&_currentScript->front(), _currentScript->size() * sizeof(inst)); Common::hexdump((byte *)&_currentScript->front(), _currentScript->size() * sizeof(inst));
int pc = 0; uint pc = 0;
while (pc < _currentScript->size()) { while (pc < _currentScript->size()) {
Common::String instr = decodeInstruction(pc, &pc); Common::String instr = decodeInstruction(pc, &pc);
debugC(3, kDebugLingoCompile, "[%5d] %s", pc, instr.c_str()); debugC(3, kDebugLingoCompile, "[%5d] %s", pc, instr.c_str());

View File

@ -175,7 +175,7 @@ public:
void addCode(const char *code, ScriptType type, uint16 id); void addCode(const char *code, ScriptType type, uint16 id);
void executeScript(ScriptType type, uint16 id); void executeScript(ScriptType type, uint16 id);
void printStack(const char *s); 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); ScriptType event2script(LEvent ev);
@ -193,7 +193,7 @@ private:
const char *findNextDefinition(const char *s); const char *findNextDefinition(const char *s);
public: public:
void execute(int pc); void execute(uint pc);
void pushContext(); void pushContext();
void popContext(); void popContext();
Symbol *lookupVar(const char *name, bool create = true, bool putInGlobalList = false); Symbol *lookupVar(const char *name, bool create = true, bool putInGlobalList = false);
@ -296,7 +296,7 @@ public:
void printStubWithArglist(const char *funcname, int nargs); void printStubWithArglist(const char *funcname, int nargs);
void convertVOIDtoString(int arg, int nargs); void convertVOIDtoString(int arg, int nargs);
void dropStack(int nargs); void dropStack(int nargs);
void drop(int num); void drop(uint num);
static void b_abs(int nargs); static void b_abs(int nargs);
static void b_atan(int nargs); static void b_atan(int nargs);
@ -445,7 +445,7 @@ private:
FuncHash _functions; FuncHash _functions;
int _pc; uint _pc;
StackData _stack; StackData _stack;

View File

@ -820,7 +820,7 @@ void Score::processEvents() {
Common::Event event; Common::Event event;
int endTime = g_system->getMillis() + 200; uint endTime = g_system->getMillis() + 200;
while (g_system->getMillis() < endTime) { while (g_system->getMillis() < endTime) {
while (g_system->getEventManager()->pollEvent(event)) { while (g_system->getEventManager()->pollEvent(event)) {