diff options
27 files changed, 112 insertions, 94 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp index 95d0f9481..35e90590c 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -2130,8 +2130,9 @@ void Being::dumpSprites() const const std::vector<int>::const_iterator it1_end = mSpriteIDs.end(); StringVectCIter it2 = mSpriteColors.begin(); const StringVectCIter it2_end = mSpriteColors.end(); - std::vector<int>::const_iterator it3 = mSpriteColorsIds.begin(); - const std::vector<int>::const_iterator it3_end = mSpriteColorsIds.end(); + std::vector<unsigned char>::const_iterator it3 = mSpriteColorsIds.begin(); + const std::vector<unsigned char>::const_iterator + it3_end = mSpriteColorsIds.end(); logger->log("sprites"); for (; it1 != it1_end && it2 != it2_end && it3 != it3_end; diff --git a/src/being/being.h b/src/being/being.h index c4b1b693c..ccfabe9a1 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -941,7 +941,7 @@ class Being notfinal : public ActorSprite, StringVect mSpriteColors; std::vector<int> mSpriteIDs; - std::vector<int> mSpriteColorsIds; + std::vector<unsigned char> mSpriteColorsIds; SpriteParticleInfo mSpriteParticles; // Character guild information diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index c069a6e4e..aed7ff767 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -107,7 +107,7 @@ extern int weightNoticeTime; extern MiniStatusWindow *miniStatusWindow; extern SkillDialog *skillDialog; -LocalPlayer::LocalPlayer(const int id, const int subtype) : +LocalPlayer::LocalPlayer(const int id, const uint16_t subtype) : Being(id, ActorType::PLAYER, subtype, nullptr), AttributeListener(), StatListener(), diff --git a/src/being/localplayer.h b/src/being/localplayer.h index 8e72bf5d6..2b61c0d2e 100644 --- a/src/being/localplayer.h +++ b/src/being/localplayer.h @@ -53,7 +53,8 @@ class LocalPlayer final : public Being, /** * Constructor. */ - explicit LocalPlayer(const int id = 65535, const int subtype = 0); + explicit LocalPlayer(const int id = 65535, + const uint16_t subtype = 0U); A_DELETE_COPY(LocalPlayer) diff --git a/src/debug/debug_new.h b/src/debug/debug_new.h index c3f833d28..b441d79fa 100644 --- a/src/debug/debug_new.h +++ b/src/debug/debug_new.h @@ -43,7 +43,7 @@ #define M_DEBUG_NEW_H #include <new> -#include <stdio.h> +#include <stdio> /** * @def HAVE_PLACEMENT_DELETE diff --git a/src/gui/focushandler.h b/src/gui/focushandler.h index 99ba45094..1537312f8 100644 --- a/src/gui/focushandler.h +++ b/src/gui/focushandler.h @@ -66,8 +66,6 @@ #ifndef GUI_FOCUSHANDLER_H #define GUI_FOCUSHANDLER_H -#include "gui/focushandler.h" - #include <list> #include <vector> diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 1c0694ca3..fb52607c7 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -166,27 +166,31 @@ void Viewport::draw(Graphics *graphics) { if (player_x > mPixelViewX + mScrollRadius) { - mPixelViewX += static_cast<float>(player_x + mPixelViewX += static_cast<int>( + static_cast<float>(player_x - mPixelViewX - mScrollRadius) / - static_cast<float>(mScrollLaziness); + static_cast<float>(mScrollLaziness)); } if (player_x < mPixelViewX - mScrollRadius) { - mPixelViewX += static_cast<float>(player_x + mPixelViewX += static_cast<int>( + static_cast<float>(player_x - mPixelViewX + mScrollRadius) / - static_cast<float>(mScrollLaziness); + static_cast<float>(mScrollLaziness)); } if (player_y > mPixelViewY + mScrollRadius) { - mPixelViewY += static_cast<float>(player_y - - mPixelViewY - mScrollRadius) / - static_cast<float>(mScrollLaziness); + mPixelViewY += static_cast<int>( + static_cast<float>(player_y + - mPixelViewY - mScrollRadius) / + static_cast<float>(mScrollLaziness)); } if (player_y < mPixelViewY - mScrollRadius) { - mPixelViewY += static_cast<float>(player_y - - mPixelViewY + mScrollRadius) / - static_cast<float>(mScrollLaziness); + mPixelViewY += static_cast<int>( + static_cast<float>(player_y + - mPixelViewY + mScrollRadius) / + static_cast<float>(mScrollLaziness)); } lastTick ++; cnt ++; @@ -407,6 +411,8 @@ bool Viewport::openContextMenu(const MouseEvent &event) } else if (mCameraMode) { + if (!mMap) + return false; mPopupMenu->showMapPopup(eventX, eventY, (mMouseX + mPixelViewX) / mMap->getTileWidth(), (mMouseY + mPixelViewY) / mMap->getTileHeight()); @@ -654,10 +660,10 @@ void Viewport::walkByMouse(const MouseEvent &event) } else { - const int destX = (event.getX() + mPixelViewX) - / static_cast<float>(mMap->getTileWidth()); - const int destY = (event.getY() + mPixelViewY) - / static_cast<float>(mMap->getTileHeight()); + const int destX = static_cast<int>((event.getX() + mPixelViewX) + / static_cast<float>(mMap->getTileWidth())); + const int destY = static_cast<int>((event.getY() + mPixelViewY) + / static_cast<float>(mMap->getTileHeight())); if (playerX != destX || playerY != destY) { if (!player_node->navigateTo(destX, destY)) @@ -1062,8 +1068,8 @@ void Viewport::moveCameraToActor(const int actorId, const Vector &actorPos = actor->getPosition(); const Vector &playerPos = player_node->getPosition(); mCameraMode = 1; - mCameraRelativeX = actorPos.x - playerPos.x + x; - mCameraRelativeY = actorPos.y - playerPos.y + y; + mCameraRelativeX = static_cast<int>(actorPos.x - playerPos.x) + x; + mCameraRelativeY = static_cast<int>(actorPos.y - playerPos.y) + y; } void Viewport::moveCameraToPosition(const int x, const int y) @@ -1074,8 +1080,8 @@ void Viewport::moveCameraToPosition(const int x, const int y) const Vector &playerPos = player_node->getPosition(); mCameraMode = 1; - mCameraRelativeX = x - playerPos.x; - mCameraRelativeY = y - playerPos.y; + mCameraRelativeX = x - static_cast<int>(playerPos.x); + mCameraRelativeY = y - static_cast<int>(playerPos.y); } void Viewport::moveCameraRelative(const int x, const int y) diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp index e5c6c06b3..50e99a24c 100644 --- a/src/gui/widgets/itemlinkhandler.cpp +++ b/src/gui/widgets/itemlinkhandler.cpp @@ -111,9 +111,9 @@ void ItemLinkHandler::handleLink(const std::string &link, MouseEvent *event) splitToIntVector(str, link, ','); if (str.empty()) return; - int color = 1; + unsigned char color = 1; if (str.size() > 1) - color = str[1]; + color = static_cast<unsigned char>(str[1]); const int id = str[0]; if (id > 0) { diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp index 68b50c458..5a8cc26e8 100644 --- a/src/gui/widgets/listbox.cpp +++ b/src/gui/widgets/listbox.cpp @@ -366,7 +366,7 @@ int ListBox::getSelectionByMouse(const int y) const { if (y < mPadding) return -1; - return (y - mPadding) / getRowHeight(); + return static_cast<unsigned int>(y - mPadding) / getRowHeight(); } void ListBox::setSelected(const int selected) diff --git a/src/gui/widgets/passwordfield.h b/src/gui/widgets/passwordfield.h index f72350763..4c05afd40 100644 --- a/src/gui/widgets/passwordfield.h +++ b/src/gui/widgets/passwordfield.h @@ -47,7 +47,7 @@ class PasswordField final : public TextField void draw(Graphics *graphics) override final; protected: - int mPasswordChar; + char mPasswordChar; }; #endif // GUI_WIDGETS_PASSWORDFIELD_H diff --git a/src/input/mouseinput.h b/src/input/mouseinput.h index 284116db2..7f89da06c 100644 --- a/src/input/mouseinput.h +++ b/src/input/mouseinput.h @@ -64,8 +64,6 @@ #ifndef INPUT_MOUSEINPUT_H #define INPUT_MOUSEINPUT_H -#include "input/mouseinput.h" - #include "events/mousebutton.h" #include "events/mouseeventtype.h" diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp index 002d7cb43..bffe6ef81 100644 --- a/src/net/ea/beinghandler.cpp +++ b/src/net/ea/beinghandler.cpp @@ -223,7 +223,7 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg, const uint16_t shield = msg.readInt16(); const uint16_t headTop = msg.readInt16(); const uint16_t headMid = msg.readInt16(); - const int hairColor = msg.readInt8(); + const unsigned char hairColor = msg.readInt8(); msg.readInt8(); // free const uint16_t shoes = msg.readInt16(); // clothes color diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp index a11f3bae8..e21a1d0e6 100644 --- a/src/net/eathena/beinghandler.cpp +++ b/src/net/eathena/beinghandler.cpp @@ -434,7 +434,7 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, const uint16_t stunMode = msg.readInt16(); // opt1 uint32_t statusEffects = msg.readInt16(); // opt2 statusEffects |= (static_cast<uint16_t>(msg.readInt16())) - << 16; // status.options; Aethyra uses this as misc2 + << 16U; // status.options; Aethyra uses this as misc2 const int16_t job = msg.readInt16(); int disguiseId = 0; if (id < 110000000 && job >= 1000) @@ -648,7 +648,8 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg, int16_t speed = msg.readInt16(); const uint16_t stunMode = msg.readInt16(); // opt1 uint32_t statusEffects = msg.readInt16(); // opt2 - statusEffects |= (static_cast<uint16_t>(msg.readInt16())) << 16; // option + statusEffects |= (static_cast<uint16_t>( + msg.readInt16())) << 16U; // option const int16_t job = msg.readInt16(); // class Being *dstBeing = actorManager->findBeing(id); diff --git a/src/net/eathena/messageout.cpp b/src/net/eathena/messageout.cpp index 49b67b84e..386f5b046 100644 --- a/src/net/eathena/messageout.cpp +++ b/src/net/eathena/messageout.cpp @@ -95,7 +95,8 @@ void MessageOut::writeCoordinates(const uint16_t x, static_cast<unsigned>(x), static_cast<unsigned>(y), static_cast<unsigned>(direction))); - char *const data = mData + mPos; + unsigned char *const data = reinterpret_cast<unsigned char*>(mData) + + static_cast<size_t>(mPos); mNetwork->mOutSize += 3; mPos += 3; diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index cf2c50bf7..7a86d2bd9 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -277,7 +277,7 @@ void BeingHandler::processBeingChangeLook(Net::MessageIn &msg, } const int type = msg.readInt8(); - int id = 0; + int16_t id = 0; int id2 = 0; const std::string color; @@ -312,7 +312,7 @@ void BeingHandler::processBeingChangeLook(Net::MessageIn &msg, break; case 1: // eAthena LOOK_HAIR { - const uint8_t look = static_cast<uint8_t>(id / 256U); + const uint8_t look = static_cast<uint8_t>(id / 256); const int hair = id % 256; dstBeing->setHairStyle(SPRITE_HAIR, hair * -1); dstBeing->setLook(look); @@ -340,7 +340,7 @@ void BeingHandler::processBeingChangeLook(Net::MessageIn &msg, player_node->imitateOutfit(dstBeing, SPRITE_TOPCLOTHES); break; case 6: // eAthena LOOK_HAIR_COLOR - dstBeing->setHairColor(SPRITE_HAIR, id); + dstBeing->setHairColor(SPRITE_HAIR, static_cast<uint8_t>(id)); break; case 7: // Clothes color // ignoring it @@ -520,7 +520,7 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, const uint16_t headTop = msg.readInt16(); const uint16_t headMid = msg.readInt16(); - const int hairColor = msg.readInt8(); + const uint8_t hairColor = msg.readInt8(); msg.readInt8(); // free unsigned char colors[9]; diff --git a/src/net/tmwa/buysellhandler.cpp b/src/net/tmwa/buysellhandler.cpp index c44b2ebbf..a51e0c7b1 100644 --- a/src/net/tmwa/buysellhandler.cpp +++ b/src/net/tmwa/buysellhandler.cpp @@ -95,14 +95,14 @@ void BuySellHandler::handleMessage(Net::MessageIn &msg) void BuySellHandler::processNpcBuy(Net::MessageIn &msg) { msg.readInt16(); // length - int sz = 11; + unsigned int sz = 11; if (serverVersion > 0) sz += 1; - const int n_items = (msg.getLength() - 4) / sz; + const unsigned int n_items = (msg.getLength() - 4U) / sz; mBuyDialog = new BuyDialog(mNpcId); mBuyDialog->setMoney(PlayerInfo::getAttribute(Attributes::MONEY)); - for (int k = 0; k < n_items; k++) + for (unsigned int k = 0; k < n_items; k++) { const int value = msg.readInt32(); msg.readInt32(); // DCvalue diff --git a/src/net/tmwa/messageout.cpp b/src/net/tmwa/messageout.cpp index 1a3986412..31196a4a7 100644 --- a/src/net/tmwa/messageout.cpp +++ b/src/net/tmwa/messageout.cpp @@ -94,7 +94,8 @@ void MessageOut::writeCoordinates(const uint16_t x, DEBUGLOG(strprintf("writeCoordinates: %u,%u %u", static_cast<unsigned>(x), static_cast<unsigned>(y), static_cast<unsigned>(direction))); - char *const data = mData + static_cast<size_t>(mPos); + unsigned char *const data = reinterpret_cast<unsigned char*>(mData) + + static_cast<size_t>(mPos); mNetwork->mOutSize += 3; mPos += 3; diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index a555a7b71..b13fffca3 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -286,7 +286,7 @@ void PlayerHandler::processOnlineList(Net::MessageIn &msg) } buf ++; - int gender = Gender::UNSPECIFIED; + unsigned char gender = Gender::UNSPECIFIED; if (serverVersion >= 4) { if (config.getBoolValue("showgender")) diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp index 757de8238..e3cf9bb91 100644 --- a/src/resources/beinginfo.cpp +++ b/src/resources/beinginfo.cpp @@ -154,7 +154,7 @@ const SoundInfo &BeingInfo::getSound(const ItemSoundEvent::Type event) const if (!vect || vect->empty()) return emptySound; else - return vect->at(rand() % vect->size()); + return vect->at(static_cast<unsigned int>(rand()) % vect->size()); } const Attack *BeingInfo::getAttack(const int id) const diff --git a/src/resources/db/palettedb.cpp b/src/resources/db/palettedb.cpp index 8ec238336..08c8ec85d 100644 --- a/src/resources/db/palettedb.cpp +++ b/src/resources/db/palettedb.cpp @@ -82,13 +82,14 @@ void PaletteDB::loadPalette() if (line.empty() || line[0] == '#') continue; - unsigned int r; - unsigned int g; - unsigned int b; + unsigned char r; + unsigned char g; + unsigned char b; - if (sscanf(line.c_str(), "%10u %10u %10u\t%100s", + if (sscanf(line.c_str(), "%10hhu %10hhu %10hhu\t%100s", &r, &g, &b, name) == 4) { + name[100] = 0; mColors[name] = DyeColor(r, g, b); } } diff --git a/src/resources/dye.cpp b/src/resources/dye.cpp index ea66b2b6b..3b83780c5 100644 --- a/src/resources/dye.cpp +++ b/src/resources/dye.cpp @@ -162,23 +162,25 @@ void Dye::normalDye(uint32_t *restrict pixels, const int bufSize) const #endif if (!alpha) continue; - int color[3]; + unsigned int color[3]; #if SDL_BYTEORDER == SDL_BIG_ENDIAN - color[0] = (p) & 255; - color[1] = (p >> 8) & 255; - color[2] = (p >> 16) & 255; + color[0] = (p) & 255U; + color[1] = (p >> 8U) & 255U; + color[2] = (p >> 16U) & 255U; #else - color[0] = (p >> 24) & 255; - color[1] = (p >> 16) & 255; - color[2] = (p >> 8) & 255; + color[0] = (p >> 24U) & 255U; + color[1] = (p >> 16U) & 255U; + color[2] = (p >> 8U) & 255U; #endif - const int cmax = std::max(color[0], std::max(color[1], color[2])); + const unsigned int cmax = std::max( + color[0], std::max(color[1], color[2])); if (cmax == 0) continue; - const int cmin = std::min(color[0], std::min(color[1], color[2])); - const int intensity = color[0] + color[1] + color[2]; + const unsigned int cmin = std::min( + color[0], std::min(color[1], color[2])); + const unsigned int intensity = color[0] + color[1] + color[2]; if (cmin != cmax && (cmin != 0 || (intensity != cmax && intensity != 2 * cmax))) @@ -187,7 +189,7 @@ void Dye::normalDye(uint32_t *restrict pixels, const int bufSize) const continue; } - const int i = (color[0] != 0) | ((color[1] != 0) << 1) + const unsigned int i = (color[0] != 0) | ((color[1] != 0) << 1) | ((color[2] != 0) << 2); if (mDyePalettes[i - 1]) @@ -217,23 +219,25 @@ void Dye::normalOGLDye(uint32_t *restrict pixels, const int bufSize) const #endif if (!alpha) continue; - int color[3]; + unsigned int color[3]; #if SDL_BYTEORDER == SDL_BIG_ENDIAN - color[0] = (p >> 24) & 255; - color[1] = (p >> 16) & 255; - color[2] = (p >> 8) & 255; + color[0] = (p >> 24U) & 255U; + color[1] = (p >> 16U) & 255U; + color[2] = (p >> 8U) & 255U; #else - color[0] = (p) & 255; - color[1] = (p >> 8) & 255; - color[2] = (p >> 16) & 255; + color[0] = (p) & 255U; + color[1] = (p >> 8U) & 255U; + color[2] = (p >> 16U) & 255U; #endif - const int cmax = std::max(color[0], std::max(color[1], color[2])); + const unsigned int cmax = std::max( + color[0], std::max(color[1], color[2])); if (cmax == 0) continue; - const int cmin = std::min(color[0], std::min(color[1], color[2])); - const int intensity = color[0] + color[1] + color[2]; + const unsigned int cmin = std::min( + color[0], std::min(color[1], color[2])); + const unsigned int intensity = color[0] + color[1] + color[2]; if (cmin != cmax && (cmin != 0 || (intensity != cmax && intensity != 2 * cmax))) @@ -242,7 +246,7 @@ void Dye::normalOGLDye(uint32_t *restrict pixels, const int bufSize) const continue; } - const int i = (color[0] != 0) | ((color[1] != 0) << 1) + const unsigned int i = (color[0] != 0) | ((color[1] != 0) << 1) | ((color[2] != 0) << 2); if (mDyePalettes[i - 1]) diff --git a/src/resources/dyepalette.cpp b/src/resources/dyepalette.cpp index f20af9086..4c62abd1c 100644 --- a/src/resources/dyepalette.cpp +++ b/src/resources/dyepalette.cpp @@ -234,11 +234,11 @@ void DyePalette::replaceSColor(uint32_t *restrict pixels, const DyeColor &col2 = *it; #if SDL_BYTEORDER == SDL_BIG_ENDIAN - const unsigned int coldata = (col.value[2] << 16) - | (col.value[1] << 8) | (col.value[0]); + const unsigned int coldata = (col.value[2] << 16U) + | (col.value[1] << 8U) | (col.value[0]); #else - const unsigned int coldata = (col.value[2] << 8) - | (col.value[1] << 16) | (col.value[0] << 24); + const unsigned int coldata = (col.value[2] << 8U) + | (col.value[1] << 16U) | (col.value[0] << 24U); #endif // logger->log("coldata: %08x", coldata); if (data == coldata) @@ -280,11 +280,15 @@ void DyePalette::replaceAColor(uint32_t *restrict pixels, const DyeColor &col2 = *it; #if SDL_BYTEORDER == SDL_BIG_ENDIAN - const unsigned int coldata = (col.value[3] << 24) - | (col.value[2] << 16) | (col.value[1] << 8) | (col.value[0]); + const unsigned int coldata = (col.value[3] << 24U) + | (col.value[2] << 16U) + | (col.value[1] << 8U) + | (col.value[0]); #else - const unsigned int coldata = (col.value[3]) | (col.value[2] << 8) - | (col.value[1] << 16) | (col.value[0] << 24); + const unsigned int coldata = (col.value[3]) + | (col.value[2] << 8U) + | (col.value[1] << 16U) | + (col.value[0] << 24U); #endif if (data == coldata) @@ -378,11 +382,15 @@ void DyePalette::replaceAOGLColor(uint32_t *restrict pixels, const DyeColor &col2 = *it; #if SDL_BYTEORDER == SDL_BIG_ENDIAN - const unsigned int coldata = (col.value[0] << 24) - | (col.value[1] << 16) | (col.value[2] << 8) | col.value[3]; + const unsigned int coldata = (col.value[0] << 24U) + | (col.value[1] << 16U) + | (col.value[2] << 8U) + | col.value[3]; #else - const unsigned int coldata = (col.value[0]) | (col.value[1] << 8) - | (col.value[2] << 16) | (col.value[3] << 24); + const unsigned int coldata = (col.value[0]) + | (col.value[1] << 8U) + | (col.value[2] << 16U) + | (col.value[3] << 24U); #endif if (data == coldata) { diff --git a/src/resources/fboinfo.h b/src/resources/fboinfo.h index 9ba4efd43..6d723ca6a 100644 --- a/src/resources/fboinfo.h +++ b/src/resources/fboinfo.h @@ -26,8 +26,6 @@ #include "render/graphics.h" -#include "resources/fboinfo.h" - #ifdef ANDROID #include <GLES/gl.h> #include <GLES/glext.h> diff --git a/src/resources/imagewriter.cpp b/src/resources/imagewriter.cpp index 9ff87c758..1f71d97a3 100644 --- a/src/resources/imagewriter.cpp +++ b/src/resources/imagewriter.cpp @@ -24,7 +24,7 @@ #include "logger.h" -#include <stdlib.h> +#include <cstdlib> #include <png.h> #include <SDL_video.h> #include <string> diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp index 8e1284fad..55ca5f44d 100644 --- a/src/resources/iteminfo.cpp +++ b/src/resources/iteminfo.cpp @@ -152,7 +152,7 @@ const SoundInfo &ItemInfo::getSound(const ItemSoundEvent::Type event) const if (i == mSounds.end()) return empty; - return (!i->second.empty()) ? i->second[rand() + return (!i->second.empty()) ? i->second[static_cast<unsigned int>(rand()) % i->second.size()] : empty; } diff --git a/src/utils/base64.cpp b/src/utils/base64.cpp index feed37066..bb69539e1 100644 --- a/src/utils/base64.cpp +++ b/src/utils/base64.cpp @@ -130,15 +130,15 @@ unsigned char *php3_base64_decode(const unsigned char *restrict const string, switch (i % 4) { case 0: - result[j] = static_cast<unsigned char>(ch << 2); + result[j] = static_cast<unsigned char>(ch << 2U); break; case 1: - result[j++] |= static_cast<unsigned char>(ch >> 4); - result[j] = static_cast<unsigned char>((ch & 0x0f) << 4); + result[j++] |= static_cast<unsigned char>(ch >> 4U); + result[j] = static_cast<unsigned char>((ch & 0x0f) << 4U); break; case 2: - result[j++] |= static_cast<unsigned char>(ch >>2); - result[j] = static_cast<unsigned char>((ch & 0x03) << 6); + result[j++] |= static_cast<unsigned char>(ch >>2U); + result[j] = static_cast<unsigned char>((ch & 0x03) << 6U); break; case 3: result[j++] |= static_cast<unsigned char>(ch); diff --git a/src/utils/physfsrwops.cpp b/src/utils/physfsrwops.cpp index 94172cd71..b4afa5e9e 100644 --- a/src/utils/physfsrwops.cpp +++ b/src/utils/physfsrwops.cpp @@ -202,7 +202,7 @@ static SDL_RWops *create_rwops(PHYSFS_file *const handle) retval->hidden.unknown.data1 = handle; } /* if */ #ifdef DUMP_LEAKED_RESOURCES - openedRWops ++; + openedRWops ++; #endif } /* else */ |