Fix FormatMessage warnings for Windows.

From the FormatMessage() Win32 API documentation: "The lpBuffer
parameter is a pointer to an LPTSTR; you must cast the pointer
to an LPTSTR (for example, (LPTSTR)&lpBuffer)."

https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-formatmessage#parameters

This commit fixes warnings like these:
warning C4047: 'function': 'LPSTR' differs in levels of indirection from 'char **'
warning C4024: 'FormatMessageA': different types for formal and actual parameter 5

Signed-off-by: Sigmund Vik <sigmund_vik@yahoo.com>
pull/1769/head
Sigmund Vik 5 years ago committed by Roger Light
parent a75d574870
commit 5481575f8b

@ -86,7 +86,7 @@ static void net__print_error(int log, const char *format_str)
#ifdef WIN32
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, WSAGetLastError(), LANG_NEUTRAL, &buf, 0, NULL);
NULL, WSAGetLastError(), LANG_NEUTRAL, (LPTSTR)&buf, 0, NULL);
log__printf(NULL, log, format_str, buf);
LocalFree(buf);

@ -33,7 +33,7 @@ void LIB_ERROR(void)
#ifdef WIN32
char *buf;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING,
NULL, GetLastError(), LANG_NEUTRAL, &buf, 0, NULL);
NULL, GetLastError(), LANG_NEUTRAL, (LPTSTR)&buf, 0, NULL);
log__printf(NULL, MOSQ_LOG_ERR, "Load error: %s", buf);
LocalFree(buf);
#else

@ -32,7 +32,7 @@ static void print_error(void)
char *buf;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, GetLastError(), LANG_NEUTRAL, &buf, 0, NULL);
NULL, GetLastError(), LANG_NEUTRAL, (LPTSTR)&buf, 0, NULL);
fprintf(stderr, "Error: %s\n", buf);
LocalFree(buf);

Loading…
Cancel
Save