From 9e83411f7e4147d09af5a5006888dcc187ea0ef8 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 7 Nov 2011 19:34:52 +0300 Subject: Fix some warnings under gcc 4.7. --- src/resources/mapreader.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/resources/mapreader.cpp') diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index f702864ea..a6e1074f3 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -102,7 +102,7 @@ int inflateMemory(unsigned char *in, unsigned int inLength, do { - if (strm.next_out == NULL) + if (!strm.next_out) { inflateEnd(&strm); return Z_MEM_ERROR; @@ -128,7 +128,7 @@ int inflateMemory(unsigned char *in, unsigned int inLength, { out = static_cast(realloc(out, bufferSize * 2)); - if (out == NULL) + if (!out) { inflateEnd(&strm); return Z_MEM_ERROR; @@ -153,7 +153,7 @@ int inflateMemory(unsigned char *in, unsigned int inLength, unsigned int outLength = 0; int ret = inflateMemory(in, inLength, out, outLength); - if (ret != Z_OK || out == NULL) + if (ret != Z_OK || !out) { if (ret == Z_MEM_ERROR) { @@ -173,7 +173,7 @@ int inflateMemory(unsigned char *in, unsigned int inLength, } free(out); - out = NULL; + out = nullptr; outLength = 0; } @@ -188,12 +188,12 @@ Map *MapReader::readMap(const std::string &filename, ResourceManager *resman = ResourceManager::getInstance(); int fileSize; void *buffer = resman->loadFile(realFilename, fileSize); - Map *map = NULL; + Map *map = nullptr; - if (buffer == NULL) + if (!buffer) { logger->log("Map file not found (%s)", realFilename.c_str()); - return NULL; + return nullptr; } unsigned char *inflated; @@ -207,11 +207,11 @@ Map *MapReader::readMap(const std::string &filename, fileSize, inflated); free(buffer); - if (inflated == NULL) + if (!inflated) { logger->log("Could not decompress map file (%s)", realFilename.c_str()); - return NULL; + return nullptr; } } else @@ -651,13 +651,13 @@ Tileset *MapReader::readTileset(xmlNodePtr node, const std::string &path, Map *map) { if (!map) - return NULL; + return nullptr; int firstGid = XML::getProperty(node, "firstgid", 0); int margin = XML::getProperty(node, "margin", 0); int spacing = XML::getProperty(node, "spacing", 0); - XML::Document* doc = NULL; - Tileset *set = NULL; + XML::Document* doc = nullptr; + Tileset *set = nullptr; std::string pathDir(path); if (xmlHasProp(node, BAD_CAST "source")) -- cgit v1.2.3-70-g09d2