Dmitry Timoshkov : windowscodecs: Add support for IFD_UNDEFINED field type.

Alexandre Julliard julliard at winehq.org
Thu Jun 21 15:03:42 CDT 2012


Module: wine
Branch: master
Commit: e4af117c061b74104f40414713cc9a6785856327
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e4af117c061b74104f40414713cc9a6785856327

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Thu Jun 21 11:21:06 2012 +0900

windowscodecs: Add support for IFD_UNDEFINED field type.

---

 dlls/windowscodecs/metadatahandler.c |   27 +++++++++++++++++++++++++++
 dlls/windowscodecs/tests/metadata.c  |   13 +++++++++++--
 2 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/dlls/windowscodecs/metadatahandler.c b/dlls/windowscodecs/metadatahandler.c
index bd96944..f3b8d38 100644
--- a/dlls/windowscodecs/metadatahandler.c
+++ b/dlls/windowscodecs/metadatahandler.c
@@ -881,6 +881,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 *)&entry->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 63605d4..b144ea9 100644
--- a/dlls/windowscodecs/tests/metadata.c
+++ b/dlls/windowscodecs/tests/metadata.c
@@ -82,7 +82,7 @@ static const struct ifd_data
     FLOAT float_val[2];
 } IFD_data =
 {
-    21,
+    23,
     {
         { 0xfe,  IFD_SHORT, 1, 1 }, /* NEWSUBFILETYPE */
         { 0x100, IFD_LONG, 1, 222 }, /* IMAGEWIDTH */
@@ -105,6 +105,8 @@ static const struct ifd_data
         { 0xf00d, IFD_FLOAT, 2, FIELD_OFFSET(struct ifd_data, float_val) },
         { 0xf00e, IFD_ASCII, 13, FIELD_OFFSET(struct ifd_data, string) },
         { 0xf00f, IFD_ASCII, 4, 'a' | 'b' << 8 | 'c' << 16 | 'd' << 24 },
+        { 0xf010, IFD_UNDEFINED, 13, FIELD_OFFSET(struct ifd_data, string) },
+        { 0xf011, IFD_UNDEFINED, 4, 'a' | 'b' << 8 | 'c' << 16 | 'd' << 24 },
     },
     0,
     { 900, 3 },
@@ -388,7 +390,7 @@ static void test_metadata_IFD(void)
         int count; /* if VT_VECTOR */
         LONGLONG value[13];
         const char *string;
-    } td[21] =
+    } td[23] =
     {
         { VT_UI2, 0xfe, 0, { 1 } },
         { VT_UI4, 0x100, 0, { 222 } },
@@ -411,6 +413,8 @@ static void test_metadata_IFD(void)
         { VT_R4|VT_VECTOR, 0xf00d, 2, { 0x449a522b, 0x4608f5ba } },
         { VT_LPSTR, 0xf00e, 12, { 0 }, "Hello World!" },
         { VT_LPSTR, 0xf00f, 4, { 0 }, "abcd" },
+        { VT_BLOB, 0xf010, 13, { 0 }, "Hello World!" },
+        { VT_BLOB, 0xf011, 4, { 0 }, "abcd" },
     };
     HRESULT hr;
     IWICMetadataReader *reader;
@@ -500,6 +504,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);
 




More information about the wine-cvs mailing list