[unicode] fix definition of _wcschr search char

This commit is contained in:
Armin Novak
2023-12-12 10:24:19 +01:00
committed by akallabeth
parent da49127a78
commit 28e5167435
2 changed files with 19 additions and 4 deletions

View File

@@ -363,7 +363,15 @@ static BOOL printer_load_from_config(const rdpSettings* settings, rdpPrinter* pr
if (!Stream_EnsureRemainingCapacity(printer_dev->device.data, PrinterNameLen))
goto fail;
for (wptr = wname; (wptr = _wcschr(wptr, L'\\'));)
union
{
char c[2];
WCHAR w;
} backslash;
backslash.c[0] = '\\';
backslash.c[1] = '\0';
for (wptr = wname; (wptr = _wcschr(wptr, backslash.w));)
*wptr = L'_';
Stream_Write(printer_dev->device.data, wname, PrinterNameLen);

View File

@@ -692,7 +692,14 @@ static void* convert_filedescriptors_to_file_list(wClipboard* clipboard, UINT32
const char* header, const char* lineprefix,
const char* lineending, BOOL skip_last_lineending)
{
const WCHAR backslash = '\\';
union
{
char c[2];
WCHAR w;
} backslash;
backslash.c[0] = '\\';
backslash.c[1] = '\0';
const FILEDESCRIPTORW* descriptors = NULL;
UINT32 nrDescriptors = 0;
size_t count, x, alloc, pos, baseLength = 0;
@@ -740,7 +747,7 @@ static void* convert_filedescriptors_to_file_list(wClipboard* clipboard, UINT32
{
const FILEDESCRIPTORW* dsc = &descriptors[x];
if (_wcschr(dsc->cFileName, backslash) == NULL)
if (_wcschr(dsc->cFileName, backslash.w) == NULL)
{
alloc += ARRAYSIZE(dsc->cFileName) *
8; /* Overallocate, just take the biggest value the result path can have */
@@ -766,7 +773,7 @@ static void* convert_filedescriptors_to_file_list(wClipboard* clipboard, UINT32
{
const FILEDESCRIPTORW* dsc = &descriptors[x];
BOOL fail = TRUE;
if (_wcschr(dsc->cFileName, backslash) != NULL)
if (_wcschr(dsc->cFileName, backslash.w) != NULL)
{
continue;
}