summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-08-28 15:53:18 +0300
committerAndrei Karas <akaras@inbox.ru>2013-08-29 00:18:56 +0300
commitee1a05faf157c8c9f0f43cf5b906d84f39ded497 (patch)
treed560c7235c09e1117dc9172867c6acb0895edd64
parentafbf2f713dd918bd0ff050d71afbf05bc581ab6e (diff)
downloadmv-ee1a05faf157c8c9f0f43cf5b906d84f39ded497.tar.gz
mv-ee1a05faf157c8c9f0f43cf5b906d84f39ded497.tar.bz2
mv-ee1a05faf157c8c9f0f43cf5b906d84f39ded497.tar.xz
mv-ee1a05faf157c8c9f0f43cf5b906d84f39ded497.zip
fix compilation errors and warnings in debug checkers.
-rw-r--r--src/compoundsprite.cpp1
-rw-r--r--src/resources/atlasmanager.cpp9
-rw-r--r--src/resources/image.cpp7
-rw-r--r--src/resources/resourcemanager.cpp9
-rw-r--r--src/resources/sdlimagehelper.cpp2
-rw-r--r--src/resources/subimage.cpp6
-rw-r--r--src/utils/fuzzer.cpp1
-rw-r--r--src/utils/sdlcheckutils.cpp12
8 files changed, 31 insertions, 16 deletions
diff --git a/src/compoundsprite.cpp b/src/compoundsprite.cpp
index df62ab9ff..c6971a518 100644
--- a/src/compoundsprite.cpp
+++ b/src/compoundsprite.cpp
@@ -37,6 +37,7 @@
#include "resources/imagehelper.h"
#include "utils/dtor.h"
+#include "utils/sdlcheckutils.h"
#include <SDL.h>
diff --git a/src/resources/atlasmanager.cpp b/src/resources/atlasmanager.cpp
index 3b8f6a326..015ad0c93 100644
--- a/src/resources/atlasmanager.cpp
+++ b/src/resources/atlasmanager.cpp
@@ -125,7 +125,8 @@ void AtlasManager::loadImages(const StringVect &files,
{
image->mIdPath = str;
#ifdef DEBUG_IMAGES
- logger->log("set name %p, %s", image, image->mIdPath.c_str());
+ logger->log("set name %p, %s", static_cast<void*>(image),
+ image->mIdPath.c_str());
#endif
images.push_back(image);
}
@@ -274,7 +275,8 @@ void AtlasManager::convertAtlas(TextureAtlas *const atlas)
image->mIdPath = atlas->name;
#ifdef DEBUG_IMAGES
- logger->log("set name %p, %s", image, image->mIdPath.c_str());
+ logger->log("set name %p, %s", static_cast<void*>(image),
+ image->mIdPath.c_str());
#endif
image->incRef();
@@ -291,7 +293,8 @@ void AtlasManager::convertAtlas(TextureAtlas *const atlas)
{
image2->mIdPath = item->name;
#ifdef DEBUG_IMAGES
- logger->log("set name %p, %s", image2, image2->mIdPath.c_str());
+ logger->log("set name %p, %s", static_cast<void*>(image2),
+ image2->mIdPath.c_str());
#endif
image2->incRef();
}
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index b5a852996..cd8231e7b 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -115,7 +115,7 @@ Image::Image(SDL_Surface *const image, const bool hasAlphaChannel0,
mIsAlphaCalculated(false)
{
#ifdef DEBUG_IMAGES
- logger->log("created: %p", this);
+ logger->log("created: %p", static_cast<void*>(this));
#endif
mBounds.x = 0;
@@ -159,7 +159,7 @@ Image::Image(const GLuint glimage, const int width, const int height,
mIsAlphaCalculated(false)
{
#ifdef DEBUG_IMAGES
- logger->log("created: %p", this);
+ logger->log("created: %p", static_cast<void*>(this));
#endif
mBounds.x = 0;
@@ -182,7 +182,8 @@ Image::Image(const GLuint glimage, const int width, const int height,
Image::~Image()
{
#ifdef DEBUG_IMAGES
- logger->log("delete: %p, %s, %s", this, mIdPath.c_str(), mSource.c_str());
+ logger->log("delete: %p, %s, %s", static_cast<void*>(this),
+ mIdPath.c_str(), mSource.c_str());
#endif
unload();
}
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 662024f36..3d13e6e00 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -450,7 +450,8 @@ bool ResourceManager::addResource(const std::string &idPath,
resource->incRef();
resource->mIdPath = idPath;
#ifdef DEBUG_IMAGES
- logger->log("set name %p, %s", resource, resource->mIdPath.c_str());
+ logger->log("set name %p, %s", static_cast<void*>(resource),
+ resource->mIdPath.c_str());
#endif
mResources[idPath] = resource;
return true;
@@ -522,7 +523,8 @@ Resource *ResourceManager::get(const std::string &idPath, const generator fun,
resource->incRef();
resource->mIdPath = idPath;
#ifdef DEBUG_IMAGES
- logger->log("set name %p, %s", resource, resource->mIdPath.c_str());
+ logger->log("set name %p, %s", static_cast<void*>(resource),
+ resource->mIdPath.c_str());
#endif
mResources[idPath] = resource;
cleanOrphans();
@@ -539,7 +541,8 @@ Resource *ResourceManager::get(const std::string &idPath, const generator fun,
resource->incRef();
resource->mIdPath = idPath;
#ifdef DEBUG_IMAGES
- logger->log("set name %p, %s", resource, resource->mIdPath.c_str());
+ logger->log("set name %p, %s", static_cast<void*>(resource),
+ resource->mIdPath.c_str());
#endif
}
else
diff --git a/src/resources/sdlimagehelper.cpp b/src/resources/sdlimagehelper.cpp
index cc5460fde..cf8d1d04a 100644
--- a/src/resources/sdlimagehelper.cpp
+++ b/src/resources/sdlimagehelper.cpp
@@ -33,6 +33,8 @@
#include "resources/image.h"
+#include "utils/sdlcheckutils.h"
+
#include <SDL_gfxBlitFunc.h>
#include <SDL_image.h>
diff --git a/src/resources/subimage.cpp b/src/resources/subimage.cpp
index 8a8fa2735..a13a885bb 100644
--- a/src/resources/subimage.cpp
+++ b/src/resources/subimage.cpp
@@ -105,7 +105,8 @@ SubImage::SubImage(Image *const parent, SDL_Surface *const image,
mAlphaChannel = mParent->SDLgetAlphaChannel();
mSource = parent->getIdPath();
#ifdef DEBUG_IMAGES
- logger->log("set name2 %p, %s", this, mSource.c_str());
+ logger->log("set name2 %p, %s", static_cast<void*>(this),
+ mSource.c_str());
#endif
#ifdef DEBUG_BIND_TEXTURE
mIdPath = parent->getIdPath();
@@ -164,7 +165,8 @@ SubImage::SubImage(Image *const parent, const GLuint image,
mInternalBounds.h = mParent->mBounds.h;
mSource = parent->getIdPath();
#ifdef DEBUG_IMAGES
- logger->log("set name2 %p, %s", this, mSource.c_str());
+ logger->log("set name2 %p, %s", static_cast<void*>(this),
+ mSource.c_str());
#endif
#ifdef DEBUG_BIND_TEXTURE
mIdPath = parent->getIdPath();
diff --git a/src/utils/fuzzer.cpp b/src/utils/fuzzer.cpp
index 4342899c3..42468d6b0 100644
--- a/src/utils/fuzzer.cpp
+++ b/src/utils/fuzzer.cpp
@@ -40,6 +40,7 @@ void Fuzzer::init()
fuzz = new Logger;
fuzz->setLogFile(client->getLocalDataDirectory() + "/fuzzer.log");
unsigned int sr = time(nullptr);
+
fuzz->log("Srand: %u", sr);
srand(sr);
}
diff --git a/src/utils/sdlcheckutils.cpp b/src/utils/sdlcheckutils.cpp
index d8e902e4f..755f9553a 100644
--- a/src/utils/sdlcheckutils.cpp
+++ b/src/utils/sdlcheckutils.cpp
@@ -33,7 +33,7 @@
#include "debug.h"
-// #define DEBUG_SURFACE_ALLOCATION 1
+#define DEBUG_SURFACE_ALLOCATION 1
struct SurfaceObject
{
@@ -85,7 +85,7 @@ static SDL_Surface *addSurface(const char *const name,
return surface;
}
-static void deleteSurface(const char *const name,
+static void deleteSurface(const char *const name A_UNUSED,
SDL_Surface *const surface,
const char *const file,
const unsigned line)
@@ -97,7 +97,8 @@ static void deleteSurface(const char *const name,
it = mSurfaces.find(surface);
if (it == mSurfaces.end())
{
- logger->log("bad surface delete: %p at %s:%d", surface, file, line);
+ logger->log("bad surface delete: %p at %s:%d",
+ static_cast<void*>(surface), file, line);
}
else
{
@@ -113,8 +114,9 @@ static void deleteSurface(const char *const name,
if (cnt < 1)
{ // surface was here but was deleted
logger->log("deleting already deleted surface: %p at %s:%d\n"
- "was add %s\nwas deleted %s", surface, file, line,
- obj->mAddFile.c_str(), obj->mRemoveFile.c_str());
+ "was add %s\nwas deleted %s", static_cast<void*>(surface),
+ file, line, obj->mAddFile.c_str(),
+ obj->mRemoveFile.c_str());
}
else if (cnt == 1)
{