From c0ca375ef75a3ca0996809c89f763c8174fb4b65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 13 Sep 2009 09:03:48 +0200 Subject: [PATCH] Fixed #478 (Warnings in Visual Studio build with -W4) --- src/check.h | 3 +++ src/checkbufferoverrun.cpp | 4 ++-- src/checkmemoryleak.h | 3 +++ src/cppcheck.cpp | 2 +- src/preprocessor.cpp | 2 +- src/threadexecutor.h | 6 ++++++ src/tokenize.cpp | 2 +- src/tokenize.h | 6 ++++++ 8 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/check.h b/src/check.h index 3bfd13cb7..5e1038d13 100644 --- a/src/check.h +++ b/src/check.h @@ -127,6 +127,9 @@ private: return (name() < other->name()); } + /** disabled assignment operator */ + void operator=(const Check &); + }; /// @} diff --git a/src/checkbufferoverrun.cpp b/src/checkbufferoverrun.cpp index 31d4a4fe8..cfb044a18 100644 --- a/src/checkbufferoverrun.cpp +++ b/src/checkbufferoverrun.cpp @@ -276,7 +276,7 @@ void CheckBufferOverrun::checkScope(const Token *tok, const char *varname[], con pattern << varnames << " [ " << strindex << " ]"; int indentlevel2 = 0; - while ((tok2 = tok2->next())) + while ((tok2 = tok2->next()) != 0) { if (tok2->str() == ";" && indentlevel2 == 0) break; @@ -429,7 +429,7 @@ void CheckBufferOverrun::checkScope(const Token *tok, const char *varname[], con { if (tok2->str()[0] == '\"') { - len += Token::getStrLength(tok2); + len += (int)Token::getStrLength(tok2); } } if (len >= (int)size) diff --git a/src/checkmemoryleak.h b/src/checkmemoryleak.h index 418b57b41..1397b2967 100644 --- a/src/checkmemoryleak.h +++ b/src/checkmemoryleak.h @@ -56,6 +56,9 @@ private: /** Disable the default constructors */ CheckMemoryLeak(const CheckMemoryLeak &); + /** disable assignment operator */ + void operator=(const CheckMemoryLeak &); + /** * Report error. Similar with the function Check::reportError * @param location the token where the error occurs diff --git a/src/cppcheck.cpp b/src/cppcheck.cpp index 59a71d5e7..1e5246c07 100644 --- a/src/cppcheck.cpp +++ b/src/cppcheck.cpp @@ -430,7 +430,7 @@ unsigned int CppCheck::check() _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 diff --git a/src/preprocessor.cpp b/src/preprocessor.cpp index d8288d472..bc663b67b 100644 --- a/src/preprocessor.cpp +++ b/src/preprocessor.cpp @@ -1373,7 +1373,7 @@ public: if (_variadic && i == _params.size() - 1) { 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) str += ","; diff --git a/src/threadexecutor.h b/src/threadexecutor.h index 5673c9e11..46978fe62 100644 --- a/src/threadexecutor.h +++ b/src/threadexecutor.h @@ -70,6 +70,12 @@ public: } #endif +private: + /** disabled copy constructor */ + ThreadExecutor(const ThreadExecutor &); + + /** disabled assignment operator */ + void operator=(const ThreadExecutor &); }; #endif // THREADEXECUTOR_H diff --git a/src/tokenize.cpp b/src/tokenize.cpp index 6e957fb8e..18eac1b2a 100644 --- a/src/tokenize.cpp +++ b/src/tokenize.cpp @@ -839,7 +839,7 @@ void Tokenizer::updateClassList() // Locate class const Token *tok1 = tokens(); - while ((tok1 = Token::findmatch(tok1, pattern_class))) + while ((tok1 = Token::findmatch(tok1, pattern_class)) != 0) { const char *className; className = tok1->strAt(1); diff --git a/src/tokenize.h b/src/tokenize.h index 94eaf91d7..e50397502 100644 --- a/src/tokenize.h +++ b/src/tokenize.h @@ -304,6 +304,12 @@ private: */ void updateClassList(); + /** Disable assignments.. */ + Tokenizer(const Tokenizer &); + + /** Disable assignment operator */ + void operator=(const Tokenizer &); + Token *_tokens, *_tokensBack; std::map _typeSize; std::vector _files;