From 112c4c9e44658a04717a804404282fa0ba3e951f Mon Sep 17 00:00:00 2001 From: cschreib Date: Tue, 6 Jan 2015 00:29:21 +0100 Subject: [PATCH 1/2] Used cppcheck to fix a few harmless bugs. --- gui/src/gui_slider.cpp | 2 +- gui/src/gui_statusbar.cpp | 2 +- gui/src/gui_uiobject.cpp | 3 ++- luapp/src/luapp_state.cpp | 1 - 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gui/src/gui_slider.cpp b/gui/src/gui_slider.cpp index 3f92e79b9d..1f9fb9983e 100644 --- a/gui/src/gui_slider.cpp +++ b/gui/src/gui_slider.cpp @@ -234,7 +234,7 @@ void slider::set_max_value(float fMax) if (fMax != fMaxValue_) { fMaxValue_ = fMax; - if (fMaxValue_ < fMaxValue_) fMaxValue_ = fMinValue_; + if (fMaxValue_ < fMinValue_) fMaxValue_ = fMinValue_; else step_value(fMaxValue_, fValueStep_); if (fValue_ > fMaxValue_) diff --git a/gui/src/gui_statusbar.cpp b/gui/src/gui_statusbar.cpp index f55cfacf78..94fb879d92 100644 --- a/gui/src/gui_statusbar.cpp +++ b/gui/src/gui_statusbar.cpp @@ -124,7 +124,7 @@ void status_bar::set_max_value(float fMax) if (fMax != fMaxValue_) { fMaxValue_ = fMax; - if (fMaxValue_ < fMaxValue_) fMaxValue_ = fMinValue_; + if (fMaxValue_ < fMinValue_) fMaxValue_ = fMinValue_; fValue_ = fValue_ > fMaxValue_ ? fMaxValue_ : (fValue_ < fMinValue_ ? fMinValue_ : fValue_); fire_update_bar_texture_(); } diff --git a/gui/src/gui_uiobject.cpp b/gui/src/gui_uiobject.cpp index 5a406820e5..4972bfb32d 100644 --- a/gui/src/gui_uiobject.cpp +++ b/gui/src/gui_uiobject.cpp @@ -259,7 +259,8 @@ bool uiobject::is_visible() const void uiobject::set_abs_dimensions(uint uiAbsWidth, uint uiAbsHeight) { - if (uiAbsWidth_ != uiAbsWidth || !bIsWidthAbs_ || uiAbsHeight_ != uiAbsHeight || !bIsWidthAbs_) + if (uiAbsWidth_ != uiAbsWidth || !bIsWidthAbs_ || + uiAbsHeight_ != uiAbsHeight || !bIsHeightAbs_) { pManager_->notify_object_moved(); bIsWidthAbs_ = true; diff --git a/luapp/src/luapp_state.cpp b/luapp/src/luapp_state.cpp index e5df992195..1ee1829060 100644 --- a/luapp/src/luapp_state.cpp +++ b/luapp/src/luapp_state.cpp @@ -784,7 +784,6 @@ std::string state::get_type_name(type mType) void state::get_global(const std::string& sName) { std::deque lDecomposedName; - std::string sVarName; utils::string_vector lWords = utils::cut(sName, ":"); utils::string_vector::iterator iter1; foreach (iter1, lWords) From 249a1a8922e8a51bed94881ef8bc77ecfe33ba53 Mon Sep 17 00:00:00 2001 From: cschreib Date: Fri, 5 May 2017 17:52:03 +0200 Subject: [PATCH 2/2] Fixed compiler error/warnings created by change in FreeType --- gui/impl/gui/gl/src/gui_gl_font.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gui/impl/gui/gl/src/gui_gl_font.cpp b/gui/impl/gui/gl/src/gui_gl_font.cpp index 44bf1de424..1e76b9f99c 100644 --- a/gui/impl/gui/gl/src/gui_gl_font.cpp +++ b/gui/impl/gui/gl/src/gui_gl_font.cpp @@ -67,7 +67,7 @@ font::font(const std::string& sFontFile, uint uiSize) : bKerning_(false) iMaxBearingY = mFace->glyph->metrics.horiBearingY; int iCharWidth = std::max( - mFace->glyph->bitmap.width + int(mFace->glyph->metrics.horiBearingX >> 6), + int(mFace->glyph->bitmap.width) + int(mFace->glyph->metrics.horiBearingX >> 6), int(mFace->glyph->advance.x >> 6) ); @@ -133,8 +133,8 @@ font::font(const std::string& sFontFile, uint uiSize) : bKerning_(false) { int iYBearing = iMaxBearingY - (mFace->glyph->metrics.horiBearingY >> 6); - for (int j = 0; j < mFace->glyph->bitmap.rows; ++j) - for (int i = 0; i < mFace->glyph->bitmap.width; ++i, ++sBuffer) + for (int j = 0; j < int(mFace->glyph->bitmap.rows); ++j) + for (int i = 0; i < int(mFace->glyph->bitmap.width); ++i, ++sBuffer) pTexture_->set_pixel(x + i + uiXBearing, y + j + iYBearing, ub32color(255, 255, 255, *sBuffer)); }