Fix compiler warning (and minor cleanup).

This commit is contained in:
Alexander Mai 2014-07-05 12:10:23 +02:00
parent 4ee9b3781f
commit 88890a851c
1 changed files with 5 additions and 11 deletions

View File

@ -129,7 +129,7 @@ bool Token::isUpperCaseName() const
{ {
if (!isName()) if (!isName())
return false; return false;
for (unsigned int i = 0; i < _str.length(); ++i) { for (size_t i = 0; i < _str.length(); ++i) {
if (std::islower(_str[i])) if (std::islower(_str[i]))
return false; return false;
} }
@ -326,7 +326,6 @@ static int multiComparePercent(const Token *tok, const char*& haystack, bool emp
haystack += 4; haystack += 4;
return 1; return 1;
} }
break;
case 'n': case 'n':
// Number (%num%) // Number (%num%)
{ {
@ -476,10 +475,8 @@ bool Token::simpleMatch(const Token *tok, const char pattern[])
{ {
if (!tok) if (!tok)
return false; // shortcut return false; // shortcut
const char *current, *next; const char *current = pattern;
const char *next = std::strchr(pattern, ' ');
current = pattern;
next = std::strchr(pattern, ' ');
if (!next) if (!next)
next = pattern + std::strlen(pattern); next = pattern + std::strlen(pattern);
@ -792,12 +789,10 @@ const Token *Token::findmatch(const Token *tok, const char pattern[], const Toke
void Token::insertToken(const std::string &tokenStr, bool prepend) void Token::insertToken(const std::string &tokenStr, bool prepend)
{ {
Token *newToken;
//TODO: Find a solution for the first token on the list //TODO: Find a solution for the first token on the list
if (prepend && !this->previous()) if (prepend && !this->previous())
return; return;
Token *newToken;
if (_str.empty()) if (_str.empty())
newToken = this; newToken = this;
else else
@ -832,12 +827,11 @@ void Token::insertToken(const std::string &tokenStr, bool prepend)
void Token::insertToken(const std::string &tokenStr, const std::string &originalNameStr, bool prepend) void Token::insertToken(const std::string &tokenStr, const std::string &originalNameStr, bool prepend)
{ {
Token *newToken;
//TODO: Find a solution for the first token on the list //TODO: Find a solution for the first token on the list
if (prepend && !this->previous()) if (prepend && !this->previous())
return; return;
Token *newToken;
if (_str.empty()) if (_str.empty())
newToken = this; newToken = this;
else else