From: Martin Schwenke Date: Thu, 1 Aug 2019 00:55:39 +0000 (+1000) Subject: ctdb-daemon: Avoid signed/unsigned comparison by declaring as unsigned X-Git-Tag: tdb-1.4.2~126 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4bdfbbd8d4fb681d509d702a8a357b11c8dddcac;p=thirdparty%2Fsamba.git ctdb-daemon: Avoid signed/unsigned comparison by declaring as unsigned Compiling with -Wsign-compare complains: ctdb/server/ctdb_call.c:831:12: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Wsign-compare] 831 | if (count <= ctdb_db->statistics.hot_keys[0].count) { | ^~ and ctdb/server/ctdb_call.c:844:13: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Wsign-compare] 844 | if (count <= ctdb_db->statistics.hot_keys[i].count) { | ^~ Found by cs-build. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/server/ctdb_call.c b/ctdb/server/ctdb_call.c index 346fe89010e..876ae448cca 100644 --- a/ctdb/server/ctdb_call.c +++ b/ctdb/server/ctdb_call.c @@ -822,7 +822,7 @@ ctdb_defer_pinned_down_request(struct ctdb_context *ctdb, struct ctdb_db_context static void ctdb_update_db_stat_hot_keys(struct ctdb_db_context *ctdb_db, TDB_DATA key, - int count) + unsigned int count) { int i, id; char *keystr; @@ -1983,7 +1983,7 @@ static void ctdb_migration_count_handler(TDB_DATA key, uint64_t counter, { struct ctdb_db_context *ctdb_db = talloc_get_type_abort( private_data, struct ctdb_db_context); - int value; + unsigned int value; value = (counter < INT_MAX ? counter : INT_MAX); ctdb_update_db_stat_hot_keys(ctdb_db, key, value);