diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-05-27 23:38:09 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-05-27 23:38:09 +0300 |
commit | d432d78ba8ced0118cc7aa2be8a0308831932bcb (patch) | |
tree | 13cee79cfad7424ecdeeb5745f90edd2d98d8962 | |
parent | 815c8c567f4aa7271069e37b1d82678920799484 (diff) | |
download | mv-d432d78ba8ced0118cc7aa2be8a0308831932bcb.tar.gz mv-d432d78ba8ced0118cc7aa2be8a0308831932bcb.tar.bz2 mv-d432d78ba8ced0118cc7aa2be8a0308831932bcb.tar.xz mv-d432d78ba8ced0118cc7aa2be8a0308831932bcb.zip |
improve userpalette.
-rw-r--r-- | src/gui/userpalette.cpp | 9 |
1 files 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); |