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/guichan/sdl/sdlgraphics.cpp | 4 ++-- src/guichan/sdl/sdlimage.cpp | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) (limited to 'src/guichan/sdl') diff --git a/src/guichan/sdl/sdlgraphics.cpp b/src/guichan/sdl/sdlgraphics.cpp index 28aface0e..67aa657cd 100644 --- a/src/guichan/sdl/sdlgraphics.cpp +++ b/src/guichan/sdl/sdlgraphics.cpp @@ -65,7 +65,7 @@ namespace gcn { SDLGraphics::SDLGraphics() : - mTarget(0), + mTarget(nullptr), mAlpha(false) { } @@ -155,7 +155,7 @@ namespace gcn const SDLImage* srcImage = dynamic_cast(image); - if (srcImage == NULL) + if (!srcImage) { throw GCN_EXCEPTION("Trying to draw an image of unknown format," " must be an SDLImage."); diff --git a/src/guichan/sdl/sdlimage.cpp b/src/guichan/sdl/sdlimage.cpp index 12c5571cf..156b399b3 100644 --- a/src/guichan/sdl/sdlimage.cpp +++ b/src/guichan/sdl/sdlimage.cpp @@ -50,6 +50,8 @@ #include "guichan/exception.hpp" #include "guichan/sdl/sdlpixel.hpp" +#include "debug.h" + namespace gcn { SDLImage::SDLImage(SDL_Surface* surface, bool autoFree) @@ -71,7 +73,7 @@ namespace gcn int SDLImage::getWidth() const { - if (mSurface == NULL) + if (!mSurface) { throw GCN_EXCEPTION("Trying to get the width of " "a non loaded image."); @@ -82,7 +84,7 @@ namespace gcn int SDLImage::getHeight() const { - if (mSurface == NULL) + if (!mSurface) { throw GCN_EXCEPTION("Trying to get the height of " "a non loaded image."); @@ -93,7 +95,7 @@ namespace gcn Color SDLImage::getPixel(int x, int y) { - if (mSurface == NULL) + if (!mSurface) { throw GCN_EXCEPTION("Trying to get a pixel from a " "non loaded image."); @@ -104,7 +106,7 @@ namespace gcn void SDLImage::putPixel(int x, int y, const Color& color) { - if (mSurface == NULL) + if (!mSurface) { throw GCN_EXCEPTION("Trying to put a pixel in a " "non loaded image."); @@ -115,7 +117,7 @@ namespace gcn void SDLImage::convertToDisplayFormat() { - if (mSurface == NULL) + if (!mSurface) { throw GCN_EXCEPTION("Trying to convert a non loaded image " "to display format."); @@ -155,16 +157,16 @@ namespace gcn { tmp = SDL_DisplayFormatAlpha(mSurface); SDL_FreeSurface(mSurface); - mSurface = NULL; + mSurface = nullptr; } else { tmp = SDL_DisplayFormat(mSurface); SDL_FreeSurface(mSurface); - mSurface = NULL; + mSurface = nullptr; } - if (tmp == NULL) + if (!tmp) throw GCN_EXCEPTION("Unable to convert image to display format."); if (hasPink) -- cgit v1.2.3-70-g09d2