dmloader: Use wide-char string literals.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2020-01-21 22:24:45 +01:00 committed by Alexandre Julliard
parent 1fa427f2d0
commit 4915c51ea6
2 changed files with 9 additions and 10 deletions

View File

@ -621,7 +621,6 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_SetSearchDirectory(IDirectMusicLoad
static HRESULT WINAPI IDirectMusicLoaderImpl_ScanDirectory(IDirectMusicLoader8 *iface, REFGUID rguidClass, WCHAR *pwzFileExtension, WCHAR *pwzScanFileName) static HRESULT WINAPI IDirectMusicLoaderImpl_ScanDirectory(IDirectMusicLoader8 *iface, REFGUID rguidClass, WCHAR *pwzFileExtension, WCHAR *pwzScanFileName)
{ {
IDirectMusicLoaderImpl *This = impl_from_IDirectMusicLoader8(iface); IDirectMusicLoaderImpl *This = impl_from_IDirectMusicLoader8(iface);
static const WCHAR wszAny[] = {'*',0};
WIN32_FIND_DATAW FileData; WIN32_FIND_DATAW FileData;
HANDLE hSearch; HANDLE hSearch;
WCHAR wszSearchString[MAX_PATH]; WCHAR wszSearchString[MAX_PATH];
@ -643,11 +642,12 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_ScanDirectory(IDirectMusicLoader8 *
p = wszSearchString + lstrlenW(wszSearchString); p = wszSearchString + lstrlenW(wszSearchString);
if (p > wszSearchString && p[-1] != '\\') *p++ = '\\'; if (p > wszSearchString && p[-1] != '\\') *p++ = '\\';
*p++ = '*'; /* any file */ *p++ = '*'; /* any file */
if (lstrcmpW (pwzFileExtension, wszAny)) *p++ = '.'; /* if we have actual extension, put a dot */ if (lstrcmpW (pwzFileExtension, L"*"))
*p++ = '.'; /* if we have actual extension, put a dot */
lstrcpyW (p, pwzFileExtension); lstrcpyW (p, pwzFileExtension);
TRACE(": search string: %s\n", debugstr_w(wszSearchString)); TRACE(": search string: %s\n", debugstr_w(wszSearchString));
hSearch = FindFirstFileW (wszSearchString, &FileData); hSearch = FindFirstFileW (wszSearchString, &FileData);
if (hSearch == INVALID_HANDLE_VALUE) { if (hSearch == INVALID_HANDLE_VALUE) {
TRACE(": no files found\n"); TRACE(": no files found\n");

View File

@ -48,10 +48,10 @@ static void test_directory(void)
{ {
IDirectMusicLoader8 *loader = NULL; IDirectMusicLoader8 *loader = NULL;
HRESULT hr; HRESULT hr;
WCHAR con[] = {'c', 'o', 'n', 0}; WCHAR con[] = L"con";
WCHAR empty[] = L"";
WCHAR invalid_path[] = L"/invalid path";
WCHAR path[MAX_PATH]; WCHAR path[MAX_PATH];
WCHAR empty[] = {0};
WCHAR invalid_path[] = {'/', 'i', 'n', 'v', 'a', 'l', 'i', 'd', ' ', 'p', 'a', 't', 'h', 0};
hr = CoCreateInstance(&CLSID_DirectMusicLoader, NULL, CLSCTX_INPROC, &IID_IDirectMusicLoader8, hr = CoCreateInstance(&CLSID_DirectMusicLoader, NULL, CLSCTX_INPROC, &IID_IDirectMusicLoader8,
(void**)&loader); (void**)&loader);
@ -477,7 +477,6 @@ static void test_parsedescriptor(void)
DMUS_OBJECTDESC desc; DMUS_OBJECTDESC desc;
HRESULT hr; HRESULT hr;
DWORD valid; DWORD valid;
const WCHAR s_unam[] = {'U','N','A','M','\0'};
const FOURCC alldesc[] = const FOURCC alldesc[] =
{ {
FOURCC_RIFF, DMUS_FOURCC_CONTAINER_FORM, DMUS_FOURCC_CATEGORY_CHUNK, FOURCC_LIST, FOURCC_RIFF, DMUS_FOURCC_CONTAINER_FORM, DMUS_FOURCC_CATEGORY_CHUNK, FOURCC_LIST,
@ -562,7 +561,7 @@ static void test_parsedescriptor(void)
wine_dbgstr_guid(&desc.guidClass)); wine_dbgstr_guid(&desc.guidClass));
ok(IsEqualGUID(&desc.guidObject, &GUID_NULL), "Got object guid %s, expected GUID_NULL\n", ok(IsEqualGUID(&desc.guidObject, &GUID_NULL), "Got object guid %s, expected GUID_NULL\n",
wine_dbgstr_guid(&desc.guidClass)); wine_dbgstr_guid(&desc.guidClass));
ok(!memcmp(desc.wszName, s_unam, sizeof(s_unam)), "Got name '%s', expected 'UNAM'\n", ok(!lstrcmpW(desc.wszName, L"UNAM"), "Got name '%s', expected 'UNAM'\n",
wine_dbgstr_w(desc.wszName)); wine_dbgstr_w(desc.wszName));
IStream_Release(stream); IStream_Release(stream);
@ -596,7 +595,7 @@ static void test_parsedescriptor(void)
ok(hr == S_OK, "ParseDescriptor failed: %08x, expected S_OK\n", hr); ok(hr == S_OK, "ParseDescriptor failed: %08x, expected S_OK\n", hr);
valid = DMUS_OBJ_OBJECT|DMUS_OBJ_CLASS|DMUS_OBJ_NAME|DMUS_OBJ_CATEGORY|DMUS_OBJ_VERSION; valid = DMUS_OBJ_OBJECT|DMUS_OBJ_CLASS|DMUS_OBJ_NAME|DMUS_OBJ_CATEGORY|DMUS_OBJ_VERSION;
ok(desc.dwValidData == valid, "Got valid data %#x, expected %#x\n", desc.dwValidData, valid); ok(desc.dwValidData == valid, "Got valid data %#x, expected %#x\n", desc.dwValidData, valid);
ok(!memcmp(desc.wszName, s_unam, sizeof(s_unam)), "Got name '%s', expected 'UNAM'\n", ok(!lstrcmpW(desc.wszName, L"UNAM"), "Got name '%s', expected 'UNAM'\n",
wine_dbgstr_w(desc.wszName)); wine_dbgstr_w(desc.wszName));
IStream_Release(stream); IStream_Release(stream);