From 03f1a137865dc99de5d433ce90ddf19b154b3547 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 5 Jul 2019 13:18:40 +0200 Subject: HDB: Simplify executeChunk() function --- engines/hdb/lua-script.cpp | 8 ++++---- engines/hdb/lua-script.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'engines/hdb') diff --git a/engines/hdb/lua-script.cpp b/engines/hdb/lua-script.cpp index e4d5f0efe7..7da2bd9bd8 100644 --- a/engines/hdb/lua-script.cpp +++ b/engines/hdb/lua-script.cpp @@ -1576,7 +1576,7 @@ bool LuaScript::executeMPC(Common::SeekableReadStream *stream, const char *name, addPatches(chunkString, scriptName); - if (!executeChunk(chunkString, chunkString.size(), name)) { + if (!executeChunk(chunkString, name)) { delete[] chunk; return false; @@ -1610,7 +1610,7 @@ bool LuaScript::executeFile(const Common::String &filename) { addPatches(fileDataString, filename.c_str()); - if (!executeChunk(fileDataString, fileDataString.size(), filename)) { + if (!executeChunk(fileDataString, filename)) { delete[] fileData; delete file; @@ -1623,14 +1623,14 @@ bool LuaScript::executeFile(const Common::String &filename) { return true; } -bool LuaScript::executeChunk(Common::String &chunk, uint chunkSize, const Common::String &chunkName) const { +bool LuaScript::executeChunk(Common::String &chunk, const Common::String &chunkName) const { if (!_systemInit) { return false; } // Compile Chunk - if (luaL_loadbuffer(_state, chunk.c_str(), chunkSize, chunkName.c_str())) { + if (luaL_loadbuffer(_state, chunk.c_str(), chunk.size(), chunkName.c_str())) { error("Couldn't compile \"%s\": %s", chunkName.c_str(), lua_tostring(_state, -1)); lua_pop(_state, -1); diff --git a/engines/hdb/lua-script.h b/engines/hdb/lua-script.h index 6949debc44..92574d268e 100644 --- a/engines/hdb/lua-script.h +++ b/engines/hdb/lua-script.h @@ -71,7 +71,7 @@ private: bool _systemInit; bool registerExtensions(); - bool executeChunk(Common::String &chunk, uint chunkSize, const Common::String &chunkName) const; + bool executeChunk(Common::String &chunk, const Common::String &chunkName) const; void stripComments(char *chunk); void addPatches(Common::String &chunk, const char *scriptName); }; -- cgit v1.2.3