Bug 310262 - krazy warns about QByteArray::endsWith(const char *)
Summary: krazy warns about QByteArray::endsWith(const char *)
Status: CONFIRMED
Alias: None
Product: krazy
Classification: Developer tools
Component: general (other bugs)
Version First Reported In: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Allen Winter
URL:
Keywords:
: 356733 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-11-17 21:31 UTC by Jan Kundrát
Modified: 2015-12-24 06:14 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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. ***