Bug 310262

Summary: krazy warns about QByteArray::endsWith(const char *)
Product: [Developer tools] krazy Reporter: Jan Kundrát <jkt>
Component: generalAssignee: Allen Winter <winter>
Status: CONFIRMED ---    
Severity: normal CC: schwarzer
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Jan Kundrát 2012-11-17 21:31:15 UTC
There's a warning about [1] where the code calls the const char * overload of the endsWith method on a member of type QByteArray. This one is actually correct, using a QLatinString makes sense just on QStrings, not QByteArrays.

[1] http://lxr.kde.org/source/playground/pim/trojita/src/Imap/Parser/Parser.cpp#675
Comment 1 Allen Winter 2012-11-17 22:17:53 UTC
Yep. You found one of the major complaints with Krazy; namely that it has no real C++ parsing capabilities.  In this case, krazy has no idea that currentLine is a QByteArray since it won't look in Parser.h to find the type of the variable.

So.. in the meantime until we get better C++ parsing capabilities you can tell Krazy to skip that line by adding the //krazy::exclude=strings comment to the lines with the false positives.

Like so:
   if (currentLine.endsWith("}\r\n")) {  //krazy:exclude=strings
and
   if (str.endsWith("\r\n"))  //krazy:exclude=strings
Comment 2 Frederik Schwarzer 2015-12-24 06:14:09 UTC
*** Bug 356733 has been marked as a duplicate of this bug. ***