Commit d0973adb163525d160b4fec22be0098c90b03cc1
1 parent
b8aea3c2
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.
Showing
2 changed files
with
6 additions
and
7 deletions
NEWS
| @@ -4,6 +4,8 @@ libmodbus 2.9.4 (2011-02-XX) | @@ -4,6 +4,8 @@ libmodbus 2.9.4 (2011-02-XX) | ||
| 4 | - IPv6 support | 4 | - IPv6 support |
| 5 | Make the TCP implementation "protocol independent" by Florian Forster | 5 | Make the TCP implementation "protocol independent" by Florian Forster |
| 6 | and Stéphane Raimbault. | 6 | and Stéphane Raimbault. |
| 7 | +- Fix compilation on Windows 7 (x64) with MinGW/MSYS and GCC 4.5 | ||
| 8 | + Reported by Patsy Kaye. | ||
| 7 | 9 | ||
| 8 | libmodbus 2.9.3 (2011-01-14) | 10 | libmodbus 2.9.3 (2011-01-14) |
| 9 | ============================ | 11 | ============================ |
src/modbus-tcp.c
| @@ -58,15 +58,12 @@ | @@ -58,15 +58,12 @@ | ||
| 58 | #ifdef OS_WIN32 | 58 | #ifdef OS_WIN32 |
| 59 | static int _modbus_tcp_init_win32(void) | 59 | static int _modbus_tcp_init_win32(void) |
| 60 | { | 60 | { |
| 61 | - // Initialise Win32 Socket API | ||
| 62 | - WORD wVersionRequested; | 61 | + /* Initialise Windows Socket API */ |
| 63 | WSADATA wsaData; | 62 | WSADATA wsaData; |
| 64 | 63 | ||
| 65 | - wVersionRequested = MAKEWORD(2, 0); | ||
| 66 | - if (WSAStartup(wVersionRequested, &wsaData) != 0) | ||
| 67 | - { | ||
| 68 | - fprintf (stderr, "WSAStartup() returned error code %d\n", | ||
| 69 | - GetLastError()); | 64 | + if (WSAStartup(MAKEWORD(2, 0), &wsaData) != 0) { |
| 65 | + fprintf(stderr, "WSAStartup() returned error code %d\n", | ||
| 66 | + (int)GetLastError()); | ||
| 70 | errno = EIO; | 67 | errno = EIO; |
| 71 | return -1; | 68 | return -1; |
| 72 | } | 69 | } |