devenum: Use switch statements for moniker type handling.
Fixes -Wsometimes-uninitialized clang warnings by using DEFAULT_UNREACHABLE.
This commit is contained in:
parent
68f8b53d69
commit
4d2d6666db
1 changed files with 21 additions and 14 deletions
|
@ -124,8 +124,9 @@ static HRESULT WINAPI property_bag_Read(IPropertyBag *iface,
|
|||
if (!name || !var)
|
||||
return E_POINTER;
|
||||
|
||||
if (moniker->type == DEVICE_DMO)
|
||||
switch (moniker->type)
|
||||
{
|
||||
case DEVICE_DMO:
|
||||
if (!wcscmp(name, L"FriendlyName"))
|
||||
{
|
||||
if (SUCCEEDED(hr = DMOGetName(&moniker->clsid, dmo_name)))
|
||||
|
@ -135,7 +136,7 @@ static HRESULT WINAPI property_bag_Read(IPropertyBag *iface,
|
|||
}
|
||||
return hr;
|
||||
}
|
||||
else if (!wcscmp(name, L"FilterData"))
|
||||
if (!wcscmp(name, L"FilterData"))
|
||||
{
|
||||
DMO_PARTIAL_MEDIATYPE *types = NULL, *new_array;
|
||||
ULONG count = 1, input_count, output_count, i;
|
||||
|
@ -196,10 +197,8 @@ static HRESULT WINAPI property_bag_Read(IPropertyBag *iface,
|
|||
return hr;
|
||||
}
|
||||
return HRESULT_FROM_WIN32(ERROR_NOT_FOUND);
|
||||
}
|
||||
|
||||
if (moniker->type == DEVICE_FILTER)
|
||||
{
|
||||
case DEVICE_FILTER:
|
||||
wcscpy(path, L"CLSID\\");
|
||||
if (moniker->has_class)
|
||||
{
|
||||
|
@ -208,15 +207,19 @@ static HRESULT WINAPI property_bag_Read(IPropertyBag *iface,
|
|||
}
|
||||
if ((ret = RegOpenKeyExW(HKEY_CLASSES_ROOT, path, 0, 0, &parent)))
|
||||
return HRESULT_FROM_WIN32(ret);
|
||||
}
|
||||
else if (moniker->type == DEVICE_CODEC)
|
||||
{
|
||||
break;
|
||||
|
||||
case DEVICE_CODEC:
|
||||
wcscpy(path, L"Software\\Microsoft\\ActiveMovie\\devenum\\");
|
||||
if (moniker->has_class)
|
||||
StringFromGUID2(&moniker->class, path + wcslen(path), CHARS_IN_GUID);
|
||||
if ((ret = RegOpenKeyExW(HKEY_CURRENT_USER, path, 0, 0, &parent)))
|
||||
return HRESULT_FROM_WIN32(ret);
|
||||
break;
|
||||
|
||||
DEFAULT_UNREACHABLE;
|
||||
}
|
||||
|
||||
ret = RegOpenKeyExW(parent, moniker->name, 0, KEY_READ, &key);
|
||||
RegCloseKey(parent);
|
||||
if (ret)
|
||||
|
@ -302,11 +305,12 @@ static HRESULT WINAPI property_bag_Write(IPropertyBag *iface, const WCHAR *name,
|
|||
|
||||
TRACE("moniker %p, name %s, var %s.\n", moniker, debugstr_w(name), debugstr_variant(var));
|
||||
|
||||
if (moniker->type == DEVICE_DMO)
|
||||
switch (moniker->type)
|
||||
{
|
||||
case DEVICE_DMO:
|
||||
return E_ACCESSDENIED;
|
||||
|
||||
if (moniker->type == DEVICE_FILTER)
|
||||
{
|
||||
case DEVICE_FILTER:
|
||||
wcscpy(path, L"CLSID\\");
|
||||
if (moniker->has_class)
|
||||
{
|
||||
|
@ -315,14 +319,17 @@ static HRESULT WINAPI property_bag_Write(IPropertyBag *iface, const WCHAR *name,
|
|||
}
|
||||
if ((ret = RegCreateKeyExW(HKEY_CLASSES_ROOT, path, 0, NULL, 0, 0, NULL, &parent, NULL)))
|
||||
return HRESULT_FROM_WIN32(ret);
|
||||
}
|
||||
else if (moniker->type == DEVICE_CODEC)
|
||||
{
|
||||
break;
|
||||
|
||||
case DEVICE_CODEC:
|
||||
wcscpy(path, L"Software\\Microsoft\\ActiveMovie\\devenum\\");
|
||||
if (moniker->has_class)
|
||||
StringFromGUID2(&moniker->class, path + wcslen(path), CHARS_IN_GUID);
|
||||
if ((ret = RegCreateKeyExW(HKEY_CURRENT_USER, path, 0, NULL, 0, 0, NULL, &parent, NULL)))
|
||||
return HRESULT_FROM_WIN32(ret);
|
||||
break;
|
||||
|
||||
DEFAULT_UNREACHABLE;
|
||||
}
|
||||
ret = RegCreateKeyExW(parent, moniker->name, 0, NULL, 0, KEY_WRITE, NULL, &key, NULL);
|
||||
RegCloseKey(parent);
|
||||
|
|
Loading…
Add table
Reference in a new issue