From 2e08c8c5b1c37a8fcefb6e4a22c01033d230ec90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 22 Nov 2011 21:14:14 +0100 Subject: [PATCH] DJGPP: Fixed a few compiler errors by using std::size_t instead of size_t --- lib/checkbufferoverrun.h | 4 ++-- lib/checkother.cpp | 10 +++++----- lib/symboldatabase.h | 4 ++-- lib/token.cpp | 2 +- lib/token.h | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/checkbufferoverrun.h b/lib/checkbufferoverrun.h index 7e6dba1cb..0b4539669 100644 --- a/lib/checkbufferoverrun.h +++ b/lib/checkbufferoverrun.h @@ -154,10 +154,10 @@ public: } /** array size */ - MathLib::bigint num(size_t index) const { + MathLib::bigint num(std::size_t index) const { return _num[index]; } - void num(size_t index, MathLib::bigint number) { + void num(std::size_t index, MathLib::bigint number) { _num[index] = number; } diff --git a/lib/checkother.cpp b/lib/checkother.cpp index b9565244b..a9a4c0aad 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -2148,15 +2148,15 @@ void CheckOther::checkIncorrectStringCompare() { for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next()) { if (Token::Match(tok, ". substr ( %any% , %num% ) ==|!= %str%")) { - size_t clen = MathLib::toLongNumber(tok->strAt(5)); - size_t slen = Token::getStrLength(tok->tokAt(8)); + std::size_t clen = MathLib::toLongNumber(tok->strAt(5)); + std::size_t slen = Token::getStrLength(tok->tokAt(8)); if (clen != slen) { incorrectStringCompareError(tok->next(), "substr", tok->strAt(8), tok->strAt(5)); } } if (Token::Match(tok, "%str% ==|!= %var% . substr ( %any% , %num% )")) { - size_t clen = MathLib::toLongNumber(tok->strAt(8)); - size_t slen = Token::getStrLength(tok); + std::size_t clen = MathLib::toLongNumber(tok->strAt(8)); + std::size_t slen = Token::getStrLength(tok); if (clen != slen) { incorrectStringCompareError(tok->next(), "substr", tok->str(), tok->strAt(8)); } @@ -2566,7 +2566,7 @@ void CheckOther::checkAlwaysTrueOrFalseStringCompare() void CheckOther::alwaysTrueFalseStringCompareError(const Token *tok, const std::string& str1, const std::string& str2) { - const size_t stringLen = 10; + const std::size_t stringLen = 10; const std::string string1 = (str1.size() < stringLen) ? str1 : (str1.substr(0, stringLen-2) + ".."); const std::string string2 = (str2.size() < stringLen) ? str2 : (str2.substr(0, stringLen-2) + ".."); diff --git a/lib/symboldatabase.h b/lib/symboldatabase.h index 7fab477d1..65a8d9b5f 100644 --- a/lib/symboldatabase.h +++ b/lib/symboldatabase.h @@ -295,7 +295,7 @@ public: * Get array dimension length. * @return length of dimension */ - MathLib::bigint dimension(size_t index_) const { + MathLib::bigint dimension(std::size_t index_) const { return _dimensions[index_].num; } @@ -353,7 +353,7 @@ public: functionScope(NULL) { } - size_t argCount() const { + std::size_t argCount() const { return argumentList.size(); } unsigned int initializedArgCount() const; diff --git a/lib/token.cpp b/lib/token.cpp index 8b72e2d0e..0c3d5b74b 100644 --- a/lib/token.cpp +++ b/lib/token.cpp @@ -737,7 +737,7 @@ bool Token::Match(const Token *tok, const char pattern[], unsigned int varid) return true; } -size_t Token::getStrLength(const Token *tok) +std::size_t Token::getStrLength(const Token *tok) { assert(tok != NULL); diff --git a/lib/token.h b/lib/token.h index bb5614910..266366766 100644 --- a/lib/token.h +++ b/lib/token.h @@ -147,7 +147,7 @@ public: * * @param tok token with C-string **/ - static size_t getStrLength(const Token *tok); + static std::size_t getStrLength(const Token *tok); bool isName() const { return _isName;