Alexandre Julliard : Revert "oleaut32: Implement a better stub for IPicture::SaveAsFile."

Alexandre Julliard julliard at wine.codeweavers.com
Wed Nov 25 10:11:19 CST 2015


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Nov 25 14:09:13 2015 +0900

Revert "oleaut32: Implement a better stub for IPicture::SaveAsFile."

This reverts commit 212dd9c226c7f20c28697592468b3e631c250809.
It's causing test failures in gdiplus. This will need to be redone
properly after 1.8.

---

 dlls/oleaut32/olepicture.c       | 92 ++++++----------------------------------
 dlls/oleaut32/tests/olepicture.c |  9 ++++
 2 files changed, 22 insertions(+), 79 deletions(-)

diff --git a/dlls/oleaut32/olepicture.c b/dlls/oleaut32/olepicture.c
index 47430e3..5ce83e0 100644
--- a/dlls/oleaut32/olepicture.c
+++ b/dlls/oleaut32/olepicture.c
@@ -834,6 +834,19 @@ static HRESULT WINAPI OLEPictureImpl_PictureChanged(IPicture *iface)
 }
 
 /************************************************************************
+ * OLEPictureImpl_SaveAsFile
+ */
+static HRESULT WINAPI OLEPictureImpl_SaveAsFile(IPicture *iface,
+						IStream *pstream,
+						BOOL SaveMemCopy,
+						LONG *pcbSize)
+{
+  OLEPictureImpl *This = impl_from_IPicture(iface);
+  FIXME("(%p)->(%p, %d, %p), hacked stub.\n", This, pstream, SaveMemCopy, pcbSize);
+  return IStream_Write(pstream,This->data,This->datalen,(ULONG*)pcbSize);
+}
+
+/************************************************************************
  * OLEPictureImpl_get_Attributes
  */
 static HRESULT WINAPI OLEPictureImpl_get_Attributes(IPicture *iface,
@@ -1846,85 +1859,6 @@ static HRESULT WINAPI OLEPictureImpl_GetSizeMax(
   return E_NOTIMPL;
 }
 
-/************************************************************************
- * OLEPictureImpl_SaveAsFile
- */
-static HRESULT WINAPI OLEPictureImpl_SaveAsFile(IPicture *iface,
-    IStream *stream, BOOL mem_copy, LONG *size)
-{
-    OLEPictureImpl *This = impl_from_IPicture(iface);
-    void *data;
-    unsigned data_size;
-    ULONG written;
-    HRESULT hr;
-
-    FIXME("(%p)->(%p,%d,%p): semi-stub\n", This, stream, mem_copy, size);
-
-    switch (This->desc.picType)
-    {
-    case PICTYPE_NONE:
-        return S_OK;
-
-    case PICTYPE_ICON:
-        if (!mem_copy) return E_FAIL;
-
-        if (This->bIsDirty || !This->data)
-        {
-            if (!serializeIcon(This->desc.u.icon.hicon, &data, &data_size))
-                return E_FAIL;
-            HeapFree(GetProcessHeap(), 0, This->data);
-            This->data = data;
-            This->datalen = data_size;
-        }
-        hr = IStream_Write(stream, This->data, This->datalen, &written);
-        if (hr == S_OK && size) *size = written;
-        return hr;
-
-    case PICTYPE_BITMAP:
-        if (!mem_copy) return E_FAIL;
-
-        if (This->bIsDirty || !This->data)
-        {
-            switch (This->keepOrigFormat ? This->loadtime_format : BITMAP_FORMAT_BMP)
-            {
-            case BITMAP_FORMAT_BMP:
-                if (!serializeBMP(This->desc.u.bmp.hbitmap, &data, &data_size))
-                    return E_FAIL;
-                break;
-            case BITMAP_FORMAT_JPEG:
-                FIXME("BITMAP_FORMAT_JPEG is not implemented\n");
-                return E_NOTIMPL;
-            case BITMAP_FORMAT_GIF:
-                FIXME("BITMAP_FORMAT_GIF is not implemented\n");
-                return E_NOTIMPL;
-            case BITMAP_FORMAT_PNG:
-                FIXME("BITMAP_FORMAT_PNG is not implemented\n");
-                return E_NOTIMPL;
-            default:
-                FIXME("PICTYPE_BITMAP/%#x is not implemented\n", This->loadtime_format);
-                return E_NOTIMPL;
-            }
-
-            HeapFree(GetProcessHeap(), 0, This->data);
-            This->data = data;
-            This->datalen = data_size;
-        }
-        hr = IStream_Write(stream, This->data, This->datalen, &written);
-        if (hr == S_OK && size) *size = written;
-        return hr;
-
-    case PICTYPE_METAFILE:
-        FIXME("PICTYPE_METAFILE is not implemented\n");
-        return E_NOTIMPL;
-    case PICTYPE_ENHMETAFILE:
-        FIXME("ENHMETAFILE is not implemented\n");
-        return E_NOTIMPL;
-    default:
-        FIXME("%#x is not implemented\n", This->desc.picType);
-        break;
-    }
-    return E_NOTIMPL;
-}
 
 /************************************************************************
  *    IDispatch
diff --git a/dlls/oleaut32/tests/olepicture.c b/dlls/oleaut32/tests/olepicture.c
index 0c69cbd..0903298 100644
--- a/dlls/oleaut32/tests/olepicture.c
+++ b/dlls/oleaut32/tests/olepicture.c
@@ -1079,14 +1079,18 @@ static void test_load_save_bmp(void)
     size = -1;
     hr = IPicture_SaveAsFile(pic, dst_stream, TRUE, &size);
     ok(hr == S_OK, "IPicture_SaveasFile error %#x\n", hr);
+todo_wine
     ok(size == 66, "expected 66, got %d\n", size);
     mem = GlobalLock(hmem);
+todo_wine
     ok(!memcmp(&mem[0], "BM", 2), "got wrong bmp header %04x\n", mem[0]);
     GlobalUnlock(hmem);
 
     size = -1;
     hr = IPicture_SaveAsFile(pic, dst_stream, FALSE, &size);
+todo_wine
     ok(hr == E_FAIL, "expected E_FAIL, got %#x\n", hr);
+todo_wine
     ok(size == -1, "expected -1, got %d\n", size);
 
     offset.QuadPart = 0;
@@ -1153,12 +1157,15 @@ static void test_load_save_icon(void)
 todo_wine
     ok(size == 766, "expected 766, got %d\n", size);
     mem = GlobalLock(hmem);
+todo_wine
     ok(mem[0] == 0x00010000, "got wrong icon header %04x\n", mem[0]);
     GlobalUnlock(hmem);
 
     size = -1;
     hr = IPicture_SaveAsFile(pic, dst_stream, FALSE, &size);
+todo_wine
     ok(hr == E_FAIL, "expected E_FAIL, got %#x\n", hr);
+todo_wine
     ok(size == -1, "expected -1, got %d\n", size);
 
     offset.QuadPart = 0;
@@ -1224,11 +1231,13 @@ static void test_load_save_empty_picture(void)
     size = -1;
     hr = IPicture_SaveAsFile(pic, dst_stream, TRUE, &size);
     ok(hr == S_OK, "IPicture_SaveasFile error %#x\n", hr);
+todo_wine
     ok(size == -1, "expected -1, got %d\n", size);
 
     size = -1;
     hr = IPicture_SaveAsFile(pic, dst_stream, FALSE, &size);
     ok(hr == S_OK, "IPicture_SaveasFile error %#x\n", hr);
+todo_wine
     ok(size == -1, "expected -1, got %d\n", size);
 
     hr = IPicture_QueryInterface(pic, &IID_IPersistStream, (void **)&src_stream);




More information about the wine-cvs mailing list