@@ -44,13 +44,13 @@ namespace {
4444static void makeArrayIndexOutOfBoundsError (std::ostream& oss, const CheckBufferOverrun::ArrayInfo &arrayInfo, const std::vector<MathLib::bigint> &index)
4545{
4646 oss << " Array '" << arrayInfo.varname ();
47- for (unsigned int i = 0 ; i < arrayInfo.num ().size (); ++i)
47+ for (size_t i = 0 ; i < arrayInfo.num ().size (); ++i)
4848 oss << " [" << arrayInfo.num (i) << " ]" ;
4949 if (index.size () == 1 )
5050 oss << " ' accessed at index " << index[0 ] << " , which is" ;
5151 else {
5252 oss << " ' index " << arrayInfo.varname ();
53- for (unsigned int i = 0 ; i < index.size (); ++i)
53+ for (size_t i = 0 ; i < index.size (); ++i)
5454 oss << " [" << index[i] << " ]" ;
5555 }
5656 oss << " out of bounds." ;
@@ -67,19 +67,19 @@ void CheckBufferOverrun::arrayIndexOutOfBoundsError(const Token *tok, const Arra
6767 std::ostringstream errmsg;
6868
6969 errmsg << " Array '" << arrayInfo.varname ();
70- for (unsigned int i = 0 ; i < arrayInfo.num ().size (); ++i)
70+ for (size_t i = 0 ; i < arrayInfo.num ().size (); ++i)
7171 errmsg << " [" << arrayInfo.num (i) << " ]" ;
7272 if (index.size () == 1 )
7373 errmsg << " ' accessed at index " << index[0 ].intvalue << " , which is out of bounds." ;
7474 else {
7575 errmsg << " ' index " << arrayInfo.varname ();
76- for (unsigned int i = 0 ; i < index.size (); ++i)
76+ for (size_t i = 0 ; i < index.size (); ++i)
7777 errmsg << " [" << index[i].intvalue << " ]" ;
7878 errmsg << " out of bounds." ;
7979 }
8080
8181 const Token *condition = nullptr ;
82- for (unsigned int i = 0 ; i < index.size (); ++i) {
82+ for (size_t i = 0 ; i < index.size (); ++i) {
8383 if (condition == nullptr )
8484 condition = index[i].condition ;
8585 }
@@ -324,11 +324,11 @@ void CheckBufferOverrun::checkFunctionParameter(const Token &ftok, unsigned int
324324 return ;
325325
326326 MathLib::bigint arraySize = arrayInfo.element_size ();
327- for (unsigned int i = 0 ; i < arrayInfo.num ().size (); ++i)
327+ for (size_t i = 0 ; i < arrayInfo.num ().size (); ++i)
328328 arraySize *= arrayInfo.num (i);
329329
330330 const Token *charSizeToken = nullptr ;
331- if (checkMinSizes (*minsizes, &ftok, arraySize, &charSizeToken))
331+ if (checkMinSizes (*minsizes, &ftok, ( size_t ) arraySize, &charSizeToken))
332332 bufferOverrunError (callstack, arrayInfo.varname ());
333333 if (charSizeToken)
334334 sizeArgumentAsCharError (charSizeToken);
@@ -428,7 +428,7 @@ void CheckBufferOverrun::checkFunctionParameter(const Token &ftok, unsigned int
428428 MathLib::bigint arraysize = arrayInfo.element_size ();
429429 if (arraysize == 100 ) // unknown size
430430 arraysize = 0 ;
431- for (unsigned int i = 0 ; i < arrayInfo.num ().size (); i++)
431+ for (size_t i = 0 ; i < arrayInfo.num ().size (); i++)
432432 arraysize *= arrayInfo.num (i);
433433
434434 if (Token::Match (tok2, " [,)]" ) && arraysize > 0 && argsize > arraysize)
0 commit comments