From 6539d39755e82e3a39f61aa0ff4e415b4861320b Mon Sep 17 00:00:00 2001 From: Tim Kosse Date: Tue, 11 Aug 2015 14:13:20 +0200 Subject: [PATCH] Use correct type to print Windows error codes. GetLastError returns DWORD. To print it, convert it to unsigned int and use the %u format specifier. --- windows/winmisc.c | 4 ++-- windows/winnet.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/windows/winmisc.c b/windows/winmisc.c index cd8d74ed..ce0a0d1d 100644 --- a/windows/winmisc.c +++ b/windows/winmisc.c @@ -222,8 +222,8 @@ const char *win_strerror(int error) MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), msgtext, lenof(msgtext)-1, NULL)) { sprintf(msgtext, - "(unable to format: FormatMessage returned %d)", - GetLastError()); + "(unable to format: FormatMessage returned %u)", + (unsigned int)GetLastError()); } else { int len = strlen(msgtext); if (len > 0 && msgtext[len-1] == '\n') diff --git a/windows/winnet.c b/windows/winnet.c index 680de2a7..c7f68ef9 100644 --- a/windows/winnet.c +++ b/windows/winnet.c @@ -478,8 +478,8 @@ const char *winsock_error_string(int error) MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), es->text + bufused, bufsize - bufused, NULL)) { sprintf(es->text + bufused, - "Windows error code %d (and FormatMessage returned %d)", - error, GetLastError()); + "Windows error code %d (and FormatMessage returned %u)", + error, (unsigned int)GetLastError()); } else { int len = strlen(es->text); if (len > 0 && es->text[len-1] == '\n') -- 2.45.2