Fix some complainted choices made in my older commits.
Note: probably you should do 'make clean' before using 'make' to rebuild it again. Maybe it's me but 'make' reports various errors when linking.
This commit is contained in:
parent
603a37b08a
commit
9dd3360cd6
|
@ -107,7 +107,7 @@ bool CppCheckExecutor::parseFromArgs(CppCheck *cppcheck, int argc, const char* c
|
|||
bool warned = false;
|
||||
std::vector<std::string> ignored = parser.GetIgnoredPaths();
|
||||
std::vector<std::string>::iterator iterIgnored = ignored.begin();
|
||||
for (unsigned int i = ignored.size() - 1; i != UINT_MAX; --i) {
|
||||
for (size_t i = 0 ; i < ignored.size();) {
|
||||
const std::string extension = Path::getFilenameExtension(ignored[i]);
|
||||
if (extension == ".h" || extension == ".hpp") {
|
||||
ignored.erase(iterIgnored + i);
|
||||
|
@ -116,12 +116,13 @@ bool CppCheckExecutor::parseFromArgs(CppCheck *cppcheck, int argc, const char* c
|
|||
std::cout << "cppcheck: Please use --suppress for ignoring results from the header files." << std::endl;
|
||||
warned = true; // Warn only once
|
||||
}
|
||||
}
|
||||
} else
|
||||
++i;
|
||||
}
|
||||
|
||||
PathMatch matcher(parser.GetIgnoredPaths());
|
||||
std::vector<std::string>::iterator iterBegin = filenames.begin();
|
||||
for (unsigned int i = filenames.size() - 1; i != UINT_MAX; i--) {
|
||||
for (size_t i = 0 ; i < filenames.size();) {
|
||||
#if defined(_WIN32)
|
||||
// For Windows we want case-insensitive path matching
|
||||
const bool caseSensitive = false;
|
||||
|
@ -130,6 +131,8 @@ bool CppCheckExecutor::parseFromArgs(CppCheck *cppcheck, int argc, const char* c
|
|||
#endif
|
||||
if (matcher.Match(filenames[i], caseSensitive))
|
||||
filenames.erase(iterBegin + i);
|
||||
else
|
||||
++i;
|
||||
}
|
||||
} else {
|
||||
std::cout << "cppcheck: error: could not find or open any of the paths given." << std::endl;
|
||||
|
@ -177,7 +180,7 @@ int CppCheckExecutor::check(int argc, const char* const argv[])
|
|||
}
|
||||
|
||||
long processedsize = 0;
|
||||
for (unsigned int c = 0; c < _filenames.size(); c++) {
|
||||
for (size_t c = 0; c < _filenames.size(); c++) {
|
||||
returnValue += cppCheck.check(_filenames[c]);
|
||||
if (_filesizes.find(_filenames[c]) != _filesizes.end()) {
|
||||
processedsize += _filesizes[_filenames[c]];
|
||||
|
@ -269,13 +272,13 @@ void CppCheckExecutor::reportProgress(const std::string &filename, const char st
|
|||
}
|
||||
}
|
||||
|
||||
void CppCheckExecutor::reportStatus(unsigned int fileindex, unsigned int filecount, long sizedone, long sizetotal)
|
||||
void CppCheckExecutor::reportStatus(size_t fileindex, size_t filecount, long sizedone, long sizetotal)
|
||||
{
|
||||
if (filecount > 1) {
|
||||
std::ostringstream oss;
|
||||
oss << fileindex << "/" << filecount
|
||||
<< " files checked " <<
|
||||
(sizetotal > 0 ? static_cast<long>(static_cast<double>(sizedone) / sizetotal*100) : 0)
|
||||
(sizetotal > 0 ? static_cast<long>(static_cast<long double>(sizedone) / sizetotal*100) : 0)
|
||||
<< "% done";
|
||||
std::cout << oss.str() << std::endl;
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ public:
|
|||
* @param sizedone The sum of sizes of the files checked.
|
||||
* @param sizetotal The total sizes of the files.
|
||||
*/
|
||||
static void reportStatus(unsigned int fileindex, unsigned int filecount, long sizedone, long sizetotal);
|
||||
static void reportStatus(size_t fileindex, size_t filecount, long sizedone, long sizetotal);
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<project version="1">
|
||||
<includedir>
|
||||
<dir name="../lib"/>
|
||||
<dir name="."/>
|
||||
<dir name="temp"/>
|
||||
</includedir>
|
||||
<paths>
|
||||
|
|
|
@ -1365,12 +1365,12 @@ static unsigned int countParameters(const Token *tok)
|
|||
++parlevel;
|
||||
|
||||
else if (tok->str() == ")") {
|
||||
if (!parlevel)
|
||||
if (parlevel <=1)
|
||||
break;
|
||||
--parlevel;
|
||||
}
|
||||
|
||||
else if (!parlevel && tok->str() == ",") {
|
||||
else if (parlevel==1 && tok->str() == ",") {
|
||||
++numpar;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -353,7 +353,7 @@ public:
|
|||
functionScope(NULL) {
|
||||
}
|
||||
|
||||
unsigned int argCount() const {
|
||||
size_t argCount() const {
|
||||
return argumentList.size();
|
||||
}
|
||||
unsigned int initializedArgCount() const;
|
||||
|
|
|
@ -2892,7 +2892,7 @@ void Tokenizer::simplifyTemplatesUseDefaultArgumentValues(const std::list<Token
|
|||
* @param patternAfter pattern that must match the tokens after the ">"
|
||||
* @return match => true
|
||||
*/
|
||||
static bool simplifyTemplatesInstantiateMatch(const Token *instance, const std::string &name, unsigned int numberOfArguments, const char patternAfter[])
|
||||
static bool simplifyTemplatesInstantiateMatch(const Token *instance, const std::string &name, size_t numberOfArguments, const char patternAfter[])
|
||||
{
|
||||
if (!Token::simpleMatch(instance, (name + " <").c_str()))
|
||||
return false;
|
||||
|
@ -4028,7 +4028,7 @@ void Tokenizer::simplifySizeof()
|
|||
|
||||
else if (Token::Match(tok, "sizeof ( * %var% )") || Token::Match(tok, "sizeof ( %var% [ %num% ] )")) {
|
||||
// Some default value..
|
||||
unsigned int sz = 0;
|
||||
size_t sz = 0;
|
||||
|
||||
unsigned int varid = tok->tokAt((tok->strAt(2) == "*") ? 3 : 2)->varId();
|
||||
if (varid != 0) {
|
||||
|
@ -4045,11 +4045,11 @@ void Tokenizer::simplifySizeof()
|
|||
sz = sizeOfType(tok->tokAt(2));
|
||||
if (sz == 0)
|
||||
continue;
|
||||
sz = sz * static_cast<unsigned int>(MathLib::toLongNumber(tok->strAt(4)));
|
||||
sz *= static_cast<unsigned long>(MathLib::toLongNumber(tok->strAt(4)));
|
||||
}
|
||||
|
||||
if (sz > 0) {
|
||||
tok->str(MathLib::toString<unsigned int>(sz));
|
||||
tok->str(MathLib::toString<size_t>(sz));
|
||||
Token::eraseTokens(tok, tok->next()->link()->next());
|
||||
}
|
||||
}
|
||||
|
@ -9693,7 +9693,7 @@ void Tokenizer::printUnknownTypes()
|
|||
if (var->typeStartToken() == var->typeEndToken())
|
||||
name = var->typeStartToken()->str();
|
||||
|
||||
// complcated type
|
||||
// complicated type
|
||||
else {
|
||||
const Token *tok = var->typeStartToken();
|
||||
int level = 0;
|
||||
|
|
Loading…
Reference in New Issue