diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-03-12 14:26:28 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-03-12 14:26:28 +0000 |
commit | c1535e9d13a7da8d0f2b58a0834cbd751dfc9887 (patch) | |
tree | 9eb88c6591a585301cc3d24e9583676725056a8e /src | |
parent | b682fc3f8669c58ecea9f35abfba6f6204565886 (diff) | |
download | mana-client-c1535e9d13a7da8d0f2b58a0834cbd751dfc9887.tar.gz mana-client-c1535e9d13a7da8d0f2b58a0834cbd751dfc9887.tar.bz2 mana-client-c1535e9d13a7da8d0f2b58a0834cbd751dfc9887.tar.xz mana-client-c1535e9d13a7da8d0f2b58a0834cbd751dfc9887.zip |
Use xmlParseFile with built in support for gzip.
Diffstat (limited to 'src')
-rw-r--r-- | src/resources/mapreader.cpp | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index 819401ed..7673bf55 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -58,28 +58,7 @@ Map *MapReader::readMap(const std::string &filename) log("Attempting to parse XML map data"); std::string name = std::string("data/") + filename; - - FILE* f = fopen(name.c_str(), "rb"); - char *map_string; - - if (!f) { - error(std::string("Error: failed to open ") + filename); - } - - // Get size of file - fseek(f, 0, SEEK_END); - long size = ftell(f); - rewind(f); - - // Read file into character array - map_string = new char[size + 1]; - fread(map_string, 1, size, f); - map_string[size] = '\0'; - - fclose(f); - - xmlDocPtr doc = xmlReadMemory(map_string, size, NULL, NULL, 0); - delete[] map_string; + xmlDocPtr doc = xmlParseFile(name.c_str()); if (doc) { log("Looking for root node"); |