From 36ba43d6ea38062b17f7e63ef659962bfc51c64d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 6 Jun 2017 23:34:34 +0300 Subject: Fix clang-tidy check readability-implicit-bool-cast. --- src/resources/dye/dye.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'src/resources/dye/dye.cpp') diff --git a/src/resources/dye/dye.cpp b/src/resources/dye/dye.cpp index b9c9e4cd8..70d2a21b1 100644 --- a/src/resources/dye/dye.cpp +++ b/src/resources/dye/dye.cpp @@ -143,9 +143,9 @@ void Dye::instantiate(std::string &restrict target, int Dye::getType() const restrict2 noexcept2 { - if (mDyePalettes[sPaleteIndex]) + if (mDyePalettes[sPaleteIndex] != nullptr) return 1; - if (mDyePalettes[aPaleteIndex]) + if (mDyePalettes[aPaleteIndex] != nullptr) return 2; return 0; } @@ -153,7 +153,7 @@ int Dye::getType() const restrict2 noexcept2 void Dye::normalDye(uint32_t *restrict pixels, const int bufSize) const restrict2 { - if (!pixels) + if (pixels == nullptr) return; #ifdef ENABLE_CILKPLUS @@ -230,7 +230,7 @@ endlabel:{} const int alpha = p & 0xff; #endif // SDL_BYTEORDER == SDL_BIG_ENDIAN - if (!alpha) + if (alpha == 0) continue; unsigned int color[3]; #if SDL_BYTEORDER == SDL_BIG_ENDIAN @@ -260,10 +260,11 @@ endlabel:{} continue; } - const unsigned int i = (color[0] != 0) | ((color[1] != 0) << 1) - | ((color[2] != 0) << 2); + const unsigned int i = static_cast(color[0] != 0) | + (static_cast(color[1] != 0) << 1) | + (static_cast(color[2] != 0) << 2); - if (mDyePalettes[i - 1]) + if (mDyePalettes[i - 1] != nullptr) mDyePalettes[i - 1]->getColor(cmax, color); #if SDL_BYTEORDER == SDL_BIG_ENDIAN @@ -281,7 +282,7 @@ endlabel:{} void Dye::normalOGLDye(uint32_t *restrict pixels, const int bufSize) const restrict2 { - if (!pixels) + if (pixels == nullptr) return; #ifdef ENABLE_CILKPLUS @@ -357,7 +358,7 @@ endlabel:{} const int alpha = p & 0xff000000; #endif // SDL_BYTEORDER == SDL_BIG_ENDIAN - if (!alpha) + if (alpha == 0) continue; unsigned int color[3]; #if SDL_BYTEORDER == SDL_BIG_ENDIAN @@ -387,10 +388,11 @@ endlabel:{} continue; } - const unsigned int i = (color[0] != 0) | ((color[1] != 0) << 1) - | ((color[2] != 0) << 2); + const unsigned int i = static_cast(color[0] != 0) | + (static_cast(color[1] != 0) << 1) | + (static_cast(color[2] != 0) << 2); - if (mDyePalettes[i - 1]) + if (mDyePalettes[i - 1] != nullptr) mDyePalettes[i - 1]->getColor(cmax, color); #if SDL_BYTEORDER == SDL_BIG_ENDIAN -- cgit v1.2.3-70-g09d2