Commit 7493fdcc authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

oleaut32: Simplify bitmap saving code.

parent 4c882397
......@@ -1749,6 +1749,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);
......@@ -1797,38 +1798,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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment