[10/11] windowscodecs: Handle IFD fields with count 0 same way as with count 1.

Dmitry Timoshkov dmitry at baikal.ru
Tue Jun 12 23:39:30 CDT 2012


---
 dlls/windowscodecs/metadatahandler.c |    8 ++++----
 dlls/windowscodecs/tests/metadata.c  |   14 +++++++++++---
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/dlls/windowscodecs/metadatahandler.c b/dlls/windowscodecs/metadatahandler.c
index 21504db..bf105cd 100644
--- a/dlls/windowscodecs/metadatahandler.c
+++ b/dlls/windowscodecs/metadatahandler.c
@@ -686,7 +686,7 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry,
         {
             const BYTE *data = (const BYTE *)&value;
 
-            if (count == 1)
+            if (count <= 1)
                 item->value.u.bVal = data[0];
             else
             {
@@ -723,7 +723,7 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry,
         {
             const SHORT *data = (const SHORT *)&value;
 
-            if (count == 1)
+            if (count <= 1)
                 item->value.u.uiVal = data[0];
             else
             {
@@ -761,7 +761,7 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry,
     case IFD_LONG:
     case IFD_SLONG:
     case IFD_FLOAT:
-        if (count == 1)
+        if (count <= 1)
         {
             item->value.u.ulVal = value;
             break;
@@ -791,7 +791,7 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry,
     case IFD_RATIONAL:
     case IFD_SRATIONAL:
     case IFD_DOUBLE:
-        if (count == 1)
+        if (count <= 1)
         {
             struct IFD_rational rational;
 
diff --git a/dlls/windowscodecs/tests/metadata.c b/dlls/windowscodecs/tests/metadata.c
index a72ad22..4e3cdd8 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 =
 {
-    22,
+    26,
     {
         { 0xfe,  IFD_SHORT, 1, 1 }, /* NEWSUBFILETYPE */
         { 0x100, IFD_LONG, 1, 222 }, /* IMAGEWIDTH */
@@ -110,6 +110,10 @@ static const struct
         { 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) },
+        { 0xf011, IFD_BYTE, 0, 0x11223344 },
+        { 0xf012, IFD_SHORT, 0, 0x11223344 },
+        { 0xf013, IFD_LONG, 0, 0x11223344 },
+        { 0xf014, IFD_FLOAT, 0, 0x11223344 },
     },
     0,
     { 900, 3 },
@@ -388,7 +392,7 @@ static void test_metadata_IFD(void)
         int count; /* if VT_VECTOR */
         LONGLONG value[13];
         const char *string;
-    } td[22] =
+    } td[26] =
     {
         { VT_UI2, 0xfe, 0, { 1 } },
         { VT_UI4, 0x100, 0, { 222 } },
@@ -412,6 +416,10 @@ static void test_metadata_IFD(void)
         { VT_R4|VT_VECTOR, 0xf00e, 2, { 900, 3 } },
         { VT_LPSTR, 0xf00f, 3, { 0 }, "abc" },
         { VT_BLOB, 0xf010, 13, { 0 }, "Hello World!" },
+        { VT_UI1, 0xf011, 0, { 0x44 } },
+        { VT_UI2, 0xf012, 0, { 0x3344 } },
+        { VT_UI4, 0xf013, 0, { 0x11223344 } },
+        { VT_R4, 0xf014, 0, { 0x11223344 } },
     };
     HRESULT hr;
     IWICMetadataReader *reader;
@@ -440,7 +448,7 @@ static void test_metadata_IFD(void)
 
     hr = IWICMetadataReader_GetCount(reader, &count);
     ok(hr == S_OK, "GetCount error %#x\n", hr);
-    ok(count == 22, "unexpected count %u\n", count);
+    ok(count == sizeof(td)/sizeof(td[0]), "unexpected count %u\n", count);
 
     hr = IWICMetadataReader_GetEnumerator(reader, NULL);
     ok(hr == E_INVALIDARG, "GetEnumerator error %#x\n", hr);
-- 
1.7.10.1




More information about the wine-patches mailing list