From: Monty Taylor Date: Thu, 3 Dec 2009 20:29:35 +0000 (-0800) Subject: Casting fixes for linux. X-Git-Tag: 0.37~81^2 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=dd175adb52ed8a5ab9ca125060f50b6185c60047;p=m6w6%2Flibmemcached Casting fixes for linux. --- diff --git a/clients/ms_conn.c b/clients/ms_conn.c index 17553022..59b0875d 100644 --- a/clients/ms_conn.c +++ b/clients/ms_conn.c @@ -909,8 +909,8 @@ static int ms_reconn(ms_conn_t *c) close(c->sfd); c->tcpsfd[c->cur_idx]= 0; - if (atomic_add_32_nv((volatile uint32_t *)&ms_setting.servers[srv_idx].disconn_cnt, 1) - % srv_conn_cnt == 0) + if (atomic_add_32_nv(&ms_setting.servers[srv_idx].disconn_cnt, 1) + % (uint32_t)srv_conn_cnt == 0) { gettimeofday(&ms_setting.servers[srv_idx].disconn_time, NULL); fprintf(stderr, "Server %s:%d disconnect\n", @@ -945,8 +945,8 @@ static int ms_reconn(ms_conn_t *c) ms_setting.udp, &c->sfd) == 0) { c->tcpsfd[c->cur_idx]= c->sfd; - if (atomic_add_32_nv((volatile uint32_t *)(&ms_setting.servers[srv_idx].reconn_cnt), 1) - % srv_conn_cnt == 0) + if (atomic_add_32_nv(&ms_setting.servers[srv_idx].reconn_cnt, 1) + % (uint32_t)srv_conn_cnt == 0) { gettimeofday(&ms_setting.servers[srv_idx].reconn_time, NULL); int reconn_time= @@ -1040,8 +1040,8 @@ int ms_reconn_socks(ms_conn_t *c) c->tcpsfd[i]= ret_sfd; c->alive_sfds++; - if (atomic_add_32_nv((volatile uint32_t *)(&ms_setting.servers[srv_idx].reconn_cnt), 1) - % srv_conn_cnt == 0) + if (atomic_add_32_nv(&ms_setting.servers[srv_idx].reconn_cnt, 1) + % (uint32_t)srv_conn_cnt == 0) { gettimeofday(&ms_setting.servers[srv_idx].reconn_time, NULL); int reconn_time= diff --git a/clients/ms_setting.h b/clients/ms_setting.h index 9283a483..7d31532c 100644 --- a/clients/ms_setting.h +++ b/clients/ms_setting.h @@ -53,8 +53,8 @@ typedef struct mcd_sever int srv_port; /* server port */ /* for calculating how long the server disconnects */ - volatile int32_t disconn_cnt; /* number of disconnections count */ - volatile int32_t reconn_cnt; /* number of reconnections count */ + volatile uint32_t disconn_cnt; /* number of disconnections count */ + volatile uint32_t reconn_cnt; /* number of reconnections count */ struct timeval disconn_time; /* start time of disconnection */ struct timeval reconn_time; /* end time of reconnection */ } ms_mcd_server_t;