From c0cdb2ad99a1e2a6ade5ce76c91177a79258e669 Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 17:10:11 +0200 Subject: 3.14 --- shared/file_id.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'shared/file_id.cpp') 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 //includes "windows.h" #include "long_path_prefix.h" -#include +#include "loki/ScopeGuard.h" #elif defined FFS_LINUX #include @@ -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 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)) -- cgit