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