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'.
pull/5357/head
Rene Cannao 2 months ago
parent 9e83a81b4c
commit 4c788dcbb3

@ -1789,7 +1789,7 @@ void MySQL_HostGroups_Manager::purge_mysql_servers_table() {
for (unsigned int i=0; i<MyHostGroups->len; i++) {
MyHGC *myhgc=(MyHGC *)MyHostGroups->index(i);
MySrvC *mysrvc=NULL;
for (int j=0; j<myhgc->mysrvs->servers->len; j++) {
for (unsigned int j=0; j<myhgc->mysrvs->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) {

@ -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<size_t>(elmhs)) {
GloMyLogger->MyLogCB->setBufferSize(elmhs);
}
}

Loading…
Cancel
Save