Change every C version of 'size_t' to C++ 'std::size_t'.

This commit is contained in:
Edoardo Prezioso 2012-07-08 23:39:46 +02:00
parent 639f15645a
commit fae40c4782
27 changed files with 83 additions and 83 deletions

View File

@ -124,7 +124,7 @@ bool CppCheckExecutor::parseFromArgs(CppCheck *cppcheck, int argc, const char* c
const bool caseSensitive = true;
#endif
PathMatch matcher(parser.GetIgnoredPaths(), caseSensitive);
for (std::map<std::string, size_t>::iterator i = _files.begin(); i != _files.end();) {
for (std::map<std::string, std::size_t>::iterator i = _files.begin(); i != _files.end();) {
if (matcher.Match(i->first))
_files.erase(i++);
else
@ -167,14 +167,14 @@ int CppCheckExecutor::check(int argc, const char* const argv[])
if (settings._jobs == 1) {
// Single process
size_t totalfilesize = 0;
for (std::map<std::string, size_t>::const_iterator i = _files.begin(); i != _files.end(); ++i) {
std::size_t totalfilesize = 0;
for (std::map<std::string, std::size_t>::const_iterator i = _files.begin(); i != _files.end(); ++i) {
totalfilesize += i->second;
}
size_t processedsize = 0;
std::size_t processedsize = 0;
unsigned int c = 0;
for (std::map<std::string, size_t>::const_iterator i = _files.begin(); i != _files.end(); ++i) {
for (std::map<std::string, std::size_t>::const_iterator i = _files.begin(); i != _files.end(); ++i) {
returnValue += cppCheck.check(i->first);
processedsize += i->second;
if (!settings._errorsOnly)
@ -237,7 +237,7 @@ void CppCheckExecutor::reportOut(const std::string &outmsg)
std::cout << outmsg << std::endl;
}
void CppCheckExecutor::reportProgress(const std::string &filename, const char stage[], const size_t value)
void CppCheckExecutor::reportProgress(const std::string &filename, const char stage[], const std::size_t value)
{
(void)filename;
@ -270,7 +270,7 @@ void CppCheckExecutor::reportInfo(const ErrorLogger::ErrorMessage &msg)
reportErr(msg);
}
void CppCheckExecutor::reportStatus(size_t fileindex, size_t filecount, size_t sizedone, size_t sizetotal)
void CppCheckExecutor::reportStatus(std::size_t fileindex, std::size_t filecount, std::size_t sizedone, std::size_t sizetotal)
{
if (filecount > 1) {
std::ostringstream oss;

View File

@ -70,7 +70,7 @@ public:
/** xml output of errors */
virtual void reportErr(const ErrorLogger::ErrorMessage &msg);
void reportProgress(const std::string &filename, const char stage[], const size_t value);
void reportProgress(const std::string &filename, const char stage[], const std::size_t value);
/**
* Output information messages.
@ -85,7 +85,7 @@ public:
* @param sizedone The sum of sizes of the files checked.
* @param sizetotal The total sizes of the files.
*/
static void reportStatus(size_t fileindex, size_t filecount, size_t sizedone, size_t sizetotal);
static void reportStatus(std::size_t fileindex, std::size_t filecount, std::size_t sizedone, std::size_t sizetotal);
protected:
@ -121,7 +121,7 @@ private:
/**
* Filename associated with size of file
*/
std::map<std::string, size_t> _files;
std::map<std::string, std::size_t> _files;
/**
* Report progress time

View File

@ -118,7 +118,7 @@ static BOOL MyFileExists(const std::string& path)
#endif // defined(UNICODE)
void FileLister::recursiveAddFiles(std::map<std::string, size_t> &files, const std::string &path)
void FileLister::recursiveAddFiles(std::map<std::string, std::size_t> &files, const std::string &path)
{
// oss is the search string passed into FindFirst and FindNext.
// bdir is the base directory which is used to form pathnames.
@ -161,7 +161,7 @@ void FileLister::recursiveAddFiles(std::map<std::string, size_t> &files, const s
continue;
#if defined(UNICODE)
size_t length = wcslen(ffd.cFileName);
std::size_t length = wcslen(ffd.cFileName);
char * ansiFfd = new char[length + 1];
TransformUcs2ToAnsi(ffd.cFileName, ansiFfd, length + 1);
#else // defined(UNICODE)
@ -182,7 +182,7 @@ void FileLister::recursiveAddFiles(std::map<std::string, size_t> &files, const s
const std::string nativename = Path::fromNativeSeparators(fname.str());
// Limitation: file sizes are assumed to fit in a 'size_t'
#ifdef _WIN64
files[nativename] = (static_cast<size_t>(ffd.nFileSizeHigh) << 32) | ffd.nFileSizeLow;
files[nativename] = (static_cast<std::size_t>(ffd.nFileSizeHigh) << 32) | ffd.nFileSizeLow;
#else
files[nativename] = ffd.nFileSizeLow;
#endif
@ -246,7 +246,7 @@ std::string FileLister::getAbsolutePath(const std::string& path)
}
void FileLister::recursiveAddFiles2(std::set<std::string> &seen_paths,
std::map<std::string, size_t> &files,
std::map<std::string, std::size_t> &files,
const std::string &path)
{
std::ostringstream oss;
@ -279,7 +279,7 @@ void FileLister::recursiveAddFiles2(std::set<std::string> &seen_paths,
struct stat sb;
if (stat(absolute_path.c_str(), &sb) == 0) {
// Limitation: file sizes are assumed to fit in a 'size_t'
files[filename] = static_cast<size_t>(sb.st_size);
files[filename] = static_cast<std::size_t>(sb.st_size);
} else
files[filename] = 0;
}
@ -294,7 +294,7 @@ void FileLister::recursiveAddFiles2(std::set<std::string> &seen_paths,
}
void FileLister::recursiveAddFiles(std::map<std::string, size_t> &files, const std::string &path)
void FileLister::recursiveAddFiles(std::map<std::string, std::size_t> &files, const std::string &path)
{
std::set<std::string> seen_paths;
recursiveAddFiles2(seen_paths, files, path);

View File

@ -37,7 +37,7 @@ public:
* @param files output map that associates the size of each file with its name
* @param path root path
*/
static void recursiveAddFiles(std::map<std::string, size_t> &files, const std::string &path);
static void recursiveAddFiles(std::map<std::string, std::size_t> &files, const std::string &path);
/**
* @brief Is given path a directory?
@ -55,7 +55,7 @@ public:
static std::string getAbsolutePath(const std::string& path);
static void recursiveAddFiles2(std::set<std::string> &seen_paths,
std::map<std::string, size_t> &files,
std::map<std::string, std::size_t> &files,
const std::string &path);
#endif
};

View File

@ -74,6 +74,6 @@ bool PathMatch::Match(const std::string &path) const
std::string PathMatch::RemoveFilename(const std::string &path)
{
const size_t ind = path.find_last_of('/');
const std::size_t ind = path.find_last_of('/');
return path.substr(0, ind + 1);
}

View File

@ -34,7 +34,7 @@
#include <sstream>
#endif
ThreadExecutor::ThreadExecutor(const std::map<std::string, size_t> &files, Settings &settings, ErrorLogger &errorLogger)
ThreadExecutor::ThreadExecutor(const std::map<std::string, std::size_t> &files, Settings &settings, ErrorLogger &errorLogger)
: _files(files), _settings(settings), _errorLogger(errorLogger), _fileCount(0)
{
#ifdef THREADING_MODEL_FORK
@ -125,16 +125,16 @@ unsigned int ThreadExecutor::check()
_fileCount = 0;
unsigned int result = 0;
size_t totalfilesize = 0;
for (std::map<std::string, size_t>::const_iterator i = _files.begin(); i != _files.end(); ++i) {
std::size_t totalfilesize = 0;
for (std::map<std::string, std::size_t>::const_iterator i = _files.begin(); i != _files.end(); ++i) {
totalfilesize += i->second;
}
std::list<int> rpipes;
std::map<pid_t, std::string> childFile;
std::map<int, std::string> pipeFile;
size_t processedsize = 0;
std::map<std::string, size_t>::const_iterator i = _files.begin();
std::size_t processedsize = 0;
std::map<std::string, std::size_t>::const_iterator i = _files.begin();
for (;;) {
// Start a new child
if (i != _files.end() && rpipes.size() < _settings._jobs) {
@ -207,7 +207,7 @@ unsigned int ThreadExecutor::check()
if (p != pipeFile.end()) {
std::string name = p->second;
pipeFile.erase(p);
std::map<std::string, size_t>::const_iterator fs = _files.find(name);
std::map<std::string, std::size_t>::const_iterator fs = _files.find(name);
if (fs != _files.end()) {
size = fs->second;
}

View File

@ -39,7 +39,7 @@ class Settings;
*/
class ThreadExecutor : public ErrorLogger {
public:
ThreadExecutor(const std::map<std::string, size_t> &files, Settings &settings, ErrorLogger &_errorLogger);
ThreadExecutor(const std::map<std::string, std::size_t> &files, Settings &settings, ErrorLogger &_errorLogger);
virtual ~ThreadExecutor();
unsigned int check();
virtual void reportOut(const std::string &outmsg);
@ -56,7 +56,7 @@ public:
void addFileContent(const std::string &path, const std::string &content);
private:
const std::map<std::string, size_t> &_files;
const std::map<std::string, std::size_t> &_files;
Settings &_settings;
ErrorLogger &_errorLogger;
unsigned int _fileCount;

View File

@ -972,12 +972,12 @@ void CheckBufferOverrun::checkScope(const Token *tok, const std::vector<std::str
// Detect few strcat() calls
const std::string strcatPattern = varid > 0 ? std::string("strcat ( %varid% , %str% ) ;") : ("strcat ( " + varnames + " , %str% ) ;");
if (Token::Match(tok, strcatPattern.c_str(), varid)) {
size_t charactersAppend = 0;
std::size_t charactersAppend = 0;
const Token *tok2 = tok;
while (tok2 && Token::Match(tok2, strcatPattern.c_str(), varid)) {
charactersAppend += Token::getStrLength(tok2->tokAt(4 + varc));
if (charactersAppend >= static_cast<size_t>(total_size)) {
if (charactersAppend >= static_cast<std::size_t>(total_size)) {
bufferOverrunError(tok2);
break;
}
@ -1882,7 +1882,7 @@ CheckBufferOverrun::ArrayInfo::ArrayInfo(const CheckBufferOverrun::ArrayInfo &ai
CheckBufferOverrun::ArrayInfo::ArrayInfo(const Variable *var, const Tokenizer *tokenizer)
: _varname(var->name()), _varid(var->varId())
{
for (size_t i = 0; i < var->dimensions().size(); i++)
for (std::size_t i = 0; i < var->dimensions().size(); i++)
_num.push_back(var->dimension(i));
if (var->typeEndToken()->str() == "*")
_element_size = tokenizer->sizeOfType(var->typeEndToken());

View File

@ -197,13 +197,13 @@ void CheckClass::initVar(const std::string &varname, const Scope *scope, std::ve
void CheckClass::assignAllVar(std::vector<Usage> &usage) const
{
for (size_t i = 0; i < usage.size(); ++i)
for (std::size_t i = 0; i < usage.size(); ++i)
usage[i].assign = true;
}
void CheckClass::clearAllVar(std::vector<Usage> &usage) const
{
for (size_t i = 0; i < usage.size(); ++i) {
for (std::size_t i = 0; i < usage.size(); ++i) {
usage[i].assign = false;
usage[i].init = false;
}
@ -212,7 +212,7 @@ void CheckClass::clearAllVar(std::vector<Usage> &usage) const
bool CheckClass::isBaseClassFunc(const Token *tok, const Scope *scope)
{
// Iterate through each base class...
for (size_t i = 0; i < scope->derivedFrom.size(); ++i) {
for (std::size_t i = 0; i < scope->derivedFrom.size(); ++i) {
const Scope *derivedFrom = scope->derivedFrom[i].scope;
// Check if base class exists in database
@ -716,7 +716,7 @@ void CheckClass::noMemset()
void CheckClass::checkMemsetType(const Scope *start, const Token *tok, const Scope *type)
{
// recursively check all parent classes
for (size_t i = 0; i < type->derivedFrom.size(); i++) {
for (std::size_t i = 0; i < type->derivedFrom.size(); i++) {
if (type->derivedFrom[i].scope)
checkMemsetType(start, tok, type->derivedFrom[i].scope);
}

View File

@ -99,8 +99,8 @@ void CheckIO::checkFileUsage()
std::map<unsigned int, Filepointer> filepointers;
const SymbolDatabase* symbolDatabase = _tokenizer->getSymbolDatabase();
size_t varListSize = symbolDatabase->getVariableListSize();
for (size_t i = 1; i < varListSize; ++i) {
std::size_t varListSize = symbolDatabase->getVariableListSize();
for (std::size_t i = 1; i < varListSize; ++i) {
const Variable* var = symbolDatabase->getVariableFromVarId(i);
if (!var || !var->varId() || !Token::Match(var->typeStartToken(), "FILE *"))
continue;

View File

@ -75,7 +75,7 @@ unsigned int CppCheck::check(const std::string &path, const std::string &content
void CppCheck::replaceAll(std::string& code, const std::string &from, const std::string &to)
{
size_t pos = 0;
std::size_t pos = 0;
while ((pos = code.find(from, pos)) != std::string::npos) {
code.replace(pos, from.length(), to);
pos += to.length();
@ -96,7 +96,7 @@ bool CppCheck::findError(std::string code, const char FileName[])
for (;;) {
// Try to remove included files from the source
size_t found=previousCode.rfind("\n#endfile");
std::size_t found = previousCode.rfind("\n#endfile");
if (found == std::string::npos) {
// No modifications can be done to the code
} else {
@ -506,7 +506,7 @@ void CppCheck::reportOut(const std::string &outmsg)
_errorLogger.reportOut(outmsg);
}
void CppCheck::reportProgress(const std::string &filename, const char stage[], const size_t value)
void CppCheck::reportProgress(const std::string &filename, const char stage[], const std::size_t value)
{
_errorLogger.reportProgress(filename, stage, value);
}
@ -516,7 +516,7 @@ void CppCheck::reportInfo(const ErrorLogger::ErrorMessage &msg)
_errorLogger.reportInfo(msg);
}
void CppCheck::reportStatus(unsigned int /*fileindex*/, unsigned int /*filecount*/, size_t /*sizedone*/, size_t /*sizetotal*/)
void CppCheck::reportStatus(unsigned int /*fileindex*/, unsigned int /*filecount*/, std::size_t /*sizedone*/, std::size_t /*sizetotal*/)
{
}

View File

@ -104,7 +104,7 @@ public:
*/
static const char * extraVersion();
virtual void reportStatus(unsigned int fileindex, unsigned int filecount, size_t sizedone, size_t sizetotal);
virtual void reportStatus(unsigned int fileindex, unsigned int filecount, std::size_t sizedone, std::size_t sizetotal);
/**
* @brief Terminate checking. The checking will be terminated as soon as possible.
@ -173,7 +173,7 @@ private:
std::string _fileContent;
std::set<std::string> _dependencies;
void reportProgress(const std::string &filename, const char stage[], const size_t value);
void reportProgress(const std::string &filename, const char stage[], const std::size_t value);
/**
* Output information messages.

View File

@ -276,7 +276,7 @@ public:
* @param stage for example preprocess / tokenize / simplify / check
* @param value progress value (0-100)
*/
virtual void reportProgress(const std::string &filename, const char stage[], const size_t value) {
virtual void reportProgress(const std::string &filename, const char stage[], const std::size_t value) {
(void)filename;
(void)stage;
(void)value;

View File

@ -392,7 +392,7 @@ std::string Preprocessor::removeComments(const std::string &str, const std::stri
// Remove comments..
if (str.compare(i, 2, "//", 0, 2) == 0) {
size_t commentStart = i + 2;
std::size_t commentStart = i + 2;
i = str.find('\n', i);
if (i == std::string::npos)
break;
@ -417,7 +417,7 @@ std::string Preprocessor::removeComments(const std::string &str, const std::stri
previous = '\n';
++lineno;
} else if (str.compare(i, 2, "/*", 0, 2) == 0) {
size_t commentStart = i + 2;
std::size_t commentStart = i + 2;
unsigned char chPrev = 0;
++i;
while (i < str.length() && (chPrev != '*' || ch != '/')) {
@ -454,7 +454,7 @@ std::string Preprocessor::removeComments(const std::string &str, const std::stri
if (!suppressionIDs.empty()) {
if (_settings != NULL) {
// Add the suppressions.
for (size_t j(0); j < suppressionIDs.size(); ++j) {
for (std::size_t j = 0; j < suppressionIDs.size(); ++j) {
const std::string errmsg(_settings->nomsg.addSuppression(suppressionIDs[j], filename, lineno));
if (!errmsg.empty()) {
writeError(filename, lineno, _errorLogger, "cppcheckError", errmsg);
@ -482,7 +482,7 @@ std::string Preprocessor::removeComments(const std::string &str, const std::stri
if (!suppressionIDs.empty()) {
if (_settings != NULL) {
// Add the suppressions.
for (size_t j(0); j < suppressionIDs.size(); ++j) {
for (std::size_t j = 0; j < suppressionIDs.size(); ++j) {
const std::string errmsg(_settings->nomsg.addSuppression(suppressionIDs[j], filename, lineno));
if (!errmsg.empty()) {
writeError(filename, lineno, _errorLogger, "cppcheckError", errmsg);
@ -1160,7 +1160,7 @@ std::list<std::string> Preprocessor::getcfgs(const std::string &filedata, const
}
// Remove defined constants from ifdef configurations..
size_t count = 0;
std::size_t count = 0;
for (std::list<std::string>::iterator it = ret.begin(); it != ret.end(); ++it) {
if (_errorLogger)
_errorLogger->reportProgress(filename, "Preprocessing (get configurations 2)", (100 * count++) / ret.size());
@ -2655,7 +2655,7 @@ std::string Preprocessor::expandMacros(const std::string &code, std::string file
// * when pos goes beyond a limit the limit needs to be
// deleted because it is unsafe to insert/delete text
// after the limit otherwise
std::map<const PreprocessorMacro *, size_t> limits;
std::map<const PreprocessorMacro *, std::size_t> limits;
// pos is the current position in line
std::string::size_type pos = 0;
@ -2717,7 +2717,7 @@ std::string Preprocessor::expandMacros(const std::string &code, std::string file
// check that pos is within allowed limits for this
// macro
{
const std::map<const PreprocessorMacro *, size_t>::const_iterator it2 = limits.find(macro);
const std::map<const PreprocessorMacro *, std::size_t>::const_iterator it2 = limits.find(macro);
if (it2 != limits.end() && pos <= line.length() - it2->second)
break;
}
@ -2777,7 +2777,7 @@ std::string Preprocessor::expandMacros(const std::string &code, std::string file
++pos2;
// Remove old limits
for (std::map<const PreprocessorMacro *, size_t>::iterator iter = limits.begin();
for (std::map<const PreprocessorMacro *, std::size_t>::iterator iter = limits.begin();
iter != limits.end();) {
if ((line.length() - pos1) < iter->second) {
// We have gone past this limit, so just delete it

View File

@ -146,7 +146,7 @@ bool Settings::platform(PlatformType type)
sizeof_float = sizeof(float);
sizeof_double = sizeof(double);
sizeof_long_double = sizeof(long double);
sizeof_size_t = sizeof(size_t);
sizeof_size_t = sizeof(std::size_t);
sizeof_pointer = sizeof(void *);
return true;
case Win32W:

View File

@ -743,11 +743,11 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti
}
/* set all unknown array dimensions that are set by a variable to the maximum size of that variable type */
for (size_t i = 1; i <= _tokenizer->varIdCount(); i++) {
for (std::size_t i = 1; i <= _tokenizer->varIdCount(); i++) {
// check each array variable
if (_variableList[i] && _variableList[i]->isArray()) {
// check each array dimension
for (size_t j = 0; j < _variableList[i]->dimensions().size(); j++) {
for (std::size_t j = 0; j < _variableList[i]->dimensions().size(); j++) {
// check for a single token dimension that is a variable
if (_variableList[i]->dimensions()[j].start &&
(_variableList[i]->dimensions()[j].start == _variableList[i]->dimensions()[j].end) &&
@ -1362,7 +1362,7 @@ void SymbolDatabase::printVariable(const Variable *var, const char *indent) cons
std::cout << "none" << std::endl;
std::cout << indent << "_dimensions:";
for (size_t i = 0; i < var->dimensions().size(); i++) {
for (std::size_t i = 0; i < var->dimensions().size(); i++) {
std::cout << " " << var->dimension(i);
}
std::cout << std::endl;
@ -1463,8 +1463,8 @@ void SymbolDatabase::printOut(const char *title) const
std::cout << " derivedFrom[" << scope->derivedFrom.size() << "] = (";
size_t count = scope->derivedFrom.size();
for (size_t i = 0; i < scope->derivedFrom.size(); ++i) {
std::size_t count = scope->derivedFrom.size();
for (std::size_t i = 0; i < scope->derivedFrom.size(); ++i) {
if (scope->derivedFrom[i].isVirtual)
std::cout << "Virtual ";
@ -1538,7 +1538,7 @@ void SymbolDatabase::printOut(const char *title) const
std::cout << std::endl;
}
for (size_t i = 0; i < _variableList.size(); i++) {
for (std::size_t i = 0; i < _variableList.size(); i++) {
std::cout << "_variableList[" << i << "] = " << _variableList[i] << std::endl;
}
}

View File

@ -573,11 +573,11 @@ public:
return bool(classAndStructTypes.find(type) != classAndStructTypes.end());
}
const Variable *getVariableFromVarId(size_t varId) const {
const Variable *getVariableFromVarId(std::size_t varId) const {
return _variableList[varId];
}
size_t getVariableListSize() const {
std::size_t getVariableListSize() const {
return _variableList.size();
}

View File

@ -531,7 +531,7 @@ void TemplateSimplifier::simplifyTemplatesUseDefaultArgumentValues(const std::li
}
}
bool TemplateSimplifier::simplifyTemplatesInstantiateMatch(const Token *instance, const std::string &name, size_t numberOfArguments, const char patternAfter[])
bool TemplateSimplifier::simplifyTemplatesInstantiateMatch(const Token *instance, const std::string &name, std::size_t numberOfArguments, const char patternAfter[])
{
if (!Token::simpleMatch(instance, (name + " <").c_str()))
return false;

View File

@ -103,7 +103,7 @@ public:
* @param patternAfter pattern that must match the tokens after the ">"
* @return match => true
*/
static bool simplifyTemplatesInstantiateMatch(const Token *instance, const std::string &name, size_t numberOfArguments, const char patternAfter[]);
static bool simplifyTemplatesInstantiateMatch(const Token *instance, const std::string &name, std::size_t numberOfArguments, const char patternAfter[]);
/**
* Match template declaration/instantiation

View File

@ -490,7 +490,7 @@ bool Token::simpleMatch(const Token *tok, const char pattern[])
next = pattern + strlen(pattern);
while (*current) {
size_t length = static_cast<size_t>(next - current);
std::size_t length = static_cast<std::size_t>(next - current);
if (!tok || length != tok->_str.length() || strncmp(current, tok->_str.c_str(), length))
return false;
@ -797,7 +797,7 @@ std::size_t Token::getStrLength(const Token *tok)
{
assert(tok != NULL);
size_t len = 0;
std::size_t len = 0;
const std::string strValue(tok->strValue());
const char *str = strValue.c_str();

View File

@ -3191,7 +3191,7 @@ void Tokenizer::simplifySizeof()
else if (Token::Match(tok, "sizeof ( * %var% )") || Token::Match(tok, "sizeof ( %var% [ %num% ] )")) {
// Some default value..
size_t sz = 0;
std::size_t sz = 0;
unsigned int varid = tok->tokAt((tok->strAt(2) == "*") ? 3 : 2)->varId();
if (varid != 0) {
@ -7771,8 +7771,8 @@ void Tokenizer::simplifyComma()
// find token where return ends and also count commas
if (inReturn) {
size_t commaCounter = 0;
size_t indentlevel = 0;
std::size_t commaCounter = 0;
std::size_t indentlevel = 0;
for (Token *tok2 = startFrom; tok2; tok2 = tok2->next()) {
if (tok2->str() == ";") {
@ -9059,7 +9059,7 @@ void Tokenizer::printUnknownTypes()
ss << unknowns.size() << " unknown types:" << std::endl;
std::set<std::string>::const_iterator it;
size_t count = 1;
std::size_t count = 1;
for (it = unknowns.begin(); it != unknowns.end(); ++it, ++count)
ss << count << ": " << *it << std::endl;

View File

@ -74,11 +74,11 @@ private:
void recursiveAddFiles() {
// Recursively add add files..
std::map<std::string, size_t> files;
std::map<std::string, std::size_t> files;
FileLister::recursiveAddFiles(files, ".");
// In case there are leading "./"..
for (std::map<std::string, size_t>::iterator i = files.begin(); i != files.end();) {
for (std::map<std::string, std::size_t>::iterator i = files.begin(); i != files.end();) {
if (i->first.compare(0,2,"./") == 0) {
files[i->first.substr(2)] = i->second;
files.erase(i++);

View File

@ -24,7 +24,7 @@ int main(int argc, const char *argv[])
{
options args(argc, argv);
size_t ret = TestFixture::runTests(args);
std::size_t ret = TestFixture::runTests(args);
return (ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}

View File

@ -58,9 +58,9 @@ public:
std::ostringstream TestFixture::errmsg;
unsigned int TestFixture::countTests;
size_t TestFixture::fails_counter = 0;
size_t TestFixture::todos_counter = 0;
size_t TestFixture::succeeded_todos_counter = 0;
std::size_t TestFixture::fails_counter = 0;
std::size_t TestFixture::todos_counter = 0;
std::size_t TestFixture::succeeded_todos_counter = 0;
TestFixture::TestFixture(const std::string &_name)
:classname(_name)
@ -229,7 +229,7 @@ void TestFixture::processOptions(const options& args)
gcc_style_errors = args.gcc_style_errors();
}
size_t TestFixture::runTests(const options& args)
std::size_t TestFixture::runTests(const options& args)
{
std::string classname(args.which_test());
std::string testname("");

View File

@ -30,9 +30,9 @@ class TestFixture : public ErrorLogger {
private:
static std::ostringstream errmsg;
static unsigned int countTests;
static size_t fails_counter;
static size_t todos_counter;
static size_t succeeded_todos_counter;
static std::size_t fails_counter;
static std::size_t todos_counter;
static std::size_t succeeded_todos_counter;
protected:
std::string classname;
@ -65,7 +65,7 @@ public:
virtual ~TestFixture() { }
static void printTests();
static size_t runTests(const options& args);
static std::size_t runTests(const options& args);
};
#define TEST_CASE( NAME ) if ( runTest(#NAME) ) { if (quiet_tests) { REDIRECT; NAME(); } else { NAME ();} }

View File

@ -132,7 +132,7 @@ private:
errout.str("");
output.str("");
std::map<std::string, size_t> files;
std::map<std::string, std::size_t> files;
files["test.cpp"] = 1;
Settings settings;
@ -143,7 +143,7 @@ private:
ASSERT_EQUALS("", r);
}
ThreadExecutor executor(files, settings, *this);
for (std::map<std::string, size_t>::const_iterator i = files.begin(); i != files.end(); ++i)
for (std::map<std::string, std::size_t>::const_iterator i = files.begin(); i != files.end(); ++i)
executor.addFileContent(i->first, code);
executor.check();

View File

@ -51,7 +51,7 @@ private:
return;
}
std::map<std::string, size_t> filemap;
std::map<std::string, std::size_t> filemap;
for (int i = 1; i <= files; ++i) {
std::ostringstream oss;
oss << "file_" << i << ".cpp";
@ -61,7 +61,7 @@ private:
Settings settings;
settings._jobs = jobs;
ThreadExecutor executor(filemap, settings, *this);
for (std::map<std::string, size_t>::const_iterator i = filemap.begin(); i != filemap.end(); ++i)
for (std::map<std::string, std::size_t>::const_iterator i = filemap.begin(); i != filemap.end(); ++i)
executor.addFileContent(i->first, data);
ASSERT_EQUALS(result, executor.check());