[07/11] windowscodecs: Add support for IFD_ASCII field type.

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


---
 dlls/windowscodecs/metadatahandler.c |   27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/dlls/windowscodecs/metadatahandler.c b/dlls/windowscodecs/metadatahandler.c
index f7d4b2f..46f5a8f 100644
--- a/dlls/windowscodecs/metadatahandler.c
+++ b/dlls/windowscodecs/metadatahandler.c
@@ -807,6 +807,33 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry,
         }
         FIXME("loading multiple rational fields is not implemented\n");
         break;
+    case IFD_ASCII:
+        item->value.u.pszVal = HeapAlloc(GetProcessHeap(), 0, count);
+        if (!item->value.u.pszVal) return E_OUTOFMEMORY;
+
+        if (count <= 4)
+        {
+            const char *data = (const char *)&value;
+            memcpy(item->value.u.pszVal, data, count);
+            item->value.u.pszVal[count - 1] = 0;
+            break;
+        }
+
+        pos.QuadPart = value;
+        hr = IStream_Seek(input, pos, SEEK_SET, NULL);
+        if (FAILED(hr))
+        {
+            HeapFree(GetProcessHeap(), 0, item->value.u.pszVal);
+            return hr;
+        }
+        hr = IStream_Read(input, item->value.u.pszVal, count, NULL);
+        if (FAILED(hr))
+        {
+            HeapFree(GetProcessHeap(), 0, item->value.u.pszVal);
+            return hr;
+        }
+        item->value.u.pszVal[count - 1] = 0;
+        break;
     default:
         FIXME("loading field of type %d, count %u is not implemented\n", type, count);
         break;
-- 
1.7.10.1




More information about the wine-patches mailing list