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.
This commit is contained in:
Tim Kosse 2015-08-11 14:13:20 +02:00 коммит произвёл Simon Tatham
Родитель 1f6504c2de
Коммит 6539d39755
2 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -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')

Просмотреть файл

@ -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')