diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:10:11 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:10:11 +0200 |
commit | c0cdb2ad99a1e2a6ade5ce76c91177a79258e669 (patch) | |
tree | 4701a015385d9a6a5a4ba99a8f1f5d400fff26b1 /shared/file_id.cpp | |
parent | 3.13 (diff) | |
download | FreeFileSync-c0cdb2ad99a1e2a6ade5ce76c91177a79258e669.tar.gz FreeFileSync-c0cdb2ad99a1e2a6ade5ce76c91177a79258e669.tar.bz2 FreeFileSync-c0cdb2ad99a1e2a6ade5ce76c91177a79258e669.zip |
3.14
Diffstat (limited to 'shared/file_id.cpp')
-rw-r--r-- | shared/file_id.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/shared/file_id.cpp b/shared/file_id.cpp index 7b091201..eb3be8d6 100644 --- a/shared/file_id.cpp +++ b/shared/file_id.cpp @@ -9,7 +9,7 @@ #ifdef FFS_WIN #include <wx/msw/wrapwin.h> //includes "windows.h" #include "long_path_prefix.h" -#include <boost/shared_ptr.hpp> +#include "loki/ScopeGuard.h" #elif defined FFS_LINUX #include <sys/stat.h> @@ -33,12 +33,12 @@ std::string util::retrieveFileID(const Zstring& filename) std::string fileID; #ifdef FFS_WIN -//WARNING: CreateFile() is SLOW, while GetFileInformationByHandle() is cheap! -//http://msdn.microsoft.com/en-us/library/aa363788(VS.85).aspx + //WARNING: CreateFile() is SLOW, while GetFileInformationByHandle() is cheap! + //http://msdn.microsoft.com/en-us/library/aa363788(VS.85).aspx - //privilege SE_BACKUP_NAME doesn't seem to be required here at all - //note: setting privileges requires admin rights! + //privilege SE_BACKUP_NAME doesn't seem to be required here at all + //note: setting privileges requires admin rights! const HANDLE hFile = ::CreateFile(ffs3::applyLongPathPrefix(filename).c_str(), 0, @@ -49,7 +49,8 @@ std::string util::retrieveFileID(const Zstring& filename) NULL); if (hFile != INVALID_HANDLE_VALUE) { - boost::shared_ptr<void> dummy(hFile, ::CloseHandle); + Loki::ScopeGuard dummy = Loki::MakeGuard(::CloseHandle, hFile); + (void)dummy; //silence warning "unused variable" BY_HANDLE_FILE_INFORMATION fileInfo = {}; if (::GetFileInformationByHandle(hFile, &fileInfo)) |