[09/11] windowscodecs: Add support for IFD_UNDEFINED field type. Resend.
Dmitry Timoshkov
dmitry at baikal.ru
Wed Jun 13 04:31:43 CDT 2012
---
dlls/windowscodecs/metadatahandler.c | 27 +++++++++++++++++++++++++++
dlls/windowscodecs/tests/metadata.c | 12 ++++++++++--
2 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/dlls/windowscodecs/metadatahandler.c b/dlls/windowscodecs/metadatahandler.c
index 5011f47..81ad787 100644
--- a/dlls/windowscodecs/metadatahandler.c
+++ b/dlls/windowscodecs/metadatahandler.c
@@ -834,6 +834,33 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry,
}
item->value.u.pszVal[count] = 0;
break;
+ case IFD_UNDEFINED:
+ item->value.u.blob.pBlobData = HeapAlloc(GetProcessHeap(), 0, count);
+ if (!item->value.u.blob.pBlobData) return E_OUTOFMEMORY;
+
+ item->value.u.blob.cbSize = count;
+
+ if (count <= 4)
+ {
+ const char *data = (const char *)&value;
+ memcpy(item->value.u.blob.pBlobData, data, count);
+ break;
+ }
+
+ pos.QuadPart = value;
+ hr = IStream_Seek(input, pos, SEEK_SET, NULL);
+ if (FAILED(hr))
+ {
+ HeapFree(GetProcessHeap(), 0, item->value.u.blob.pBlobData);
+ return hr;
+ }
+ hr = IStream_Read(input, item->value.u.blob.pBlobData, count, NULL);
+ if (FAILED(hr))
+ {
+ HeapFree(GetProcessHeap(), 0, item->value.u.blob.pBlobData);
+ return hr;
+ }
+ break;
default:
FIXME("loading field of type %d, count %u is not implemented\n", type, count);
break;
diff --git a/dlls/windowscodecs/tests/metadata.c b/dlls/windowscodecs/tests/metadata.c
index 5249329..386d119 100644
--- a/dlls/windowscodecs/tests/metadata.c
+++ b/dlls/windowscodecs/tests/metadata.c
@@ -77,7 +77,7 @@ static const struct
char string[13];
} IFD_data =
{
- 21,
+ 22,
{
{ 0xfe, IFD_SHORT, 1, 1 }, /* NEWSUBFILETYPE */
{ 0x100, IFD_LONG, 1, 222 }, /* IMAGEWIDTH */
@@ -108,6 +108,8 @@ static const struct
{ 0xf00e, IFD_FLOAT, 2,
sizeof(USHORT) + sizeof(struct IFD_entry) * 40 + sizeof(ULONG) },
{ 0xf00f, IFD_ASCII, 4, 'a' | 'b' << 8 | 'c' << 16 | 'd' << 24 },
+ { 0xf010, IFD_UNDEFINED, 13,
+ sizeof(USHORT) + sizeof(struct IFD_entry) * 40 + sizeof(ULONG) + sizeof(struct IFD_rational) },
},
0,
{ 900, 3 },
@@ -386,7 +388,7 @@ static void test_metadata_IFD(void)
int count; /* if VT_VECTOR */
LONGLONG value[13];
const char *string;
- } td[21] =
+ } td[22] =
{
{ VT_UI2, 0xfe, 0, { 1 } },
{ VT_UI4, 0x100, 0, { 222 } },
@@ -409,6 +411,7 @@ static void test_metadata_IFD(void)
{ VT_I4|VT_VECTOR, 0xf00d, 2, { 900, 3 } },
{ VT_R4|VT_VECTOR, 0xf00e, 2, { 900, 3 } },
{ VT_LPSTR, 0xf00f, 4, { 0 }, "abcd" },
+ { VT_BLOB, 0xf010, 13, { 0 }, "Hello World!" },
};
HRESULT hr;
IWICMetadataReader *reader;
@@ -498,6 +501,11 @@ static void test_metadata_IFD(void)
ok(!strcmp(td[i].string, U(value).pszVal),
"%u: expected %s, got %s\n", i, td[i].string, U(value).pszVal);
}
+ else if (value.vt == VT_BLOB)
+ {
+ ok(td[i].count == U(value).blob.cbSize, "%u: expected count %d, got %d\n", i, td[i].count, U(value).blob.cbSize);
+ ok(!memcmp(td[i].string, U(value).blob.pBlobData, td[i].count), "%u: expected %s, got %s\n", i, td[i].string, U(value).blob.pBlobData);
+ }
else
ok(U(value).uhVal.QuadPart == td[i].value[0], "%u: unexpected value: %d/%d\n", i, U(value).uhVal.u.LowPart, U(value).uhVal.u.HighPart);
--
1.7.10.1
More information about the wine-patches
mailing list