diff options
author | Andrei Karas <akaras@inbox.ru> | 2018-10-29 02:02:04 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2018-10-29 02:02:04 +0300 |
commit | a6d18b282ab916c6536dc25516affeb9200043b6 (patch) | |
tree | 9980735a47cb2118999fb4f4dceaa52bf9f4fae7 | |
parent | 98c74738f21d7ae256f1273b6c1614ee64e2a3ad (diff) | |
download | plus-a6d18b282ab916c6536dc25516affeb9200043b6.tar.gz plus-a6d18b282ab916c6536dc25516affeb9200043b6.tar.bz2 plus-a6d18b282ab916c6536dc25516affeb9200043b6.tar.xz plus-a6d18b282ab916c6536dc25516affeb9200043b6.zip |
Fix code style.s20181102
91 files changed, 290 insertions, 290 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp index d25fd0207..d43912258 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -987,7 +987,7 @@ void Being::handleAttack(Being *restrict const victim, { const uint8_t dir = calcDirection(victim->mX, victim->mY); - if (dir != 0u) + if (dir != 0U) setDirection(dir); } @@ -1090,7 +1090,7 @@ void Being::handleSkill(Being *restrict const victim, { const uint8_t dir = calcDirection(victim->mX, victim->mY); - if (dir != 0u) + if (dir != 0U) setDirection(dir); } if ((damage != 0) && victim->mType == ActorType::Player @@ -1791,7 +1791,7 @@ void Being::nextTile() restrict2 mPath.pop_front(); const uint8_t dir = calcDirection(pos.x, pos.y); - if (dir != 0u) + if (dir != 0U) setDirection(dir); if (mMap == nullptr || @@ -2303,7 +2303,7 @@ void Being::updateBotDirection(const int dstX, break; } } - if ((newDir != 0u) && newDir != mDirection) + if ((newDir != 0U) && newDir != mDirection) { if (mType == ActorType::Homunculus) homunculusHandler->setDirection(newDir); @@ -2317,7 +2317,7 @@ void Being::updateBadgesPosition() const int px = mPixelX - mapTileSize / 2; const int py = mPixelY - mapTileSize * 2 - mapTileSize; if (mShowBadges != BadgeDrawType::Hide && - mBadgesCount != 0u) + mBadgesCount != 0U) { if (mDispName != nullptr && gui != nullptr) @@ -2386,7 +2386,7 @@ void Being::drawEmotion(Graphics *restrict const graphics, if (mAnimationEffect != nullptr) mAnimationEffect->draw(graphics, px, py); if (mShowBadges != BadgeDrawType::Hide && - mBadgesCount != 0u) + mBadgesCount != 0U) { int x = mBadgesX - offsetX; const int y = mBadgesY - offsetY; @@ -2778,7 +2778,7 @@ void Being::updateSprite(const unsigned int slot, if (slot >= CAST_U32(mSlots.size())) mSlots.resize(slot + 1, BeingSlot()); - if ((slot != 0u) && mSlots[slot].spriteId == id) + if ((slot != 0U) && mSlots[slot].spriteId == id) return; setSpriteColor(slot, id, @@ -3503,7 +3503,7 @@ bool Being::updateFromCache() restrict2 showInactiveBadge(mInactive); showAwayBadge(mAway); updateAwayEffect(); - if (mType == ActorType::Player || (mTeamId != 0u)) + if (mType == ActorType::Player || (mTeamId != 0U)) updateColors(); return true; } @@ -3951,7 +3951,7 @@ void Being::drawCompound(Graphics *const graphics, posX + mOffsetX, posY + mOffsetY); } - else if ((mAlpha != 0.0f) && (mAlphaImage != nullptr)) + else if ((mAlpha != 0.0F) && (mAlphaImage != nullptr)) { mAlphaImage->setAlpha(mAlpha); graphics->drawImage(mAlphaImage, @@ -5198,7 +5198,7 @@ void Being::showTeamBadge(const bool show) restrict2 { delete2(mBadges[BadgeIndex::Team]); if (show && - mTeamId != 0u && + mTeamId != 0U && mShowBadges != BadgeDrawType::Hide) { const std::string name = paths.getStringValue("badges") + diff --git a/src/being/castingeffect.h b/src/being/castingeffect.h index 090491c1e..3e219bcd5 100644 --- a/src/being/castingeffect.h +++ b/src/being/castingeffect.h @@ -58,7 +58,7 @@ class CastingEffect final : public Actor bool isTerminated() const; float getAlpha() const override final A_WARN_UNUSED - { return 1.0f; } + { return 1.0F; } void setAlpha(const float alpha A_UNUSED) override final { } diff --git a/src/being/compoundsprite.cpp b/src/being/compoundsprite.cpp index 72bdc4417..843c3b6b6 100644 --- a/src/being/compoundsprite.cpp +++ b/src/being/compoundsprite.cpp @@ -160,7 +160,7 @@ void CompoundSprite::drawSimple(Graphics *const graphics, { graphics->drawImage(mImage, posX + mOffsetX, posY + mOffsetY); } - else if ((mAlpha != 0.0f) && (mAlphaImage != nullptr)) + else if ((mAlpha != 0.0F) && (mAlphaImage != nullptr)) { mAlphaImage->setAlpha(mAlpha); graphics->drawImage(mAlphaImage, diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index 240228068..54c95bd85 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -452,7 +452,7 @@ void LocalPlayer::nextTile() if (mPickUpTarget != nullptr) pickUp(mPickUpTarget); - if (mWalkingDir != 0u) + if (mWalkingDir != 0U) startWalking(mWalkingDir); } else if (mPath.size() == 1) @@ -648,7 +648,7 @@ void LocalPlayer::setWalkingDir(const unsigned char dir) mWalkingDir = dir; // If we're not already walking, start walking. - if (mAction != BeingAction::MOVE && (dir != 0u)) + if (mAction != BeingAction::MOVE && (dir != 0U)) startWalking(dir); } @@ -656,7 +656,7 @@ void LocalPlayer::startWalking(const unsigned char dir) { // This function is called by setWalkingDir(), // but also by nextTile() for TMW-Athena... - if ((mMap == nullptr) || (dir == 0u)) + if ((mMap == nullptr) || (dir == 0U)) return; mPickUpTarget = nullptr; @@ -707,7 +707,7 @@ void LocalPlayer::startWalking(const unsigned char dir) void LocalPlayer::stopWalking(const bool sendToServer) { - if (mAction == BeingAction::MOVE && (mWalkingDir != 0u)) + if (mAction == BeingAction::MOVE && (mWalkingDir != 0U)) { mWalkingDir = 0; mPickUpTarget = nullptr; @@ -1676,10 +1676,10 @@ void LocalPlayer::moveByDirection(const unsigned char dir) void LocalPlayer::specialMove(const unsigned char direction) { - if ((direction != 0u) && ((mNavigateX != 0) || (mNavigateY != 0))) + if ((direction != 0U) && ((mNavigateX != 0) || (mNavigateY != 0))) navigateClean(); - if ((direction != 0u) && (settings.moveType >= 2 + if ((direction != 0U) && (settings.moveType >= 2 && settings.moveType <= 4)) { if (mAction == BeingAction::MOVE) @@ -2635,7 +2635,7 @@ void LocalPlayer::fixAttackTarget() if ((mMap == nullptr) || (mTarget == nullptr)) return; - if (settings.moveToTargetType == 11 || (settings.attackType == 0u) + if (settings.moveToTargetType == 11 || (settings.attackType == 0U) || !config.getBoolValue("autofixPos")) { return; @@ -2676,7 +2676,7 @@ void LocalPlayer::updateNavigateList() if (iter != mHomes.end()) { const Vector &pos = mHomes[(*iter).first]; - if ((pos.x != 0.0f) && (pos.y != 0.0f)) + if ((pos.x != 0.0F) && (pos.y != 0.0F)) { mMap->addPortalTile("home", MapItemType::HOME, CAST_S32(pos.x), CAST_S32(pos.y)); diff --git a/src/eventsmanager.cpp b/src/eventsmanager.cpp index ae0cf0650..090cfdb82 100644 --- a/src/eventsmanager.cpp +++ b/src/eventsmanager.cpp @@ -627,7 +627,7 @@ void EventsManager::handleActive(const SDL_Event &event) if ((event.active.state & SDL_APPACTIVE) != 0) { - if (event.active.gain != 0u) + if (event.active.gain != 0U) { // window restore WindowManager::setIsMinimized(false); #ifndef DYECMD @@ -670,11 +670,11 @@ void EventsManager::handleActive(const SDL_Event &event) if ((event.active.state & SDL_APPINPUTFOCUS) != 0) { - settings.inputFocused = (event.active.gain != 0u) ? + settings.inputFocused = (event.active.gain != 0U) ? KeyboardFocus::Focused : KeyboardFocus::Unfocused; } if ((event.active.state & SDL_APPMOUSEFOCUS) != 0) - settings.mouseFocused = (event.active.gain != 0u); + settings.mouseFocused = (event.active.gain != 0U); #ifndef DYECMD if (inGame) Game::instance()->updateFrameRate(fpsLimit); diff --git a/src/fs/files.cpp b/src/fs/files.cpp index 98eea7cfc..ce7f663a3 100644 --- a/src/fs/files.cpp +++ b/src/fs/files.cpp @@ -188,7 +188,7 @@ int Files::copyFile(const std::string &restrict srcName, const int chunkSize = 512000; char *buf = new char[chunkSize]; size_t sz = 0; - while ((sz = fread(buf, 1, chunkSize, srcFile)) != 0u) + while ((sz = fread(buf, 1, chunkSize, srcFile)) != 0U) { if (fwrite(buf, 1, sz, dstFile) != sz) { diff --git a/src/game.cpp b/src/game.cpp index eadfda7f6..dec8874cf 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1006,7 +1006,7 @@ void Game::moveInDirection(const unsigned char direction) if (viewport == nullptr) return; - if (settings.cameraMode == 0u) + if (settings.cameraMode == 0U) { if (localPlayer != nullptr) localPlayer->specialMove(direction); @@ -1190,7 +1190,7 @@ void Game::changeMap(const std::string &mapPath) void Game::updateHistory(const SDL_Event &event) { - if ((localPlayer == nullptr) || (settings.attackType == 0u)) + if ((localPlayer == nullptr) || (settings.attackType == 0U)) return; if (CAST_S32(event.key.keysym.sym) != -1) @@ -1250,7 +1250,7 @@ void Game::checkKeys() const int timeRange = 120; const int cntInTime = 130; - if ((localPlayer == nullptr) || (settings.attackType == 0u)) + if ((localPlayer == nullptr) || (settings.attackType == 0U)) return; const time_t time = cur_time; diff --git a/src/gamemodifiers.cpp b/src/gamemodifiers.cpp index 822678668..f3e9dbdd0 100644 --- a/src/gamemodifiers.cpp +++ b/src/gamemodifiers.cpp @@ -119,7 +119,7 @@ void GameModifiers::changeMode(unsigned *restrict const var, } else { - if (*var == 0u) + if (*var == 0U) *var = limit - 1; else (*var) --; @@ -502,7 +502,7 @@ void GameModifiers::resetModifiers() settings.mapDrawType = MapType::NORMAL; if (viewport != nullptr) { - if (settings.cameraMode != 0u) + if (settings.cameraMode != 0U) viewport->toggleCameraMode(); Map *const map = viewport->getMap(); if (map != nullptr) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 8df7c384a..1f8589b50 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -1526,7 +1526,7 @@ void Gui::handleModalFocusReleased() int Gui::getMousePressLength() const { - if (mLastMousePressTimeStamp == 0u) + if (mLastMousePressTimeStamp == 0U) return 0; unsigned int ticks = SDL_GetTicks(); if (ticks > mLastMousePressTimeStamp) diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 03398c6b5..1d4745110 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -2592,7 +2592,7 @@ void PopupMenu::addFollow() void PopupMenu::addBuySell(const Being *const being) { - if ((playerRelations.getDefault() & PlayerRelation::TRADE) != 0u) + if ((playerRelations.getDefault() & PlayerRelation::TRADE) != 0U) { mBrowserBox->addSeparator("##3---"); const bool haveVending = @@ -2626,7 +2626,7 @@ void PopupMenu::addBuySell(const Being *const being) void PopupMenu::addBuySellDefault() { - if ((playerRelations.getDefault() & PlayerRelation::TRADE) != 0u) + if ((playerRelations.getDefault() & PlayerRelation::TRADE) != 0U) { mBrowserBox->addSeparator("##3---"); // TRANSLATORS: popup menu item diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp index 59d964641..f1da58cbc 100644 --- a/src/gui/sdlinput.cpp +++ b/src/gui/sdlinput.cpp @@ -278,7 +278,7 @@ void SDLInput::pushInput(const SDL_Event &event) * application loses its mousefocus. */ if ((event.active.state & SDL_APPMOUSEFOCUS) != 0 && - event.active.gain == 0u) + event.active.gain == 0U) { mMouseInWindow = false; @@ -294,7 +294,7 @@ void SDLInput::pushInput(const SDL_Event &event) } if ((event.active.state & SDL_APPMOUSEFOCUS) != 0 && - event.active.gain != 0u) + event.active.gain != 0U) { mMouseInWindow = true; } diff --git a/src/gui/sdlinput.h b/src/gui/sdlinput.h index 9ccd34f04..782604bd4 100644 --- a/src/gui/sdlinput.h +++ b/src/gui/sdlinput.h @@ -331,7 +331,7 @@ class SDLInput final } PRAGMA45(GCC diagnostic pop) - if ((CAST_U32(keysym.mod) & KMOD_NUM) == 0u) + if ((CAST_U32(keysym.mod) & KMOD_NUM) == 0U) { PRAGMA45(GCC diagnostic push) PRAGMA45(GCC diagnostic ignored "-Wswitch-enum") diff --git a/src/gui/shortcut/emoteshortcut.cpp b/src/gui/shortcut/emoteshortcut.cpp index 68c609ea2..26f9ce946 100644 --- a/src/gui/shortcut/emoteshortcut.cpp +++ b/src/gui/shortcut/emoteshortcut.cpp @@ -68,7 +68,7 @@ void EmoteShortcut::save() const { for (int i = 0; i < SHORTCUT_EMOTES; i++) { - const unsigned char emoteId = mEmotes[i] != 0u ? mEmotes[i] + const unsigned char emoteId = mEmotes[i] != 0U ? mEmotes[i] : CAST_U8(0); serverConfig.setValue("emoteshortcut" + toString(i), CAST_U32(emoteId)); diff --git a/src/gui/shortcut/emoteshortcut.h b/src/gui/shortcut/emoteshortcut.h index fd6ebd777..65f7aa86d 100644 --- a/src/gui/shortcut/emoteshortcut.h +++ b/src/gui/shortcut/emoteshortcut.h @@ -101,7 +101,7 @@ class EmoteShortcut final * A flag to check if the Emote is selected. */ bool isEmoteSelected() const noexcept2 A_WARN_UNUSED - { return mEmoteSelected != 0u; } + { return mEmoteSelected != 0U; } /** * Remove a Emote from the shortcut. diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index c345e6911..c6d1e1bd1 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -965,7 +965,7 @@ ImageSet *Theme::getImageSetFromThemeXml(const std::string &name, { Image *const image = rect.grid[0]; const SDL_Rect &rect2 = image->mBounds; - if ((rect2.w != 0u) && (rect2.h != 0u)) + if ((rect2.w != 0U) && (rect2.h != 0U)) { ImageSet *const imageSet = Loader::getSubImageSet( image, w, h); diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index ab87076d9..7354dbabf 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -426,7 +426,7 @@ void BrowserBox::draw(Graphics *const graphics) if (mSelectedLink >= 0 && mSelectedLink < CAST_S32(mLinks.size())) { - if ((mHighlightMode & LinkHighlightMode::BACKGROUND) != 0u) + if ((mHighlightMode & LinkHighlightMode::BACKGROUND) != 0U) { BrowserLink &link = mLinks[CAST_SIZE(mSelectedLink)]; graphics->setColor(mHighlightColor); @@ -437,7 +437,7 @@ void BrowserBox::draw(Graphics *const graphics) link.y2 - link.y1)); } - if ((mHighlightMode & LinkHighlightMode::UNDERLINE) != 0u) + if ((mHighlightMode & LinkHighlightMode::UNDERLINE) != 0U) { BrowserLink &link = mLinks[CAST_SIZE(mSelectedLink)]; graphics->setColor(mHyperLinkColor); @@ -458,7 +458,7 @@ void BrowserBox::draw(Graphics *const graphics) continue; if (part.mY > yEnd) break; - if (part.mType == 0u) + if (part.mType == 0U) { if (part.mBold) { diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index ad597ee60..f3d7e7446 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -216,7 +216,7 @@ void EmoteShortcutContainer::mousePressed(MouseEvent &restrict event) restrict2 emoteShortcut->setEmote(index); emoteShortcut->setEmoteSelected(0); } - else if (emoteShortcut->getEmote(index) != 0u) + else if (emoteShortcut->getEmote(index) != 0U) { mEmoteClicked = true; } @@ -250,12 +250,12 @@ void EmoteShortcutContainer::mouseReleased(MouseEvent &restrict event) return; } - if (mEmoteMoved != 0u) + if (mEmoteMoved != 0U) { emoteShortcut->setEmotes(index, mEmoteMoved); mEmoteMoved = 0; } - else if ((emoteShortcut->getEmote(index) != 0u) && mEmoteClicked) + else if ((emoteShortcut->getEmote(index) != 0U) && mEmoteClicked) { emoteShortcut->useEmote(index + 1); } diff --git a/src/gui/widgets/extendedlistbox.cpp b/src/gui/widgets/extendedlistbox.cpp index dc8ead760..b15aee7d2 100644 --- a/src/gui/widgets/extendedlistbox.cpp +++ b/src/gui/widgets/extendedlistbox.cpp @@ -41,7 +41,7 @@ ExtendedListBox::ExtendedListBox(const Widget2 *const widget, mListItems(), mSelectedItems() { - if (rowHeight != 0u) + if (rowHeight != 0U) mRowHeight = rowHeight; } diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp index e815a4ec8..5f13f9bc7 100644 --- a/src/gui/widgets/listbox.cpp +++ b/src/gui/widgets/listbox.cpp @@ -357,7 +357,7 @@ void ListBox::mouseDragged(MouseEvent &event) return; // Make list selection update on drag, but guard against negative y - if (getRowHeight() != 0u) + if (getRowHeight() != 0U) setSelected(std::max(0, getSelectionByMouse(event.getY()))); } diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index 8cc053699..d8f01a644 100644 --- a/src/gui/widgets/shoplistbox.cpp +++ b/src/gui/widgets/shoplistbox.cpp @@ -209,7 +209,7 @@ void ShopListBox::setPriceCheck(const bool check) void ShopListBox::mouseMoved(MouseEvent &event) { - if ((itemPopup == nullptr) || (mRowHeight == 0u)) + if ((itemPopup == nullptr) || (mRowHeight == 0U)) return; if (mShopItems == nullptr) diff --git a/src/gui/widgets/staticbrowserbox.cpp b/src/gui/widgets/staticbrowserbox.cpp index cd67991b7..c4a705aa9 100644 --- a/src/gui/widgets/staticbrowserbox.cpp +++ b/src/gui/widgets/staticbrowserbox.cpp @@ -375,7 +375,7 @@ void StaticBrowserBox::draw(Graphics *const graphics) if (mSelectedLink >= 0 && mSelectedLink < CAST_S32(mLinks.size())) { - if ((mHighlightMode & LinkHighlightMode::BACKGROUND) != 0u) + if ((mHighlightMode & LinkHighlightMode::BACKGROUND) != 0U) { BrowserLink &link = mLinks[CAST_SIZE(mSelectedLink)]; graphics->setColor(mHighlightColor); @@ -386,7 +386,7 @@ void StaticBrowserBox::draw(Graphics *const graphics) link.y2 - link.y1)); } - if ((mHighlightMode & LinkHighlightMode::UNDERLINE) != 0u) + if ((mHighlightMode & LinkHighlightMode::UNDERLINE) != 0U) { BrowserLink &link = mLinks[CAST_SIZE(mSelectedLink)]; graphics->setColor(mHyperLinkColor); @@ -407,7 +407,7 @@ void StaticBrowserBox::draw(Graphics *const graphics) continue; if (part.mY > yEnd) break; - if (part.mType == 0u) + if (part.mType == 0U) { if (part.mBold) { diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index 37fb7637e..59882966c 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -516,7 +516,7 @@ void TabbedArea::widgetResized(const Event &event A_UNUSED) innerWidth = 0; int newWidth = mVisibleTabsWidth; - while ((mTabScrollIndex != 0u) && newWidth < innerWidth) + while ((mTabScrollIndex != 0U) && newWidth < innerWidth) { Tab *const tab = mTabs[mTabScrollIndex - 1].first; if ((tab != nullptr) && tab->mVisible == Visible_true) @@ -659,7 +659,7 @@ void TabbedArea::action(const ActionEvent& actionEvent) const std::string &eventId = actionEvent.getId(); if (eventId == "shift_left") { - if (mTabScrollIndex != 0u) + if (mTabScrollIndex != 0U) --mTabScrollIndex; } else if (eventId == "shift_right") @@ -694,7 +694,7 @@ void TabbedArea::updateArrowEnableState() } // Left arrow consistency check - if (mTabScrollIndex == 0u) + if (mTabScrollIndex == 0U) mArrowButton[0]->setEnabled(false); else mArrowButton[0]->setEnabled(true); diff --git a/src/gui/widgets/tabs/setup_relations.cpp b/src/gui/widgets/tabs/setup_relations.cpp index 85a861109..e89c2a3e0 100644 --- a/src/gui/widgets/tabs/setup_relations.cpp +++ b/src/gui/widgets/tabs/setup_relations.cpp @@ -71,11 +71,11 @@ Setup_Relations::Setup_Relations(const Widget2 *const widget) : mPlayerTable, Opaque_true, std::string())), // TRANSLATORS: relation dialog button mDefaultTrading(new CheckBox(this, _("Allow trading"), - (playerRelations.getDefault() & PlayerRelation::TRADE) != 0u, + (playerRelations.getDefault() & PlayerRelation::TRADE) != 0U, nullptr, std::string())), // TRANSLATORS: relation dialog button mDefaultWhisper(new CheckBox(this, _("Allow whispers"), - (playerRelations.getDefault() & PlayerRelation::WHISPER) != 0u, + (playerRelations.getDefault() & PlayerRelation::WHISPER) != 0U, nullptr, std::string())), // TRANSLATORS: relation dialog button mDeleteButton(new Button(this, _("Delete"), ACTION_DELETE, @@ -236,9 +236,9 @@ void Setup_Relations::updatedPlayer(const std::string &name A_UNUSED) { mPlayerTableModel->playerRelationsUpdated(); mDefaultTrading->setSelected( - (playerRelations.getDefault() & PlayerRelation::TRADE) != 0u); + (playerRelations.getDefault() & PlayerRelation::TRADE) != 0U); mDefaultWhisper->setSelected( - (playerRelations.getDefault() & PlayerRelation::WHISPER) != 0u); + (playerRelations.getDefault() & PlayerRelation::WHISPER) != 0U); if (localPlayer != nullptr) localPlayer->updateName(); } @@ -265,7 +265,7 @@ void Setup_Relations::updateAll() void Setup_Relations::externalUpdated() { mDefaultTrading->setSelected( - (playerRelations.getDefault() & PlayerRelation::TRADE) != 0u); + (playerRelations.getDefault() & PlayerRelation::TRADE) != 0U); mDefaultWhisper->setSelected( - (playerRelations.getDefault() & PlayerRelation::WHISPER) != 0u); + (playerRelations.getDefault() & PlayerRelation::WHISPER) != 0U); } diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index b80404c73..adcb557d7 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -322,7 +322,7 @@ void TextField::keyPressed(KeyEvent &event) if (mNumeric) { if ((val >= '0' && val <= '9') || - (val == '-' && mCaretPosition == 0u)) + (val == '-' && mCaretPosition == 0U)) { char buf[2]; buf[0] = CAST_8(val); diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index cdc10f1af..3df552404 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -213,7 +213,7 @@ Window::Window(const std::string &caption, } setTitleBarHeight(CAST_U32( getOption("titlebarHeight", 0))); - if (mTitleBarHeight == 0u) + if (mTitleBarHeight == 0U) mTitleBarHeight = mCaptionFont->getHeight() + mPadding; mTitleBarHeight += getOption("titlebarHeightRelative", 0); diff --git a/src/gui/windowmanager.cpp b/src/gui/windowmanager.cpp index be5a5b152..d4923c478 100644 --- a/src/gui/windowmanager.cpp +++ b/src/gui/windowmanager.cpp @@ -247,7 +247,7 @@ void WindowManager::updateTitle() void WindowManager::setFramerate(const unsigned int fpsLimit) { - if (fpsLimit == 0u) + if (fpsLimit == 0U) return; if (!settings.limitFps) diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp index 49dcd8314..852dbc2cc 100644 --- a/src/gui/windows/charcreatedialog.cpp +++ b/src/gui/windows/charcreatedialog.cpp @@ -163,12 +163,12 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent, beingSlot.cardsId); } - if (maxHairColor == 0u) + if (maxHairColor == 0U) maxHairColor = ColorDB::getHairSize(); - if (maxHairStyle == 0u) + if (maxHairStyle == 0U) maxHairStyle = ItemDB::getNumOfHairstyles(); - if (maxHairStyle != 0u) + if (maxHairStyle != 0U) { mHairStyle = (CAST_U32(rand()) % maxHairStyle) + minHairStyle; @@ -177,7 +177,7 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent, { mHairStyle = 0; } - if (maxHairColor != 0u) + if (maxHairColor != 0U) { mHairColor = (CAST_U32(rand()) % maxHairColor) + minHairColor; diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index a33bb4ec8..560826d79 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -883,7 +883,7 @@ void ChatWindow::keyPressed(KeyEvent &event) const ChatTab *const tab = getFocused(); if ((tab != nullptr) && tab->hasRows()) { - if (mChatHistoryIndex == 0u) + if (mChatHistoryIndex == 0U) { mChatHistoryIndex = CAST_U32( tab->getRows().size()); diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp index ed59cab7d..7d0284fc1 100644 --- a/src/gui/windows/equipmentwindow.cpp +++ b/src/gui/windows/equipmentwindow.cpp @@ -352,7 +352,7 @@ void EquipmentWindow::action(const ActionEvent &event) PlayerInfo::unequipItem(item, Sfx_true); setSelected(-1); } - else if (eventId.find("tab_") == 0u) + else if (eventId.find("tab_") == 0U) { Button *const button = dynamic_cast<Button*>(event.getSource()); if (button == nullptr) diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index f198743ec..be036a558 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -514,7 +514,7 @@ void InventoryWindow::action(const ActionEvent &event) mItems->setName(mNameFilter->getText()); mItems->updateMatrix(); } - else if (eventId.find("tag_") == 0u) + else if (eventId.find("tag_") == 0U) { std::string tagName = event.getId().substr(4); mItems->setFilter(ItemDB::getTagId(tagName)); diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp index 0abce52ca..7a671c987 100644 --- a/src/gui/windows/npcdialog.cpp +++ b/src/gui/windows/npcdialog.cpp @@ -1354,7 +1354,7 @@ std::string NpcDialog::complexItemToStr(const ComplexItem *const item) { const STD_VECTOR<Item*> &items = item->getChilds(); const size_t sz = items.size(); - if (sz == 0u) + if (sz == 0U) return str; const Item *item2 = items[0]; diff --git a/src/gui/windows/outfitwindow.cpp b/src/gui/windows/outfitwindow.cpp index 8a36bca6c..365ccbfc4 100644 --- a/src/gui/windows/outfitwindow.cpp +++ b/src/gui/windows/outfitwindow.cpp @@ -74,7 +74,7 @@ OutfitWindow::OutfitWindow() : nullptr, std::string())), // TRANSLATORS: outfits window checkbox mAwayOutfitCheck(new CheckBox(this, _("Away outfit"), - serverConfig.getValue("OutfitAwayIndex", OUTFITS_COUNT - 1) != 0u, + serverConfig.getValue("OutfitAwayIndex", OUTFITS_COUNT - 1) != 0U, nullptr, std::string())), // TRANSLATORS: outfits window label mKeyLabel(new Label(this, strprintf(_("Key: %s"), diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index a8db9302d..9656d0c1c 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -868,11 +868,11 @@ int ServerDialog::downloadUpdate(void *ptr, else { float progress = static_cast<float>(remaining); - if (total != 0u) + if (total != 0U) progress /= static_cast<float>(total); if (progress != progress || progress < 0.0F) - progress = 0.0f; + progress = 0.0F; else if (progress > 1.0F) progress = 1.0F; diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index e60465367..39235c570 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -595,25 +595,25 @@ void SkillDialog::loadSkillData(XmlNodeConstPtr node, missile.particle = XML::getProperty( node, "missile-particle", ""); missile.z = XML::getFloatProperty( - node, "missile-z", 32.0f); + node, "missile-z", 32.0F); missile.lifeTime = XML::getProperty( node, "missile-lifetime", 500); missile.speed = XML::getFloatProperty( - node, "missile-speed", 7.0f); + node, "missile-speed", 7.0F); missile.dieDistance = XML::getFloatProperty( - node, "missile-diedistance", 8.0f); + node, "missile-diedistance", 8.0F); MissileInfo &castingMissile = data->castingMissile; castingMissile.particle = XML::getProperty( node, "castingMissile-particle", ""); castingMissile.z = XML::getFloatProperty( - node, "castingMissile-z", 32.0f); + node, "castingMissile-z", 32.0F); castingMissile.lifeTime = XML::getProperty( node, "castingMissile-lifetime", 500); castingMissile.speed = XML::getFloatProperty( - node, "castingMissile-speed", 7.0f); + node, "castingMissile-speed", 7.0F); castingMissile.dieDistance = XML::getFloatProperty( - node, "castingMissile-diedistance", 8.0f); + node, "castingMissile-diedistance", 8.0F); data->castingAnimation = XML::getProperty( node, diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp index a4b01a050..c7b5ef8b0 100644 --- a/src/gui/windows/updaterwindow.cpp +++ b/src/gui/windows/updaterwindow.cpp @@ -395,7 +395,7 @@ void UpdaterWindow::loadNews() { firstLine = false; const size_t i = line.find("##9 Latest client version: ##6"); - if (i == 0u) + if (i == 0U) continue; if (file.is_open()) @@ -529,7 +529,7 @@ int UpdaterWindow::updateProgress(void *ptr, } } - if (dt == 0u) + if (dt == 0U) dt = 1; float progress = static_cast<float>(dn) / diff --git a/src/input/joystick.cpp b/src/input/joystick.cpp index e5bf1c220..91e21dc1c 100644 --- a/src/input/joystick.cpp +++ b/src/input/joystick.cpp @@ -263,7 +263,7 @@ void Joystick::logic() logger->log("axis 4 pos: %d", SDL_JoystickGetAxis(mJoystick, 4)); #endif // DEBUG_JOYSTICK - if ((mDirection == 0u) && mHaveHats) + if ((mDirection == 0U) && mHaveHats) { // reading only hat 0 const uint8_t hat = SDL_JoystickGetHat(mJoystick, 0); diff --git a/src/input/keyboardconfig.cpp b/src/input/keyboardconfig.cpp index f201d6811..daef2e32f 100644 --- a/src/input/keyboardconfig.cpp +++ b/src/input/keyboardconfig.cpp @@ -182,12 +182,12 @@ bool KeyboardConfig::isActionActive(const InputActionT index) const const int value = val.value; if (value >= 0) { - if (mActiveKeys[value] != 0u) + if (mActiveKeys[value] != 0U) return true; } else if (value < -1 && value > -500) { - if (mActiveKeys2[-value] != 0u) + if (mActiveKeys2[-value] != 0U) return true; } } @@ -247,12 +247,12 @@ void KeyboardConfig::handleRepeat(const int time) const int key = (*it).first; if (key >= 0) { - if ((mActiveKeys != nullptr) && (mActiveKeys[key] != 0u)) + if ((mActiveKeys != nullptr) && (mActiveKeys[key] != 0U)) repeat = true; } else if (key < -1 && key > -500) { - if ((mActiveKeys2 != nullptr) && (mActiveKeys2[-key] != 0u)) + if ((mActiveKeys2 != nullptr) && (mActiveKeys2[-key] != 0U)) repeat = true; } if (repeat) diff --git a/src/input/keyboardconfig.h b/src/input/keyboardconfig.h index 0e7f6fac4..cfef188fb 100644 --- a/src/input/keyboardconfig.h +++ b/src/input/keyboardconfig.h @@ -96,7 +96,7 @@ class KeyboardConfig final return event.key.keysym.scancode; #else // USE_SDL2 - if (event.key.keysym.sym != 0u) + if (event.key.keysym.sym != 0U) return CAST_S32(event.key.keysym.sym); else if (event.key.keysym.scancode > 1) return -event.key.keysym.scancode; diff --git a/src/input/keyinput.h b/src/input/keyinput.h index 5a8a26363..4d38cfe4d 100644 --- a/src/input/keyinput.h +++ b/src/input/keyinput.h @@ -79,7 +79,7 @@ class KeyInput final { public: - KeyInput() : + KeyInput() noexcept2 : mKey(0), mType(KeyEventType::PRESSED), #ifdef USE_SDL2 @@ -88,7 +88,7 @@ class KeyInput final mActionId(InputAction::UNDEFINED_VALUE) { } - KeyInput(const KeyInput &k) : + KeyInput(const KeyInput &k) noexcept2 : mKey(k.mKey), mType(k.mType), #ifdef USE_SDL2 diff --git a/src/input/mouseinput.h b/src/input/mouseinput.h index 59d74196d..4a683ca66 100644 --- a/src/input/mouseinput.h +++ b/src/input/mouseinput.h @@ -72,7 +72,7 @@ class MouseInput final { public: - MouseInput() : + MouseInput() noexcept2 : mType(MouseEventType::MOVED), mButton(MouseButton::EMPTY), mTimeStamp(0), @@ -82,7 +82,7 @@ class MouseInput final mRealY(0) { } - MouseInput(const MouseInput &m) : + MouseInput(const MouseInput &m) noexcept2 : mType(m.mType), mButton(m.mButton), mTimeStamp(m.mTimeStamp), @@ -95,7 +95,7 @@ class MouseInput final A_DEFAULT_COPY(MouseInput) - MouseInput &operator=(const MouseInput &m) + MouseInput &operator=(const MouseInput &m) noexcept2 { mType = m.mType; mButton = m.mButton; diff --git a/src/net/download.cpp b/src/net/download.cpp index 05f10e027..92e205273 100644 --- a/src/net/download.cpp +++ b/src/net/download.cpp @@ -81,7 +81,7 @@ Download::Download(void *const ptr, mOptions.cancel = 0; mOptions.memoryWrite = 0; - mOptions.checkAdler = 1u; + mOptions.checkAdler = 1U; if (!mUpload) { const std::string serverName = settings.serverName; @@ -170,7 +170,7 @@ void Download::setFile(const std::string &filename, const int64_t adler32) if (adler32 > -1) { mAdler = static_cast<unsigned long>(adler32); - mOptions.checkAdler = 1u; + mOptions.checkAdler = 1U; } else { @@ -180,7 +180,7 @@ void Download::setFile(const std::string &filename, const int64_t adler32) void Download::setWriteFunction(WriteFunction write) { - mOptions.memoryWrite = 1u; + mOptions.memoryWrite = 1U; mWriteFunction = write; } @@ -209,7 +209,7 @@ void Download::cancel() { logger->log("Canceling download: %s", mUrl.c_str()); - mOptions.cancel = 1u; + mOptions.cancel = 1U; SDL::WaitThread(mThread); mThread = nullptr; } @@ -230,7 +230,7 @@ int Download::downloadProgress(void *clientp, double dltotal, double dlnow, if (d->mUpload) return 0; - if (d->mOptions.cancel != 0u) + if (d->mOptions.cancel != 0U) { return d->mUpdateFunction(d->mPtr, DownloadStatus::Cancelled, CAST_SIZE(dltotal), @@ -260,7 +260,7 @@ int Download::downloadThread(void *ptr) } else { - if (d->mOptions.memoryWrite == 0u) + if (d->mOptions.memoryWrite == 0U) outFilename = d->mFileName + ".part"; else outFilename.clear(); @@ -276,19 +276,19 @@ int Download::downloadThread(void *ptr) logger->log_r("selected url: %s", d->mUrl.c_str()); while (attempts < 3 && !complete && - (d->mOptions.cancel == 0u) && + (d->mOptions.cancel == 0U) && isTerminate == false) { d->mUpdateFunction(d->mPtr, DownloadStatus::Starting, 0, 0); - if ((d->mOptions.cancel != 0u) || isTerminate == true) + if ((d->mOptions.cancel != 0U) || isTerminate == true) { return 0; } d->mCurl = curl_easy_init(); if (d->mCurl != nullptr && - d->mOptions.cancel == 0u && + d->mOptions.cancel == 0U && isTerminate == false) { FILE *file = nullptr; @@ -308,7 +308,7 @@ int Download::downloadThread(void *ptr) curl_easy_setopt(d->mCurl, CURLOPT_FOLLOWLOCATION, 1); curl_easy_setopt(d->mCurl, CURLOPT_HTTPHEADER, d->mHeaders); - if (d->mOptions.memoryWrite != 0u) + if (d->mOptions.memoryWrite != 0U) { curl_easy_setopt(d->mCurl, CURLOPT_FAILONERROR, 1); curl_easy_setopt(d->mCurl, CURLOPT_WRITEFUNCTION, @@ -346,7 +346,7 @@ int Download::downloadThread(void *ptr) addCommonFlags(d->mCurl); if ((res = curl_easy_perform(d->mCurl)) != 0 && - (d->mOptions.cancel == 0u) && + (d->mOptions.cancel == 0U) && isTerminate == false) { PRAGMA45(GCC diagnostic push) @@ -354,7 +354,7 @@ int Download::downloadThread(void *ptr) switch (res) { case CURLE_ABORTED_BY_CALLBACK: - d->mOptions.cancel = 1u; + d->mOptions.cancel = 1U; break; case CURLE_COULDNT_CONNECT: default: @@ -362,7 +362,7 @@ int Download::downloadThread(void *ptr) } PRAGMA45(GCC diagnostic pop) - if (res != 0u) + if (res != 0U) { if (d->mError != nullptr) { @@ -373,7 +373,7 @@ int Download::downloadThread(void *ptr) continue; } - if ((d->mOptions.cancel != 0u) || isTerminate == true) + if ((d->mOptions.cancel != 0U) || isTerminate == true) break; // d->mUpdateFunction(d->mPtr, DownloadStatus::Error, 0, 0); @@ -383,7 +383,7 @@ int Download::downloadThread(void *ptr) fclose(file); file = nullptr; } - if (!d->mUpload && (d->mOptions.memoryWrite == 0u)) + if (!d->mUpload && (d->mOptions.memoryWrite == 0U)) ::remove(outFilename.c_str()); attempts++; continue; @@ -404,10 +404,10 @@ int Download::downloadThread(void *ptr) } else { - if (d->mOptions.memoryWrite == 0u) + if (d->mOptions.memoryWrite == 0U) { // Don't check resources.xml checksum - if (d->mOptions.checkAdler != 0u) + if (d->mOptions.checkAdler != 0U) { const unsigned long adler = fadler32(file); @@ -438,7 +438,7 @@ int Download::downloadThread(void *ptr) // Any existing file with this name is deleted first, // otherwise the rename will fail on Windows. - if ((d->mOptions.cancel == 0u) && isTerminate == false) + if ((d->mOptions.cancel == 0U) && isTerminate == false) { if (d->mIsXml) { @@ -478,18 +478,18 @@ int Download::downloadThread(void *ptr) d->mCurl = nullptr; } - if ((d->mOptions.cancel != 0u) || isTerminate == true) + if ((d->mOptions.cancel != 0U) || isTerminate == true) { return 0; } attempts++; } - if ((complete && attempts < 3) || (d->mOptions.cancel != 0u)) + if ((complete && attempts < 3) || (d->mOptions.cancel != 0U)) break; } - if ((d->mOptions.cancel != 0u) || isTerminate == true) + if ((d->mOptions.cancel != 0U) || isTerminate == true) { // Nothing to do... } diff --git a/src/net/ea/beingrecv.cpp b/src/net/ea/beingrecv.cpp index b2909576d..e88fc1f02 100644 --- a/src/net/ea/beingrecv.cpp +++ b/src/net/ea/beingrecv.cpp @@ -261,7 +261,7 @@ void BeingRecv::processBeingEmotion(Net::MessageIn &msg) } const uint8_t emote = msg.readUInt8("emote"); - if ((emote != 0u) && + if ((emote != 0U) && playerRelations.hasPermission(dstBeing, PlayerRelation::EMOTE)) { dstBeing->setEmote(emote, 0); diff --git a/src/net/ea/gamerecv.cpp b/src/net/ea/gamerecv.cpp index 0d180dc45..ee5ccb9ce 100644 --- a/src/net/ea/gamerecv.cpp +++ b/src/net/ea/gamerecv.cpp @@ -54,7 +54,7 @@ void GameRecv::processWhoAnswer(Net::MessageIn &msg) void GameRecv::processCharSwitchResponse(Net::MessageIn &msg) { - if (msg.readUInt8("response") != 0u) + if (msg.readUInt8("response") != 0U) client->setState(State::SWITCH_CHARACTER); } diff --git a/src/net/ea/network.cpp b/src/net/ea/network.cpp index 618d4895f..11a0757f1 100644 --- a/src/net/ea/network.cpp +++ b/src/net/ea/network.cpp @@ -155,7 +155,7 @@ void Network::disconnect() void Network::flush() { - if ((mOutSize == 0u) || mState != CONNECTED) + if ((mOutSize == 0U) || mState != CONNECTED) return; SDL_mutexP(mMutexOut); @@ -181,7 +181,7 @@ void Network::skip(const int len) { SDL_mutexP(mMutexIn); mToSkip += len; - if (mInSize == 0u) + if (mInSize == 0U) { SDL_mutexV(mMutexIn); return; @@ -301,7 +301,7 @@ void Network::receive() { // DEBUGLOG("Receive " + toString(ret) + " bytes"); mInSize += ret; - if (mToSkip != 0u) + if (mToSkip != 0U) { if (mInSize >= mToSkip) { diff --git a/src/net/ea/partyrecv.cpp b/src/net/ea/partyrecv.cpp index 57ad76da0..248a44a96 100644 --- a/src/net/ea/partyrecv.cpp +++ b/src/net/ea/partyrecv.cpp @@ -54,7 +54,7 @@ namespace PartyRecv void PartyRecv::processPartyCreate(Net::MessageIn &msg) { - if (msg.readUInt8("flag") != 0u) + if (msg.readUInt8("flag") != 0U) NotifyManager::notify(NotifyTypes::PARTY_CREATE_FAILED); else NotifyManager::notify(NotifyTypes::PARTY_CREATED); diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp index a214dda39..f145bb17b 100644 --- a/src/net/eathena/beingrecv.cpp +++ b/src/net/eathena/beingrecv.cpp @@ -762,7 +762,7 @@ void BeingRecv::processBeingMove(Net::MessageIn &msg) { d = dstBeing->calcDirection(dstX, dstY); } - if ((d != 0u) && dstBeing->getDirection() != d) + if ((d != 0U) && dstBeing->getDirection() != d) dstBeing->setDirection(d); const int level = CAST_S32(msg.readInt16("level")); diff --git a/src/net/eathena/chatrecv.cpp b/src/net/eathena/chatrecv.cpp index 092fc0589..87fc6b63e 100644 --- a/src/net/eathena/chatrecv.cpp +++ b/src/net/eathena/chatrecv.cpp @@ -589,7 +589,7 @@ void ChatRecv::processBeingChat(Net::MessageIn &msg) // because ignorePlayer' side effects are triggered // right below for Being::IGNORE_SPEECH_FLOAT. if ((playerRelations.checkPermissionSilently(sender_name, - PlayerRelation::SPEECH_LOG) != 0u) && (chatWindow != nullptr)) + PlayerRelation::SPEECH_LOG) != 0U) && (chatWindow != nullptr)) { allow = chatWindow->resortChatLog( removeColors(sender_name).append(" : ").append(chatMsg), diff --git a/src/net/eathena/inventoryrecv.cpp b/src/net/eathena/inventoryrecv.cpp index 7547d03c7..9d9707735 100644 --- a/src/net/eathena/inventoryrecv.cpp +++ b/src/net/eathena/inventoryrecv.cpp @@ -271,7 +271,7 @@ void InventoryRecv::processPlayerInventoryAdd(Net::MessageIn &msg) Ea::InventoryRecv::mSentPickups.pop(); } - if (err != 0u) + if (err != 0U) { PickupT pickup; switch (err) @@ -570,7 +570,7 @@ void InventoryRecv::processPlayerUnEquip(Net::MessageIn &msg) equipType = msg.readInt16("wear location"); const uint8_t flag = msg.readUInt8("result"); - if (flag != 0u) + if (flag != 0U) { NotifyManager::notify(NotifyTypes::UNEQUIP_FAILED); } @@ -834,7 +834,7 @@ void InventoryRecv::processPlayerInsertCard(Net::MessageIn &msg) { const int itemIndex = msg.readInt16("item index") - INVENTORY_OFFSET; const int cardIndex = msg.readInt16("card index") - INVENTORY_OFFSET; - if (msg.readUInt8("flag") != 0u) + if (msg.readUInt8("flag") != 0U) { NotifyManager::notify(NotifyTypes::CARD_INSERT_FAILED); } @@ -1424,7 +1424,7 @@ int InventoryRecv::getSlot(const int eAthenaSlot) unsigned int mask = 1; int position = 0; - while ((eAthenaSlot & mask) == 0u) + while ((eAthenaSlot & mask) == 0U) { mask <<= 1; position++; diff --git a/src/net/eathena/mailrecv.cpp b/src/net/eathena/mailrecv.cpp index 434745386..94e6c6fb9 100644 --- a/src/net/eathena/mailrecv.cpp +++ b/src/net/eathena/mailrecv.cpp @@ -86,7 +86,7 @@ void MailRecv::processMailList(Net::MessageIn &msg) MailMessage *const mail = new MailMessage; mail->id = msg.readInt32("message id"); mail->title = msg.readString(40, "title"); - mail->read = msg.readUInt8("unread flag") != 0u ? true : false; + mail->read = msg.readUInt8("unread flag") != 0U ? true : false; mail->sender = msg.readString(24, "sender name"); mail->time = msg.readInt32("time stamp"); mail->strTime = timeToStr(mail->time); diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp index ff34cd2c5..1a82c8282 100644 --- a/src/net/messagein.cpp +++ b/src/net/messagein.cpp @@ -64,7 +64,7 @@ MessageIn::MessageIn(const char *const data, MessageIn::~MessageIn() { - if (mLength != 0u) + if (mLength != 0U) { if (mPos != mLength && mPos != 2) { @@ -463,7 +463,7 @@ unsigned char *MessageIn::readBytes(int length, const char *const dstr) str += " "; for (int f = 0; f < length; f ++) { - if (buf[f] != 0u) + if (buf[f] != 0U) str.append(strprintf("%c", buf[f])); else str.append("_"); diff --git a/src/net/tmwa/beingrecv.cpp b/src/net/tmwa/beingrecv.cpp index f4b533891..69744946b 100644 --- a/src/net/tmwa/beingrecv.cpp +++ b/src/net/tmwa/beingrecv.cpp @@ -280,7 +280,7 @@ void BeingRecv::processPlayerUpdate1(Net::MessageIn &msg) } uint8_t dir = dstBeing->getDirectionDelayed(); - if (dir != 0u) + if (dir != 0U) { if (dir != dstBeing->getDirection()) dstBeing->setDirection(dir); @@ -425,7 +425,7 @@ void BeingRecv::processPlayerUpdate2(Net::MessageIn &msg) } uint8_t dir = dstBeing->getDirectionDelayed(); - if (dir != 0u) + if (dir != 0U) { if (dir != dstBeing->getDirection()) dstBeing->setDirection(dir); @@ -566,7 +566,7 @@ void BeingRecv::processPlayerMove(Net::MessageIn &msg) } const uint8_t dir = dstBeing->getDirectionDelayed(); - if (dir != 0u) + if (dir != 0U) { if (dir != dstBeing->getDirection()) dstBeing->setDirection(dir); diff --git a/src/net/tmwa/chatrecv.cpp b/src/net/tmwa/chatrecv.cpp index 83078bee9..e044d5877 100644 --- a/src/net/tmwa/chatrecv.cpp +++ b/src/net/tmwa/chatrecv.cpp @@ -77,7 +77,7 @@ void ChatRecv::processChatContinue(std::string chatMsg) } const std::string senseStr("You sense the following: "); - if ((actorManager != nullptr) && (chatMsg.find(senseStr) == 0u)) + if ((actorManager != nullptr) && (chatMsg.find(senseStr) == 0U)) { actorManager->parseLevels( chatMsg.substr(senseStr.size())); @@ -372,7 +372,7 @@ void ChatRecv::processBeingChat(Net::MessageIn &msg) // because ignorePlayer' side effects are triggered // right below for Being::IGNORE_SPEECH_FLOAT. if ((playerRelations.checkPermissionSilently(sender_name, - PlayerRelation::SPEECH_LOG) != 0u) && + PlayerRelation::SPEECH_LOG) != 0U) && (chatWindow != nullptr)) { allow = chatWindow->resortChatLog( diff --git a/src/net/tmwa/inventoryrecv.cpp b/src/net/tmwa/inventoryrecv.cpp index 68521bfa4..2c0c51471 100644 --- a/src/net/tmwa/inventoryrecv.cpp +++ b/src/net/tmwa/inventoryrecv.cpp @@ -171,7 +171,7 @@ void InventoryRecv::processPlayerInventoryAdd(Net::MessageIn &msg) Ea::InventoryRecv::mSentPickups.pop(); } - if (err != 0u) + if (err != 0U) { PickupT pickup; switch (err) @@ -381,7 +381,7 @@ void InventoryRecv::processPlayerEquip(Net::MessageIn &msg) const int equipType = msg.readInt16("equip type"); const uint8_t flag = msg.readUInt8("flag"); - if (flag == 0u) + if (flag == 0U) { NotifyManager::notify(NotifyTypes::EQUIP_FAILED); } @@ -401,7 +401,7 @@ void InventoryRecv::processPlayerUnEquip(Net::MessageIn &msg) const int equipType = msg.readInt16("equip type"); const uint8_t flag = msg.readUInt8("flag"); - if (flag != 0u) + if (flag != 0U) { Ea::InventoryRecv::mEquips.setEquipment( InventoryRecv::getSlot(equipType), @@ -550,7 +550,7 @@ int InventoryRecv::getSlot(const int eAthenaSlot) unsigned int mask = 1; int position = 0; - while ((eAthenaSlot & mask) == 0u) + while ((eAthenaSlot & mask) == 0U) { mask <<= 1; position++; diff --git a/src/net/tmwa/loginrecv.cpp b/src/net/tmwa/loginrecv.cpp index 91d11b05e..43db7b99a 100644 --- a/src/net/tmwa/loginrecv.cpp +++ b/src/net/tmwa/loginrecv.cpp @@ -65,7 +65,7 @@ void LoginRecv::processServerVersion(Net::MessageIn &msg) { // old TMWA const unsigned int options = msg.readInt32("options"); Ea::LoginRecv::mRegistrationEnabled = - ((options & FLAG_REGISTRATION) != 0u); + ((options & FLAG_REGISTRATION) != 0U); serverVersion = 0; tmwServerVersion = 0; } @@ -73,7 +73,7 @@ void LoginRecv::processServerVersion(Net::MessageIn &msg) { // new TMWA const unsigned int options = msg.readInt32("options"); Ea::LoginRecv::mRegistrationEnabled = - ((options & FLAG_REGISTRATION) != 0u); + ((options & FLAG_REGISTRATION) != 0U); serverVersion = 0; tmwServerVersion = (b1 << 16) | (b2 << 8) | b3; } @@ -81,7 +81,7 @@ void LoginRecv::processServerVersion(Net::MessageIn &msg) { // eAthena const unsigned int options = msg.readInt32("options"); Ea::LoginRecv::mRegistrationEnabled = - ((options & FLAG_REGISTRATION) != 0u); + ((options & FLAG_REGISTRATION) != 0U); serverVersion = 0; tmwServerVersion = 0; } diff --git a/src/particle/particle.cpp b/src/particle/particle.cpp index 82a61b9ef..dacb7b1f2 100644 --- a/src/particle/particle.cpp +++ b/src/particle/particle.cpp @@ -145,7 +145,7 @@ void Particle::updateSelf() restrict2 dist.x * dist.x + dist.y * dist.y + dist.z * dist.z); break; case ParticlePhysics::Fast: - if (dist.x == 0.0f) + if (dist.x == 0.0F) { invHypotenuse = 0; break; @@ -162,7 +162,7 @@ void Particle::updateSelf() restrict2 break; } - if (invHypotenuse != 0.0f) + if (invHypotenuse != 0.0F) { if (mInvDieDistance > 0.0F && invHypotenuse > mInvDieDistance) mAlive = AliveStatus::DEAD_IMPACT; diff --git a/src/progs/manaplus/actions/actions.cpp b/src/progs/manaplus/actions/actions.cpp index 9c0188d20..322599791 100644 --- a/src/progs/manaplus/actions/actions.cpp +++ b/src/progs/manaplus/actions/actions.cpp @@ -938,7 +938,7 @@ impHandler(targetAttack) } } - if ((target == nullptr) && (settings.targetingType == 0u)) + if ((target == nullptr) && (settings.targetingType == 0U)) target = localPlayer->getTarget(); if (target == nullptr) diff --git a/src/progs/manaplus/actions/statusbar.cpp b/src/progs/manaplus/actions/statusbar.cpp index 90a3f74d8..e15694902 100644 --- a/src/progs/manaplus/actions/statusbar.cpp +++ b/src/progs/manaplus/actions/statusbar.cpp @@ -172,7 +172,7 @@ impHandler0(changeMapMode) impHandler0(changeTrade) { unsigned int deflt = playerRelations.getDefault(); - if ((deflt & PlayerRelation::TRADE) != 0u) + if ((deflt & PlayerRelation::TRADE) != 0U) { if (localChatTab != nullptr) { diff --git a/src/progs/manaplus/gui/viewport.cpp b/src/progs/manaplus/gui/viewport.cpp index 634bc3b25..d3ed684e2 100644 --- a/src/progs/manaplus/gui/viewport.cpp +++ b/src/progs/manaplus/gui/viewport.cpp @@ -412,7 +412,7 @@ bool Viewport::openContextMenu(const MouseEvent &event) popupMenu->showPopup(eventX, eventY, mHoverSign); return true; } - else if (settings.cameraMode != 0u) + else if (settings.cameraMode != 0U) { if (mMap == nullptr) return false; @@ -1041,7 +1041,7 @@ void Viewport::toggleCameraMode() settings.cameraMode ++; if (settings.cameraMode > 1) settings.cameraMode = 0; - if (settings.cameraMode == 0u) + if (settings.cameraMode == 0U) { mCameraRelativeX = 0; mCameraRelativeY = 0; diff --git a/src/render/graphics.cpp b/src/render/graphics.cpp index 9b584f9bb..42b313bd4 100644 --- a/src/render/graphics.cpp +++ b/src/render/graphics.cpp @@ -516,23 +516,23 @@ bool Graphics::videoInfo() restrict2 return false; logger->log("Possible to create hardware surfaces: %s", - ((vi->hw_available) != 0u ? "yes" : "no")); + ((vi->hw_available) != 0U ? "yes" : "no")); logger->log("Window manager available: %s", - ((vi->wm_available) != 0u ? "yes" : "no")); + ((vi->wm_available) != 0U ? "yes" : "no")); logger->log("Accelerated hardware to hardware blits: %s", - ((vi->blit_hw) != 0u ? "yes" : "no")); + ((vi->blit_hw) != 0U ? "yes" : "no")); logger->log("Accelerated hardware to hardware colorkey blits: %s", - ((vi->blit_hw_CC) != 0u ? "yes" : "no")); + ((vi->blit_hw_CC) != 0U ? "yes" : "no")); logger->log("Accelerated hardware to hardware alpha blits: %s", - ((vi->blit_hw_A) != 0u ? "yes" : "no")); + ((vi->blit_hw_A) != 0U ? "yes" : "no")); logger->log("Accelerated software to hardware blits: %s", - ((vi->blit_sw) != 0u ? "yes" : "no")); + ((vi->blit_sw) != 0U ? "yes" : "no")); logger->log("Accelerated software to hardware colorkey blits: %s", - ((vi->blit_sw_CC) != 0u ? "yes" : "no")); + ((vi->blit_sw_CC) != 0U ? "yes" : "no")); logger->log("Accelerated software to hardware alpha blits: %s", - ((vi->blit_sw_A) != 0u ? "yes" : "no")); + ((vi->blit_sw_A) != 0U ? "yes" : "no")); logger->log("Accelerated color fills: %s", - ((vi->blit_fill) != 0u ? "yes" : "no")); + ((vi->blit_fill) != 0U ? "yes" : "no")); #endif // USE_SDL2 return true; diff --git a/src/render/mobileopengl2graphics.cpp b/src/render/mobileopengl2graphics.cpp index 36f6263d1..73579005a 100644 --- a/src/render/mobileopengl2graphics.cpp +++ b/src/render/mobileopengl2graphics.cpp @@ -129,10 +129,10 @@ MobileOpenGL2Graphics::~MobileOpenGL2Graphics() void MobileOpenGL2Graphics::deleteGLObjects() restrict2 { delete2(mProgram); - if (mVbo != 0u) + if (mVbo != 0U) mglDeleteBuffers(1, &mVbo); #ifndef __native_client__ - if (mVao != 0u) + if (mVao != 0U) mglDeleteVertexArrays(1, &mVao); #endif // __native_client__ } @@ -172,7 +172,7 @@ void MobileOpenGL2Graphics::postInit() restrict2 logger->safeError("Shader creation error. See manaplus.log."); } mProgramId = mProgram->getProgramId(); - if (mProgramId == 0u) + if (mProgramId == 0U) logger->safeError("Shaders compilation error."); logger->log("Shaders compilation done."); @@ -186,19 +186,19 @@ void MobileOpenGL2Graphics::postInit() restrict2 mTextureColorUniform = mglGetUniformLocation(mProgramId, "alpha"); mTextureSizeUniform = mglGetUniformLocation(mProgramId, "textureSize"); - mglUniform1f(mTextureColorUniform, 1.0f); + mglUniform1f(mTextureColorUniform, 1.0F); mglVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, nullptr); mglEnableVertexAttribArray(0); mAttributesBinded = mVbo; mglUniform2f(mScreenUniform, - static_cast<float>(mWidth) / 2.0f, - static_cast<float>(mHeight) / 2.0f); + static_cast<float>(mWidth) / 2.0F, + static_cast<float>(mHeight) / 2.0F); // for safty init texture size to 1x1 mglUniform2f(mTextureSizeUniform, - 1.0f, - 1.0f); + 1.0F, + 1.0F); mglUniform4f(mSimpleColorUniform, 0.0F, 0.0F, @@ -946,7 +946,7 @@ void MobileOpenGL2Graphics::drawPoint(int x, int y) restrict2 const ClipRect &clipArea = mClipStack.top(); GLfloat vertices[] = { - toGL(x + clipArea.xOffset), toGL(y + clipArea.yOffset), 0.0f, 0.0f + toGL(x + clipArea.xOffset), toGL(y + clipArea.yOffset), 0.0F, 0.0F }; mglBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STREAM_DRAW); @@ -967,8 +967,8 @@ void MobileOpenGL2Graphics::drawLine(int x1, int y1, const ClipRect &clipArea = mClipStack.top(); GLfloat vertices[] = { - toGL(x1 + clipArea.xOffset), toGL(y1 + clipArea.yOffset), 0.0f, 0.0f, - toGL(x2 + clipArea.xOffset), toGL(y2 + clipArea.yOffset), 0.0f, 0.0f + toGL(x1 + clipArea.xOffset), toGL(y1 + clipArea.yOffset), 0.0F, 0.0F, + toGL(x2 + clipArea.xOffset), toGL(y2 + clipArea.yOffset), 0.0F, 0.0F }; mglBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STREAM_DRAW); @@ -992,10 +992,10 @@ void MobileOpenGL2Graphics::drawRectangle(const Rect &restrict rect) restrict2 const GLfloat y2 = y1 + static_cast<GLfloat>(rect.height); GLfloat vertices[] = { - x1, y1, 0.0f, 0.0f, - x1, y2, 0.0f, 0.0f, - x2, y2, 0.0f, 0.0f, - x2, y1, 0.0f, 0.0f + x1, y1, 0.0F, 0.0F, + x1, y2, 0.0F, 0.0F, + x2, y2, 0.0F, 0.0F, + x2, y1, 0.0F, 0.0F }; mglBufferData(GL_ARRAY_BUFFER, sizeof(vertices), @@ -1020,10 +1020,10 @@ void MobileOpenGL2Graphics::fillRectangle(const Rect &restrict rect) restrict2 const GLfloat y2 = y1 + static_cast<GLfloat>(rect.height); GLfloat vertices[] = { - x1, y1, 0.0f, 0.0f, - x2, y1, 0.0f, 0.0f, - x1, y2, 0.0f, 0.0f, - x2, y2, 0.0f, 0.0f + x1, y1, 0.0F, 0.0F, + x2, y1, 0.0F, 0.0F, + x1, y2, 0.0F, 0.0F, + x2, y2, 0.0F, 0.0F }; mglBufferData(GL_ARRAY_BUFFER, sizeof(vertices), @@ -1042,7 +1042,7 @@ void MobileOpenGL2Graphics::enableTexturingAndBlending() restrict2 if (!mTextureDraw) { mTextureDraw = true; - mglUniform1f(mDrawTypeUniform, 1.0f); + mglUniform1f(mDrawTypeUniform, 1.0F); } if (!mAlpha) { @@ -1056,7 +1056,7 @@ void MobileOpenGL2Graphics::disableTexturingAndBlending() restrict2 if (mTextureDraw) { mTextureDraw = false; - mglUniform1f(mDrawTypeUniform, 0.0f); + mglUniform1f(mDrawTypeUniform, 0.0F); } if (mAlpha && !mColorAlpha) { @@ -1100,13 +1100,13 @@ void MobileOpenGL2Graphics::drawNet(const int x1, { mFloatArray[vp + 0] = xs1; mFloatArray[vp + 1] = toGL(y); - mFloatArray[vp + 2] = 0.0f; - mFloatArray[vp + 3] = 0.0f; + mFloatArray[vp + 2] = 0.0F; + mFloatArray[vp + 3] = 0.0F; mFloatArray[vp + 4] = xs2; mFloatArray[vp + 5] = toGL(y); - mFloatArray[vp + 6] = 0.0f; - mFloatArray[vp + 7] = 0.0f; + mFloatArray[vp + 6] = 0.0F; + mFloatArray[vp + 7] = 0.0F; vp += 8; if (vp >= vLimit) @@ -1120,13 +1120,13 @@ void MobileOpenGL2Graphics::drawNet(const int x1, { mFloatArray[vp + 0] = toGL(x); mFloatArray[vp + 1] = ys1; - mFloatArray[vp + 2] = 0.0f; - mFloatArray[vp + 3] = 0.0f; + mFloatArray[vp + 2] = 0.0F; + mFloatArray[vp + 3] = 0.0F; mFloatArray[vp + 4] = toGL(x); mFloatArray[vp + 5] = ys2; - mFloatArray[vp + 6] = 0.0f; - mFloatArray[vp + 7] = 0.0f; + mFloatArray[vp + 6] = 0.0F; + mFloatArray[vp + 7] = 0.0F; vp += 8; if (vp >= vLimit) diff --git a/src/render/mobileopenglgraphics.cpp b/src/render/mobileopenglgraphics.cpp index cf5d7b83a..c8cbb7bba 100644 --- a/src/render/mobileopenglgraphics.cpp +++ b/src/render/mobileopenglgraphics.cpp @@ -427,7 +427,7 @@ void MobileOpenGLGraphics::drawPatternCached(const Image *restrict const image, void MobileOpenGLGraphics::completeCache() restrict2 { - if (mImageCached == 0u) + if (mImageCached == 0U) return; setColorAlpha(mAlphaCached); diff --git a/src/render/modernopenglgraphics.cpp b/src/render/modernopenglgraphics.cpp index 473b8d264..e742db33e 100644 --- a/src/render/modernopenglgraphics.cpp +++ b/src/render/modernopenglgraphics.cpp @@ -126,17 +126,17 @@ ModernOpenGLGraphics::~ModernOpenGLGraphics() void ModernOpenGLGraphics::deleteGLObjects() restrict2 { delete2(mProgram); - if (mVbo != 0u) + if (mVbo != 0U) { // logger->log("delete buffer vbo: %u", mVbo); mglDeleteBuffers(1, &mVbo); } - if (mEbo != 0u) + if (mEbo != 0U) { // logger->log("delete buffer ebo: %u", mEbo); mglDeleteBuffers(1, &mEbo); } - if (mVao != 0u) + if (mVao != 0U) mglDeleteVertexArrays(1, &mVao); } @@ -176,7 +176,7 @@ void ModernOpenGLGraphics::postInit() restrict2 logger->safeError("Shader creation error. See manaplus.log."); } mProgramId = mProgram->getProgramId(); - if (mProgramId == 0u) + if (mProgramId == 0U) logger->error("Shaders compilation error."); logger->log("Shaders compilation done."); @@ -191,7 +191,7 @@ void ModernOpenGLGraphics::postInit() restrict2 mDrawTypeUniform = mglGetUniformLocation(mProgramId, "drawType"); mTextureColorUniform = mglGetUniformLocation(mProgramId, "alpha"); - mglUniform1f(mTextureColorUniform, 1.0f); + mglUniform1f(mTextureColorUniform, 1.0F); mglBindVertexBuffer(0, mVbo, 0, 4 * sizeof(GLint)); mglVertexAttribBinding(mPosAttrib, 0); @@ -199,8 +199,8 @@ void ModernOpenGLGraphics::postInit() restrict2 mAttributesBinded = mVbo; mglUniform2f(mScreenUniform, - static_cast<float>(mWidth) / 2.0f, - static_cast<float>(mHeight) / 2.0f); + static_cast<float>(mWidth) / 2.0F, + static_cast<float>(mHeight) / 2.0F); mglUniform4f(mSimpleColorUniform, 0.0F, 0.0F, @@ -1032,7 +1032,7 @@ void ModernOpenGLGraphics::enableTexturingAndBlending() restrict2 if (!mTextureDraw) { mTextureDraw = true; - mglUniform1f(mDrawTypeUniform, 1.0f); + mglUniform1f(mDrawTypeUniform, 1.0F); } if (!mAlpha) { @@ -1046,7 +1046,7 @@ void ModernOpenGLGraphics::disableTexturingAndBlending() restrict2 if (mTextureDraw) { mTextureDraw = false; - mglUniform1f(mDrawTypeUniform, 0.0f); + mglUniform1f(mDrawTypeUniform, 0.0F); } if (mAlpha && !mColorAlpha) { @@ -1107,13 +1107,13 @@ void ModernOpenGLGraphics::drawNet(const int x1, const int y1, { mIntArray[vp + 0] = x; mIntArray[vp + 1] = ys1; - mIntArray[vp + 2] = 0.0f; - mIntArray[vp + 3] = 0.0f; + mIntArray[vp + 2] = 0.0F; + mIntArray[vp + 3] = 0.0F; mIntArray[vp + 4] = x; mIntArray[vp + 5] = ys2; - mIntArray[vp + 6] = 0.0f; - mIntArray[vp + 7] = 0.0f; + mIntArray[vp + 6] = 0.0F; + mIntArray[vp + 7] = 0.0F; vp += 8; if (vp >= vLimit) diff --git a/src/render/normalopenglgraphics.cpp b/src/render/normalopenglgraphics.cpp index 20b39cd99..edaeb17cb 100644 --- a/src/render/normalopenglgraphics.cpp +++ b/src/render/normalopenglgraphics.cpp @@ -416,10 +416,10 @@ void NormalOpenGLGraphics::testDraw() restrict2 { GLfloat tex[] = { - 0.0f, 0.781250f, - 0.0f, 0.781250f, - 0.0f, 0.585938f, - 0.0f, 0.585938f + 0.0F, 0.781250f, + 0.0F, 0.781250f, + 0.0F, 0.585938f, + 0.0F, 0.585938f }; GLint vert[] = @@ -631,7 +631,7 @@ void NormalOpenGLGraphics::drawPatternCached(const Image *restrict const image, void NormalOpenGLGraphics::completeCache() restrict2 { - if (mImageCached == 0u) + if (mImageCached == 0U) return; setColorAlpha(mAlphaCached); diff --git a/src/render/safeopenglgraphics.cpp b/src/render/safeopenglgraphics.cpp index 53b31f8c4..03ff2cc28 100644 --- a/src/render/safeopenglgraphics.cpp +++ b/src/render/safeopenglgraphics.cpp @@ -210,13 +210,13 @@ void SafeOpenGLGraphics::testDraw() restrict2 if (SafeOpenGLImageHelper::mTextureType == GL_TEXTURE_2D) { glBegin(GL_QUADS); - glTexCoord2f(0.0f, 0.781250f); + glTexCoord2f(0.0F, 0.781250f); glVertex2i(0, 0); - glTexCoord2f(0.0f, 0.781250f); + glTexCoord2f(0.0F, 0.781250f); glVertex2i(800, 0); - glTexCoord2f(0.0f, 0.585938f); + glTexCoord2f(0.0F, 0.585938f); glVertex2i(800, 600); - glTexCoord2f(0.0f, 0.585938f); + glTexCoord2f(0.0F, 0.585938f); glVertex2i(0, 600); glEnd(); } diff --git a/src/render/sdlgraphics.cpp b/src/render/sdlgraphics.cpp index 8e77cbf1e..ad7ea9fcd 100644 --- a/src/render/sdlgraphics.cpp +++ b/src/render/sdlgraphics.cpp @@ -1043,11 +1043,11 @@ void SDLGraphics::fillRectangle(const Rect &restrict rectangle) restrict2 unsigned rShift = rMask / 0xff; unsigned gShift = gMask / 0xff; unsigned bShift = bMask / 0xff; - if (rShift == 0u) + if (rShift == 0U) rShift = 1; - if (gShift == 0u) + if (gShift == 0U) gShift = 1; - if (bShift == 0u) + if (bShift == 0U) bShift = 1; if (pixel != mOldPixel || mColor.a != mOldAlpha) { diff --git a/src/render/shaders/shader.cpp b/src/render/shaders/shader.cpp index 38238a189..8464103d7 100644 --- a/src/render/shaders/shader.cpp +++ b/src/render/shaders/shader.cpp @@ -34,7 +34,7 @@ Shader::Shader(const unsigned int id) : Shader::~Shader() { - if (mShaderId != 0u) + if (mShaderId != 0U) mglDeleteShader(mShaderId); } diff --git a/src/render/shaders/shaderprogram.cpp b/src/render/shaders/shaderprogram.cpp index 42f0b725c..5d611de0e 100644 --- a/src/render/shaders/shaderprogram.cpp +++ b/src/render/shaders/shaderprogram.cpp @@ -43,7 +43,7 @@ ShaderProgram::ShaderProgram(const unsigned int id, ShaderProgram::~ShaderProgram() { - if (mProgramId != 0u) + if (mProgramId != 0U) mglDeleteProgram(mProgramId); if (mVertex != nullptr) mVertex->decRef(); diff --git a/src/render/shaders/shadersmanager.cpp b/src/render/shaders/shadersmanager.cpp index 86ede490e..5ec7b9680 100644 --- a/src/render/shaders/shadersmanager.cpp +++ b/src/render/shaders/shadersmanager.cpp @@ -86,7 +86,7 @@ ShaderProgram *ShadersManager::createProgram(const std::string &vertex, } GLuint programId = mglCreateProgram(); - if (programId == 0u) + if (programId == 0U) { vertexShader->decRef(); fragmentShader->decRef(); diff --git a/src/resources/atlas/atlasresource.cpp b/src/resources/atlas/atlasresource.cpp index 3288bb27b..01029a3d6 100644 --- a/src/resources/atlas/atlasresource.cpp +++ b/src/resources/atlas/atlasresource.cpp @@ -58,7 +58,7 @@ AtlasResource::~AtlasResource() void AtlasResource::incRef() { - if (mRefCount == 0u) + if (mRefCount == 0U) AtlasManager::injectToResources(this); Resource::incRef(); } @@ -66,7 +66,7 @@ void AtlasResource::incRef() void AtlasResource::decRef() { Resource::decRef(); - if (mRefCount == 0u) + if (mRefCount == 0U) AtlasManager::moveToDeleted(this); } diff --git a/src/resources/beingcommon.cpp b/src/resources/beingcommon.cpp index 02b342e34..cef275bd1 100644 --- a/src/resources/beingcommon.cpp +++ b/src/resources/beingcommon.cpp @@ -232,13 +232,13 @@ bool BeingCommon::readObjectNodes(XmlNodePtrConst &spriteNode, "missile-particle", ""); const float missileZ = XML::getFloatProperty( - spriteNode, "missile-z", 32.0f); + spriteNode, "missile-z", 32.0F); const int missileLifeTime = XML::getProperty( spriteNode, "missile-lifetime", 500); const float missileSpeed = XML::getFloatProperty( - spriteNode, "missile-speed", 7.0f); + spriteNode, "missile-speed", 7.0F); const float missileDieDistance = XML::getFloatProperty( - spriteNode, "missile-diedistance", 8.0f); + spriteNode, "missile-diedistance", 8.0F); currentInfo->addAttack(attackId, spriteAction, diff --git a/src/resources/db/deaddb.cpp b/src/resources/db/deaddb.cpp index 5f5e2db5a..cd921d05a 100644 --- a/src/resources/db/deaddb.cpp +++ b/src/resources/db/deaddb.cpp @@ -102,7 +102,7 @@ void DeadDB::unload() std::string DeadDB::getRandomString() { const size_t sz = mMessages.size(); - if (sz == 0u) + if (sz == 0U) return std::string(); return translator->getStr(mMessages[rand() % sz]); } diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp index d6889bd83..78ac033a6 100644 --- a/src/resources/db/itemdb.cpp +++ b/src/resources/db/itemdb.cpp @@ -369,13 +369,13 @@ void ItemDB::loadXmlFile(const std::string &fileName, std::string missileParticle = XML::getProperty( node, "missile-particle", ""); float missileZ = XML::getFloatProperty( - node, "missile-z", 32.0f); + node, "missile-z", 32.0F); int missileLifeTime = XML::getProperty( node, "missile-lifetime", 500); float missileSpeed = XML::getFloatProperty( - node, "missile-speed", 7.0f); + node, "missile-speed", 7.0F); float missileDieDistance = XML::getFloatProperty( - node, "missile-diedistance", 8.0f); + node, "missile-diedistance", 8.0F); int hitEffectId = XML::getProperty(node, "hit-effect-id", paths.getIntValue("hitEffectId")); int criticalEffectId = XML::getProperty( diff --git a/src/resources/dye/dyepalette.cpp b/src/resources/dye/dyepalette.cpp index d5fab2550..f250b36f6 100644 --- a/src/resources/dye/dyepalette.cpp +++ b/src/resources/dye/dyepalette.cpp @@ -253,7 +253,7 @@ void DyePalette::initFunctions() { #ifdef SIMD_SUPPORTED const uint32_t flags = Cpu::getFlags(); - if ((flags & Cpu::FEATURE_AVX2) != 0u) + if ((flags & Cpu::FEATURE_AVX2) != 0U) { funcReplaceSColor = &DyePalette::replaceSColorAvx2; funcReplaceSColorAvx2 = &DyePalette::replaceSColorAvx2; @@ -271,7 +271,7 @@ void DyePalette::initFunctions() funcReplaceAOGLColorSse2 = &DyePalette::replaceAOGLColorSse2; #endif // USE_OPENGL } - else if ((flags & Cpu::FEATURE_SSE2) != 0u) + else if ((flags & Cpu::FEATURE_SSE2) != 0U) { funcReplaceSColor = &DyePalette::replaceSColorSse2; funcReplaceSColorAvx2 = &DyePalette::replaceSColorSse2; diff --git a/src/resources/dye/dyepalette_replaceacolor.cpp b/src/resources/dye/dyepalette_replaceacolor.cpp index 5d94d9a1f..3ca757021 100644 --- a/src/resources/dye/dyepalette_replaceacolor.cpp +++ b/src/resources/dye/dyepalette_replaceacolor.cpp @@ -41,9 +41,9 @@ void DyePalette::replaceAColorDefault(uint32_t *restrict pixels, { STD_VECTOR<DyeColor>::const_iterator it_end = mColors.end(); const size_t sz = mColors.size(); - if ((sz == 0u) || (pixels == nullptr)) + if ((sz == 0U) || (pixels == nullptr)) return; - if ((sz % 2) != 0u) + if ((sz % 2) != 0U) -- it_end; for (const uint32_t *const p_end = pixels + CAST_SIZE(bufSize); @@ -101,9 +101,9 @@ void DyePalette::replaceAColorSse2(uint32_t *restrict pixels, { STD_VECTOR<DyeColor>::const_iterator it_end = mColors.end(); const size_t sz = mColors.size(); - if ((sz == 0u) || (pixels == nullptr)) + if ((sz == 0U) || (pixels == nullptr)) return; - if ((sz % 2) != 0u) + if ((sz % 2) != 0U) -- it_end; const int mod = bufSize % 4; const int bufEnd = bufSize - mod; @@ -172,9 +172,9 @@ void DyePalette::replaceAColorAvx2(uint32_t *restrict pixels, { STD_VECTOR<DyeColor>::const_iterator it_end = mColors.end(); const size_t sz = mColors.size(); - if ((sz == 0u) || (pixels == nullptr)) + if ((sz == 0U) || (pixels == nullptr)) return; - if ((sz % 2) != 0u) + if ((sz % 2) != 0U) -- it_end; const int mod = bufSize % 8; const int bufEnd = bufSize - mod; diff --git a/src/resources/dye/dyepalette_replaceaoglcolor.cpp b/src/resources/dye/dyepalette_replaceaoglcolor.cpp index ec999812a..e50136783 100644 --- a/src/resources/dye/dyepalette_replaceaoglcolor.cpp +++ b/src/resources/dye/dyepalette_replaceaoglcolor.cpp @@ -43,9 +43,9 @@ void DyePalette::replaceAOGLColorDefault(uint32_t *restrict pixels, { STD_VECTOR<DyeColor>::const_iterator it_end = mColors.end(); const size_t sz = mColors.size(); - if (sz == 0u || pixels == nullptr) + if (sz == 0U || pixels == nullptr) return; - if ((sz % 2) != 0u) + if ((sz % 2) != 0U) -- it_end; for (const uint32_t *const p_end = pixels + CAST_SIZE(bufSize); @@ -104,9 +104,9 @@ void DyePalette::replaceAOGLColorSse2(uint32_t *restrict pixels, { STD_VECTOR<DyeColor>::const_iterator it_end = mColors.end(); const size_t sz = mColors.size(); - if (sz == 0u || pixels == nullptr) + if (sz == 0U || pixels == nullptr) return; - if ((sz % 2) != 0u) + if ((sz % 2) != 0U) -- it_end; if (bufSize >= 8) @@ -188,9 +188,9 @@ void DyePalette::replaceAOGLColorAvx2(uint32_t *restrict pixels, { STD_VECTOR<DyeColor>::const_iterator it_end = mColors.end(); const size_t sz = mColors.size(); - if (sz == 0u || pixels == nullptr) + if (sz == 0U || pixels == nullptr) return; - if ((sz % 2) != 0u) + if ((sz % 2) != 0U) -- it_end; if (bufSize >= 8) diff --git a/src/resources/dye/dyepalette_replacescolor.cpp b/src/resources/dye/dyepalette_replacescolor.cpp index 80b82751d..4c987aa9d 100644 --- a/src/resources/dye/dyepalette_replacescolor.cpp +++ b/src/resources/dye/dyepalette_replacescolor.cpp @@ -41,9 +41,9 @@ void DyePalette::replaceSColorDefault(uint32_t *restrict pixels, { STD_VECTOR<DyeColor>::const_iterator it_end = mColors.end(); const size_t sz = mColors.size(); - if (sz == 0u || pixels == nullptr) + if (sz == 0U || pixels == nullptr) return; - if ((sz % 2) != 0u) + if ((sz % 2) != 0U) -- it_end; for (const uint32_t *const p_end = pixels + CAST_SIZE(bufSize); @@ -102,9 +102,9 @@ void DyePalette::replaceSColorSse2(uint32_t *restrict pixels, { STD_VECTOR<DyeColor>::const_iterator it_end = mColors.end(); const size_t sz = mColors.size(); - if (sz == 0u || pixels == nullptr) + if (sz == 0U || pixels == nullptr) return; - if ((sz % 2) != 0u) + if ((sz % 2) != 0U) -- it_end; const int mod = bufSize % 8; const int bufEnd = bufSize - mod; @@ -183,9 +183,9 @@ void DyePalette::replaceSColorAvx2(uint32_t *restrict pixels, { STD_VECTOR<DyeColor>::const_iterator it_end = mColors.end(); const size_t sz = mColors.size(); - if (sz == 0u || pixels == nullptr) + if (sz == 0U || pixels == nullptr) return; - if ((sz % 2) != 0u) + if ((sz % 2) != 0U) -- it_end; const int mod = bufSize % 8; const int bufEnd = bufSize - mod; diff --git a/src/resources/dye/dyepalette_replacesoglcolor.cpp b/src/resources/dye/dyepalette_replacesoglcolor.cpp index 7e435d936..4483ed02b 100644 --- a/src/resources/dye/dyepalette_replacesoglcolor.cpp +++ b/src/resources/dye/dyepalette_replacesoglcolor.cpp @@ -43,9 +43,9 @@ void DyePalette::replaceSOGLColorDefault(uint32_t *restrict pixels, { STD_VECTOR<DyeColor>::const_iterator it_end = mColors.end(); const size_t sz = mColors.size(); - if ((sz == 0u) || (pixels == nullptr)) + if ((sz == 0U) || (pixels == nullptr)) return; - if ((sz % 2) != 0u) + if ((sz % 2) != 0U) -- it_end; for (const uint32_t *const p_end = pixels + CAST_SIZE(bufSize); @@ -104,9 +104,9 @@ void DyePalette::replaceSOGLColorSse2(uint32_t *restrict pixels, { STD_VECTOR<DyeColor>::const_iterator it_end = mColors.end(); const size_t sz = mColors.size(); - if ((sz == 0u) || (pixels == nullptr)) + if ((sz == 0U) || (pixels == nullptr)) return; - if ((sz % 2) != 0u) + if ((sz % 2) != 0U) -- it_end; if (bufSize >= 8) @@ -190,9 +190,9 @@ void DyePalette::replaceSOGLColorAvx2(uint32_t *restrict pixels, { STD_VECTOR<DyeColor>::const_iterator it_end = mColors.end(); const size_t sz = mColors.size(); - if ((sz == 0u) || (pixels == nullptr)) + if ((sz == 0U) || (pixels == nullptr)) return; - if ((sz % 2) != 0u) + if ((sz % 2) != 0U) -- it_end; if (bufSize >= 8) diff --git a/src/resources/image/image.cpp b/src/resources/image/image.cpp index 92cdbee43..69f6da98c 100644 --- a/src/resources/image/image.cpp +++ b/src/resources/image/image.cpp @@ -196,7 +196,7 @@ Image::Image(const GLuint glimage, const int width, const int height, mBounds.w = CAST_U16(width); mBounds.h = CAST_U16(height); - if (mGLImage != 0u) + if (mGLImage != 0U) { mLoaded = true; } @@ -249,7 +249,7 @@ void Image::unload() #endif // USE_SDL2 #ifdef USE_OPENGL - if (mGLImage != 0u) + if (mGLImage != 0U) { glDeleteTextures(1, &mGLImage); mGLImage = 0; @@ -521,7 +521,7 @@ int Image::calcMemoryLocal() const #ifdef USE_OPENGL void Image::decRef() { - if ((mGLImage != 0u) && mRefCount <= 1) + if ((mGLImage != 0U) && mRefCount <= 1) OpenGLImageHelper::invalidate(mGLImage); Resource::decRef(); } diff --git a/src/resources/openglimagehelper.cpp b/src/resources/openglimagehelper.cpp index 1b0ce9979..a2aa72958 100644 --- a/src/resources/openglimagehelper.cpp +++ b/src/resources/openglimagehelper.cpp @@ -412,7 +412,7 @@ Image *OpenGLImageHelper::glLoad(SDL_Surface *tmpImage, MSDL_FreeSurface(tmpImage); GLenum error = graphicsManager.getLastError(); - if (error != 0u) + if (error != 0U) { std::string errmsg = GraphicsManager::errorToString(error); reportAlways("Error: Image GL import failed: %s (%u)", diff --git a/src/resources/resourcemanager/resourcemanager.cpp b/src/resources/resourcemanager/resourcemanager.cpp index 5cbf005aa..9ed7b6dde 100644 --- a/src/resources/resourcemanager/resourcemanager.cpp +++ b/src/resources/resourcemanager/resourcemanager.cpp @@ -327,7 +327,7 @@ void clearDeleted(const bool full) std::set<Resource*>::iterator resDelIter = mDeletedResources.begin(); while (resDelIter != mDeletedResources.end()) { - if ((*resDelIter)->mRefCount == 0u) + if ((*resDelIter)->mRefCount == 0U) { status = true; Resource *res = *resDelIter; @@ -604,7 +604,7 @@ void deleteInstance() const Resource *const res = iter->second; if (res != nullptr) { - if (res->mRefCount != 0u) + if (res->mRefCount != 0U) { logger->log(std::string("ResourceLeak: ").append( res->mIdPath).append(" (").append(toString( diff --git a/src/resources/safeopenglimagehelper.cpp b/src/resources/safeopenglimagehelper.cpp index 11fcfd4b6..70b2c31a1 100644 --- a/src/resources/safeopenglimagehelper.cpp +++ b/src/resources/safeopenglimagehelper.cpp @@ -387,7 +387,7 @@ Image *SafeOpenGLImageHelper::glLoad(SDL_Surface *tmpImage, MSDL_FreeSurface(tmpImage); GLenum error = graphicsManager.getLastError(); - if (error != 0u) + if (error != 0U) { std::string errmsg = GraphicsManager::errorToString(error); logger->log("Error: Image GL import failed: %s (%u)", diff --git a/src/resources/sdlgfxblitfunc.cpp b/src/resources/sdlgfxblitfunc.cpp index c2d66a68f..d72e7fbc5 100644 --- a/src/resources/sdlgfxblitfunc.cpp +++ b/src/resources/sdlgfxblitfunc.cpp @@ -397,7 +397,7 @@ static int _SDL_gfxBlitRGBACall(const SDL_Surface *const src, /* * Set up source and destination buffer pointers, then blit */ - if ((srcrect->w != 0u) && (srcrect->h != 0u)) + if ((srcrect->w != 0U) && (srcrect->h != 0U)) { SDL_gfxBlitInfo info; diff --git a/src/resources/sdlimagehelper.cpp b/src/resources/sdlimagehelper.cpp index 1d51bb4cc..2c5970a49 100644 --- a/src/resources/sdlimagehelper.cpp +++ b/src/resources/sdlimagehelper.cpp @@ -153,7 +153,7 @@ Image *SDLImageHelper::createTextSurface(SDL_Surface *const tmpImage, uint8_t *alphaChannel = new uint8_t[sz]; const SDL_PixelFormat *const fmt = tmpImage->format; - if (fmt->Amask != 0u) + if (fmt->Amask != 0U) { for (size_t i = 0; i < sz; ++ i) { @@ -241,7 +241,7 @@ Image *SDLImageHelper::_SDLload(SDL_Surface *tmpImage) if (tmpImage->format->palette == nullptr) { const SDL_PixelFormat *const fmt = tmpImage->format; - if (fmt->Amask != 0u) + if (fmt->Amask != 0U) { const uint32_t amask = fmt->Amask; const uint8_t ashift = fmt->Ashift; diff --git a/src/resources/sprite/animatedsprite.cpp b/src/resources/sprite/animatedsprite.cpp index 476a45f35..965cffbec 100644 --- a/src/resources/sprite/animatedsprite.cpp +++ b/src/resources/sprite/animatedsprite.cpp @@ -461,7 +461,7 @@ bool AnimatedSprite::updateNumber(const unsigned num) restrict2 { mNumber1 = num; mNumber = mSprite->findNumber(num); - if (mNumber == 0u) + if (mNumber == 0U) { mNumber = 100; return false; diff --git a/src/sdl2gfx/SDL2_framerate.cpp b/src/sdl2gfx/SDL2_framerate.cpp index e03a8ba7c..032dc08b9 100644 --- a/src/sdl2gfx/SDL2_framerate.cpp +++ b/src/sdl2gfx/SDL2_framerate.cpp @@ -73,7 +73,7 @@ void SDL_initFramerate(FPSmanager * manager) */ manager->framecount = 0; manager->rate = FPS_DEFAULT; - manager->rateticks = (1000.0f / static_cast<float>(FPS_DEFAULT)); + manager->rateticks = (1000.0F / static_cast<float>(FPS_DEFAULT)); manager->baseticks = _getTicks(); manager->lastticks = manager->baseticks; @@ -96,7 +96,7 @@ int SDL_setFramerate(FPSmanager * manager, Uint32 rate) { manager->framecount = 0; manager->rate = rate; - manager->rateticks = (1000.0f / static_cast<float>(rate)); + manager->rateticks = (1000.0F / static_cast<float>(rate)); return (0); } else diff --git a/src/test/testlauncher.cpp b/src/test/testlauncher.cpp index 2a7ad05d8..2e886b2c9 100644 --- a/src/test/testlauncher.cpp +++ b/src/test/testlauncher.cpp @@ -753,7 +753,7 @@ int TestLauncher::testDraw() mainGraphics->setColor(Color(0xFFU, 0x00U, 0x00U, 0xB0U)); img[0]->setAlpha(0.5f); mainGraphics->drawImage(img[0], 190, 383); - img[0]->setAlpha(1.0f); + img[0]->setAlpha(1.0F); mainGraphics->calcWindow(col2, 5, 40, diff --git a/src/unittests/configuration.cc b/src/unittests/configuration.cc index 495684ab6..11b463d86 100644 --- a/src/unittests/configuration.cc +++ b/src/unittests/configuration.cc @@ -67,7 +67,7 @@ TEST_CASE("configuration tests", "configuration") { const char *const key = "sfxVolume"; REQUIRE(config.getIntValue(key) == 100); - REQUIRE(config.getFloatValue(key) >= 100.0f); + REQUIRE(config.getFloatValue(key) >= 100.0F); REQUIRE(config.getStringValue(key) == "100"); REQUIRE(config.getBoolValue(key) == true); } @@ -76,7 +76,7 @@ TEST_CASE("configuration tests", "configuration") { const char *const key = "guialpha"; REQUIRE(config.getIntValue(key) == 0); - REQUIRE(config.getFloatValue(key) >= 0.8f); + REQUIRE(config.getFloatValue(key) >= 0.8F); REQUIRE(config.getStringValue(key).substr(0, 3) == "0.8"); REQUIRE(config.getBoolValue(key) == false); } @@ -85,7 +85,7 @@ TEST_CASE("configuration tests", "configuration") { const char *const key = "soundwhisper"; REQUIRE(config.getIntValue(key) == 0); - REQUIRE(config.getFloatValue(key) >= 0.0f); + REQUIRE(config.getFloatValue(key) >= 0.0F); REQUIRE(config.getStringValue(key) == "newmessage"); REQUIRE(config.getBoolValue(key) == true); } @@ -94,7 +94,7 @@ TEST_CASE("configuration tests", "configuration") { const char *const key = "showgender"; REQUIRE(config.getIntValue(key) == 1); - REQUIRE(config.getFloatValue(key) >= 1.0f); + REQUIRE(config.getFloatValue(key) >= 1.0F); REQUIRE(config.getStringValue(key) == "1"); REQUIRE(config.getBoolValue(key) == true); } @@ -103,7 +103,7 @@ TEST_CASE("configuration tests", "configuration") { const char *const key = "showlevel"; REQUIRE(config.getIntValue(key) == 0); - REQUIRE(config.getFloatValue(key) >= 0.0f); + REQUIRE(config.getFloatValue(key) >= 0.0F); REQUIRE(config.getStringValue(key) == "0"); REQUIRE(config.getBoolValue(key) == false); } @@ -113,7 +113,7 @@ TEST_CASE("configuration tests", "configuration") const char *const key = "sfxVolume"; config.setValue(key, 50); REQUIRE(config.getIntValue(key) == 50); - REQUIRE(config.getFloatValue(key) >= 50.0f); + REQUIRE(config.getFloatValue(key) >= 50.0F); REQUIRE(config.getStringValue(key) == "50"); REQUIRE(config.getBoolValue(key) == true); @@ -132,7 +132,7 @@ TEST_CASE("configuration tests", "configuration") const char *const key = "guialpha"; config.setValue(key, 50.5); REQUIRE(config.getIntValue(key) == 50); - REQUIRE(config.getFloatValue(key) >= 50.4f); + REQUIRE(config.getFloatValue(key) >= 50.4F); REQUIRE(config.getStringValue(key).substr(0, 2) == "50"); REQUIRE(config.getBoolValue(key) == true); @@ -151,7 +151,7 @@ TEST_CASE("configuration tests", "configuration") const char *const key = "soundwhisper"; config.setValue(key, "test line"); REQUIRE(config.getIntValue(key) == 0); - REQUIRE(config.getFloatValue(key) >= 0.0f); + REQUIRE(config.getFloatValue(key) >= 0.0F); REQUIRE(config.getStringValue(key) == "test line"); REQUIRE(config.getBoolValue(key) == false); @@ -170,7 +170,7 @@ TEST_CASE("configuration tests", "configuration") const char *const key = "showgender"; config.setValue(key, true); REQUIRE(config.getIntValue(key) == 1); - REQUIRE(config.getFloatValue(key) >= 1.0f); + REQUIRE(config.getFloatValue(key) >= 1.0F); REQUIRE(config.getStringValue(key) == "1"); REQUIRE(config.getBoolValue(key) == true); @@ -189,7 +189,7 @@ TEST_CASE("configuration tests", "configuration") const char *const key = "showgender"; config.setValue(key, false); REQUIRE(config.getIntValue(key) == 0); - REQUIRE(config.getFloatValue(key) >= 0.0f); + REQUIRE(config.getFloatValue(key) >= 0.0F); REQUIRE(config.getStringValue(key) == "0"); REQUIRE(config.getBoolValue(key) == false); @@ -249,12 +249,12 @@ TEST_CASE("configuration tests", "configuration") const char *const key = "sfxVolume"; config.setValue(key, 20); REQUIRE(config.getIntValue(key) == 20); - REQUIRE(config.getFloatValue(key) >= 20.0f); + REQUIRE(config.getFloatValue(key) >= 20.0F); REQUIRE(config.getStringValue(key) == "20"); REQUIRE(config.getBoolValue(key) == true); config.resetIntValue(key); REQUIRE(config.getIntValue(key) == 100); - REQUIRE(config.getFloatValue(key) >= 100.0f); + REQUIRE(config.getFloatValue(key) >= 100.0F); REQUIRE(config.getStringValue(key) == "100"); REQUIRE(config.getBoolValue(key) == true); } @@ -264,13 +264,13 @@ TEST_CASE("configuration tests", "configuration") const char *const key = "showgender"; config.setValue(key, false); REQUIRE(config.getIntValue(key) == 0); - REQUIRE(config.getFloatValue(key) >= 0.0f); + REQUIRE(config.getFloatValue(key) >= 0.0F); REQUIRE(config.getStringValue(key) == "0"); REQUIRE(config.getBoolValue(key) == false); config.resetBoolValue(key); REQUIRE(config.getIntValue(key) == 1); - REQUIRE(config.getFloatValue(key) >= 1.0f); + REQUIRE(config.getFloatValue(key) >= 1.0F); REQUIRE(config.getStringValue(key) == "1"); REQUIRE(config.getBoolValue(key) == true); } @@ -280,13 +280,13 @@ TEST_CASE("configuration tests", "configuration") const char *const key = "showlevel"; config.setValue(key, true); REQUIRE(config.getIntValue(key) == 1); - REQUIRE(config.getFloatValue(key) >= 1.0f); + REQUIRE(config.getFloatValue(key) >= 1.0F); REQUIRE(config.getStringValue(key) == "1"); REQUIRE(config.getBoolValue(key) == true); config.resetBoolValue(key); REQUIRE(config.getIntValue(key) == 0); - REQUIRE(config.getFloatValue(key) >= 0.0f); + REQUIRE(config.getFloatValue(key) >= 0.0F); REQUIRE(config.getStringValue(key) == "0"); REQUIRE(config.getBoolValue(key) == false); } diff --git a/src/unittests/utils/stringutils.cc b/src/unittests/utils/stringutils.cc index ddb94ddd9..348be5d7d 100644 --- a/src/unittests/utils/stringutils.cc +++ b/src/unittests/utils/stringutils.cc @@ -141,7 +141,7 @@ TEST_CASE("stringuntils toString 1", "") REQUIRE(strprintf("%d", 123) == toString(CAST_U8(123))); REQUIRE(strprintf("%u", static_cast<uint32_t>(30000000)) == toString( static_cast<uint32_t>(30000000))); - REQUIRE(strprintf("%f", 3.1f) == toString(3.1f)); + REQUIRE(strprintf("%f", 3.1F) == toString(3.1F)); REQUIRE(strprintf("%f", 3.1) == toString(3.1)); } diff --git a/src/utils/cpu.cpp b/src/utils/cpu.cpp index 6b553b096..99fd2d461 100644 --- a/src/utils/cpu.cpp +++ b/src/utils/cpu.cpp @@ -153,21 +153,21 @@ void Cpu::printFlags() if (logger == nullptr) return; std::string str("CPU features:"); - if ((mCpuFlags & FEATURE_MMX) != 0u) + if ((mCpuFlags & FEATURE_MMX) != 0U) str.append(" mmx"); - if ((mCpuFlags & FEATURE_SSE) != 0u) + if ((mCpuFlags & FEATURE_SSE) != 0U) str.append(" sse"); - if ((mCpuFlags & FEATURE_SSE2) != 0u) + if ((mCpuFlags & FEATURE_SSE2) != 0U) str.append(" sse2"); - if ((mCpuFlags & FEATURE_SSSE3) != 0u) + if ((mCpuFlags & FEATURE_SSSE3) != 0U) str.append(" ssse3"); - if ((mCpuFlags & FEATURE_SSE4) != 0u) + if ((mCpuFlags & FEATURE_SSE4) != 0U) str.append(" sse4"); - if ((mCpuFlags & FEATURE_SSE42) != 0u) + if ((mCpuFlags & FEATURE_SSE42) != 0U) str.append(" sse4_2"); - if ((mCpuFlags & FEATURE_AVX) != 0u) + if ((mCpuFlags & FEATURE_AVX) != 0U) str.append(" avx"); - if ((mCpuFlags & FEATURE_AVX2) != 0u) + if ((mCpuFlags & FEATURE_AVX2) != 0U) str.append(" avx2"); logger->log(str); } diff --git a/src/utils/sdlhelper.cpp b/src/utils/sdlhelper.cpp index a3dfb3842..474840d2a 100644 --- a/src/utils/sdlhelper.cpp +++ b/src/utils/sdlhelper.cpp @@ -193,7 +193,7 @@ void SDL::setLogLevel(const int level A_UNUSED) void SDL::WaitThread(SDL_Thread *const thread) { - if (thread != nullptr && SDL_GetThreadID(thread) != 0u) + if (thread != nullptr && SDL_GetThreadID(thread) != 0U) SDL_WaitThread(thread, nullptr); } diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp index 0cece6d0a..bcb6c8c73 100644 --- a/src/utils/stringutils.cpp +++ b/src/utils/stringutils.cpp @@ -236,7 +236,7 @@ const std::string encodeStr(unsigned int value, const unsigned int size) buf += CAST_S8(value % base + start); value /= base; } - while (value != 0u); + while (value != 0U); while (buf.length() < size) buf += CAST_S8(start); @@ -944,7 +944,7 @@ std::string timeToStr(const uint32_t time) char buf[101]; const time_t tempTime = time; tm *const timeInfo = localtime(&tempTime); - if (strftime(&buf[0], 100, "%Y-%m-%d_%H-%M-%S", timeInfo) != 0u) + if (strftime(&buf[0], 100, "%Y-%m-%d_%H-%M-%S", timeInfo) != 0U) return std::string(buf); return "unknown"; } |