mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-16 03:53:01 -05:00
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:
parent
1f6504c2de
commit
6539d39755
@ -222,8 +222,8 @@ const char *win_strerror(int error)
|
|||||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||||
msgtext, lenof(msgtext)-1, NULL)) {
|
msgtext, lenof(msgtext)-1, NULL)) {
|
||||||
sprintf(msgtext,
|
sprintf(msgtext,
|
||||||
"(unable to format: FormatMessage returned %d)",
|
"(unable to format: FormatMessage returned %u)",
|
||||||
GetLastError());
|
(unsigned int)GetLastError());
|
||||||
} else {
|
} else {
|
||||||
int len = strlen(msgtext);
|
int len = strlen(msgtext);
|
||||||
if (len > 0 && msgtext[len-1] == '\n')
|
if (len > 0 && msgtext[len-1] == '\n')
|
||||||
|
@ -478,8 +478,8 @@ const char *winsock_error_string(int error)
|
|||||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||||
es->text + bufused, bufsize - bufused, NULL)) {
|
es->text + bufused, bufsize - bufused, NULL)) {
|
||||||
sprintf(es->text + bufused,
|
sprintf(es->text + bufused,
|
||||||
"Windows error code %d (and FormatMessage returned %d)",
|
"Windows error code %d (and FormatMessage returned %u)",
|
||||||
error, GetLastError());
|
error, (unsigned int)GetLastError());
|
||||||
} else {
|
} else {
|
||||||
int len = strlen(es->text);
|
int len = strlen(es->text);
|
||||||
if (len > 0 && es->text[len-1] == '\n')
|
if (len > 0 && es->text[len-1] == '\n')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user