summaryrefslogtreecommitdiff
path: root/shared/fileID.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:05:30 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:05:30 +0200
commitc0fce877c478ddbf71a1b651c789e5ea00a00144 (patch)
treede01b0ae8fd296bd24fbca54a80f2f0ba071d461 /shared/fileID.cpp
parent3.3 (diff)
downloadFreeFileSync-c0fce877c478ddbf71a1b651c789e5ea00a00144.tar.gz
FreeFileSync-c0fce877c478ddbf71a1b651c789e5ea00a00144.tar.bz2
FreeFileSync-c0fce877c478ddbf71a1b651c789e5ea00a00144.zip
3.4
Diffstat (limited to 'shared/fileID.cpp')
-rw-r--r--shared/fileID.cpp24
1 files changed, 8 insertions, 16 deletions
diff --git a/shared/fileID.cpp b/shared/fileID.cpp
index 005707dc..09c63c2e 100644
--- a/shared/fileID.cpp
+++ b/shared/fileID.cpp
@@ -1,9 +1,16 @@
+// **************************************************************************
+// * This file is part of the FreeFileSync project. It is distributed under *
+// * GNU General Public License: http://www.gnu.org/licenses/gpl.html *
+// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) *
+// **************************************************************************
+//
#include "fileID.h"
#ifdef FFS_WIN
#include "staticAssert.h"
#include <wx/msw/wrapwin.h> //includes "windows.h"
#include "longPathPrefix.h"
+#include <boost/shared_ptr.hpp>
#elif defined FFS_LINUX
@@ -12,21 +19,6 @@
#ifdef FFS_WIN
-class CloseHandleOnExit
-{
-public:
- CloseHandleOnExit(HANDLE fileHandle) : fileHandle_(fileHandle) {}
-
- ~CloseHandleOnExit()
- {
- ::CloseHandle(fileHandle_);
- }
-
-private:
- HANDLE fileHandle_;
-};
-
-
Utility::FileID Utility::retrieveFileID(const Zstring& filename)
{
//ensure our DWORD_FFS really is the same as DWORD
@@ -44,7 +36,7 @@ Utility::FileID Utility::retrieveFileID(const Zstring& filename)
NULL);
if (hFile != INVALID_HANDLE_VALUE)
{
- CloseHandleOnExit dummy(hFile);
+ boost::shared_ptr<void> dummy(hFile, ::CloseHandle);
BY_HANDLE_FILE_INFORMATION info;
if (::GetFileInformationByHandle(hFile, &info))
bgstack15