Fixed unused warnings.

This commit is contained in:
Armin Novak 2015-12-16 15:15:46 +01:00
parent 6010932984
commit 03a1ff814d

View File

@ -472,10 +472,10 @@ void winpr_log_backtrace(const char* tag, DWORD level, DWORD size)
} }
char* winpr_strerror(DWORD dw, char* dmsg, size_t size) { char* winpr_strerror(DWORD dw, char* dmsg, size_t size) {
#if defined(_WIN32)
LPTSTR msg = NULL; LPTSTR msg = NULL;
DWORD rc; DWORD rc;
#if defined(_WIN32)
rc = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | rc = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS, FORMAT_MESSAGE_IGNORE_INSERTS,
@ -483,17 +483,17 @@ char* winpr_strerror(DWORD dw, char* dmsg, size_t size) {
if (rc) { if (rc) {
#if defined(UNICODE) #if defined(UNICODE)
WideCharToMultiByte(CP_ACP, 0, msg, rc, dmsg, size - 1, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, msg, rc, dmsg, size - 1, NULL, NULL);
#else #else /* defined(UNICODE) */
memcpy(dmsg, msg, min(rc, size - 1)); memcpy(dmsg, msg, min(rc, size - 1));
#endif #endif /* defined(UNICODE) */
dmsg[min(rc, size - 1)] = 0; dmsg[min(rc, size - 1)] = 0;
LocalFree(msg); LocalFree(msg);
} else { } else {
_snprintf(dmsg, size, "FAILURE: %08X", GetLastError()); _snprintf(dmsg, size, "FAILURE: %08X", GetLastError());
} }
#else #else /* defined(_WIN32) */
_snprintf(dmsg, size, "%s", strerror(dw)); _snprintf(dmsg, size, "%s", strerror(dw));
#endif #endif /* defined(_WIN32) */
return dmsg; return dmsg;
} }