From a2fed5b08abf03846d7f2ec976b707c3547da3e7 Mon Sep 17 00:00:00 2001 From: Hannah von Reth Date: Wed, 4 Jun 2025 14:57:23 +0200 Subject: [PATCH] Initilize structs Signed-off-by: Hannah von Reth --- src/libsync/vfs/cfapi/cfapiwrapper.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/libsync/vfs/cfapi/cfapiwrapper.cpp b/src/libsync/vfs/cfapi/cfapiwrapper.cpp index c914e5beb3..022997302d 100644 --- a/src/libsync/vfs/cfapi/cfapiwrapper.cpp +++ b/src/libsync/vfs/cfapi/cfapiwrapper.cpp @@ -320,13 +320,12 @@ OCC::Result updatePlaceholderStat const auto previousPinState = cfPinStateToPinState(info->PinState); - CF_FS_METADATA metadata; + CF_FS_METADATA metadata = {}; metadata.FileSize.QuadPart = size; OCC::Utility::UnixTimeToLargeIntegerFiletime(modtime, &metadata.BasicInfo.CreationTime); OCC::Utility::UnixTimeToLargeIntegerFiletime(modtime, &metadata.BasicInfo.LastWriteTime); OCC::Utility::UnixTimeToLargeIntegerFiletime(modtime, &metadata.BasicInfo.LastAccessTime); OCC::Utility::UnixTimeToLargeIntegerFiletime(modtime, &metadata.BasicInfo.ChangeTime); - metadata.BasicInfo.FileAttributes = 0; OCC::CfApiWrapper::setPinState(path, OCC::PinState::Unspecified, OCC::CfApiWrapper::SetPinRecurseMode::NoRecurse); @@ -653,17 +652,12 @@ OCC::Result OCC::CfApiWrapper::registerSyncRoot(const QString &pa const auto version = std::wstring(providerVersion.toStdWString().data()); CF_SYNC_REGISTRATION info = {}; - info.StructSize = static_cast(sizeof(info) + (name.length() + version.length()) * sizeof(wchar_t)); + info.StructSize = sizeof(CF_SYNC_REGISTRATION); info.ProviderName = name.data(); info.ProviderVersion = version.data(); - info.SyncRootIdentity = nullptr; - info.SyncRootIdentityLength = 0; - info.FileIdentity = nullptr; - info.FileIdentityLength = 0; - info.ProviderId = QUuid::createUuid(); - CF_SYNC_POLICIES policies; - policies.StructSize = sizeof(policies); + CF_SYNC_POLICIES policies = {}; + policies.StructSize = sizeof(CF_SYNC_POLICIES); policies.Hydration.Primary = CF_HYDRATION_POLICY_FULL; policies.Hydration.Modifier = CF_HYDRATION_POLICY_MODIFIER_NONE; policies.Population.Primary = CF_POPULATION_POLICY_ALWAYS_FULL; @@ -907,8 +901,7 @@ OCC::Result OCC::CfApiWrapper::de if (info) { setPinState(path, OCC::PinState::OnlineOnly, OCC::CfApiWrapper::NoRecurse); - CF_FILE_RANGE dehydrationRange; - dehydrationRange.StartingOffset.QuadPart = 0; + CF_FILE_RANGE dehydrationRange = {}; dehydrationRange.Length.QuadPart = size; const qint64 result = CfUpdatePlaceholder(handleForPath(path).get(), nullptr, fileId.data(), static_cast(fileId.size()), &dehydrationRange, 1,