Fix in the IPAddress Common Control

Francois Gouget fgouget at codeweavers.com
Mon Feb 4 03:55:09 CST 2002


   Ah, the beauty of two's complement and division of ip addresses.
ip_address was a signed int and because of this, IPADDRESS_SetAddress
would convert an address such as 130.10.20.30 into 131.11.21.30. But and
address such as 10.20.30.40 would get through correctly!


Changelog:

   François Gouget <fgouget at codeweavers.com>

 * dlls/comctl32/ipaddress.c
   Storing an ipaddress in a signed int results in bugs if it starts
with >=128



-- 
François Gouget
fgouget at codeweavers.com
-------------- next part --------------
Index: dlls/comctl32/ipaddress.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/ipaddress.c,v
retrieving revision 1.18
diff -u -r1.18 ipaddress.c
--- dlls/comctl32/ipaddress.c	2001/07/25 00:43:30	1.18
+++ dlls/comctl32/ipaddress.c	2002/02/04 07:48:24
@@ -347,7 +347,8 @@
   HDC hdc;
   LPIP_SUBCLASS_INFO lpipsi=(LPIP_SUBCLASS_INFO)
             GetPropA ((HWND)hwnd, IP_SUBCLASS_PROP);
-  int i,ip_address,value;
+  int i,value;
+  DWORD ip_address;
   char buf[20];
 
   TRACE("\n");
@@ -361,7 +362,7 @@
       SetWindowTextA (lpipsi->hwndIP[i],buf);
       IPADDRESS_SendNotify (hwnd, EN_CHANGE);
     }
-    ip_address/=256;
+    ip_address= ip_address >> 8;
   }
 
   hdc = GetDC (hwnd);		/* & send notifications */


More information about the wine-patches mailing list