From 4c788dcbb36549b066737cf3b9506c072a35894c Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Mon, 9 Feb 2026 10:08:19 +0000 Subject: [PATCH] fix: signed/unsigned comparison warnings (-Wsign-compare) Fix two HIGH priority signed/unsigned comparison warnings: 1. MySQL_HostGroups_Manager.cpp:1792 - Change loop variable from 'int j' to 'unsigned int j' to match the unsigned comparison with servers->len. 2. MySQL_Thread.cpp:4357 - Cast int to size_t when comparing with getBufferSize() which returns size_t. These changes prevent potential logic errors from negative values being interpreted as large unsigned values. Found during compiler warning analysis with 'make debug'. --- lib/MySQL_HostGroups_Manager.cpp | 2 +- lib/MySQL_Thread.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/MySQL_HostGroups_Manager.cpp b/lib/MySQL_HostGroups_Manager.cpp index 37912d4b0..cf520ed50 100644 --- a/lib/MySQL_HostGroups_Manager.cpp +++ b/lib/MySQL_HostGroups_Manager.cpp @@ -1789,7 +1789,7 @@ void MySQL_HostGroups_Manager::purge_mysql_servers_table() { for (unsigned int i=0; ilen; i++) { MyHGC *myhgc=(MyHGC *)MyHostGroups->index(i); MySrvC *mysrvc=NULL; - for (int j=0; jmysrvs->servers->len; j++) { + for (unsigned int j=0; jmysrvs->servers->len; j++) { mysrvc=myhgc->mysrvs->idx(j); if (mysrvc->get_status() == MYSQL_SERVER_STATUS_OFFLINE_HARD) { if (mysrvc->ConnectionsUsed->conns_length()==0 && mysrvc->ConnectionsFree->conns_length()==0) { diff --git a/lib/MySQL_Thread.cpp b/lib/MySQL_Thread.cpp index 0427b2617..c2a5762df 100644 --- a/lib/MySQL_Thread.cpp +++ b/lib/MySQL_Thread.cpp @@ -4354,7 +4354,7 @@ void MySQL_Thread::refresh_variables() { REFRESH_VARIABLE_INT(eventslog_buffer_history_size); { int elmhs = mysql_thread___eventslog_buffer_history_size; - if (GloMyLogger->MyLogCB->getBufferSize() != elmhs) { + if (GloMyLogger->MyLogCB->getBufferSize() != static_cast(elmhs)) { GloMyLogger->MyLogCB->setBufferSize(elmhs); } }