diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-08-21 22:44:29 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-08-21 22:45:15 +0300 |
commit | 42f47e483da19079a937c4801ca94bd62d8dc970 (patch) | |
tree | 56dc96737e01e04d54357ce7118de3a1f000c516 /src/utils | |
parent | 2d8b9246c8003f1d32ba396bc19cc11bc5a595b2 (diff) | |
download | mv-42f47e483da19079a937c4801ca94bd62d8dc970.tar.gz mv-42f47e483da19079a937c4801ca94bd62d8dc970.tar.bz2 mv-42f47e483da19079a937c4801ca94bd62d8dc970.tar.xz mv-42f47e483da19079a937c4801ca94bd62d8dc970.zip |
Remove useless else.
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/stringutils.cpp | 48 | ||||
-rw-r--r-- | src/utils/timer.cpp | 10 | ||||
-rw-r--r-- | src/utils/translation/poparser.cpp | 48 |
3 files changed, 41 insertions, 65 deletions
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp index 8920d111b..ecbd7de19 100644 --- a/src/utils/stringutils.cpp +++ b/src/utils/stringutils.cpp @@ -560,10 +560,7 @@ std::string combineDye2(std::string file, } return file.append("|").append(str); } - else - { - return file; - } + return file; } std::string combineDye3(std::string file, @@ -588,13 +585,9 @@ std::string combineDye3(std::string file, } return file.append("|").append(str); } - else - { - if (dye.empty() || file.empty()) - return file; - else - return file.append("|").append(dye); - } + if (dye.empty() || file.empty()) + return file; + return file.append("|").append(dye); } std::string packList(const std::list<std::string> &list) @@ -959,8 +952,7 @@ std::string timeToStr(const uint32_t time) tm *const timeInfo = localtime(&tempTime); if (strftime(&buf[0], 100, "%Y-%m-%d_%H-%M-%S", timeInfo) != 0u) return std::string(buf); - else - return "unknown"; + return "unknown"; } std::string timeDiffToString(int timeDiff) @@ -1060,30 +1052,26 @@ std::string pathJoin(std::string str1, { if (str2[0] == sep) return str2; - else - return sepStr.append(str2); + return sepStr.append(str2); } const size_t sz1 = str1.size(); if (str2.empty()) { if (str1[sz1 - 1] == sep) return str1; - else - return str1.append(sepStr); + return str1.append(sepStr); } if (str1[sz1 - 1] == sep) { if (str2[0] == sep) return str1.append(str2.substr(1)); - else - return str1.append(str2); + return str1.append(str2); } else { if (str2[0] == sep) return str1.append(str2); - else - return str1.append(sepStr).append(str2); + return str1.append(sepStr).append(str2); } } @@ -1132,15 +1120,13 @@ std::string pathJoin(std::string str1, { if (str3[0] == sep) return str1.append(str3.substr(1)); - else - return str1.append(str3); + return str1.append(str3); } else { if (str3[0] == sep) return str1.append(str3); - else - return str1.append(sepStr).append(str3); + return str1.append(sepStr).append(str3); } } @@ -1154,30 +1140,26 @@ std::string urlJoin(std::string str1, { if (str2[0] == sep) return str2; - else - return sepStr.append(str2); + return sepStr.append(str2); } const size_t sz1 = str1.size(); if (str2.empty()) { if (str1[sz1 - 1] == sep) return str1; - else - return str1.append(sepStr); + return str1.append(sepStr); } if (str1[sz1 - 1] == sep) { if (str2[0] == sep) return str1.append(str2.substr(1)); - else - return str1.append(str2); + return str1.append(str2); } else { if (str2[0] == sep) return str1.append(str2); - else - return str1.append(sepStr).append(str2); + return str1.append(sepStr).append(str2); } } diff --git a/src/utils/timer.cpp b/src/utils/timer.cpp index cb224e8e5..21ef307ba 100644 --- a/src/utils/timer.cpp +++ b/src/utils/timer.cpp @@ -97,11 +97,8 @@ int get_elapsed_time(const int startTime) { return (time - startTime) * MILLISECONDS_IN_A_TICK; } - else - { - return (time + (MAX_TICK_VALUE - startTime)) - * MILLISECONDS_IN_A_TICK; - } + return (time + (MAX_TICK_VALUE - startTime)) + * MILLISECONDS_IN_A_TICK; } int get_elapsed_time1(const int startTime) @@ -109,8 +106,7 @@ int get_elapsed_time1(const int startTime) const int time = tick_time; if (startTime <= time) return time - startTime; - else - return time + (MAX_TICK_VALUE - startTime); + return time + (MAX_TICK_VALUE - startTime); } void startTimers() diff --git a/src/utils/translation/poparser.cpp b/src/utils/translation/poparser.cpp index 1050cc82e..399980a21 100644 --- a/src/utils/translation/poparser.cpp +++ b/src/utils/translation/poparser.cpp @@ -160,35 +160,33 @@ bool PoParser::readMsgId() mReadingId = false; return false; } - else + + // check line start from msgid " + if (strStartWith(mLine, msgId1)) { - // check line start from msgid " - if (strStartWith(mLine, msgId1)) - { - if (!mSkipId) - { // translation not fuzzed and can be processed - mReadingId = true; - const size_t msgId1Size = msgId1.size(); - // reading text from: msgid "text" - mMsgId.append(mLine.substr(msgId1Size, - mLine.size() - 1 - msgId1Size)); - } - else - { // skipped fuzzed translation. reset skip flag - mSkipId = false; - } - mLine.clear(); - return true; + if (!mSkipId) + { // translation not fuzzed and can be processed + mReadingId = true; + const size_t msgId1Size = msgId1.size(); + // reading text from: msgid "text" + mMsgId.append(mLine.substr(msgId1Size, + mLine.size() - 1 - msgId1Size)); } - else if (mLine == "#, fuzzy") - { // check for fuzzy translation - mSkipId = true; - mLine.clear(); - return true; + else + { // skipped fuzzed translation. reset skip flag + mSkipId = false; } - // stop reading if we don't read msgid before - return mMsgId.empty(); + mLine.clear(); + return true; + } + else if (mLine == "#, fuzzy") + { // check for fuzzy translation + mSkipId = true; + mLine.clear(); + return true; } + // stop reading if we don't read msgid before + return mMsgId.empty(); } bool PoParser::readMsgStr() |