From: Kevin Ottens Date: Thu, 7 Jan 2021 12:41:51 +0000 (+0100) Subject: Second attempt at fixing CfAPI wrapper build in Win32 mode X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~21^2~435^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=2d8eb19ee5a9c4cc78b7d70a19855483466217db;p=nextcloud-desktop.git Second attempt at fixing CfAPI wrapper build in Win32 mode MSVC having so useless error messages it didn't quite point to the root cause of the issue... it turns out that through the maze of macros defined in the windows API, there's one which impacted the function pointer definition of CfCloseHandle which would then not convert to FileHandle::Deleter as expected. So I end up wrapping it in a lambda to help... luckily this kind of lambdas decay into a simple function pointer so there's likely no overhead it's just to coerce the compiler into doing the right thing. Signed-off-by: Kevin Ottens --- diff --git a/src/libsync/vfs/cfapi/cfapiwrapper.cpp b/src/libsync/vfs/cfapi/cfapiwrapper.cpp index 62ffcffa1..1b40222ab 100644 --- a/src/libsync/vfs/cfapi/cfapiwrapper.cpp +++ b/src/libsync/vfs/cfapi/cfapiwrapper.cpp @@ -346,7 +346,7 @@ OCC::CfApiWrapper::FileHandle OCC::CfApiWrapper::handleForPath(const QString &pa HANDLE handle = nullptr; const qint64 openResult = CfOpenFileWithOplock(path.toStdWString().data(), CF_OPEN_FILE_FLAG_NONE, &handle); if (openResult == S_OK) { - return {handle, CfCloseHandle}; + return {handle, [](HANDLE h) { CfCloseHandle(h); }}; } } else { const auto handle = CreateFile(path.toStdWString().data(), 0, 0, nullptr,