[PATCH 2/2] ole32: Don't clear the dirty flag when saving to another storage.
Huw Davies
huw at codeweavers.com
Fri Dec 8 04:52:45 CST 2017
Signed-off-by: Huw Davies <huw at codeweavers.com>
---
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 6a13485339..75c961164e 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 a8cbcdeb1e..f42ebe2330 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);
--
2.12.0
More information about the wine-devel
mailing list