[Wine-patches] [eter-2.0.0 3/4] oleaut32: Simplify bitmap saving code. (eterbug #8330)

Dmitry Timoshkov dtimoshkov на etersoft.ru
Пн Июн 4 07:40:13 MSK 2012


---
 dlls/oleaut32/olepicture.c |   46 +++++++++++++++-----------------------------
 1 file changed, 16 insertions(+), 30 deletions(-)

diff --git a/dlls/oleaut32/olepicture.c b/dlls/oleaut32/olepicture.c
index c99eb81..4cfe9f8 100644
--- a/dlls/oleaut32/olepicture.c
+++ b/dlls/oleaut32/olepicture.c
@@ -1712,6 +1712,7 @@ static HRESULT WINAPI OLEPictureImpl_Save(
     HRESULT hResult = E_NOTIMPL;
     void * pIconData;
     unsigned int iDataSize;
+    DWORD header[2];
     ULONG dummy;
     int iSerializeResult = 0;
     OLEPictureImpl *This = impl_from_IPersistStream(iface);
@@ -1760,38 +1761,23 @@ static HRESULT WINAPI OLEPictureImpl_Save(
                 FIXME("(%p,%p,%d), PICTYPE_BITMAP (format UNKNOWN, using BMP?) not implemented!\n",This,pStm,fClearDirty);
                 break;
             }
-            if (iSerializeResult) {
-                /*
-                if (This->loadtime_magic != 0xdeadbeef) {
-                */
-                if (1) {
-                    DWORD header[2];
-
-                    header[0] = (This->loadtime_magic != 0xdeadbeef) ? This->loadtime_magic : 0x0000746c;
-                    header[1] = iDataSize;
-                    IStream_Write(pStm, header, 2 * sizeof(DWORD), &dummy);
-                }
-                IStream_Write(pStm, pIconData, iDataSize, &dummy);
-
-                HeapFree(GetProcessHeap(), 0, This->data);
-                This->data = pIconData;
-                This->datalen = iDataSize;
-                hResult = S_OK;
-            }
-        } else {
-            /*
-            if (This->loadtime_magic != 0xdeadbeef) {
-            */
-            if (1) {
-                DWORD header[2];
-
-                header[0] = (This->loadtime_magic != 0xdeadbeef) ? This->loadtime_magic : 0x0000746c;
-                header[1] = This->datalen;
-                IStream_Write(pStm, header, 2 * sizeof(DWORD), &dummy);
+
+            if (!iSerializeResult)
+            {
+                hResult = E_FAIL;
+                break;
             }
-            IStream_Write(pStm, This->data, This->datalen, &dummy);
-            hResult = S_OK;
+
+            HeapFree(GetProcessHeap(), 0, This->data);
+            This->data = pIconData;
+            This->datalen = iDataSize;
         }
+
+        header[0] = (This->loadtime_magic != 0xdeadbeef) ? This->loadtime_magic : 0x0000746c;
+        header[1] = This->datalen;
+        IStream_Write(pStm, header, 2 * sizeof(DWORD), &dummy);
+        IStream_Write(pStm, This->data, This->datalen, &dummy);
+        hResult = S_OK;
         break;
     case PICTYPE_METAFILE:
         FIXME("(%p,%p,%d), PICTYPE_METAFILE not implemented!\n",This,pStm,fClearDirty);
-- 
1.7.10.1



Подробная информация о списке рассылки Wine-patches