From cd18dea17452cf3d930b1448809c60394ae9bde7 Mon Sep 17 00:00:00 2001 From: akallabeth Date: Mon, 16 Sep 2024 05:14:10 +0200 Subject: [PATCH] [return checks] fix use of unicode functions --- channels/drive/client/drive_file.c | 14 ++++---- client/Windows/wf_client.c | 15 +++++---- client/common/client_cliprdr_file.c | 4 +-- client/common/cmdline.c | 8 ++--- libfreerdp/core/childsession.c | 2 +- libfreerdp/core/smartcardlogon.c | 4 +-- libfreerdp/core/timezone.c | 8 ++--- libfreerdp/utils/rdpdr_utils.c | 4 +-- libfreerdp/utils/smartcard_pack.c | 16 +++++----- winpr/libwinpr/crt/string.c | 2 +- winpr/libwinpr/crt/test/TestString.c | 19 +++++++---- winpr/libwinpr/dsparse/test/TestDsMakeSpn.c | 16 +++++----- winpr/libwinpr/file/file.c | 2 +- winpr/libwinpr/file/test/TestFileDeleteFile.c | 2 +- .../file/test/TestFileFindFirstFile.c | 8 ++--- winpr/libwinpr/ncrypt/ncrypt.c | 2 +- winpr/libwinpr/ncrypt/ncrypt_pkcs11.c | 4 +-- .../ncrypt/test/TestNCryptProviders.c | 2 +- .../ncrypt/test/TestNCryptSmartcard.c | 2 +- winpr/libwinpr/smartcard/smartcard_pcsc.c | 2 +- winpr/libwinpr/timezone/timezone.c | 32 +++++++++---------- 21 files changed, 87 insertions(+), 81 deletions(-) diff --git a/channels/drive/client/drive_file.c b/channels/drive/client/drive_file.c index ed66592e2..fef202687 100644 --- a/channels/drive/client/drive_file.c +++ b/channels/drive/client/drive_file.c @@ -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]); diff --git a/client/Windows/wf_client.c b/client/Windows/wf_client.c index c7dbb2820..59f924f24 100644 --- a/client/Windows/wf_client.c +++ b/client/Windows/wf_client.c @@ -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; diff --git a/client/common/client_cliprdr_file.c b/client/common/client_cliprdr_file.c index 84f3a292d..34cdefef3 100644 --- a/client/common/client_cliprdr_file.c +++ b/client/common/client_cliprdr_file.c @@ -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); diff --git a/client/common/cmdline.c b/client/common/cmdline.c index 263640830..00e6c7cf8 100644 --- a/client/common/cmdline.c +++ b/client/common/cmdline.c @@ -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) diff --git a/libfreerdp/core/childsession.c b/libfreerdp/core/childsession.c index cb863c36a..17a9e0b46 100644 --- a/libfreerdp/core/childsession.c +++ b/libfreerdp/core/childsession.c @@ -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, diff --git a/libfreerdp/core/smartcardlogon.c b/libfreerdp/core/smartcardlogon.c index 95192324e..32d4bb357 100644 --- a/libfreerdp/core/smartcardlogon.c +++ b/libfreerdp/core/smartcardlogon.c @@ -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; diff --git a/libfreerdp/core/timezone.c b/libfreerdp/core/timezone.c index b16a30003..4facc0874 100644 --- a/libfreerdp/core/timezone.c +++ b/libfreerdp/core/timezone.c @@ -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))); diff --git a/libfreerdp/utils/rdpdr_utils.c b/libfreerdp/utils/rdpdr_utils.c index 28cc97f29..d92d16225 100644 --- a/libfreerdp/utils/rdpdr_utils.c +++ b/libfreerdp/utils/rdpdr_utils.c @@ -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 diff --git a/libfreerdp/utils/smartcard_pack.c b/libfreerdp/utils/smartcard_pack.c index e225549be..a83abf9f6 100644 --- a/libfreerdp/utils/smartcard_pack.c +++ b/libfreerdp/utils/smartcard_pack.c @@ -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); diff --git a/winpr/libwinpr/crt/string.c b/winpr/libwinpr/crt/string.c index 22b3feece..e385276f7 100644 --- a/winpr/libwinpr/crt/string.c +++ b/winpr/libwinpr/crt/string.c @@ -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; } diff --git a/winpr/libwinpr/crt/test/TestString.c b/winpr/libwinpr/crt/test/TestString.c index cb7d0fbcd..9eda33e84 100644 --- a/winpr/libwinpr/crt/test/TestString.c +++ b/winpr/libwinpr/crt/test/TestString.c @@ -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"); diff --git a/winpr/libwinpr/dsparse/test/TestDsMakeSpn.c b/winpr/libwinpr/dsparse/test/TestDsMakeSpn.c index dcaf6350e..91aa87923 100644 --- a/winpr/libwinpr/dsparse/test/TestDsMakeSpn.c +++ b/winpr/libwinpr/dsparse/test/TestDsMakeSpn.c @@ -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); } diff --git a/winpr/libwinpr/file/file.c b/winpr/libwinpr/file/file.c index 046417f4c..f43e38f26 100644 --- a/winpr/libwinpr/file/file.c +++ b/winpr/libwinpr/file/file.c @@ -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); diff --git a/winpr/libwinpr/file/test/TestFileDeleteFile.c b/winpr/libwinpr/file/test/TestFileDeleteFile.c index 81f05997c..500693133 100644 --- a/winpr/libwinpr/file/test/TestFileDeleteFile.c +++ b/winpr/libwinpr/file/test/TestFileDeleteFile.c @@ -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); diff --git a/winpr/libwinpr/file/test/TestFileFindFirstFile.c b/winpr/libwinpr/file/test/TestFileFindFirstFile.c index 4242f39c8..b40254840 100644 --- a/winpr/libwinpr/file/test/TestFileFindFirstFile.c +++ b/winpr/libwinpr/file/test/TestFileFindFirstFile.c @@ -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); diff --git a/winpr/libwinpr/ncrypt/ncrypt.c b/winpr/libwinpr/ncrypt/ncrypt.c index c3fb7584e..d5b6e5f89 100644 --- a/winpr/libwinpr/ncrypt/ncrypt.c +++ b/winpr/libwinpr/ncrypt/ncrypt.c @@ -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 diff --git a/winpr/libwinpr/ncrypt/ncrypt_pkcs11.c b/winpr/libwinpr/ncrypt/ncrypt_pkcs11.c index 6a609d50c..8fc9aed33 100644 --- a/winpr/libwinpr/ncrypt/ncrypt_pkcs11.c +++ b/winpr/libwinpr/ncrypt/ncrypt_pkcs11.c @@ -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) diff --git a/winpr/libwinpr/ncrypt/test/TestNCryptProviders.c b/winpr/libwinpr/ncrypt/test/TestNCryptProviders.c index 8381e68d8..e27cf90d0 100644 --- a/winpr/libwinpr/ncrypt/test/TestNCryptProviders.c +++ b/winpr/libwinpr/ncrypt/test/TestNCryptProviders.c @@ -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); } diff --git a/winpr/libwinpr/ncrypt/test/TestNCryptSmartcard.c b/winpr/libwinpr/ncrypt/test/TestNCryptSmartcard.c index 06d81c888..34560ba2f 100644 --- a/winpr/libwinpr/ncrypt/test/TestNCryptSmartcard.c +++ b/winpr/libwinpr/ncrypt/test/TestNCryptSmartcard.c @@ -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); } diff --git a/winpr/libwinpr/smartcard/smartcard_pcsc.c b/winpr/libwinpr/smartcard/smartcard_pcsc.c index 239f309d5..a719d269d 100644 --- a/winpr/libwinpr/smartcard/smartcard_pcsc.c +++ b/winpr/libwinpr/smartcard/smartcard_pcsc.c @@ -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; } diff --git a/winpr/libwinpr/timezone/timezone.c b/winpr/libwinpr/timezone/timezone.c index 4348ead59..6c1a02666 100644 --- a/winpr/libwinpr/timezone/timezone.c +++ b/winpr/libwinpr/timezone/timezone.c @@ -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 };