diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/LuaXML.cc | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/lib/LuaXML.cc b/lib/LuaXML.cc index 8dc98cc..62cb57e 100644 --- a/lib/LuaXML.cc +++ b/lib/LuaXML.cc @@ -20,6 +20,7 @@ #include "tinyxml.h" #include <Handle.h> +#include <Buffer.h> #include <BLua.h> class LuaXML : public Base { @@ -98,22 +99,14 @@ static int ParseString(lua_State *L) { return 1; } -#define XMLBUFSIZ 81920 - static int ParseHandle(lua_State *__L) { Lua * L = Lua::find(__L); Handle * h = (Handle *) LuaObject::getme(L, 1); TiXmlDocument doc; - char buffer[XMLBUFSIZ + 1]; - int l; - - while (!h->IsClosed()) { - l = h->read(buffer, XMLBUFSIZ); - if (l) { - buffer[l] = 0; - doc.Parse(buffer); - } - } + Buffer b(true); + + b.copyfrom(h); + doc.Parse(reinterpret_cast<const char *>(b.GetBuffer())); lua_newtable(__L); ParseNode(__L, &doc); |