Fixed #478 (Warnings in Visual Studio build with -W4)

This commit is contained in:
Daniel Marjamäki 2009-09-13 09:03:48 +02:00
parent 1d974f7c05
commit c0ca375ef7
8 changed files with 23 additions and 5 deletions

View File

@ -127,6 +127,9 @@ private:
return (name() < other->name()); return (name() < other->name());
} }
/** disabled assignment operator */
void operator=(const Check &);
}; };
/// @} /// @}

View File

@ -276,7 +276,7 @@ void CheckBufferOverrun::checkScope(const Token *tok, const char *varname[], con
pattern << varnames << " [ " << strindex << " ]"; pattern << varnames << " [ " << strindex << " ]";
int indentlevel2 = 0; int indentlevel2 = 0;
while ((tok2 = tok2->next())) while ((tok2 = tok2->next()) != 0)
{ {
if (tok2->str() == ";" && indentlevel2 == 0) if (tok2->str() == ";" && indentlevel2 == 0)
break; break;
@ -429,7 +429,7 @@ void CheckBufferOverrun::checkScope(const Token *tok, const char *varname[], con
{ {
if (tok2->str()[0] == '\"') if (tok2->str()[0] == '\"')
{ {
len += Token::getStrLength(tok2); len += (int)Token::getStrLength(tok2);
} }
} }
if (len >= (int)size) if (len >= (int)size)

View File

@ -56,6 +56,9 @@ private:
/** Disable the default constructors */ /** Disable the default constructors */
CheckMemoryLeak(const CheckMemoryLeak &); CheckMemoryLeak(const CheckMemoryLeak &);
/** disable assignment operator */
void operator=(const CheckMemoryLeak &);
/** /**
* Report error. Similar with the function Check::reportError * Report error. Similar with the function Check::reportError
* @param location the token where the error occurs * @param location the token where the error occurs

View File

@ -430,7 +430,7 @@ unsigned int CppCheck::check()
_errorLogger->reportOut("Bailing out from checking " + fname + ": " + e.what()); _errorLogger->reportOut("Bailing out from checking " + fname + ": " + e.what());
} }
_errorLogger->reportStatus(c + 1, _filenames.size()); _errorLogger->reportStatus(c + 1, (unsigned int)_filenames.size());
} }
// This generates false positives - especially for libraries // This generates false positives - especially for libraries

View File

@ -1373,7 +1373,7 @@ public:
if (_variadic && i == _params.size() - 1) if (_variadic && i == _params.size() - 1)
{ {
str = ""; str = "";
for (unsigned int j = _params.size() - 1; j < params2.size(); ++j) for (unsigned int j = (unsigned int)_params.size() - 1; j < params2.size(); ++j)
{ {
if (optcomma || j > _params.size() - 1) if (optcomma || j > _params.size() - 1)
str += ","; str += ",";

View File

@ -70,6 +70,12 @@ public:
} }
#endif #endif
private:
/** disabled copy constructor */
ThreadExecutor(const ThreadExecutor &);
/** disabled assignment operator */
void operator=(const ThreadExecutor &);
}; };
#endif // THREADEXECUTOR_H #endif // THREADEXECUTOR_H

View File

@ -839,7 +839,7 @@ void Tokenizer::updateClassList()
// Locate class // Locate class
const Token *tok1 = tokens(); const Token *tok1 = tokens();
while ((tok1 = Token::findmatch(tok1, pattern_class))) while ((tok1 = Token::findmatch(tok1, pattern_class)) != 0)
{ {
const char *className; const char *className;
className = tok1->strAt(1); className = tok1->strAt(1);

View File

@ -304,6 +304,12 @@ private:
*/ */
void updateClassList(); void updateClassList();
/** Disable assignments.. */
Tokenizer(const Tokenizer &);
/** Disable assignment operator */
void operator=(const Tokenizer &);
Token *_tokens, *_tokensBack; Token *_tokens, *_tokensBack;
std::map<std::string, unsigned int> _typeSize; std::map<std::string, unsigned int> _typeSize;
std::vector<std::string> _files; std::vector<std::string> _files;