Fix some style errors found from our own code.

This commit is contained in:
Reijo Tomperi 2010-01-23 23:44:08 +02:00
parent a0d8f44603
commit 24052c16b4
3 changed files with 13 additions and 13 deletions

View File

@ -1410,7 +1410,7 @@ public:
bool renameMacroVariables(std::string &result, const PreprocessorMacro &macro) bool renameMacroVariables(std::string &result, const PreprocessorMacro &macro)
{ {
// No variables // No variables
if (_params.size() == 0) if (_params.empty())
return false; return false;
// Already renamed // Already renamed
@ -1787,7 +1787,7 @@ std::string Preprocessor::expandMacros(const std::string &code, std::string file
// leaving a file, update position.. // leaving a file, update position..
else if (line == "#endfile") else if (line == "#endfile")
{ {
if (fileinfo.size()) if (!fileinfo.empty())
{ {
linenr = fileinfo.top().first; linenr = fileinfo.top().first;
filename = fileinfo.top().second; filename = fileinfo.top().second;

View File

@ -805,7 +805,7 @@ void Tokenizer::simplifyTypedef()
} }
} }
bool Tokenizer::tokenize(std::istream &code, const char FileName[], const std::string configuration) bool Tokenizer::tokenize(std::istream &code, const char FileName[], const std::string &configuration)
{ {
_configuration = configuration; _configuration = configuration;
@ -1950,7 +1950,7 @@ bool Tokenizer::createLinks()
} }
else if (token->str() == "}") else if (token->str() == "}")
{ {
if (links.size() == 0) if (links.empty())
{ {
// Error, { and } don't match. // Error, { and } don't match.
syntaxError(token, '{'); syntaxError(token, '{');
@ -1973,7 +1973,7 @@ bool Tokenizer::createLinks()
} }
else if (token->str() == ")") else if (token->str() == ")")
{ {
if (links2.size() == 0) if (links2.empty())
{ {
// Error, ( and ) don't match. // Error, ( and ) don't match.
syntaxError(token, '('); syntaxError(token, '(');
@ -1996,7 +1996,7 @@ bool Tokenizer::createLinks()
} }
else if (token->str() == "]") else if (token->str() == "]")
{ {
if (links3.size() == 0) if (links3.empty())
{ {
// Error, [ and ] don't match. // Error, [ and ] don't match.
syntaxError(token, '['); syntaxError(token, '[');
@ -2014,21 +2014,21 @@ bool Tokenizer::createLinks()
} }
} }
if (links.size() > 0) if (!links.empty())
{ {
// Error, { and } don't match. // Error, { and } don't match.
syntaxError(links.back(), '{'); syntaxError(links.back(), '{');
return false; return false;
} }
if (links2.size() > 0) if (!links2.empty())
{ {
// Error, ( and ) don't match. // Error, ( and ) don't match.
syntaxError(links2.back(), '('); syntaxError(links2.back(), '(');
return false; return false;
} }
if (links3.size() > 0) if (!links3.empty())
{ {
// Error, [ and ] don't match. // Error, [ and ] don't match.
syntaxError(links3.back(), '['); syntaxError(links3.back(), '[');
@ -4534,7 +4534,7 @@ void Tokenizer::simplifyGoto()
} }
else if (token->str() == ")") else if (token->str() == ")")
{ {
if (links.size() == 0) if (links.empty())
{ {
// This should never happen at this point // This should never happen at this point
syntaxError(token, ')'); syntaxError(token, ')');
@ -4550,7 +4550,7 @@ void Tokenizer::simplifyGoto()
} }
else if (token->str() == "}") else if (token->str() == "}")
{ {
if (links2.size() == 0) if (links2.empty())
{ {
// This should never happen at this point // This should never happen at this point
syntaxError(token, '}'); syntaxError(token, '}');
@ -4566,7 +4566,7 @@ void Tokenizer::simplifyGoto()
} }
else if (token->str() == "]") else if (token->str() == "]")
{ {
if (links3.size() == 0) if (links3.empty())
{ {
// This should never happen at this point // This should never happen at this point
syntaxError(token, ']'); syntaxError(token, ']');

View File

@ -67,7 +67,7 @@ public:
* @param configuration E.g. "A" for code where "#ifdef A" is true * @param configuration E.g. "A" for code where "#ifdef A" is true
* @return false if Source code contains syntax errors * @return false if Source code contains syntax errors
*/ */
bool tokenize(std::istream &code, const char FileName[], const std::string configuration = ""); bool tokenize(std::istream &code, const char FileName[], const std::string &configuration = "");
/** /**
* Create tokens from code. * Create tokens from code.