lint: fix unsigned-to-signed cast in MySrvConnList::find_idx

Use static_cast<int> instead of C-style cast for clarity and to avoid
unsigned->signed narrowing warnings while preserving the -1 sentinel.
v3.0-lint
Rene Cannao 2 months ago
parent 17225cf2a8
commit 413584f0fb

@ -180,7 +180,10 @@ class MySrvConnList {
MySQL_Connection *conn = NULL;
conn = (MySQL_Connection *)conns->index(i);
if (conn==c) {
return (unsigned int)i;
// 'find_idx' returns an int; cast the unsigned loop index to int
// to avoid unsigned->signed narrowing warnings and keep the
// sentinel return value of -1 for "not found".
return static_cast<int>(i);
}
}
return -1;

Loading…
Cancel
Save