From c0fce877c478ddbf71a1b651c789e5ea00a00144 Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 17:05:30 +0200 Subject: 3.4 --- shared/fileTraverser.cpp | 57 ++++++++++++++---------------------------------- 1 file changed, 16 insertions(+), 41 deletions(-) (limited to 'shared/fileTraverser.cpp') diff --git a/shared/fileTraverser.cpp b/shared/fileTraverser.cpp index 7d2615bf..1657f66c 100644 --- a/shared/fileTraverser.cpp +++ b/shared/fileTraverser.cpp @@ -1,3 +1,9 @@ +// ************************************************************************** +// * 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 "fileTraverser.h" #include "systemConstants.h" #include "systemFunctions.h" @@ -7,6 +13,7 @@ #ifdef FFS_WIN #include //includes "windows.h" #include "longPathPrefix.h" +#include #elif defined FFS_LINUX #include @@ -16,36 +23,6 @@ #ifdef FFS_WIN -class CloseHandleOnExit -{ -public: - CloseHandleOnExit(HANDLE fileHandle) : fileHandle_(fileHandle) {} - - ~CloseHandleOnExit() - { - ::CloseHandle(fileHandle_); - } - -private: - HANDLE fileHandle_; -}; - - -class CloseFindHandleOnExit -{ -public: - CloseFindHandleOnExit(HANDLE searchHandle) : searchHandle_(searchHandle) {} - - ~CloseFindHandleOnExit() - { - FindClose(searchHandle_); - } - -private: - HANDLE searchHandle_; -}; - - inline void setWin32FileInformation(const FILETIME& lastWriteTime, const DWORD fileSizeHigh, @@ -76,7 +53,7 @@ bool setWin32FileInformationFromSymlink(const Zstring linkName, FreeFileSync::Tr if (hFile == INVALID_HANDLE_VALUE) return false; - CloseHandleOnExit dummy(hFile); + boost::shared_ptr dummy(hFile, ::CloseHandle); BY_HANDLE_FILE_INFORMATION fileInfoByHandle; @@ -152,7 +129,8 @@ bool traverseDirectory(const Zstring& directory, FreeFileSync::TraverseCallback* return true; } } - CloseFindHandleOnExit dummy(searchHandle); + +boost::shared_ptr dummy(searchHandle, ::FindClose); do { @@ -170,13 +148,13 @@ bool traverseDirectory(const Zstring& directory, FreeFileSync::TraverseCallback* const TraverseCallback::ReturnValDir rv = sink->onDir(shortName, fullName); switch (rv.returnCode) { - case TraverseCallback::ReturnValDir::TRAVERSING_STOP: + case TraverseCallback::ReturnValDir::TRAVERSING_DIR_STOP: return false; - case TraverseCallback::ReturnValDir::TRAVERSING_IGNORE_DIR: + case TraverseCallback::ReturnValDir::TRAVERSING_DIR_IGNORE: break; - case TraverseCallback::ReturnValDir::TRAVERSING_CONTINUE: + case TraverseCallback::ReturnValDir::TRAVERSING_DIR_CONTINUE: //traverse into symbolic links, junctions, etc. if requested only: if (traverseDirectorySymlinks || (~fileMetaData.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)) if (!traverseDirectory(fullName, rv.subDirCb, level + 1)) @@ -312,13 +290,13 @@ bool traverseDirectory(const Zstring& directory, FreeFileSync::TraverseCallback* const TraverseCallback::ReturnValDir rv = sink->onDir(shortName, fullName); switch (rv.returnCode) { - case TraverseCallback::ReturnValDir::TRAVERSING_STOP: + case TraverseCallback::ReturnValDir::TRAVERSING_DIR_STOP: return false; - case TraverseCallback::ReturnValDir::TRAVERSING_IGNORE_DIR: + case TraverseCallback::ReturnValDir::TRAVERSING_DIR_IGNORE: break; - case TraverseCallback::ReturnValDir::TRAVERSING_CONTINUE: + case TraverseCallback::ReturnValDir::TRAVERSING_DIR_CONTINUE: //traverse into symbolic links, junctions, etc. if requested only: if (traverseDirectorySymlinks || !isSymbolicLink) //traverse into symbolic links if requested only if (!traverseDirectory(fullName, rv.subDirCb, level + 1)) @@ -365,6 +343,3 @@ void FreeFileSync::traverseFolder(const Zstring& directory, else traverseDirectory(directoryFormatted, sink, 0); } - - - -- cgit