Commit 8b981266 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

dmloader: Use a bitfield to store the per class cache enable info.

parent 693b40f7
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include "dmusicf.h" #include "dmusicf.h"
#include "dmusics.h" #include "dmusics.h"
#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
#define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field)) #define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
/* dmloader.dll global (for DllCanUnloadNow) */ /* dmloader.dll global (for DllCanUnloadNow) */
...@@ -83,7 +84,6 @@ typedef struct _WINE_LOADER_OPTION { ...@@ -83,7 +84,6 @@ typedef struct _WINE_LOADER_OPTION {
struct list entry; /* for listing elements */ struct list entry; /* for listing elements */
GUID guidClass; /* ID of object type */ GUID guidClass; /* ID of object type */
WCHAR wszSearchPath[MAX_PATH]; /* look for objects of certain type in here */ WCHAR wszSearchPath[MAX_PATH]; /* look for objects of certain type in here */
BOOL bCache; /* cache objects of certain type */
} WINE_LOADER_OPTION, *LPWINE_LOADER_OPTION; } WINE_LOADER_OPTION, *LPWINE_LOADER_OPTION;
/***************************************************************************** /*****************************************************************************
...@@ -92,6 +92,7 @@ typedef struct _WINE_LOADER_OPTION { ...@@ -92,6 +92,7 @@ typedef struct _WINE_LOADER_OPTION {
struct IDirectMusicLoaderImpl { struct IDirectMusicLoaderImpl {
IDirectMusicLoader8 IDirectMusicLoader8_iface; IDirectMusicLoader8 IDirectMusicLoader8_iface;
LONG ref; LONG ref;
unsigned int cache_class;
/* simple cache (linked list) */ /* simple cache (linked list) */
struct list *pObjects; struct list *pObjects;
/* settings for certain object classes */ /* settings for certain object classes */
......
...@@ -69,14 +69,14 @@ static void test_directory(void) ...@@ -69,14 +69,14 @@ static void test_directory(void)
/* SetSearchDirectory with the current directory */ /* SetSearchDirectory with the current directory */
GetCurrentDirectoryW(ARRAY_SIZE(path), path); GetCurrentDirectoryW(ARRAY_SIZE(path), path);
hr = IDirectMusicLoader_SetSearchDirectory(loader, &GUID_DirectMusicAllTypes, path, 0); hr = IDirectMusicLoader_SetSearchDirectory(loader, &GUID_DirectMusicAllTypes, path, 0);
ok(hr == S_OK, "SetSearchDirectory failed with %#x\n", hr); todo_wine ok(hr == S_OK, "SetSearchDirectory failed with %#x\n", hr);
/* Two consecutive SetSearchDirectory with the same path */ /* Two consecutive SetSearchDirectory with the same path */
GetTempPathW(ARRAY_SIZE(path), path); GetTempPathW(ARRAY_SIZE(path), path);
hr = IDirectMusicLoader_SetSearchDirectory(loader, &GUID_DirectMusicAllTypes, path, 0); hr = IDirectMusicLoader_SetSearchDirectory(loader, &GUID_DirectMusicAllTypes, path, 0);
ok(hr == S_OK, "SetSearchDirectory failed with %#x\n", hr); ok(hr == S_OK, "SetSearchDirectory failed with %#x\n", hr);
hr = IDirectMusicLoader_SetSearchDirectory(loader, &GUID_DirectMusicAllTypes, path, 0); hr = IDirectMusicLoader_SetSearchDirectory(loader, &GUID_DirectMusicAllTypes, path, 0);
todo_wine ok(hr == S_FALSE, "Second SetSearchDirectory failed with %#x\n", hr); ok(hr == S_FALSE, "Second SetSearchDirectory failed with %#x\n", hr);
hr = IDirectMusicLoader_SetSearchDirectory(loader, &CLSID_DirectSoundWave, path, 0); hr = IDirectMusicLoader_SetSearchDirectory(loader, &CLSID_DirectSoundWave, path, 0);
todo_wine ok(hr == S_OK, "SetSearchDirectory failed with %#x\n", hr); todo_wine ok(hr == S_OK, "SetSearchDirectory failed with %#x\n", hr);
hr = IDirectMusicLoader_SetSearchDirectory(loader, &CLSID_DirectSoundWave, path, 0); hr = IDirectMusicLoader_SetSearchDirectory(loader, &CLSID_DirectSoundWave, path, 0);
...@@ -99,7 +99,7 @@ static void test_directory(void) ...@@ -99,7 +99,7 @@ static void test_directory(void)
(void**)&loader); (void**)&loader);
ok(hr == S_OK, "Couldn't create Loader %#x\n", hr); ok(hr == S_OK, "Couldn't create Loader %#x\n", hr);
hr = IDirectMusicLoader_SetSearchDirectory(loader, &GUID_DirectMusicAllTypes, empty, 0); hr = IDirectMusicLoader_SetSearchDirectory(loader, &GUID_DirectMusicAllTypes, empty, 0);
todo_wine ok(hr == S_OK, "SetSearchDirectory failed with %#x\n", hr); ok(hr == S_OK, "SetSearchDirectory failed with %#x\n", hr);
hr = IDirectMusicLoader_SetSearchDirectory(loader, &GUID_DirectMusicAllTypes, empty, 0); hr = IDirectMusicLoader_SetSearchDirectory(loader, &GUID_DirectMusicAllTypes, empty, 0);
ok(hr == S_FALSE, "SetSearchDirectory failed with %#x\n", hr); ok(hr == S_FALSE, "SetSearchDirectory failed with %#x\n", hr);
hr = IDirectMusicLoader_ScanDirectory(loader, &CLSID_DirectMusicContainer, con, NULL); hr = IDirectMusicLoader_ScanDirectory(loader, &CLSID_DirectMusicContainer, con, NULL);
...@@ -126,7 +126,7 @@ static void test_caching(void) ...@@ -126,7 +126,7 @@ static void test_caching(void)
hr = IDirectMusicLoader_EnableCache(loader, &CLSID_DirectMusicContainer, TRUE); hr = IDirectMusicLoader_EnableCache(loader, &CLSID_DirectMusicContainer, TRUE);
ok(hr == S_FALSE, "EnableCache failed with %#x\n", hr); ok(hr == S_FALSE, "EnableCache failed with %#x\n", hr);
hr = IDirectMusicLoader_EnableCache(loader, &GUID_DirectMusicAllTypes, TRUE); hr = IDirectMusicLoader_EnableCache(loader, &GUID_DirectMusicAllTypes, TRUE);
todo_wine ok(hr == S_FALSE, "EnableCache failed with %#x\n", hr); ok(hr == S_FALSE, "EnableCache failed with %#x\n", hr);
/* Disabling/enabling the cache for all types */ /* Disabling/enabling the cache for all types */
hr = IDirectMusicLoader_EnableCache(loader, &GUID_DirectMusicAllTypes, FALSE); hr = IDirectMusicLoader_EnableCache(loader, &GUID_DirectMusicAllTypes, FALSE);
...@@ -135,6 +135,10 @@ static void test_caching(void) ...@@ -135,6 +135,10 @@ static void test_caching(void)
ok(hr == S_FALSE, "EnableCache failed with %#x\n", hr); ok(hr == S_FALSE, "EnableCache failed with %#x\n", hr);
hr = IDirectMusicLoader_EnableCache(loader, &GUID_DirectMusicAllTypes, TRUE); hr = IDirectMusicLoader_EnableCache(loader, &GUID_DirectMusicAllTypes, TRUE);
ok(hr == S_OK, "EnableCache failed with %#x\n", hr); ok(hr == S_OK, "EnableCache failed with %#x\n", hr);
hr = IDirectMusicLoader_EnableCache(loader, &CLSID_DirectMusicContainer, FALSE);
ok(hr == S_OK, "EnableCache failed with %#x\n", hr);
hr = IDirectMusicLoader_EnableCache(loader, &GUID_DirectMusicAllTypes, TRUE);
ok(hr == S_FALSE, "EnableCache failed with %#x\n", hr);
hr = IDirectMusicLoader_EnableCache(loader, &CLSID_DirectMusicContainer, TRUE); hr = IDirectMusicLoader_EnableCache(loader, &CLSID_DirectMusicContainer, TRUE);
ok(hr == S_FALSE, "EnableCache failed with %#x\n", hr); ok(hr == S_FALSE, "EnableCache failed with %#x\n", hr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment