summaryrefslogtreecommitdiff
path: root/src/resources/loaders
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-06-06 23:34:34 +0300
committerAndrei Karas <akaras@inbox.ru>2017-06-07 19:23:40 +0300
commit36ba43d6ea38062b17f7e63ef659962bfc51c64d (patch)
tree190156cb88b13a38a6d13c69ee0742cc078065a1 /src/resources/loaders
parentf1518dd8476c968a43fa57cfb06198e290a4f77a (diff)
downloadmv-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.gz
mv-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.bz2
mv-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.xz
mv-36ba43d6ea38062b17f7e63ef659962bfc51c64d.zip
Fix clang-tidy check readability-implicit-bool-cast.
Diffstat (limited to 'src/resources/loaders')
-rw-r--r--src/resources/loaders/atlasloader.cpp4
-rw-r--r--src/resources/loaders/emptyatlasloader.cpp4
-rw-r--r--src/resources/loaders/imageloader.cpp8
-rw-r--r--src/resources/loaders/imagesetloader.cpp4
-rw-r--r--src/resources/loaders/musicloader.cpp4
-rw-r--r--src/resources/loaders/rescaledloader.cpp8
-rw-r--r--src/resources/loaders/shaderloader.cpp4
-rw-r--r--src/resources/loaders/shaderprogramloader.cpp4
-rw-r--r--src/resources/loaders/soundloader.cpp6
-rw-r--r--src/resources/loaders/spritedefloader.cpp2
-rw-r--r--src/resources/loaders/subimageloader.cpp8
-rw-r--r--src/resources/loaders/subimagesetloader.cpp6
-rw-r--r--src/resources/loaders/walklayerloader.cpp4
-rw-r--r--src/resources/loaders/xmlloader.cpp2
14 files changed, 34 insertions, 34 deletions
diff --git a/src/resources/loaders/atlasloader.cpp b/src/resources/loaders/atlasloader.cpp
index d3e2e276f..9f7b4ab09 100644
--- a/src/resources/loaders/atlasloader.cpp
+++ b/src/resources/loaders/atlasloader.cpp
@@ -40,13 +40,13 @@ struct AtlasLoader final
static Resource *load(const void *const v)
{
- if (!v)
+ if (v == nullptr)
return nullptr;
const AtlasLoader *const rl = static_cast<const AtlasLoader *>(v);
AtlasResource *const resource = AtlasManager::loadTextureAtlas(
rl->name, *rl->files);
- if (!resource)
+ if (resource == nullptr)
reportAlways("Atlas creation error: %s", rl->name.c_str());
return resource;
}
diff --git a/src/resources/loaders/emptyatlasloader.cpp b/src/resources/loaders/emptyatlasloader.cpp
index 24c73ac21..3138c821b 100644
--- a/src/resources/loaders/emptyatlasloader.cpp
+++ b/src/resources/loaders/emptyatlasloader.cpp
@@ -40,14 +40,14 @@ struct EmptyAtlasLoader final
static Resource *load(const void *const v)
{
- if (!v)
+ if (v == nullptr)
return nullptr;
const EmptyAtlasLoader *const rl =
static_cast<const EmptyAtlasLoader *>(v);
AtlasResource *const resource = AtlasManager::loadEmptyAtlas(
rl->name, *rl->files);
- if (!resource)
+ if (resource == nullptr)
reportAlways("Empty atlas creation error: %s", rl->name.c_str());
return resource;
}
diff --git a/src/resources/loaders/imageloader.cpp b/src/resources/loaders/imageloader.cpp
index 5a1830e15..c5635ef14 100644
--- a/src/resources/loaders/imageloader.cpp
+++ b/src/resources/loaders/imageloader.cpp
@@ -46,7 +46,7 @@ namespace
static Resource *load(const void *const v)
{
BLOCK_START("DyedImageLoader::load")
- if (!v)
+ if (v == nullptr)
{
BLOCK_END("DyedImageLoader::load")
return nullptr;
@@ -64,17 +64,17 @@ namespace
path1 = path1.substr(0, p);
}
SDL_RWops *const rw = VirtFs::rwopsOpenRead(path1);
- if (!rw)
+ if (rw == nullptr)
{
delete d;
reportAlways("Image loading error: %s", path1.c_str());
BLOCK_END("DyedImageLoader::load")
return nullptr;
}
- Resource *const res = d ? imageHelper->load(rw, *d)
+ Resource *const res = d != nullptr ? imageHelper->load(rw, *d)
: imageHelper->load(rw);
delete d;
- if (!res)
+ if (res == nullptr)
reportAlways("Image loading error: %s", path1.c_str());
BLOCK_END("DyedImageLoader::load")
return res;
diff --git a/src/resources/loaders/imagesetloader.cpp b/src/resources/loaders/imagesetloader.cpp
index 342b26d9a..63b56d1fe 100644
--- a/src/resources/loaders/imagesetloader.cpp
+++ b/src/resources/loaders/imagesetloader.cpp
@@ -44,14 +44,14 @@ struct ImageSetLoader final
static Resource *load(const void *const v)
{
- if (!v)
+ if (v == nullptr)
return nullptr;
const ImageSetLoader *const
rl = static_cast<const ImageSetLoader *>(v);
Image *const img = Loader::getImage(rl->path);
- if (!img)
+ if (img == nullptr)
{
reportAlways("Image loading error: %s", rl->path.c_str());
return nullptr;
diff --git a/src/resources/loaders/musicloader.cpp b/src/resources/loaders/musicloader.cpp
index 23a994e1b..f0b67cb67 100644
--- a/src/resources/loaders/musicloader.cpp
+++ b/src/resources/loaders/musicloader.cpp
@@ -42,12 +42,12 @@ namespace
static Resource *load(const void *const v)
{
- if (!v)
+ if (v == nullptr)
return nullptr;
const ResourceLoader *const
rl = static_cast<const ResourceLoader *>(v);
SDL_RWops *const rw = VirtFs::rwopsOpenRead(rl->path);
- if (!rw)
+ if (rw == nullptr)
{
reportAlways("Error loading resource: %s",
rl->path.c_str());
diff --git a/src/resources/loaders/rescaledloader.cpp b/src/resources/loaders/rescaledloader.cpp
index c6a70f969..cea73b382 100644
--- a/src/resources/loaders/rescaledloader.cpp
+++ b/src/resources/loaders/rescaledloader.cpp
@@ -42,15 +42,15 @@ namespace
const int height;
static Resource *load(const void *const v)
{
- if (!v)
+ if (v == nullptr)
return nullptr;
const RescaledLoader *const rl
= static_cast<const RescaledLoader *>(v);
- if (!rl->image)
+ if (rl->image == nullptr)
return nullptr;
Image *const rescaled = rl->image->SDLgetScaledImage(
rl->width, rl->height);
- if (!rescaled)
+ if (rescaled == nullptr)
{
reportAlways("Rescale image failed: %s",
rl->image->mIdPath.c_str());
@@ -65,7 +65,7 @@ Image *Loader::getRescaled(const Image *const image,
const int width,
const int height)
{
- if (!image)
+ if (image == nullptr)
return nullptr;
const std::string idPath = image->mIdPath + strprintf(
diff --git a/src/resources/loaders/shaderloader.cpp b/src/resources/loaders/shaderloader.cpp
index 5d5b70869..550be0a75 100644
--- a/src/resources/loaders/shaderloader.cpp
+++ b/src/resources/loaders/shaderloader.cpp
@@ -44,13 +44,13 @@ namespace
static Resource *load(const void *const v)
{
- if (!v)
+ if (v == nullptr)
return nullptr;
const ShaderLoader *const rl
= static_cast<const ShaderLoader *>(v);
Shader *const resource = shaders.createShader(rl->type, rl->name);
- if (!resource)
+ if (resource == nullptr)
reportAlways("Shader creation error: %s", rl->name.c_str());
return resource;
}
diff --git a/src/resources/loaders/shaderprogramloader.cpp b/src/resources/loaders/shaderprogramloader.cpp
index 2f73cb5a8..fe4a5cf50 100644
--- a/src/resources/loaders/shaderprogramloader.cpp
+++ b/src/resources/loaders/shaderprogramloader.cpp
@@ -45,7 +45,7 @@ namespace
static Resource *load(const void *const v)
{
- if (!v)
+ if (v == nullptr)
return nullptr;
const ShaderProgramLoader *const rl
@@ -54,7 +54,7 @@ namespace
rl->vertex,
rl->fragment,
rl->isNewShader);
- if (!resource)
+ if (resource == nullptr)
reportAlways("Shader program creation error");
return resource;
}
diff --git a/src/resources/loaders/soundloader.cpp b/src/resources/loaders/soundloader.cpp
index f5e7f1058..a84898201 100644
--- a/src/resources/loaders/soundloader.cpp
+++ b/src/resources/loaders/soundloader.cpp
@@ -42,12 +42,12 @@ namespace
static Resource *load(const void *const v)
{
- if (!v)
+ if (v == nullptr)
return nullptr;
const ResourceLoader *const
rl = static_cast<const ResourceLoader *>(v);
SDL_RWops *const rw = VirtFs::rwopsOpenRead(rl->path);
- if (!rw)
+ if (rw == nullptr)
{
reportAlways("Error loading resource: %s",
rl->path.c_str());
@@ -56,7 +56,7 @@ namespace
// Load the music data and free the RWops structure
Mix_Chunk *const tmpSoundEffect = Mix_LoadWAV_RW(rw, 1);
- if (tmpSoundEffect)
+ if (tmpSoundEffect != nullptr)
{
return new SoundEffect(tmpSoundEffect, rl->path);
}
diff --git a/src/resources/loaders/spritedefloader.cpp b/src/resources/loaders/spritedefloader.cpp
index 69f182b89..2e91d759b 100644
--- a/src/resources/loaders/spritedefloader.cpp
+++ b/src/resources/loaders/spritedefloader.cpp
@@ -42,7 +42,7 @@ namespace
const int variant;
static Resource *load(const void *const v)
{
- if (!v)
+ if (v == nullptr)
return nullptr;
const SpriteDefLoader *const
diff --git a/src/resources/loaders/subimageloader.cpp b/src/resources/loaders/subimageloader.cpp
index f340f69c9..a4ccc2346 100644
--- a/src/resources/loaders/subimageloader.cpp
+++ b/src/resources/loaders/subimageloader.cpp
@@ -44,17 +44,17 @@ namespace
const int height;
static Resource *load(const void *const v)
{
- if (!v)
+ if (v == nullptr)
return nullptr;
const SubImageLoader *const
rl = static_cast<const SubImageLoader *>(v);
- if (!rl->parent)
+ if (rl->parent == nullptr)
return nullptr;
Image *const res = rl->parent->getSubImage(rl->x, rl->y,
rl->width, rl->height);
- if (!res)
+ if (res == nullptr)
{
reportAlways("SubImage loading error: %s",
rl->parent->mSource.c_str());
@@ -70,7 +70,7 @@ Image *Loader::getSubImage(Image *const parent,
const int width,
const int height)
{
- if (!parent)
+ if (parent == nullptr)
return nullptr;
const SubImageLoader rl = { parent, x, y, width, height};
diff --git a/src/resources/loaders/subimagesetloader.cpp b/src/resources/loaders/subimagesetloader.cpp
index 4aefb4c2e..ef47b164d 100644
--- a/src/resources/loaders/subimagesetloader.cpp
+++ b/src/resources/loaders/subimagesetloader.cpp
@@ -43,13 +43,13 @@ namespace
int height;
static Resource *load(const void *const v)
{
- if (!v)
+ if (v == nullptr)
return nullptr;
const SubImageSetLoader *const
rl = static_cast<const SubImageSetLoader *>(v);
- if (!rl->parent)
+ if (rl->parent == nullptr)
return nullptr;
ImageSet *const res = new ImageSet(rl->parent,
rl->width, rl->height);
@@ -62,7 +62,7 @@ ImageSet *Loader::getSubImageSet(Image *const parent,
const int width,
const int height)
{
- if (!parent)
+ if (parent == nullptr)
return nullptr;
const SubImageSetLoader rl = { parent, width, height };
diff --git a/src/resources/loaders/walklayerloader.cpp b/src/resources/loaders/walklayerloader.cpp
index c5e4569c8..16be1e2ce 100644
--- a/src/resources/loaders/walklayerloader.cpp
+++ b/src/resources/loaders/walklayerloader.cpp
@@ -42,13 +42,13 @@ struct WalkLayerLoader final
static Resource *load(const void *const v)
{
- if (!v)
+ if (v == nullptr)
return nullptr;
const WalkLayerLoader *const rl = static_cast<const
WalkLayerLoader *>(v);
Resource *const resource = NavigationManager::loadWalkLayer(rl->map);
- if (!resource)
+ if (resource == nullptr)
reportAlways("WalkLayer creation error");
return resource;
}
diff --git a/src/resources/loaders/xmlloader.cpp b/src/resources/loaders/xmlloader.cpp
index 9cacd1c41..61618530e 100644
--- a/src/resources/loaders/xmlloader.cpp
+++ b/src/resources/loaders/xmlloader.cpp
@@ -40,7 +40,7 @@ namespace
static Resource *load(const void *const v)
{
- if (!v)
+ if (v == nullptr)
return nullptr;
const ResourceLoader *const
rl = static_cast<const ResourceLoader *>(v);