diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-05-31 17:01:38 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-05-31 17:01:38 +0300 |
commit | 5a60cfd0ef0c2f8b78397d05a50ab9b939309ea5 (patch) | |
tree | aeafccf4632262393b23e52afc9facc5ec9f1b3f /src | |
parent | 84f2cad3897d0dacb60cfef4e1860ffb8ec268e1 (diff) | |
download | plus-5a60cfd0ef0c2f8b78397d05a50ab9b939309ea5.tar.gz plus-5a60cfd0ef0c2f8b78397d05a50ab9b939309ea5.tar.bz2 plus-5a60cfd0ef0c2f8b78397d05a50ab9b939309ea5.tar.xz plus-5a60cfd0ef0c2f8b78397d05a50ab9b939309ea5.zip |
Fix sign on some vars.
Diffstat (limited to 'src')
-rw-r--r-- | src/graphicsmanager.cpp | 9 | ||||
-rw-r--r-- | src/gui/palette.h | 2 | ||||
-rw-r--r-- | src/gui/sdlinput.cpp | 2 | ||||
-rw-r--r-- | src/net/eathena/network.cpp | 8 | ||||
-rw-r--r-- | src/net/tmwa/network.cpp | 8 | ||||
-rw-r--r-- | src/resources/imagehelper.cpp | 13 | ||||
-rw-r--r-- | src/resources/openglimagehelper.cpp | 2 | ||||
-rw-r--r-- | src/resources/resourcemanager.cpp | 2 | ||||
-rw-r--r-- | src/utils/stringutils.cpp | 9 |
9 files changed, 32 insertions, 23 deletions
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp index cb546e752..e31ec36ea 100644 --- a/src/graphicsmanager.cpp +++ b/src/graphicsmanager.cpp @@ -593,7 +593,10 @@ void GraphicsManager::updateTextureFormat() const ? static_cast<size_t>(num) : 10]; glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS, formats); for (int f = 0; f < num; f ++) - logger->log(" 0x%x", formats[f]); + { + logger->log(" 0x%x", static_cast<unsigned int>( + formats[f])); + } for (int f = 0; f < num; f ++) { @@ -1171,8 +1174,8 @@ void GraphicsManager::detectPixelSize() &mWidthMM, &mHeightMM, &mDensity); #endif #endif - logger->log("screen size in pixels: %dx%d", mMaxWidth, mMaxHeight); - logger->log("screen size in millimeters: %dx%d", mWidthMM, mHeightMM); + logger->log("screen size in pixels: %ux%u", mMaxWidth, mMaxHeight); + logger->log("screen size in millimeters: %ux%u", mWidthMM, mHeightMM); logger->log("actual screen density: " + getDensityString()); const int density = config.getIntValue("screenDensity"); if (density > 0 && density <= densitySize) diff --git a/src/gui/palette.h b/src/gui/palette.h index de733f838..bd974a94b 100644 --- a/src/gui/palette.h +++ b/src/gui/palette.h @@ -204,7 +204,7 @@ class Palette gradientIndex = rand(); } - inline int getRGB() const A_WARN_UNUSED + inline unsigned int getRGB() const A_WARN_UNUSED { return (committedColor.r << 16) | (committedColor.g << 8) | committedColor.b; diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp index 665617c8d..05518e9a6 100644 --- a/src/gui/sdlinput.cpp +++ b/src/gui/sdlinput.cpp @@ -313,7 +313,7 @@ MouseButton::Type SDLInput::convertMouseButton(const int button) #endif default: // We have an unknown mouse type which is ignored. - logger->log("unknown button type: %u", button); + logger->log("unknown button type: %d", button); return MouseButton::EMPTY; } } diff --git a/src/net/eathena/network.cpp b/src/net/eathena/network.cpp index 87d5d4b5a..9b3ede389 100644 --- a/src/net/eathena/network.cpp +++ b/src/net/eathena/network.cpp @@ -165,7 +165,7 @@ void Network::dispatchMessages() while (messageReady()) { SDL_mutexP(mMutexIn); - const int msgId = readWord(0); + const unsigned int msgId = readWord(0); int len = -1; if (msgId == SMSG_SERVER_VERSION_RESPONSE) { @@ -177,7 +177,7 @@ void Network::dispatchMessages() } else { - if (msgId >= 0 && msgId < packet_lengths_size) + if (msgId < packet_lengths_size) len = packet_lengths[msgId]; } @@ -191,12 +191,12 @@ void Network::dispatchMessages() if (len == 0) { // need copy data for safty - std::string str = strprintf("Wrong packet %d ""received. Exiting.", + std::string str = strprintf("Wrong packet %u ""received. Exiting.", msgId); logger->safeError(str); } - if (msgId >= 0 && msgId < messagesSize) + if (msgId < messagesSize) { MessageHandler *const handler = mMessageHandlers[msgId]; if (handler) diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index b778d6b31..8f4b2452a 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -145,13 +145,13 @@ void Network::dispatchMessages() { SDL_mutexP(mMutexIn); BLOCK_START("Network::dispatchMessages 2") - const int msgId = readWord(0); + const unsigned int msgId = readWord(0); int len = -1; if (msgId == SMSG_SERVER_VERSION_RESPONSE) len = 10; else if (msgId == SMSG_UPDATE_HOST2) len = -1; - else if (msgId >= 0 && msgId < packet_lengths_size) + else if (msgId < packet_lengths_size) len = packet_lengths[msgId]; if (len == -1) @@ -166,12 +166,12 @@ void Network::dispatchMessages() if (len == 0) { // need copy data for safty - std::string str = strprintf("Wrong packet %d ""received. Exiting.", + std::string str = strprintf("Wrong packet %u ""received. Exiting.", msgId); logger->safeError(str); } - if (msgId >= 0 && msgId < messagesSize) + if (msgId < messagesSize) { MessageHandler *const handler = mMessageHandlers[msgId]; if (handler) diff --git a/src/resources/imagehelper.cpp b/src/resources/imagehelper.cpp index ad0c98ad1..0092d132b 100644 --- a/src/resources/imagehelper.cpp +++ b/src/resources/imagehelper.cpp @@ -169,12 +169,15 @@ void ImageHelper::dumpSurfaceFormat(const SDL_Surface *const image) logger->log("Alpha: %d", format->alpha); #endif logger->log("Loss: %02x, %02x, %02x, %02x", - static_cast<int>(format->Rloss), static_cast<int>(format->Gloss), - static_cast<int>(format->Bloss), static_cast<int>(format->Aloss)); + static_cast<unsigned int>(format->Rloss), + static_cast<unsigned int>(format->Gloss), + static_cast<unsigned int>(format->Bloss), + static_cast<unsigned int>(format->Aloss)); logger->log("Shift: %02x, %02x, %02x, %02x", - static_cast<int>(format->Rshift), static_cast<int>(format->Gshift), - static_cast<int>(format->Bshift), - static_cast<int>(format->Ashift)); + static_cast<unsigned int>(format->Rshift), + static_cast<unsigned int>(format->Gshift), + static_cast<unsigned int>(format->Bshift), + static_cast<unsigned int>(format->Ashift)); logger->log("Mask: %08x, %08x, %08x, %08x", format->Rmask, format->Gmask, format->Bmask, format->Amask); } diff --git a/src/resources/openglimagehelper.cpp b/src/resources/openglimagehelper.cpp index 7421dc852..292b2fb22 100644 --- a/src/resources/openglimagehelper.cpp +++ b/src/resources/openglimagehelper.cpp @@ -277,7 +277,7 @@ Image *OpenGLImageHelper::glLoad(SDL_Surface *tmpImage, if (error) { std::string errmsg = GraphicsManager::errorToString(error); - logger->log("Error: Image GL import failed: %s (%d)", + logger->log("Error: Image GL import failed: %s (%u)", errmsg.c_str(), error); return nullptr; } diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp index ff907bb53..ea4698862 100644 --- a/src/resources/resourcemanager.cpp +++ b/src/resources/resourcemanager.cpp @@ -169,7 +169,7 @@ void ResourceManager::cleanUp(Resource *const res) if (res->mRefCount > 0) { - logger->log("ResourceManager::~ResourceManager() cleaning up %d " + logger->log("ResourceManager::~ResourceManager() cleaning up %u " "reference%s to %s", res->mRefCount, (res->mRefCount == 1) ? "" : "s", diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp index a5435f3f9..af4cafd35 100644 --- a/src/utils/stringutils.cpp +++ b/src/utils/stringutils.cpp @@ -573,9 +573,12 @@ std::string stringToHexPath(const std::string &str) if (str.empty()) return ""; - std::string hex = strprintf("%%%2x/", static_cast<int>(str[0])); - for (unsigned f = 1, sz = static_cast<unsigned>(str.size()); f < sz; f ++) - hex.append(strprintf("%%%2x", static_cast<int>(str[f]))); + std::string hex = strprintf("%%%2x/", static_cast<unsigned int>(str[0])); + for (unsigned f = 1, sz = static_cast<unsigned int>(str.size()); + f < sz; f ++) + { + hex.append(strprintf("%%%2x", static_cast<unsigned int>(str[f]))); + } return hex; } |