Casting fixes for linux.
authorMonty Taylor <mordred@inaugust.com>
Thu, 3 Dec 2009 20:29:35 +0000 (12:29 -0800)
committerMonty Taylor <mordred@inaugust.com>
Thu, 3 Dec 2009 20:29:35 +0000 (12:29 -0800)
clients/ms_conn.c
clients/ms_setting.h

index 17553022daf5e2e5c91c48a2e7810416c545d58f..59b0875d73db61a59d881626fdfc376740793c20 100644 (file)
@@ -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=
index 9283a4834b385d3e765d4756e594615ce139fc23..7d31532c8b5ea7a8590de1402bcc82112724f711 100644 (file)
@@ -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;