From d432d78ba8ced0118cc7aa2be8a0308831932bcb Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 27 May 2013 23:38:09 +0300 Subject: improve userpalette. --- src/gui/userpalette.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/gui/userpalette.cpp b/src/gui/userpalette.cpp index fd02a7c77..9db32677a 100644 --- a/src/gui/userpalette.cpp +++ b/src/gui/userpalette.cpp @@ -81,7 +81,6 @@ const std::string ColorTypeNames[] = std::string UserPalette::getConfigName(const std::string &typeName) { std::string res = "Color" + typeName; - size_t pos = 5; for (size_t i = 0; i < typeName.length(); i++) { @@ -99,7 +98,6 @@ std::string UserPalette::getConfigName(const std::string &typeName) pos ++; } res.erase(pos, res.length() - pos); - return res; } @@ -252,7 +250,8 @@ void UserPalette::setGradient(const int type, const GradientType grad) if (elem->grad != STATIC && grad == STATIC) { - for (size_t i = 0; i < mGradVector.size(); i++) + const int sz = mGradVector.size(); + for (size_t i = 0; i < sz; i++) { if (mGradVector[i] == elem) { @@ -337,8 +336,8 @@ void UserPalette::addColor(const unsigned type, const unsigned rgb, snprintf(buffer, sizeof(buffer), "0x%06x", rgb); buffer[19] = 0; - const std::string rgbString = config.getValue(configName, - std::string(buffer)); + const std::string rgbString = config.getValue( + configName, std::string(buffer)); unsigned int rgbValue = 0; if (rgbString.length() == 8 && rgbString[0] == '0' && rgbString[1] == 'x') rgbValue = atox(rgbString); -- cgit v1.2.3-60-g2f50