From 57b57428c261875d668f079ee42a312df5b07db8 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sun, 27 Nov 2016 11:40:42 +0100 Subject: [PATCH] Fix some typos in comments (found by codespell) Signed-off-by: Stefan Weil --- addons/cppcheckdata.doxyfile | 2 +- addons/y2038/README | 2 +- cli/cppcheckexecutor.h | 2 +- gui/test/data/benchmark/simple.cpp | 2 +- lib/checkassert.cpp | 2 +- lib/checkbufferoverrun.cpp | 2 +- lib/tokenize.cpp | 4 ++-- lib/tokenize.h | 2 +- lib/tokenlist.cpp | 2 +- lib/valueflow.cpp | 2 +- test/test64bit.cpp | 2 +- test/testcondition.cpp | 4 ++-- test/testgarbage.cpp | 2 +- test/testincompletestatement.cpp | 2 +- test/testnullpointer.cpp | 2 +- test/testother.cpp | 2 +- test/testsimplifytemplate.cpp | 2 +- test/testsimplifytokens.cpp | 2 +- test/testtokenize.cpp | 2 +- test/testtype.cpp | 2 +- test/testvalueflow.cpp | 12 ++++++------ 21 files changed, 28 insertions(+), 28 deletions(-) diff --git a/addons/cppcheckdata.doxyfile b/addons/cppcheckdata.doxyfile index aea0523b3..9fd8eada7 100644 --- a/addons/cppcheckdata.doxyfile +++ b/addons/cppcheckdata.doxyfile @@ -1658,7 +1658,7 @@ UML_LOOK = NO # the class node. If there are many fields or methods and many nodes the # graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS # threshold limits the number of items for each type to make the size more -# managable. Set this to 0 for no limit. Note that the threshold may be +# manageable. Set this to 0 for no limit. Note that the threshold may be # exceeded by 50% before the limit is enforced. UML_LIMIT_NUM_FIELDS = 10 diff --git a/addons/y2038/README b/addons/y2038/README index 3c3e5141b..bbcb03ef4 100644 --- a/addons/y2038/README +++ b/addons/y2038/README @@ -58,7 +58,7 @@ _TIME_BITS is defined equal to 64 by user code when it wants 64-bit time support from the GNU glibc. Code which does not define _TIME_BITS equal to 64 (or defines it to something else than 64) runs a risk of not being Y2038-proof. -__USE_TIME_BITS64 is defined by the GNU glibc when it actualy provides 64-bit +__USE_TIME_BITS64 is defined by the GNU glibc when it actually provides 64-bit time support. When this is defined, then all glibc symbols, barring bugs, are Y2038-proof (but your code might have its own Y2038 bugs, if it handles signed 32-bit Unix epoch values). diff --git a/cli/cppcheckexecutor.h b/cli/cppcheckexecutor.h index eab5e9b95..f23251a79 100644 --- a/cli/cppcheckexecutor.h +++ b/cli/cppcheckexecutor.h @@ -100,7 +100,7 @@ public: /** * Tries to load a library and prints warning/error messages - * @return false, if an error occured (except unknown XML elements) + * @return false, if an error occurred (except unknown XML elements) */ static bool tryLoadLibrary(Library& destination, const char* basepath, const char* filename); diff --git a/gui/test/data/benchmark/simple.cpp b/gui/test/data/benchmark/simple.cpp index 995c215a0..b0370de7f 100644 --- a/gui/test/data/benchmark/simple.cpp +++ b/gui/test/data/benchmark/simple.cpp @@ -796,7 +796,7 @@ void CheckOther::invalidScanf() bool format = false; - // scan the string backwards, so we dont need to keep states + // scan the string backwards, so we don't need to keep states const std::string &formatstr(formatToken->str()); for (unsigned int i = 1; i < formatstr.length(); i++) { if (formatstr[i] == '%') diff --git a/lib/checkassert.cpp b/lib/checkassert.cpp index 2175ff1e6..26c588c1d 100644 --- a/lib/checkassert.cpp +++ b/lib/checkassert.cpp @@ -114,7 +114,7 @@ void CheckAssert::checkVariableAssignment(const Token* assignTok, const Scope *a if (!prevVar) return; - // Variable declared in inner scope in assert => dont warn + // Variable declared in inner scope in assert => don't warn if (assertionScope != prevVar->scope()) { const Scope *s = prevVar->scope(); while (s && s != assertionScope) diff --git a/lib/checkbufferoverrun.cpp b/lib/checkbufferoverrun.cpp index 79fd99fdb..a17b4be47 100644 --- a/lib/checkbufferoverrun.cpp +++ b/lib/checkbufferoverrun.cpp @@ -193,7 +193,7 @@ void CheckBufferOverrun::outOfBoundsError(const Token *tok, const std::string &w void CheckBufferOverrun::pointerOutOfBoundsError(const Token *tok, const Token *index, const MathLib::bigint indexvalue) { - // The severity is portability instead of error since this ub doesnt + // The severity is portability instead of error since this ub doesn't // cause bad behaviour on most implementations. people create out // of bounds pointers by intention. const std::string expr(tok ? tok->expressionString() : std::string("")); diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 6cf9ea39c..d4ae4028e 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -2678,7 +2678,7 @@ void Tokenizer::setVarIdPass1() const Token *tok3 = tok2->next(); if (!tok3->isStandardType() && tok3->str() != "void" && !Token::Match(tok3, "struct|union|class %type%") && tok3->str() != "." && !Token::Match(tok2->link()->previous(), "[&*]")) { if (!scopeStack.top().isExecutable) { - // Detecting initializations with () in non-executable scope is hard and often impossible to be done safely. Thus, only treat code as a variable that definitly is one. + // Detecting initializations with () in non-executable scope is hard and often impossible to be done safely. Thus, only treat code as a variable that definitely is one. decl = false; bool rhs = false; for (; tok3; tok3 = tok3->nextArgumentBeforeCreateLinks2()) { @@ -7299,7 +7299,7 @@ bool Tokenizer::IsScopeNoReturn(const Token *endScopeToken, bool *unknown) const } } - // don't warn for nonglobal functions (class methods, functions hidden in namespaces) since they cant be configured yet + // don't warn for nonglobal functions (class methods, functions hidden in namespaces) since they can't be configured yet // FIXME: when methods and namespaces can be configured properly, remove the "globalFunction" check if (globalFunction) { reportError(endScopeToken->previous(), diff --git a/lib/tokenize.h b/lib/tokenize.h index bc0e67e07..b6ef154e1 100644 --- a/lib/tokenize.h +++ b/lib/tokenize.h @@ -750,7 +750,7 @@ public: * Token list: stores all tokens. */ TokenList list; - // Implement tokens() as a wrapper for convinience when using the TokenList + // Implement tokens() as a wrapper for convenience when using the TokenList const Token* tokens() const { return list.front(); } diff --git a/lib/tokenlist.cpp b/lib/tokenlist.cpp index 615eaaa9e..374b24c3f 100644 --- a/lib/tokenlist.cpp +++ b/lib/tokenlist.cpp @@ -678,7 +678,7 @@ static void compilePrecedence2(Token *&tok, AST_state& state) // - Nest the round bracket under the square bracket. // - Nest what follows the lambda (if anything) with the lambda opening [ // - Compile the content of the lambda function as separate tree (this is done later) - // this must be consistant with isLambdaCaptureList + // this must be consistent with isLambdaCaptureList Token* squareBracket = tok; Token* roundBracket = squareBracket->link()->next(); Token* curlyBracket = roundBracket->link()->next(); diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index 9a15200d0..1942ea4aa 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -2098,7 +2098,7 @@ static void execute(const Token *expr, else if (expr->str() == "%") *result = result1 % result2; else if (expr->str() == "<<") { - if (result2 < 0 || result1 < 0) { // dont perform UB + if (result2 < 0 || result1 < 0) { // don't perform UB *error= true; } else { *result = result1 << result2; diff --git a/test/test64bit.cpp b/test/test64bit.cpp index cd0c9020e..79de4a51e 100644 --- a/test/test64bit.cpp +++ b/test/test64bit.cpp @@ -209,7 +209,7 @@ private: "}"); ASSERT_EQUALS("", errout.str()); - // #7247: dont check return statements in nested functions.. + // #7247: don't check return statements in nested functions.. check("int foo() {\n" " struct {\n" " const char * name() { return \"abc\"; }\n" diff --git a/test/testcondition.cpp b/test/testcondition.cpp index 51212f662..32292ab7f 100644 --- a/test/testcondition.cpp +++ b/test/testcondition.cpp @@ -1463,7 +1463,7 @@ private: "}"); ASSERT_EQUALS("", errout.str()); - // #6313 - false postive: opposite conditions in nested if blocks when condition changed + // #6313 - false positive: opposite conditions in nested if blocks when condition changed check("void Foo::Bar() {\n" " if(var){\n" " --var;\n" @@ -1829,7 +1829,7 @@ private: "}"); ASSERT_EQUALS("[test.cpp:2]: (warning) Invalid test for overflow 'x+100 dont warn + check("void f(signed int x) {\n" // unsigned overflow => don't warn " assert(x + 100U < x);\n" "}"); ASSERT_EQUALS("", errout.str()); diff --git a/test/testgarbage.cpp b/test/testgarbage.cpp index f02d5745b..7d78278cd 100644 --- a/test/testgarbage.cpp +++ b/test/testgarbage.cpp @@ -1151,7 +1151,7 @@ private: "}"); } - void garbageCode152() { // happened in travis, originaly from llvm clang code + void garbageCode152() { // happened in travis, originally from llvm clang code const char* code = "template \n" "static std::string foo(char *Bla) {\n" " while (Bla[1] && Bla[1] != ',') }\n"; diff --git a/test/testincompletestatement.cpp b/test/testincompletestatement.cpp index 375bf2b02..53a1bc69d 100644 --- a/test/testincompletestatement.cpp +++ b/test/testincompletestatement.cpp @@ -119,7 +119,7 @@ private: } void test6() { - // dont crash + // don't crash check("void f() {\n" " 1 == (two + three);\n" " 2 != (two + three);\n" diff --git a/test/testnullpointer.cpp b/test/testnullpointer.cpp index 262def468..8839b37db 100644 --- a/test/testnullpointer.cpp +++ b/test/testnullpointer.cpp @@ -2134,7 +2134,7 @@ private: "}", true); ASSERT_EQUALS("", errout.str()); - // #5811 false postive: (error) Null pointer dereference + // #5811 false positive: (error) Null pointer dereference check("using namespace std;\n" "std::string itoip(int ip) {\n" " stringstream out;\n" diff --git a/test/testother.cpp b/test/testother.cpp index c0551020c..166f4ccf6 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -6046,7 +6046,7 @@ private: } void testEvaluationOrderMacro() { - // macro, dont bailout (#7233) + // macro, don't bailout (#7233) check((std::string("void f(int x) {\n" " return x + ") + Preprocessor::macroChar + "x++;\n" "}").c_str(), "test.c"); diff --git a/test/testsimplifytemplate.cpp b/test/testsimplifytemplate.cpp index fbb8e5588..183f4cbef 100644 --- a/test/testsimplifytemplate.cpp +++ b/test/testsimplifytemplate.cpp @@ -444,7 +444,7 @@ private: // #3130 const char code2[] = "template struct vec {\n" " vec() {}\n" - " vec(const vec& v) {}\n" // <- never used dont instantiate + " vec(const vec& v) {}\n" // <- never used don't instantiate "};\n" "\n" "vec<4> v;"; diff --git a/test/testsimplifytokens.cpp b/test/testsimplifytokens.cpp index 8c84df6b4..7e3ea5ec6 100644 --- a/test/testsimplifytokens.cpp +++ b/test/testsimplifytokens.cpp @@ -385,7 +385,7 @@ private: ASSERT_EQUALS("if ( true )", tok("if ((unsigned char)1)")); // #4164 ASSERT_EQUALS("f ( 200 )", tok("f((unsigned char)200)")); - ASSERT_EQUALS("f ( ( char ) 1234 )", tok("f((char)1234)")); // dont simplify downcast + ASSERT_EQUALS("f ( ( char ) 1234 )", tok("f((char)1234)")); // don't simplify downcast } diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 3d555bdd0..a5a2b30c7 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -7965,7 +7965,7 @@ private: testAst("QT_WA({},{x=0;});" // don't hang "QT_WA({x=1;},{x=2;});")); ASSERT_EQUALS("xMACROtypeT=value1=,{({=", - testAst("x = { MACRO( { .type=T, .value=1 } ) }")); // dont hang: MACRO({..}) + testAst("x = { MACRO( { .type=T, .value=1 } ) }")); // don't hang: MACRO({..}) // function pointer diff --git a/test/testtype.cpp b/test/testtype.cpp index 8e2652467..1e6889314 100644 --- a/test/testtype.cpp +++ b/test/testtype.cpp @@ -158,7 +158,7 @@ private: "void f2() { f1(-4); }"); ASSERT_EQUALS("", errout.str()); - // Dont warn for + and - + // Don't warn for + and - check("void f1(int x) {" " a = x + 5U;\n" "}\n" diff --git a/test/testvalueflow.cpp b/test/testvalueflow.cpp index 4d82e39d2..f106acb5f 100644 --- a/test/testvalueflow.cpp +++ b/test/testvalueflow.cpp @@ -656,7 +656,7 @@ private: "}"; ASSERT_EQUALS(true, testValueOfX(code, 2U, 37)); - code = "void f(int x) {\n" // loop condition, x is assigned inside loop => dont use condition + code = "void f(int x) {\n" // loop condition, x is assigned inside loop => don't use condition " a = x;\n" // don't assume that x can be 37 " while (x != 37) { x++; }\n" "}"; @@ -682,7 +682,7 @@ private: "}"; ASSERT_EQUALS(true, testValueOfX(code, 2U, 76)); - code = "void f(int x) {\n" // conditions inside loop, x is assigned inside do-while => dont use condition + code = "void f(int x) {\n" // conditions inside loop, x is assigned inside do-while => don't use condition " a = x;\n" " do {\n" " if (x!=76) { x=do_something(); }\n" @@ -690,7 +690,7 @@ private: "}"; ASSERT_EQUALS(false, testValueOfX(code, 2U, 76)); - code = "void f(X x) {\n" // conditions inside loop, x is assigned inside do-while => dont use condition + code = "void f(X x) {\n" // conditions inside loop, x is assigned inside do-while => don't use condition " a = x;\n" " for (i=1;i<=count;i++) {\n" " BUGON(x==0)\n" @@ -1319,9 +1319,9 @@ private: " ;\n" // <- no break " }\n" " }\n" - " a = x;\n" // <- x cant be 0 + " a = x;\n" // <- x can't be 0 "}\n"; - ASSERT_EQUALS(false, testValueOfX(code, 9U, 0)); // x cant be 0 at line 9 + ASSERT_EQUALS(false, testValueOfX(code, 9U, 0)); // x can't be 0 at line 9 code = "void f(const int *buf) {\n" " int x = 0;\n" @@ -1777,7 +1777,7 @@ private: " for(int i = 0; i < 20; i++)\n" " n = (int)(i < 10 || abs(negWander) < abs(negTravel));\n" "}"; - testValueOfX(code,0,0); // <- dont hang + testValueOfX(code,0,0); // <- don't hang // conditional code in loop code = "void f(int mask) {\n" // #6000