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

Method suspiciousStringCompareError

lib/checkstring.cpp:200–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198}
199
200void CheckStringImpl::suspiciousStringCompareError(const Token* tok, const std::string& var, bool isLong)
201{
202 const std::string cmpFunc = isLong ? "wcscmp" : "strcmp";
203 reportError(tok, Severity::warning, "literalWithCharPtrCompare",
204 "$symbol:" + var + "\nString literal compared with variable '$symbol'. Did you intend to use " + cmpFunc + "() instead?", CWE595, Certainty::normal);
205}
206
207void CheckStringImpl::suspiciousStringCompareError_char(const Token* tok, const std::string& var)
208{

Callers 1

getErrorMessagesMethod · 0.80

Calls 1

reportErrorFunction · 0.70

Tested by

no test coverage detected