diff options
author | Jared Adams <jaxad0127@gmail.com> | 2010-08-13 14:45:52 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2010-08-13 18:43:16 -0600 |
commit | 8eadc834ed3e8439836f7dc87390a56a1164ec11 (patch) | |
tree | 36cf9915914517b137d488a40d1f61265867723d /src/utils/xml.cpp | |
parent | 6d315d0e61f419636021476582a49ab0b1f1b5e9 (diff) | |
download | mana-8eadc834ed3e8439836f7dc87390a56a1164ec11.tar.gz mana-8eadc834ed3e8439836f7dc87390a56a1164ec11.tar.bz2 mana-8eadc834ed3e8439836f7dc87390a56a1164ec11.tar.xz mana-8eadc834ed3e8439836f7dc87390a56a1164ec11.zip |
Simplify handling of compressed files
ResourceManager will now check for ".gz" and act appropriately (unless told
not to). Compression handling functions are now in new utils/zlib files,
along with a function to load a file from drive, uncompressing it if it ends
in ".gz".
Reviewed-by: Freeyorp
Diffstat (limited to 'src/utils/xml.cpp')
-rw-r--r-- | src/utils/xml.cpp | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp index 8d444fab..9835f88c 100644 --- a/src/utils/xml.cpp +++ b/src/utils/xml.cpp @@ -25,12 +25,11 @@ #include "resources/resourcemanager.h" +#include "utils/zlib.h" + #include <libxml/parser.h> #include <libxml/xmlerror.h> -#include <fstream> -#include <iostream> - namespace XML { static void xmlLogger(void *ctx, xmlErrorPtr error); @@ -58,25 +57,7 @@ namespace XML } else { - std::ifstream file; - file.open(filename.c_str(), std::ios::in); - - if (file.is_open()) - { - // Get length of file - file.seekg (0, std::ios::end); - size = file.tellg(); - file.seekg(0, std::ios::beg); - - data = (char*) malloc(size); - - file.read(data, size); - file.close(); - } - else - { - logger->log("Error loading XML file %s", filename.c_str()); - } + data = (char *) loadCompressedFile(filename, size); } if (data) |