dehydrate placeholder files using CfDehydratePlaceholder
authorMatthieu Gallien <matthieu.gallien@nextcloud.com>
Wed, 4 Dec 2024 17:33:24 +0000 (18:33 +0100)
committerMatthieu Gallien <matthieu.gallien@nextcloud.com>
Wed, 11 Dec 2024 13:47:00 +0000 (14:47 +0100)
might be enough to get this working reliably

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
src/libsync/vfs/cfapi/cfapiwrapper.cpp

index ed214b88f9d780b066a96a5193750a7aa2de0f4b..c1d13479f69e5deea4853d71ed6a860ccdb8a3a8 100644 (file)
@@ -906,19 +906,15 @@ OCC::Result<OCC::Vfs::ConvertToPlaceholderResult, QString> OCC::CfApiWrapper::de
 
     const auto info = findPlaceholderInfo(path);
     if (info) {
-        CF_FILE_RANGE dehydrationRange;
-        dehydrationRange.StartingOffset.QuadPart = 0;
-        dehydrationRange.Length.QuadPart = size;
-
-        const qint64 result = CfUpdatePlaceholder(handleForPath(path).get(),
-                                                  nullptr,
-                                                  fileIdentity.data(),
-                                                  sizeToDWORD(fileIdentitySize),
-                                                  &dehydrationRange,
-                                                  1,
-                                                  CF_UPDATE_FLAG_MARK_IN_SYNC | CF_UPDATE_FLAG_DEHYDRATE,
-                                                  nullptr,
-                                                  nullptr);
+        LARGE_INTEGER largeStart, largeSize;
+        largeStart.QuadPart = 0;
+        largeSize.QuadPart = size;
+
+        const qint64 result = CfDehydratePlaceholder(handleForPath(path).get(),
+                                                     largeStart,
+                                                     largeSize,
+                                                     CF_DEHYDRATE_FLAG_NONE,
+                                                     0);
 
         if (result != S_OK) {
             const auto errorMessage = createErrorMessageForPlaceholderUpdateAndCreate(path, "Couldn't update placeholder info");