[return checks] fix use of unicode functions
This commit is contained in:
parent
f655843260
commit
cd18dea174
@ -45,12 +45,12 @@
|
||||
#include "drive_file.h"
|
||||
|
||||
#ifdef WITH_DEBUG_RDPDR
|
||||
#define DEBUG_WSTR(msg, wstr) \
|
||||
do \
|
||||
{ \
|
||||
char lpstr[1024] = { 0 }; \
|
||||
ConvertWCharToUtf8(wstr, lpstr, ARRAYSIZE(lpstr)); \
|
||||
WLog_DBG(TAG, msg, lpstr); \
|
||||
#define DEBUG_WSTR(msg, wstr) \
|
||||
do \
|
||||
{ \
|
||||
char lpstr[1024] = { 0 }; \
|
||||
(void)ConvertWCharToUtf8(wstr, lpstr, ARRAYSIZE(lpstr)); \
|
||||
WLog_DBG(TAG, msg, lpstr); \
|
||||
} while (0)
|
||||
#else
|
||||
#define DEBUG_WSTR(msg, wstr) \
|
||||
@ -147,7 +147,7 @@ static WCHAR* drive_file_combine_fullpath(const WCHAR* base_path, const WCHAR* p
|
||||
if (contains_dotdot(&fullpath[base_path_length], base_path_length, PathWCharLength))
|
||||
{
|
||||
char abuffer[MAX_PATH] = { 0 };
|
||||
ConvertWCharToUtf8(&fullpath[base_path_length], abuffer, ARRAYSIZE(abuffer));
|
||||
(void)ConvertWCharToUtf8(&fullpath[base_path_length], abuffer, ARRAYSIZE(abuffer));
|
||||
|
||||
WLog_WARN(TAG, "[rdpdr] received invalid file path '%s' from server, aborting!",
|
||||
&abuffer[base_path_length]);
|
||||
|
@ -526,15 +526,15 @@ static BOOL wf_authenticate_ex(freerdp* instance, char** username, char** passwo
|
||||
|
||||
if (*username)
|
||||
{
|
||||
ConvertUtf8ToWChar(*username, UserNameW, ARRAYSIZE(UserNameW));
|
||||
ConvertUtf8ToWChar(*username, UserW, ARRAYSIZE(UserW));
|
||||
(void)ConvertUtf8ToWChar(*username, UserNameW, ARRAYSIZE(UserNameW));
|
||||
(void)ConvertUtf8ToWChar(*username, UserW, ARRAYSIZE(UserW));
|
||||
}
|
||||
|
||||
if (*password)
|
||||
ConvertUtf8ToWChar(*password, PasswordW, ARRAYSIZE(PasswordW));
|
||||
(void)ConvertUtf8ToWChar(*password, PasswordW, ARRAYSIZE(PasswordW));
|
||||
|
||||
if (*domain)
|
||||
ConvertUtf8ToWChar(*domain, DomainW, ARRAYSIZE(DomainW));
|
||||
(void)ConvertUtf8ToWChar(*domain, DomainW, ARRAYSIZE(DomainW));
|
||||
|
||||
if (_wcsnlen(PasswordW, ARRAYSIZE(PasswordW)) == 0)
|
||||
{
|
||||
@ -566,9 +566,10 @@ static BOOL wf_authenticate_ex(freerdp* instance, char** username, char** passwo
|
||||
CHAR UserName[CREDUI_MAX_USERNAME_LENGTH + 1] = { 0 };
|
||||
CHAR Domain[CREDUI_MAX_DOMAIN_TARGET_LENGTH + 1] = { 0 };
|
||||
|
||||
ConvertWCharNToUtf8(UserNameW, ARRAYSIZE(UserNameW), UserName, ARRAYSIZE(UserName));
|
||||
ConvertWCharNToUtf8(UserW, ARRAYSIZE(UserW), User, ARRAYSIZE(User));
|
||||
ConvertWCharNToUtf8(DomainW, ARRAYSIZE(DomainW), Domain, ARRAYSIZE(Domain));
|
||||
(void)ConvertWCharNToUtf8(UserNameW, ARRAYSIZE(UserNameW), UserName,
|
||||
ARRAYSIZE(UserName));
|
||||
(void)ConvertWCharNToUtf8(UserW, ARRAYSIZE(UserW), User, ARRAYSIZE(User));
|
||||
(void)ConvertWCharNToUtf8(DomainW, ARRAYSIZE(DomainW), Domain, ARRAYSIZE(Domain));
|
||||
WLog_ERR(TAG, "Failed to parse UserName: %s into User: %s Domain: %s", UserName,
|
||||
User, Domain);
|
||||
return FALSE;
|
||||
|
@ -2237,8 +2237,8 @@ static BOOL add_directory(CliprdrLocalStream* stream, const char* path)
|
||||
continue;
|
||||
|
||||
char cFileName[MAX_PATH] = { 0 };
|
||||
ConvertWCharNToUtf8(FindFileData.cFileName, ARRAYSIZE(FindFileData.cFileName), cFileName,
|
||||
ARRAYSIZE(cFileName));
|
||||
(void)ConvertWCharNToUtf8(FindFileData.cFileName, ARRAYSIZE(FindFileData.cFileName),
|
||||
cFileName, ARRAYSIZE(cFileName));
|
||||
|
||||
free(next);
|
||||
next = GetCombinedPath(path, cFileName);
|
||||
|
@ -1692,8 +1692,8 @@ static void freerdp_client_print_timezone_list(void)
|
||||
{
|
||||
char TimeZoneKeyName[ARRAYSIZE(info.TimeZoneKeyName) + 1] = { 0 };
|
||||
|
||||
ConvertWCharNToUtf8(info.TimeZoneKeyName, ARRAYSIZE(info.TimeZoneKeyName), TimeZoneKeyName,
|
||||
ARRAYSIZE(TimeZoneKeyName));
|
||||
(void)ConvertWCharNToUtf8(info.TimeZoneKeyName, ARRAYSIZE(info.TimeZoneKeyName),
|
||||
TimeZoneKeyName, ARRAYSIZE(TimeZoneKeyName));
|
||||
printf("%" PRIu32 ": '%s'\n", index, TimeZoneKeyName);
|
||||
}
|
||||
}
|
||||
@ -4775,8 +4775,8 @@ static int freerdp_client_settings_parse_command_line_arguments_int(
|
||||
char TimeZoneKeyName[ARRAYSIZE(info.TimeZoneKeyName) + 1] = { 0 };
|
||||
while (EnumDynamicTimeZoneInformation(index++, &info) != ERROR_NO_MORE_ITEMS)
|
||||
{
|
||||
ConvertWCharNToUtf8(info.TimeZoneKeyName, ARRAYSIZE(info.TimeZoneKeyName),
|
||||
TimeZoneKeyName, ARRAYSIZE(TimeZoneKeyName));
|
||||
(void)ConvertWCharNToUtf8(info.TimeZoneKeyName, ARRAYSIZE(info.TimeZoneKeyName),
|
||||
TimeZoneKeyName, ARRAYSIZE(TimeZoneKeyName));
|
||||
|
||||
WINPR_ASSERT(arg->Value);
|
||||
if (strncmp(TimeZoneKeyName, arg->Value, ARRAYSIZE(TimeZoneKeyName)) == 0)
|
||||
|
@ -502,7 +502,7 @@ static BOOL createChildSessionTransport(HANDLE* pFile)
|
||||
memcpy(pipePath, startOfPath, 8);
|
||||
}
|
||||
|
||||
ConvertWCharNToUtf8(pipePath, 0x80, pipePathA, sizeof(pipePathA));
|
||||
(void)ConvertWCharNToUtf8(pipePath, 0x80, pipePathA, sizeof(pipePathA));
|
||||
WLog_DBG(TAG, "child session is at '%s'", pipePathA);
|
||||
|
||||
HANDLE f = CreateFileW(pipePath, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING,
|
||||
|
@ -547,9 +547,9 @@ out:
|
||||
{
|
||||
char cspa[128] = { 0 };
|
||||
|
||||
ConvertWCharToUtf8(csp, cspa, sizeof(cspa));
|
||||
(void)ConvertWCharToUtf8(csp, cspa, sizeof(cspa));
|
||||
char scopea[128] = { 0 };
|
||||
ConvertWCharToUtf8(scope, scopea, sizeof(scopea));
|
||||
(void)ConvertWCharToUtf8(scope, scopea, sizeof(scopea));
|
||||
WLog_WARN(TAG, "%s [%s] no certificates found", cspa, scopea);
|
||||
}
|
||||
*pcount = count;
|
||||
|
@ -94,15 +94,15 @@ static void log_timezone_(const TIME_ZONE_INFORMATION* tzif, DWORD result, const
|
||||
wLog* log = WLog_Get(TIMEZONE_TAG);
|
||||
log_print(log, level, file, fkt, line, "TIME_ZONE_INFORMATION {");
|
||||
log_print(log, level, file, fkt, line, " Bias=%" PRIu32, tzif->Bias);
|
||||
ConvertWCharNToUtf8(tzif->StandardName, ARRAYSIZE(tzif->StandardName), buffer,
|
||||
ARRAYSIZE(buffer));
|
||||
(void)ConvertWCharNToUtf8(tzif->StandardName, ARRAYSIZE(tzif->StandardName), buffer,
|
||||
ARRAYSIZE(buffer));
|
||||
log_print(log, level, file, fkt, line, " StandardName=%s", buffer);
|
||||
log_print(log, level, file, fkt, line, " StandardDate=%s",
|
||||
systemtime2str(&tzif->StandardDate, buffer, sizeof(buffer)));
|
||||
log_print(log, level, file, fkt, line, " StandardBias=%" PRIu32, tzif->StandardBias);
|
||||
|
||||
ConvertWCharNToUtf8(tzif->DaylightName, ARRAYSIZE(tzif->DaylightName), buffer,
|
||||
ARRAYSIZE(buffer));
|
||||
(void)ConvertWCharNToUtf8(tzif->DaylightName, ARRAYSIZE(tzif->DaylightName), buffer,
|
||||
ARRAYSIZE(buffer));
|
||||
log_print(log, level, file, fkt, line, " DaylightName=%s", buffer);
|
||||
log_print(log, level, file, fkt, line, " DaylightDate=%s",
|
||||
systemtime2str(&tzif->DaylightDate, buffer, sizeof(buffer)));
|
||||
|
@ -325,8 +325,8 @@ static void rdpdr_dump_packet(wLog* log, DWORD lvl, wStream* s, const char* cust
|
||||
if (unicodeFlag == 0)
|
||||
Stream_Read(s, name, MIN(sizeof(name), computerNameLen));
|
||||
else
|
||||
ConvertWCharNToUtf8(Stream_ConstPointer(s), computerNameLen / sizeof(WCHAR),
|
||||
name, sizeof(name));
|
||||
(void)ConvertWCharNToUtf8(Stream_ConstPointer(s),
|
||||
computerNameLen / sizeof(WCHAR), name, sizeof(name));
|
||||
}
|
||||
WLog_Print(log, lvl,
|
||||
"%s [%s | %s] [ucs:%" PRIu32 "|cp:%" PRIu32 "][len:0x%08" PRIx32
|
||||
|
@ -479,7 +479,7 @@ static void smartcard_trace_context_and_string_call_w(const char* name,
|
||||
return;
|
||||
|
||||
if (sz)
|
||||
ConvertWCharToUtf8(sz, tmp, ARRAYSIZE(tmp));
|
||||
(void)ConvertWCharToUtf8(sz, tmp, ARRAYSIZE(tmp));
|
||||
|
||||
WLog_LVL(TAG, g_LogLevel, "%s {", name);
|
||||
smartcard_log_context(TAG, phContext);
|
||||
@ -532,7 +532,7 @@ static void smartcard_trace_get_status_change_w_call(const GetStatusChangeW_Call
|
||||
const LPSCARD_READERSTATEW readerState = &call->rgReaderStates[index];
|
||||
char szReaderA[1024] = { 0 };
|
||||
|
||||
ConvertWCharToUtf8(readerState->szReader, szReaderA, ARRAYSIZE(szReaderA));
|
||||
(void)ConvertWCharToUtf8(readerState->szReader, szReaderA, ARRAYSIZE(szReaderA));
|
||||
|
||||
WLog_LVL(TAG, g_LogLevel, "\t[%" PRIu32 "]: szReader: %s cbAtr: %" PRIu32 "", index,
|
||||
szReaderA, readerState->cbAtr);
|
||||
@ -806,9 +806,9 @@ static void smartcard_trace_context_and_two_strings_w_call(const ContextAndTwoSt
|
||||
if (!WLog_IsLevelActive(WLog_Get(TAG), g_LogLevel))
|
||||
return;
|
||||
if (call->sz1)
|
||||
ConvertWCharToUtf8(call->sz1, sz1, ARRAYSIZE(sz1));
|
||||
(void)ConvertWCharToUtf8(call->sz1, sz1, ARRAYSIZE(sz1));
|
||||
if (call->sz2)
|
||||
ConvertWCharToUtf8(call->sz2, sz2, ARRAYSIZE(sz2));
|
||||
(void)ConvertWCharToUtf8(call->sz2, sz2, ARRAYSIZE(sz2));
|
||||
|
||||
WLog_LVL(TAG, g_LogLevel, "ContextAndTwoStringW_Call {");
|
||||
smartcard_log_context(TAG, &call->handles.hContext);
|
||||
@ -863,7 +863,7 @@ static void smartcard_trace_write_cache_w_call(const WriteCacheW_Call* call)
|
||||
WLog_LVL(TAG, g_LogLevel, "WriteCacheW_Call {");
|
||||
|
||||
if (call->szLookupName)
|
||||
ConvertWCharToUtf8(call->szLookupName, tmp, ARRAYSIZE(tmp));
|
||||
(void)ConvertWCharToUtf8(call->szLookupName, tmp, ARRAYSIZE(tmp));
|
||||
WLog_LVL(TAG, g_LogLevel, " szLookupName=%s", tmp);
|
||||
|
||||
smartcard_log_context(TAG, &call->Common.handles.hContext);
|
||||
@ -909,7 +909,7 @@ static void smartcard_trace_read_cache_w_call(const ReadCacheW_Call* call)
|
||||
|
||||
WLog_LVL(TAG, g_LogLevel, "ReadCacheW_Call {");
|
||||
if (call->szLookupName)
|
||||
ConvertWCharToUtf8(call->szLookupName, tmp, ARRAYSIZE(tmp));
|
||||
(void)ConvertWCharToUtf8(call->szLookupName, tmp, ARRAYSIZE(tmp));
|
||||
WLog_LVL(TAG, g_LogLevel, " szLookupName=%s", tmp);
|
||||
|
||||
smartcard_log_context(TAG, &call->Common.handles.hContext);
|
||||
@ -1011,7 +1011,7 @@ static void smartcard_trace_locate_cards_by_atr_w_call(const LocateCardsByATRW_C
|
||||
(const LPSCARD_READERSTATEW)&call->rgReaderStates[index];
|
||||
|
||||
if (readerState->szReader)
|
||||
ConvertWCharToUtf8(readerState->szReader, tmp, ARRAYSIZE(tmp));
|
||||
(void)ConvertWCharToUtf8(readerState->szReader, tmp, ARRAYSIZE(tmp));
|
||||
WLog_LVL(TAG, g_LogLevel, "\t[%" PRIu32 "]: szReader: %s cbAtr: %" PRIu32 "", index, tmp,
|
||||
readerState->cbAtr);
|
||||
szCurrentState = SCardGetReaderStateString(readerState->dwCurrentState);
|
||||
@ -1307,7 +1307,7 @@ static void smartcard_trace_connect_w_call(const ConnectW_Call* call)
|
||||
return;
|
||||
|
||||
if (call->szReader)
|
||||
ConvertWCharToUtf8(call->szReader, szReaderA, ARRAYSIZE(szReaderA));
|
||||
(void)ConvertWCharToUtf8(call->szReader, szReaderA, ARRAYSIZE(szReaderA));
|
||||
WLog_LVL(TAG, g_LogLevel, "ConnectW_Call {");
|
||||
smartcard_log_context(TAG, &call->Common.handles.hContext);
|
||||
|
||||
|
@ -831,6 +831,6 @@ const WCHAR* InitializeConstWCharFromUtf8(const char* str, WCHAR* buffer, size_t
|
||||
{
|
||||
WINPR_ASSERT(str);
|
||||
WINPR_ASSERT(buffer || (len == 0));
|
||||
ConvertUtf8ToWChar(str, buffer, len);
|
||||
(void)ConvertUtf8ToWChar(str, buffer, len);
|
||||
return buffer;
|
||||
}
|
||||
|
@ -93,7 +93,8 @@ int TestString(int argc, char* argv[])
|
||||
|
||||
/* _wcslen */
|
||||
WCHAR testStringW[ARRAYSIZE(testStringA)] = { 0 };
|
||||
ConvertUtf8NToWChar(testStringA, ARRAYSIZE(testStringA), testStringW, ARRAYSIZE(testStringW));
|
||||
(void)ConvertUtf8NToWChar(testStringA, ARRAYSIZE(testStringA), testStringW,
|
||||
ARRAYSIZE(testStringW));
|
||||
const size_t testStringW_Length = testStringA_Length;
|
||||
length = _wcslen(testStringW);
|
||||
|
||||
@ -143,13 +144,15 @@ int TestString(int argc, char* argv[])
|
||||
/* wcstok_s */
|
||||
WCHAR testDelimiterW[ARRAYSIZE(testDelimiterA)] = { 0 };
|
||||
WCHAR testTokensW[ARRAYSIZE(testTokensA)] = { 0 };
|
||||
ConvertUtf8NToWChar(testTokensA, ARRAYSIZE(testTokensA), testTokensW, ARRAYSIZE(testTokensW));
|
||||
ConvertUtf8NToWChar(testDelimiterA, ARRAYSIZE(testDelimiterA), testDelimiterW,
|
||||
ARRAYSIZE(testDelimiterW));
|
||||
(void)ConvertUtf8NToWChar(testTokensA, ARRAYSIZE(testTokensA), testTokensW,
|
||||
ARRAYSIZE(testTokensW));
|
||||
(void)ConvertUtf8NToWChar(testDelimiterA, ARRAYSIZE(testDelimiterA), testDelimiterW,
|
||||
ARRAYSIZE(testDelimiterW));
|
||||
p = wcstok_s(testTokensW, testDelimiterW, &context);
|
||||
|
||||
WCHAR testToken1W[ARRAYSIZE(testToken1A)] = { 0 };
|
||||
ConvertUtf8NToWChar(testToken1A, ARRAYSIZE(testToken1A), testToken1W, ARRAYSIZE(testToken1W));
|
||||
(void)ConvertUtf8NToWChar(testToken1A, ARRAYSIZE(testToken1A), testToken1W,
|
||||
ARRAYSIZE(testToken1W));
|
||||
if (memcmp(p, testToken1W, sizeof(testToken1W)) != 0)
|
||||
{
|
||||
printf("wcstok_s error: token #1 mismatch\n");
|
||||
@ -159,7 +162,8 @@ int TestString(int argc, char* argv[])
|
||||
p = wcstok_s(NULL, testDelimiterW, &context);
|
||||
|
||||
WCHAR testToken2W[ARRAYSIZE(testToken2A)] = { 0 };
|
||||
ConvertUtf8NToWChar(testToken2A, ARRAYSIZE(testToken2A), testToken2W, ARRAYSIZE(testToken2W));
|
||||
(void)ConvertUtf8NToWChar(testToken2A, ARRAYSIZE(testToken2A), testToken2W,
|
||||
ARRAYSIZE(testToken2W));
|
||||
if (memcmp(p, testToken2W, sizeof(testToken2W)) != 0)
|
||||
{
|
||||
printf("wcstok_s error: token #2 mismatch\n");
|
||||
@ -169,7 +173,8 @@ int TestString(int argc, char* argv[])
|
||||
p = wcstok_s(NULL, testDelimiterW, &context);
|
||||
|
||||
WCHAR testToken3W[ARRAYSIZE(testToken3A)] = { 0 };
|
||||
ConvertUtf8NToWChar(testToken3A, ARRAYSIZE(testToken3A), testToken3W, ARRAYSIZE(testToken3W));
|
||||
(void)ConvertUtf8NToWChar(testToken3A, ARRAYSIZE(testToken3A), testToken3W,
|
||||
ARRAYSIZE(testToken3W));
|
||||
if (memcmp(p, testToken3W, sizeof(testToken3W)) != 0)
|
||||
{
|
||||
printf("wcstok_s error: token #3 mismatch\n");
|
||||
|
@ -76,11 +76,11 @@ static BOOL test_DsMakeSpnW(void)
|
||||
DWORD status = 0;
|
||||
DWORD SpnLength = -1;
|
||||
|
||||
ConvertUtf8NToWChar(ctestServiceClass, ARRAYSIZE(ctestServiceClass), testServiceClass,
|
||||
ARRAYSIZE(testServiceClass));
|
||||
ConvertUtf8NToWChar(ctestServiceName, ARRAYSIZE(ctestServiceName), testServiceName,
|
||||
ARRAYSIZE(testServiceName));
|
||||
ConvertUtf8NToWChar(ctestSpn, ARRAYSIZE(ctestSpn), testSpn, ARRAYSIZE(testSpn));
|
||||
(void)ConvertUtf8NToWChar(ctestServiceClass, ARRAYSIZE(ctestServiceClass), testServiceClass,
|
||||
ARRAYSIZE(testServiceClass));
|
||||
(void)ConvertUtf8NToWChar(ctestServiceName, ARRAYSIZE(ctestServiceName), testServiceName,
|
||||
ARRAYSIZE(testServiceName));
|
||||
(void)ConvertUtf8NToWChar(ctestSpn, ARRAYSIZE(ctestSpn), testSpn, ARRAYSIZE(testSpn));
|
||||
|
||||
status = DsMakeSpnW(testServiceClass, testServiceName, NULL, 0, NULL, &SpnLength, NULL);
|
||||
|
||||
@ -120,8 +120,8 @@ static BOOL test_DsMakeSpnW(void)
|
||||
char* SpnA = buffer1;
|
||||
char* testSpnA = buffer2;
|
||||
|
||||
ConvertWCharToUtf8(Spn, SpnA, ARRAYSIZE(buffer1));
|
||||
ConvertWCharToUtf8(testSpn, testSpnA, ARRAYSIZE(buffer2));
|
||||
(void)ConvertWCharToUtf8(Spn, SpnA, ARRAYSIZE(buffer1));
|
||||
(void)ConvertWCharToUtf8(testSpn, testSpnA, ARRAYSIZE(buffer2));
|
||||
printf("DsMakeSpnW: SPN mismatch: Actual: %s, Expected: %s\n", SpnA, testSpnA);
|
||||
goto fail;
|
||||
}
|
||||
@ -130,7 +130,7 @@ static BOOL test_DsMakeSpnW(void)
|
||||
char buffer[8192] = { 0 };
|
||||
char* SpnA = buffer;
|
||||
|
||||
ConvertWCharToUtf8(Spn, SpnA, ARRAYSIZE(buffer));
|
||||
(void)ConvertWCharToUtf8(Spn, SpnA, ARRAYSIZE(buffer));
|
||||
printf("DsMakeSpnW: %s\n", SpnA);
|
||||
}
|
||||
|
||||
|
@ -1343,7 +1343,7 @@ DWORD GetFullPathNameA(LPCSTR lpFileName, DWORD nBufferLength, LPSTR lpBuffer, L
|
||||
|
||||
dwStatus = GetFullPathNameW(lpFileNameW, nBufferLengthW, lpBufferW, &lpFilePartW);
|
||||
|
||||
ConvertWCharNToUtf8(lpBufferW, nBufferLengthW / sizeof(WCHAR), lpBuffer, nBufferLength);
|
||||
(void)ConvertWCharNToUtf8(lpBufferW, nBufferLengthW / sizeof(WCHAR), lpBuffer, nBufferLength);
|
||||
|
||||
if (lpFilePart)
|
||||
lpFilePart = lpBuffer + (lpFilePartW - lpBufferW);
|
||||
|
@ -15,7 +15,7 @@ int TestFileDeleteFile(int argc, char* argv[])
|
||||
const char invalidA[] = "/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
|
||||
WCHAR invalidW[sizeof(invalidA)] = { 0 };
|
||||
|
||||
ConvertUtf8NToWChar(invalidA, ARRAYSIZE(invalidA), invalidW, ARRAYSIZE(invalidW));
|
||||
(void)ConvertUtf8NToWChar(invalidA, ARRAYSIZE(invalidA), invalidW, ARRAYSIZE(invalidW));
|
||||
|
||||
WINPR_UNUSED(argc);
|
||||
WINPR_UNUSED(argv);
|
||||
|
@ -264,7 +264,7 @@ static int TestFileFindFirstFileW(const char* str)
|
||||
|
||||
WCHAR BasePath[PATHCCH_MAX_CCH] = { 0 };
|
||||
|
||||
ConvertUtf8ToWChar(str, BasePath, ARRAYSIZE(BasePath));
|
||||
(void)ConvertUtf8ToWChar(str, BasePath, ARRAYSIZE(BasePath));
|
||||
|
||||
const size_t length = _wcsnlen(BasePath, PATHCCH_MAX_CCH - 1);
|
||||
|
||||
@ -275,7 +275,7 @@ static int TestFileFindFirstFileW(const char* str)
|
||||
NativePathCchAppendW(FilePath, PATHCCH_MAX_CCH, testFile1W);
|
||||
|
||||
CHAR FilePathA[PATHCCH_MAX_CCH] = { 0 };
|
||||
ConvertWCharNToUtf8(FilePath, ARRAYSIZE(FilePath), FilePathA, ARRAYSIZE(FilePathA));
|
||||
(void)ConvertWCharNToUtf8(FilePath, ARRAYSIZE(FilePath), FilePathA, ARRAYSIZE(FilePathA));
|
||||
printf("Finding file: %s\n", FilePathA);
|
||||
|
||||
WIN32_FIND_DATAW FindData = { 0 };
|
||||
@ -288,8 +288,8 @@ static int TestFileFindFirstFileW(const char* str)
|
||||
}
|
||||
|
||||
CHAR cFileName[MAX_PATH] = { 0 };
|
||||
ConvertWCharNToUtf8(FindData.cFileName, ARRAYSIZE(FindData.cFileName), cFileName,
|
||||
ARRAYSIZE(cFileName));
|
||||
(void)ConvertWCharNToUtf8(FindData.cFileName, ARRAYSIZE(FindData.cFileName), cFileName,
|
||||
ARRAYSIZE(cFileName));
|
||||
|
||||
printf("FindFirstFile: %s", cFileName);
|
||||
|
||||
|
@ -159,7 +159,7 @@ SECURITY_STATUS winpr_NCryptOpenStorageProviderEx(NCRYPT_PROV_HANDLE* phProvider
|
||||
return NCryptOpenP11StorageProviderEx(phProvider, pszProviderName, dwFlags, modulePaths);
|
||||
|
||||
char buffer[128] = { 0 };
|
||||
ConvertWCharToUtf8(pszProviderName, buffer, sizeof(buffer));
|
||||
(void)ConvertWCharToUtf8(pszProviderName, buffer, sizeof(buffer));
|
||||
WLog_WARN(TAG, "provider '%s' not supported", buffer);
|
||||
return ERROR_NOT_SUPPORTED;
|
||||
#else
|
||||
|
@ -568,8 +568,8 @@ static void wprintKeyName(LPWSTR str, CK_SLOT_ID slotId, CK_BYTE* id, CK_ULONG i
|
||||
for (CK_ULONG i = 0; i < idLen; i++, id++, ptr += 2)
|
||||
(void)snprintf(ptr, 3, "%.2x", *id);
|
||||
|
||||
ConvertUtf8NToWChar(asciiName, ARRAYSIZE(asciiName), str,
|
||||
strnlen(asciiName, ARRAYSIZE(asciiName)) + 1);
|
||||
(void)ConvertUtf8NToWChar(asciiName, ARRAYSIZE(asciiName), str,
|
||||
strnlen(asciiName, ARRAYSIZE(asciiName)) + 1);
|
||||
}
|
||||
|
||||
static size_t parseHex(const char* str, const char* end, CK_BYTE* target)
|
||||
|
@ -42,7 +42,7 @@ int TestNCryptProviders(int argc, char* argv[])
|
||||
const NCryptProviderName* provider = &providers[i];
|
||||
char providerNameStr[256] = { 0 };
|
||||
|
||||
ConvertWCharToUtf8(provider->pszName, providerNameStr, ARRAYSIZE(providerNameStr));
|
||||
(void)ConvertWCharToUtf8(provider->pszName, providerNameStr, ARRAYSIZE(providerNameStr));
|
||||
printf("%d: %s\n", i, providerNameStr);
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ int TestNCryptSmartcard(int argc, char* argv[])
|
||||
{
|
||||
char readerStr[1024] = { 0 };
|
||||
|
||||
ConvertWCharNToUtf8(reader, cbOutput, readerStr, ARRAYSIZE(readerStr));
|
||||
(void)ConvertWCharNToUtf8(reader, cbOutput, readerStr, ARRAYSIZE(readerStr));
|
||||
printf("\treader: %s\n", readerStr);
|
||||
}
|
||||
|
||||
|
@ -1658,7 +1658,7 @@ static LONG WINAPI PCSC_SCardGetStatusChangeW(SCARDCONTEXT hContext, DWORD dwTim
|
||||
|
||||
if (!states)
|
||||
{
|
||||
PCSC_UnlockCardContext(hContext);
|
||||
(void)PCSC_UnlockCardContext(hContext);
|
||||
return SCARD_E_NO_MEMORY;
|
||||
}
|
||||
|
||||
|
@ -541,11 +541,11 @@ static BOOL map_iana_id(const char* iana, LPDYNAMIC_TIME_ZONE_INFORMATION tz)
|
||||
const char* winDst = TimeZoneIanaToWindows(iana, TIME_ZONE_NAME_DAYLIGHT);
|
||||
|
||||
if (winStd)
|
||||
ConvertUtf8ToWChar(winStd, tz->StandardName, ARRAYSIZE(tz->StandardName));
|
||||
(void)ConvertUtf8ToWChar(winStd, tz->StandardName, ARRAYSIZE(tz->StandardName));
|
||||
if (winDst)
|
||||
ConvertUtf8ToWChar(winDst, tz->DaylightName, ARRAYSIZE(tz->DaylightName));
|
||||
(void)ConvertUtf8ToWChar(winDst, tz->DaylightName, ARRAYSIZE(tz->DaylightName));
|
||||
if (winId)
|
||||
ConvertUtf8ToWChar(winId, tz->TimeZoneKeyName, ARRAYSIZE(tz->TimeZoneKeyName));
|
||||
(void)ConvertUtf8ToWChar(winId, tz->TimeZoneKeyName, ARRAYSIZE(tz->TimeZoneKeyName));
|
||||
|
||||
return winId != NULL;
|
||||
}
|
||||
@ -613,21 +613,21 @@ static void log_timezone_(const DYNAMIC_TIME_ZONE_INFORMATION* tzif, DWORD resul
|
||||
log_print(log, level, file, fkt, line, "DYNAMIC_TIME_ZONE_INFORMATION {");
|
||||
|
||||
log_print(log, level, file, fkt, line, " Bias=%" PRIu32, tzif->Bias);
|
||||
ConvertWCharNToUtf8(tzif->StandardName, ARRAYSIZE(tzif->StandardName), buffer,
|
||||
ARRAYSIZE(buffer));
|
||||
(void)ConvertWCharNToUtf8(tzif->StandardName, ARRAYSIZE(tzif->StandardName), buffer,
|
||||
ARRAYSIZE(buffer));
|
||||
log_print(log, level, file, fkt, line, " StandardName=%s", buffer);
|
||||
log_print(log, level, file, fkt, line, " StandardDate=%s",
|
||||
systemtime2str(&tzif->StandardDate, buffer, sizeof(buffer)));
|
||||
log_print(log, level, file, fkt, line, " StandardBias=%" PRIu32, tzif->StandardBias);
|
||||
|
||||
ConvertWCharNToUtf8(tzif->DaylightName, ARRAYSIZE(tzif->DaylightName), buffer,
|
||||
ARRAYSIZE(buffer));
|
||||
(void)ConvertWCharNToUtf8(tzif->DaylightName, ARRAYSIZE(tzif->DaylightName), buffer,
|
||||
ARRAYSIZE(buffer));
|
||||
log_print(log, level, file, fkt, line, " DaylightName=%s", buffer);
|
||||
log_print(log, level, file, fkt, line, " DaylightDate=%s",
|
||||
systemtime2str(&tzif->DaylightDate, buffer, sizeof(buffer)));
|
||||
log_print(log, level, file, fkt, line, " DaylightBias=%" PRIu32, tzif->DaylightBias);
|
||||
ConvertWCharNToUtf8(tzif->TimeZoneKeyName, ARRAYSIZE(tzif->TimeZoneKeyName), buffer,
|
||||
ARRAYSIZE(buffer));
|
||||
(void)ConvertWCharNToUtf8(tzif->TimeZoneKeyName, ARRAYSIZE(tzif->TimeZoneKeyName), buffer,
|
||||
ARRAYSIZE(buffer));
|
||||
log_print(log, level, file, fkt, line, " TimeZoneKeyName=%s", buffer);
|
||||
log_print(log, level, file, fkt, line, " DynamicDaylightTimeDisabled=DST-%s",
|
||||
tzif->DynamicDaylightTimeDisabled ? "disabled" : "enabled");
|
||||
@ -751,7 +751,7 @@ DWORD GetDynamicTimeZoneInformation(PDYNAMIC_TIME_ZONE_INFORMATION tz)
|
||||
WINPR_ASSERT(tz);
|
||||
|
||||
*tz = empty;
|
||||
ConvertUtf8ToWChar(defaultName, tz->StandardName, ARRAYSIZE(tz->StandardName));
|
||||
(void)ConvertUtf8ToWChar(defaultName, tz->StandardName, ARRAYSIZE(tz->StandardName));
|
||||
|
||||
const time_t t = time(NULL);
|
||||
struct tm tres = { 0 };
|
||||
@ -858,14 +858,14 @@ DWORD EnumDynamicTimeZoneInformation(const DWORD dwIndex,
|
||||
return ERROR_NO_MORE_ITEMS;
|
||||
|
||||
if (entry->DaylightName)
|
||||
ConvertUtf8ToWChar(entry->DaylightName, lpTimeZoneInformation->DaylightName,
|
||||
ARRAYSIZE(lpTimeZoneInformation->DaylightName));
|
||||
(void)ConvertUtf8ToWChar(entry->DaylightName, lpTimeZoneInformation->DaylightName,
|
||||
ARRAYSIZE(lpTimeZoneInformation->DaylightName));
|
||||
if (entry->StandardName)
|
||||
ConvertUtf8ToWChar(entry->StandardName, lpTimeZoneInformation->StandardName,
|
||||
ARRAYSIZE(lpTimeZoneInformation->StandardName));
|
||||
(void)ConvertUtf8ToWChar(entry->StandardName, lpTimeZoneInformation->StandardName,
|
||||
ARRAYSIZE(lpTimeZoneInformation->StandardName));
|
||||
if (entry->Id)
|
||||
ConvertUtf8ToWChar(entry->Id, lpTimeZoneInformation->TimeZoneKeyName,
|
||||
ARRAYSIZE(lpTimeZoneInformation->TimeZoneKeyName));
|
||||
(void)ConvertUtf8ToWChar(entry->Id, lpTimeZoneInformation->TimeZoneKeyName,
|
||||
ARRAYSIZE(lpTimeZoneInformation->TimeZoneKeyName));
|
||||
|
||||
const time_t t = time(NULL);
|
||||
struct tm tres = { 0 };
|
||||
|
Loading…
Reference in New Issue
Block a user