Huw Davies : ole32: Don' t clear the dirty flag when saving to another storage.

Alexandre Julliard julliard at winehq.org
Fri Dec 8 13:51:30 CST 2017


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

Author: Huw Davies <huw at codeweavers.com>
Date:   Fri Dec  8 10:52:45 2017 +0000

ole32: Don't clear the dirty flag when saving to another storage.

Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 6a13485..75c9611 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 a8cbcde..f42ebe2 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);




More information about the wine-cvs mailing list