From 2a4bbb886477a83e6ade0df8d8d58def3838d6bf Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Fri, 8 Dec 2017 10:52:45 +0000 Subject: [PATCH] ole32: Don't clear the dirty flag when saving to another storage. Signed-off-by: Huw Davies Signed-off-by: Alexandre Julliard --- dlls/ole32/datacache.c | 15 ++++++--------- dlls/ole32/tests/ole2.c | 3 +++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dlls/ole32/datacache.c b/dlls/ole32/datacache.c index 6a13485339a..75c961164e2 100644 --- a/dlls/ole32/datacache.c +++ b/dlls/ole32/datacache.c @@ -1835,17 +1835,14 @@ static HRESULT WINAPI DataCache_Load( IPersistStorage *iface, IStorage *pStg ) * our responsibility to copy the information when saving to a new * storage. */ -static HRESULT WINAPI DataCache_Save( - IPersistStorage* iface, - IStorage* pStg, - BOOL fSameAsLoad) +static HRESULT WINAPI DataCache_Save(IPersistStorage* iface, IStorage *stg, BOOL same_as_load) { DataCache *This = impl_from_IPersistStorage(iface); DataCacheEntry *cache_entry; HRESULT hr = S_OK; unsigned short stream_number = 0; - TRACE("(%p, %p, %d)\n", iface, pStg, fSameAsLoad); + TRACE("(%p, %p, %d)\n", iface, stg, same_as_load); /* assign stream numbers to the cache entries */ LIST_FOR_EACH_ENTRY(cache_entry, &This->cache_list, DataCacheEntry, entry) @@ -1861,17 +1858,17 @@ static HRESULT WINAPI DataCache_Save( /* write out the cache entries */ LIST_FOR_EACH_ENTRY(cache_entry, &This->cache_list, DataCacheEntry, entry) { - if (!fSameAsLoad || cache_entry->dirty) + if (!same_as_load || cache_entry->dirty) { - hr = DataCacheEntry_Save(cache_entry, pStg, fSameAsLoad); + hr = DataCacheEntry_Save(cache_entry, stg, same_as_load); if (FAILED(hr)) break; - cache_entry->dirty = FALSE; + if (same_as_load) cache_entry->dirty = FALSE; } } - This->dirty = FALSE; + if (same_as_load) This->dirty = FALSE; return hr; } diff --git a/dlls/ole32/tests/ole2.c b/dlls/ole32/tests/ole2.c index a8cbcdeb1eb..f42ebe23309 100644 --- a/dlls/ole32/tests/ole2.c +++ b/dlls/ole32/tests/ole2.c @@ -4320,6 +4320,9 @@ static void test_data_cache_save_data(void) hr = IPersistStorage_Save(persist, doc, FALSE); ok(hr == S_OK, "unexpected %#x\n", hr); + hr = IPersistStorage_IsDirty(persist); + ok(hr == S_OK, "unexpected %#x\n", hr); + check_storage_contents(doc, &pdata->stg_def, &enumerated_streams, &matched_streams); ok(enumerated_streams == matched_streams, "enumerated %d != matched %d\n", enumerated_streams, matched_streams);