Andrew Talbot : ws2_32: Avoid signed-unsigned integer comparisons.

Alexandre Julliard julliard at winehq.org
Fri Mar 8 14:00:36 CST 2013


Module: wine
Branch: master
Commit: 05d5654237c1af93661a3f5e21c792f6e431883d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=05d5654237c1af93661a3f5e21c792f6e431883d

Author: Andrew Talbot <andrew.talbot at talbotville.com>
Date:   Thu Mar  7 22:22:31 2013 +0000

ws2_32: Avoid signed-unsigned integer comparisons.

---

 dlls/ws2_32/socket.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 05c7aac..f9e8a6c 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -2881,7 +2881,8 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level,
             {
                 struct irda_device_list *src = (struct irda_device_list *)buf;
                 DEVICELIST *dst = (DEVICELIST *)optval;
-                INT needed = sizeof(DEVICELIST), i;
+                INT needed = sizeof(DEVICELIST);
+                unsigned int i;
 
                 if (src->len > 0)
                     needed += (src->len - 1) * sizeof(IRDA_DEVICE_INFO);
@@ -4605,6 +4606,7 @@ struct WS_hostent* WINAPI WS_gethostbyaddr(const char *addr, int len, int type)
 static struct WS_hostent* WS_get_local_ips( char *hostname )
 {
     int last_metric, numroutes = 0, i, j;
+    DWORD n;
     PIP_ADAPTER_INFO adapters = NULL, k;
     struct WS_hostent *hostlist = NULL;
     PMIB_IPFORWARDTABLE routes = NULL;
@@ -4627,15 +4629,15 @@ static struct WS_hostent* WS_get_local_ips( char *hostname )
     if (GetIpForwardTable(routes, &route_size, FALSE) != NO_ERROR)
         goto cleanup;
     /* Store the interface associated with each route */
-    for (i = 0; i < routes->dwNumEntries; i++)
+    for (n = 0; n < routes->dwNumEntries; n++)
     {
         IF_INDEX ifindex;
         DWORD ifmetric, exists = FALSE;
 
-        if (routes->table[i].u1.ForwardType != MIB_IPROUTE_TYPE_DIRECT)
+        if (routes->table[n].u1.ForwardType != MIB_IPROUTE_TYPE_DIRECT)
             continue;
-        ifindex = routes->table[i].dwForwardIfIndex;
-        ifmetric = routes->table[i].dwForwardMetric1;
+        ifindex = routes->table[n].dwForwardIfIndex;
+        ifmetric = routes->table[n].dwForwardMetric1;
         /* Only store the lowest valued metric for an interface */
         for (j = 0; j < numroutes; j++)
         {




More information about the wine-cvs mailing list