Commit 909b2ced authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

windowscodecs: Use nameless unions.

parent 36cec2c7
......@@ -3,7 +3,6 @@ IMPORTLIB = windowscodecs
IMPORTS = windowscodecs uuid ole32 oleaut32 propsys rpcrt4 shlwapi user32 gdi32 advapi32
EXTRAINCL = $(JPEG_CFLAGS) $(PNG_CFLAGS) $(TIFF_CFLAGS)
EXTRALIBS = $(APPLICATIONSERVICES_LIBS)
EXTRADEFS = -DWINE_NO_NAMELESS_EXTENSION
EXTRADLLFLAGS = -mno-cygwin
......
......@@ -101,51 +101,51 @@ static HRESULT load_LSD_metadata(IStream *stream, const GUID *vendor, DWORD opti
}
result[0].id.vt = VT_LPWSTR;
result[0].id.u.pwszVal = strdupAtoW("Signature");
result[0].id.pwszVal = strdupAtoW("Signature");
result[0].value.vt = VT_UI1|VT_VECTOR;
result[0].value.u.caub.cElems = sizeof(lsd_data.signature);
result[0].value.u.caub.pElems = HeapAlloc(GetProcessHeap(), 0, sizeof(lsd_data.signature));
memcpy(result[0].value.u.caub.pElems, lsd_data.signature, sizeof(lsd_data.signature));
result[0].value.caub.cElems = sizeof(lsd_data.signature);
result[0].value.caub.pElems = HeapAlloc(GetProcessHeap(), 0, sizeof(lsd_data.signature));
memcpy(result[0].value.caub.pElems, lsd_data.signature, sizeof(lsd_data.signature));
result[1].id.vt = VT_LPWSTR;
result[1].id.u.pwszVal = strdupAtoW("Width");
result[1].id.pwszVal = strdupAtoW("Width");
result[1].value.vt = VT_UI2;
result[1].value.u.uiVal = lsd_data.width;
result[1].value.uiVal = lsd_data.width;
result[2].id.vt = VT_LPWSTR;
result[2].id.u.pwszVal = strdupAtoW("Height");
result[2].id.pwszVal = strdupAtoW("Height");
result[2].value.vt = VT_UI2;
result[2].value.u.uiVal = lsd_data.height;
result[2].value.uiVal = lsd_data.height;
result[3].id.vt = VT_LPWSTR;
result[3].id.u.pwszVal = strdupAtoW("GlobalColorTableFlag");
result[3].id.pwszVal = strdupAtoW("GlobalColorTableFlag");
result[3].value.vt = VT_BOOL;
result[3].value.u.boolVal = (lsd_data.packed >> 7) & 1;
result[3].value.boolVal = (lsd_data.packed >> 7) & 1;
result[4].id.vt = VT_LPWSTR;
result[4].id.u.pwszVal = strdupAtoW("ColorResolution");
result[4].id.pwszVal = strdupAtoW("ColorResolution");
result[4].value.vt = VT_UI1;
result[4].value.u.bVal = (lsd_data.packed >> 4) & 7;
result[4].value.bVal = (lsd_data.packed >> 4) & 7;
result[5].id.vt = VT_LPWSTR;
result[5].id.u.pwszVal = strdupAtoW("SortFlag");
result[5].id.pwszVal = strdupAtoW("SortFlag");
result[5].value.vt = VT_BOOL;
result[5].value.u.boolVal = (lsd_data.packed >> 3) & 1;
result[5].value.boolVal = (lsd_data.packed >> 3) & 1;
result[6].id.vt = VT_LPWSTR;
result[6].id.u.pwszVal = strdupAtoW("GlobalColorTableSize");
result[6].id.pwszVal = strdupAtoW("GlobalColorTableSize");
result[6].value.vt = VT_UI1;
result[6].value.u.bVal = lsd_data.packed & 7;
result[6].value.bVal = lsd_data.packed & 7;
result[7].id.vt = VT_LPWSTR;
result[7].id.u.pwszVal = strdupAtoW("BackgroundColorIndex");
result[7].id.pwszVal = strdupAtoW("BackgroundColorIndex");
result[7].value.vt = VT_UI1;
result[7].value.u.bVal = lsd_data.background_color_index;
result[7].value.bVal = lsd_data.background_color_index;
result[8].id.vt = VT_LPWSTR;
result[8].id.u.pwszVal = strdupAtoW("PixelAspectRatio");
result[8].id.pwszVal = strdupAtoW("PixelAspectRatio");
result[8].value.vt = VT_UI1;
result[8].value.u.bVal = lsd_data.pixel_aspect_ratio;
result[8].value.bVal = lsd_data.pixel_aspect_ratio;
*items = result;
*count = 9;
......@@ -189,44 +189,44 @@ static HRESULT load_IMD_metadata(IStream *stream, const GUID *vendor, DWORD opti
}
result[0].id.vt = VT_LPWSTR;
result[0].id.u.pwszVal = strdupAtoW("Left");
result[0].id.pwszVal = strdupAtoW("Left");
result[0].value.vt = VT_UI2;
result[0].value.u.uiVal = imd_data.left;
result[0].value.uiVal = imd_data.left;
result[1].id.vt = VT_LPWSTR;
result[1].id.u.pwszVal = strdupAtoW("Top");
result[1].id.pwszVal = strdupAtoW("Top");
result[1].value.vt = VT_UI2;
result[1].value.u.uiVal = imd_data.top;
result[1].value.uiVal = imd_data.top;
result[2].id.vt = VT_LPWSTR;
result[2].id.u.pwszVal = strdupAtoW("Width");
result[2].id.pwszVal = strdupAtoW("Width");
result[2].value.vt = VT_UI2;
result[2].value.u.uiVal = imd_data.width;
result[2].value.uiVal = imd_data.width;
result[3].id.vt = VT_LPWSTR;
result[3].id.u.pwszVal = strdupAtoW("Height");
result[3].id.pwszVal = strdupAtoW("Height");
result[3].value.vt = VT_UI2;
result[3].value.u.uiVal = imd_data.height;
result[3].value.uiVal = imd_data.height;
result[4].id.vt = VT_LPWSTR;
result[4].id.u.pwszVal = strdupAtoW("LocalColorTableFlag");
result[4].id.pwszVal = strdupAtoW("LocalColorTableFlag");
result[4].value.vt = VT_BOOL;
result[4].value.u.boolVal = (imd_data.packed >> 7) & 1;
result[4].value.boolVal = (imd_data.packed >> 7) & 1;
result[5].id.vt = VT_LPWSTR;
result[5].id.u.pwszVal = strdupAtoW("InterlaceFlag");
result[5].id.pwszVal = strdupAtoW("InterlaceFlag");
result[5].value.vt = VT_BOOL;
result[5].value.u.boolVal = (imd_data.packed >> 6) & 1;
result[5].value.boolVal = (imd_data.packed >> 6) & 1;
result[6].id.vt = VT_LPWSTR;
result[6].id.u.pwszVal = strdupAtoW("SortFlag");
result[6].id.pwszVal = strdupAtoW("SortFlag");
result[6].value.vt = VT_BOOL;
result[6].value.u.boolVal = (imd_data.packed >> 5) & 1;
result[6].value.boolVal = (imd_data.packed >> 5) & 1;
result[7].id.vt = VT_LPWSTR;
result[7].id.u.pwszVal = strdupAtoW("LocalColorTableSize");
result[7].id.pwszVal = strdupAtoW("LocalColorTableSize");
result[7].value.vt = VT_UI1;
result[7].value.u.bVal = imd_data.packed & 7;
result[7].value.bVal = imd_data.packed & 7;
*items = result;
*count = 8;
......@@ -282,29 +282,29 @@ static HRESULT load_GCE_metadata(IStream *stream, const GUID *vendor, DWORD opti
}
result[0].id.vt = VT_LPWSTR;
result[0].id.u.pwszVal = strdupAtoW("Disposal");
result[0].id.pwszVal = strdupAtoW("Disposal");
result[0].value.vt = VT_UI1;
result[0].value.u.bVal = (gce_data.packed >> 2) & 7;
result[0].value.bVal = (gce_data.packed >> 2) & 7;
result[1].id.vt = VT_LPWSTR;
result[1].id.u.pwszVal = strdupAtoW("UserInputFlag");
result[1].id.pwszVal = strdupAtoW("UserInputFlag");
result[1].value.vt = VT_BOOL;
result[1].value.u.boolVal = (gce_data.packed >> 1) & 1;
result[1].value.boolVal = (gce_data.packed >> 1) & 1;
result[2].id.vt = VT_LPWSTR;
result[2].id.u.pwszVal = strdupAtoW("TransparencyFlag");
result[2].id.pwszVal = strdupAtoW("TransparencyFlag");
result[2].value.vt = VT_BOOL;
result[2].value.u.boolVal = gce_data.packed & 1;
result[2].value.boolVal = gce_data.packed & 1;
result[3].id.vt = VT_LPWSTR;
result[3].id.u.pwszVal = strdupAtoW("Delay");
result[3].id.pwszVal = strdupAtoW("Delay");
result[3].value.vt = VT_UI2;
result[3].value.u.uiVal = gce_data.delay;
result[3].value.uiVal = gce_data.delay;
result[4].id.vt = VT_LPWSTR;
result[4].id.u.pwszVal = strdupAtoW("TransparentColorIndex");
result[4].id.pwszVal = strdupAtoW("TransparentColorIndex");
result[4].value.vt = VT_UI1;
result[4].value.u.bVal = gce_data.transparent_color_index;
result[4].value.bVal = gce_data.transparent_color_index;
*items = result;
*count = 5;
......@@ -401,17 +401,17 @@ static HRESULT load_APE_metadata(IStream *stream, const GUID *vendor, DWORD opti
}
result[0].id.vt = VT_LPWSTR;
result[0].id.u.pwszVal = strdupAtoW("Application");
result[0].id.pwszVal = strdupAtoW("Application");
result[0].value.vt = VT_UI1|VT_VECTOR;
result[0].value.u.caub.cElems = sizeof(ape_data.application);
result[0].value.u.caub.pElems = HeapAlloc(GetProcessHeap(), 0, sizeof(ape_data.application));
memcpy(result[0].value.u.caub.pElems, ape_data.application, sizeof(ape_data.application));
result[0].value.caub.cElems = sizeof(ape_data.application);
result[0].value.caub.pElems = HeapAlloc(GetProcessHeap(), 0, sizeof(ape_data.application));
memcpy(result[0].value.caub.pElems, ape_data.application, sizeof(ape_data.application));
result[1].id.vt = VT_LPWSTR;
result[1].id.u.pwszVal = strdupAtoW("Data");
result[1].id.pwszVal = strdupAtoW("Data");
result[1].value.vt = VT_UI1|VT_VECTOR;
result[1].value.u.caub.cElems = data_size;
result[1].value.u.caub.pElems = data;
result[1].value.caub.cElems = data_size;
result[1].value.caub.pElems = data;
*items = result;
*count = 2;
......@@ -503,9 +503,9 @@ static HRESULT load_GifComment_metadata(IStream *stream, const GUID *vendor, DWO
PropVariantInit(&result->value);
result->id.vt = VT_LPWSTR;
result->id.u.pwszVal = strdupAtoW("TextEntry");
result->id.pwszVal = strdupAtoW("TextEntry");
result->value.vt = VT_LPSTR;
result->value.u.pszVal = data;
result->value.pszVal = data;
*items = result;
*count = 1;
......
......@@ -234,10 +234,10 @@ static HRESULT get_token(struct string_t *elem, PROPVARIANT *id, PROPVARIANT *sc
if (vt == VT_ILLEGAL) return WINCODEC_ERR_WRONGSTATE;
next_token.vt = VT_BSTR;
next_token.u.bstrVal = SysAllocStringLen(NULL, elem->len - (end - start) + 1);
if (!next_token.u.bstrVal) return E_OUTOFMEMORY;
next_token.bstrVal = SysAllocStringLen(NULL, elem->len - (end - start) + 1);
if (!next_token.bstrVal) return E_OUTOFMEMORY;
bstr = next_token.u.bstrVal;
bstr = next_token.bstrVal;
end++;
while (*end && *end != '}' && end - start < elem->len)
......@@ -251,19 +251,19 @@ static HRESULT get_token(struct string_t *elem, PROPVARIANT *id, PROPVARIANT *sc
return WINCODEC_ERR_INVALIDQUERYREQUEST;
}
*bstr = 0;
TRACE("schema/id %s\n", wine_dbgstr_w(next_token.u.bstrVal));
TRACE("schema/id %s\n", wine_dbgstr_w(next_token.bstrVal));
if (vt == VT_CLSID)
{
id->vt = VT_CLSID;
id->u.puuid = CoTaskMemAlloc(sizeof(GUID));
if (!id->u.puuid)
id->puuid = CoTaskMemAlloc(sizeof(GUID));
if (!id->puuid)
{
PropVariantClear(&next_token);
return E_OUTOFMEMORY;
}
hr = UuidFromStringW(next_token.u.bstrVal, id->u.puuid);
hr = UuidFromStringW(next_token.bstrVal, id->puuid);
}
else
hr = PropVariantChangeType(id, &next_token, 0, vt);
......@@ -325,10 +325,10 @@ static HRESULT get_token(struct string_t *elem, PROPVARIANT *id, PROPVARIANT *sc
elem->len = end - start;
id->vt = VT_BSTR;
id->u.bstrVal = SysAllocStringLen(NULL, elem->len + 1);
if (!id->u.bstrVal) return E_OUTOFMEMORY;
id->bstrVal = SysAllocStringLen(NULL, elem->len + 1);
if (!id->bstrVal) return E_OUTOFMEMORY;
bstr = id->u.bstrVal;
bstr = id->bstrVal;
p = elem->str;
while (p - elem->str < elem->len)
{
......@@ -428,16 +428,16 @@ static HRESULT get_next_reader(IWICMetadataReader *reader, UINT index,
if (index)
{
schema.vt = VT_UI2;
schema.u.uiVal = index;
schema.uiVal = index;
}
id.vt = VT_CLSID;
id.u.puuid = guid;
id.puuid = guid;
hr = IWICMetadataReader_GetValue(reader, &schema, &id, &value);
if (hr != S_OK) return hr;
if (value.vt == VT_UNKNOWN)
hr = IUnknown_QueryInterface(value.u.punkVal, &IID_IWICMetadataReader, (void **)new_reader);
hr = IUnknown_QueryInterface(value.punkVal, &IID_IWICMetadataReader, (void **)new_reader);
else
hr = WINCODEC_ERR_UNEXPECTEDMETADATATYPE;
......@@ -499,7 +499,7 @@ static HRESULT WINAPI mqr_GetMetadataByName(IWICMetadataQueryReader *iface, LPCW
if (!elem.len) break;
if (tk_id.vt == VT_CLSID || (tk_id.vt == VT_BSTR && WICMapShortNameToGuid(tk_id.u.bstrVal, &guid) == S_OK))
if (tk_id.vt == VT_CLSID || (tk_id.vt == VT_BSTR && WICMapShortNameToGuid(tk_id.bstrVal, &guid) == S_OK))
{
WCHAR *root;
......@@ -509,7 +509,7 @@ static HRESULT WINAPI mqr_GetMetadataByName(IWICMetadataQueryReader *iface, LPCW
PropVariantClear(&tk_schema);
}
if (tk_id.vt == VT_CLSID) guid = *tk_id.u.puuid;
if (tk_id.vt == VT_CLSID) guid = *tk_id.puuid;
if (reader)
{
......@@ -534,7 +534,7 @@ static HRESULT WINAPI mqr_GetMetadataByName(IWICMetadataQueryReader *iface, LPCW
PropVariantClear(&new_value);
new_value.vt = VT_UNKNOWN;
hr = MetadataQueryReader_CreateInstance(This->block, root, (IWICMetadataQueryReader **)&new_value.u.punkVal);
hr = MetadataQueryReader_CreateInstance(This->block, root, (IWICMetadataQueryReader **)&new_value.punkVal);
SysFreeString(root);
if (hr != S_OK) break;
}
......@@ -554,9 +554,9 @@ static HRESULT WINAPI mqr_GetMetadataByName(IWICMetadataQueryReader *iface, LPCW
if (hr != S_OK) break;
schema.vt = VT_LPWSTR;
schema.u.pwszVal = (LPWSTR)map_shortname_to_schema(&guid, tk_schema.u.bstrVal);
if (!schema.u.pwszVal)
schema.u.pwszVal = tk_schema.u.bstrVal;
schema.pwszVal = (LPWSTR)map_shortname_to_schema(&guid, tk_schema.bstrVal);
if (!schema.pwszVal)
schema.pwszVal = tk_schema.bstrVal;
}
else
schema = tk_schema;
......@@ -564,7 +564,7 @@ static HRESULT WINAPI mqr_GetMetadataByName(IWICMetadataQueryReader *iface, LPCW
if (tk_id.vt == VT_BSTR)
{
id.vt = VT_LPWSTR;
id.u.pwszVal = tk_id.u.bstrVal;
id.pwszVal = tk_id.bstrVal;
}
else
id = tk_id;
......
......@@ -83,9 +83,9 @@ static HRESULT LoadTextMetadata(IStream *stream, const GUID *preferred_vendor,
value[value_len] = 0;
result[0].id.vt = VT_LPSTR;
result[0].id.u.pszVal = name;
result[0].id.pszVal = name;
result[0].value.vt = VT_LPSTR;
result[0].value.u.pszVal = value;
result[0].value.pszVal = value;
*items = result;
*item_count = 1;
......@@ -146,9 +146,9 @@ static HRESULT LoadGamaMetadata(IStream *stream, const GUID *preferred_vendor,
memcpy(name, L"ImageGamma", sizeof(L"ImageGamma"));
result[0].id.vt = VT_LPWSTR;
result[0].id.u.pwszVal = name;
result[0].id.pwszVal = name;
result[0].value.vt = VT_UI4;
result[0].value.u.ulVal = gamma;
result[0].value.ulVal = gamma;
*items = result;
*item_count = 1;
......@@ -218,12 +218,12 @@ static HRESULT LoadChrmMetadata(IStream *stream, const GUID *preferred_vendor,
PropVariantInit(&result[i].id);
result[i].id.vt = VT_LPWSTR;
result[i].id.u.pwszVal = dyn_names[i];
result[i].id.pwszVal = dyn_names[i];
lstrcpyW(dyn_names[i], names[i]);
PropVariantInit(&result[i].value);
result[i].value.vt = VT_UI4;
result[i].value.u.ulVal = read_ulong_be(&data[i*4]);
result[i].value.ulVal = read_ulong_be(&data[i*4]);
}
*items = result;
......
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