Parcourir la source

Fix compilation issue on Windows 7 (x64) with MinGW/MSYS and GCC 4.5

Reported by Patsy Kaye.
Removed useless asignment at the same time.
Stéphane Raimbault il y a 14 ans
Parent
commit
d0973adb16
2 fichiers modifiés avec 6 ajouts et 7 suppressions
  1. 2 0
      NEWS
  2. 4 7
      src/modbus-tcp.c

+ 2 - 0
NEWS

@@ -4,6 +4,8 @@ libmodbus 2.9.4 (2011-02-XX)
 - IPv6 support
   Make the TCP implementation "protocol independent" by Florian Forster
   and Stéphane Raimbault.
+- Fix compilation on Windows 7 (x64) with MinGW/MSYS and GCC 4.5
+  Reported by Patsy Kaye.
 
 libmodbus 2.9.3 (2011-01-14)
 ============================

+ 4 - 7
src/modbus-tcp.c

@@ -58,15 +58,12 @@
 #ifdef OS_WIN32
 static int _modbus_tcp_init_win32(void)
 {
-    // Initialise Win32 Socket API
-    WORD wVersionRequested;
+    /* Initialise Windows Socket API */
     WSADATA wsaData;
 
-    wVersionRequested = MAKEWORD(2, 0);
-    if (WSAStartup(wVersionRequested, &wsaData) != 0)
-    {
-        fprintf (stderr, "WSAStartup() returned error code %d\n",
-                 GetLastError());
+    if (WSAStartup(MAKEWORD(2, 0), &wsaData) != 0) {
+        fprintf(stderr, "WSAStartup() returned error code %d\n",
+                (int)GetLastError());
         errno = EIO;
         return -1;
     }