MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / stringifyIndexes

Function stringifyIndexes

lib/checkbufferoverrun.cpp:370–386  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

368}
369
370static std::string stringifyIndexes(const std::string& array, const std::vector<ValueFlow::Value>& indexValues)
371{
372 if (indexValues.size() == 1)
373 return MathLib::toString(indexValues[0].intvalue);
374
375 std::ostringstream ret;
376 ret << array;
377 for (const ValueFlow::Value& index : indexValues) {
378 ret << "[";
379 if (index.isNonValue())
380 ret << "*";
381 else
382 ret << index.intvalue;
383 ret << "]";
384 }
385 return ret.str();
386}
387
388static std::string arrayIndexMessage(const Token* tok,
389 const std::vector<Dimension>& dimensions,

Callers 1

arrayIndexMessageFunction · 0.85

Calls 3

toStringFunction · 0.70
sizeMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected