diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:13:13 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:13:13 +0200 |
commit | 7f23ee90fd545995a29e2175f15e8b97e59ca67a (patch) | |
tree | f8d0afac51995032e58b9a475ccbbc73ba207baf /library/binary.cpp | |
parent | 3.19 (diff) | |
download | FreeFileSync-7f23ee90fd545995a29e2175f15e8b97e59ca67a.tar.gz FreeFileSync-7f23ee90fd545995a29e2175f15e8b97e59ca67a.tar.bz2 FreeFileSync-7f23ee90fd545995a29e2175f15e8b97e59ca67a.zip |
3.20
Diffstat (limited to 'library/binary.cpp')
-rw-r--r-- | library/binary.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/library/binary.cpp b/library/binary.cpp index 3a202711..1fd8c55f 100644 --- a/library/binary.cpp +++ b/library/binary.cpp @@ -3,12 +3,13 @@ // * GNU General Public License: http://www.gnu.org/licenses/gpl.html * // * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * // ************************************************************************** -// + #include "binary.h" #include "../shared/file_io.h" #include <vector> #include <wx/stopwatch.h> #include "../shared/int64.h" +#include <boost/thread/tss.hpp> inline void setMinSize(std::vector<char>& buffer, size_t minSize) @@ -71,11 +72,15 @@ bool zen::filesHaveSameContent(const Zstring& filename1, const Zstring& filename FileInput file1(filename1); //throw (FileError) FileInput file2(filename2); //throw (FileError) - BufferSize bufferSize; + static boost::thread_specific_ptr<std::vector<char>> cpyBuf1; + static boost::thread_specific_ptr<std::vector<char>> cpyBuf2; + if (!cpyBuf1.get()) cpyBuf1.reset(new std::vector<char>()); + if (!cpyBuf2.get()) cpyBuf2.reset(new std::vector<char>()); - static std::vector<char> memory1; - static std::vector<char> memory2; + std::vector<char>& memory1 = *cpyBuf1; + std::vector<char>& memory2 = *cpyBuf2; + BufferSize bufferSize; zen::UInt64 bytesCompared; wxLongLong lastDelayViolation = wxGetLocalTimeMillis(); |