summaryrefslogtreecommitdiff
path: root/src/resources/mapreader.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-03-18 17:48:29 +0200
committerAndrei Karas <akaras@inbox.ru>2011-03-18 17:49:00 +0200
commitf98d003e354a1792117b7cbc771d1dd91475a156 (patch)
treedc2a297f7c4026394c9954ae4bfd4abd22ef9612 /src/resources/mapreader.cpp
parentbb0a6cb25b2985fd1f74c9d27d5a46f6863e2dee (diff)
downloadmanaverse-f98d003e354a1792117b7cbc771d1dd91475a156.tar.gz
manaverse-f98d003e354a1792117b7cbc771d1dd91475a156.tar.bz2
manaverse-f98d003e354a1792117b7cbc771d1dd91475a156.tar.xz
manaverse-f98d003e354a1792117b7cbc771d1dd91475a156.zip
Fix most old style cast except manaserv and libxml2 defines.
Diffstat (limited to 'src/resources/mapreader.cpp')
-rw-r--r--src/resources/mapreader.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index 7bcb08a0f..d66e2dbe3 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -84,7 +84,7 @@ int inflateMemory(unsigned char *in, unsigned int inLength,
int ret;
z_stream strm;
- out = (unsigned char*) malloc(bufferSize);
+ out = static_cast<unsigned char*>(malloc(bufferSize));
strm.zalloc = Z_NULL;
strm.zfree = Z_NULL;
@@ -124,7 +124,7 @@ int inflateMemory(unsigned char *in, unsigned int inLength,
if (ret != Z_STREAM_END)
{
- out = (unsigned char*) realloc(out, bufferSize * 2);
+ out = static_cast<unsigned char*>(realloc(out, bufferSize * 2));
if (out == NULL)
{
@@ -200,8 +200,8 @@ Map *MapReader::readMap(const std::string &filename,
if (realFilename.find(".gz", realFilename.length() - 3) != std::string::npos)
{
// Inflate the gzipped map data
- inflatedSize =
- inflateMemory((unsigned char*) buffer, fileSize, inflated);
+ inflatedSize = inflateMemory(static_cast<unsigned char*>(buffer),
+ fileSize, inflated);
free(buffer);
if (inflated == NULL)
@@ -213,11 +213,11 @@ Map *MapReader::readMap(const std::string &filename,
}
else
{
- inflated = (unsigned char*) buffer;
+ inflated = static_cast<unsigned char*>(buffer);
inflatedSize = fileSize;
}
- XML::Document doc((char*) inflated, inflatedSize);
+ XML::Document doc(reinterpret_cast<char*>(inflated), inflatedSize);
free(inflated);
xmlNodePtr node = doc.rootNode();
@@ -456,9 +456,10 @@ void MapReader::readLayer(xmlNodePtr node, Map *map)
continue;
int len = static_cast<int>(strlen(
- (const char*)dataChild->content) + 1);
+ reinterpret_cast<const char*>(dataChild->content)) + 1);
unsigned char *charData = new unsigned char[len + 1];
- const char *charStart = (const char*) xmlNodeGetContent(dataChild);
+ const char *charStart = reinterpret_cast<const char*>(
+ xmlNodeGetContent(dataChild));
if (!charStart)
{
delete charData;
@@ -481,7 +482,8 @@ void MapReader::readLayer(xmlNodePtr node, Map *map)
int binLen;
unsigned char *binData = php3_base64_decode(charData,
- static_cast<int>(strlen((char*)charData)), &binLen);
+ static_cast<int>(strlen(reinterpret_cast<char*>(
+ charData))), &binLen);
delete[] charData;
@@ -537,7 +539,8 @@ void MapReader::readLayer(xmlNodePtr node, Map *map)
if (!dataChild)
continue;
- const char *data = (const char*) xmlNodeGetContent(dataChild);
+ const char *data = reinterpret_cast<const char*>(
+ xmlNodeGetContent(dataChild));
if (!data)
return;