Fix clang-tidy bugprone-inc-dec-in-conditions warnings

This commit is contained in:
Tim Wojtulewicz 2025-04-17 11:03:57 -07:00
parent d0bbc61bd4
commit 184757b3db
3 changed files with 13 additions and 4 deletions

View file

@ -6,4 +6,5 @@ Checks: [-*,
bugprone-incorrect-roundings,
bugprone-macro-parentheses,
bugprone-multi-level-implicit-pointer-conversion,
bugprone-inc-dec-in-conditions,
]

View file

@ -164,9 +164,17 @@ function parse_ftp_pasv%(str: string%): ftp_port
line += 5; // Skip over
else if ( line = strchr(s, ','); line != nullptr )
{ // Look for comma-separated list.
while ( --line >= s && isdigit(*line) )
; // Back up over preceding digits.
++line; // now points to first digit, or beginning of s
do
{
// Back up over preceding digits. We'll end on the
// first digit or the beginning of s.
--line;
}
while ( line >= s && isdigit(*line) );
// Scoot forward one to point at the first digit or at the
// beginning of s.
++line;
}
// Make sure we didn't step past the end of the string.

View file

@ -142,7 +142,7 @@ void Ident_Analyzer::DeliverStream(int length, const u_char* data, bool is_orig)
const char* sys_end = (comma && comma < colon) ? comma : colon;
while ( --sys_end > sys_type && isspace(*sys_end) )
for ( ; sys_end > sys_type && isspace(*sys_end); --sys_end )
;
String* sys_type_s = new String((const u_char*)sys_type, sys_end - sys_type + 1, true);