svn rev #24506: trunk/src/lib/apputils/

ghudson@MIT.EDU ghudson at MIT.EDU
Wed Nov 3 12:42:05 EDT 2010


http://src.mit.edu/fisheye/changelog/krb5/?cs=24506
Commit By: ghudson
Log Message:
Use size_t to hold set counts in net-server.c.



Changed Files:
U   trunk/src/lib/apputils/net-server.c
Modified: trunk/src/lib/apputils/net-server.c
===================================================================
--- trunk/src/lib/apputils/net-server.c	2010-11-02 17:21:28 UTC (rev 24505)
+++ trunk/src/lib/apputils/net-server.c	2010-11-03 16:42:05 UTC (rev 24506)
@@ -224,7 +224,7 @@
 };
 
 
-#define SET(TYPE) struct { TYPE *data; int n, max; }
+#define SET(TYPE) struct { TYPE *data; size_t n, max; }
 
 /* Start at the top and work down -- this should allow for deletions
    without disrupting the iteration, since we delete by overwriting
@@ -233,13 +233,12 @@
     for (idx = set.n-1; idx >= 0 && (vvar = set.data[idx], 1); idx--)
 
 #define GROW_SET(set, incr, tmpptr)                                     \
-    (((int)(set.max + incr) < set.max                                   \
-      || (((size_t)((int)(set.max + incr) * sizeof(set.data[0]))        \
-           / sizeof(set.data[0]))                                       \
-          != (size_t)(set.max + incr)))                                 \
-     ? 0                          /* overflow */                        \
+    ((set.max + incr < set.max                                          \
+      || ((set.max + incr) * sizeof(set.data[0]) / sizeof(set.data[0])  \
+          != set.max + incr))                                           \
+     ? 0                         /* overflow */                         \
      : ((tmpptr = realloc(set.data,                                     \
-                          (int)(set.max + incr) * sizeof(set.data[0]))) \
+                          (set.max + incr) * sizeof(set.data[0])))      \
         ? (set.data = tmpptr, set.max += incr, 1)                       \
         : 0))
 
@@ -1127,7 +1126,7 @@
     }
     setup_tcp_listener_ports(&setup_data);
     setup_rpc_listener_ports(&setup_data);
-    krb5_klog_syslog (LOG_INFO, "set up %d sockets", n_sockets);
+    krb5_klog_syslog (LOG_INFO, "set up %d sockets", (int)n_sockets);
     if (n_sockets == 0) {
         com_err(prog, 0, "no sockets set up?");
         exit (1);
@@ -1803,7 +1802,8 @@
        can be rather large.  Making this static avoids putting all
        that junk on the stack.  */
     static struct select_state sout;
-    int i, sret, netchanged = 0;
+    size_t i;
+    int sret, netchanged = 0;
     krb5_error_code err;
 
     if (conns == (struct connection **) NULL)




More information about the cvs-krb5 mailing list