summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/resources/resourcemanager.cpp25
1 files changed, 9 insertions, 16 deletions
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index dd9aaebb..65cc4d50 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -465,31 +465,24 @@ void *ResourceManager::loadFile(const std::string &filename, int &filesize,
// Close the file and let the user deallocate the memory
PHYSFS_close(file);
- unsigned char *inflated;
- unsigned int inflatedSize;
-
if (inflate && filename.find(".gz", filename.length() - 3)
!= std::string::npos)
{
+ unsigned char *inflated;
+
// Inflate the gzipped map data
- inflatedSize =
- inflateMemory((unsigned char*) buffer, filesize, inflated);
+ filesize = inflateMemory((unsigned char*) buffer, filesize, inflated);
free(buffer);
- if (inflated == nullptr)
+ buffer = inflated;
+
+ if (!buffer)
{
- logger->log("Could not decompress file: %s",
- filename.c_str());
- return nullptr;
+ logger->log("Could not decompress file: %s", filename.c_str());
}
-
- filesize = inflatedSize;
- return inflated;
- }
- else
- {
- return buffer;
}
+
+ return buffer;
}
bool ResourceManager::copyFile(const std::string &src, const std::string &dst)