diff options
author | B. Stack <bgstack15@gmail.com> | 2023-10-28 08:29:29 -0400 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2023-10-28 08:29:29 -0400 |
commit | d30e0825ff61e9d8bae68cdfd2798da0badcf255 (patch) | |
tree | a55034c5f47324d2220e40639c6c632a895c5648 /zen | |
parent | add upstream 13.0 (diff) | |
download | FreeFileSync-d30e0825ff61e9d8bae68cdfd2798da0badcf255.tar.gz FreeFileSync-d30e0825ff61e9d8bae68cdfd2798da0badcf255.tar.bz2 FreeFileSync-d30e0825ff61e9d8bae68cdfd2798da0badcf255.zip |
add upstream 13.113.1
Diffstat (limited to 'zen')
-rw-r--r-- | zen/dir_watcher.h | 1 | ||||
-rw-r--r-- | zen/file_access.cpp | 22 | ||||
-rw-r--r-- | zen/format_unit.h | 2 | ||||
-rw-r--r-- | zen/legacy_compiler.h | 5 | ||||
-rw-r--r-- | zen/serialize.h | 11 | ||||
-rw-r--r-- | zen/thread.h | 1 |
6 files changed, 14 insertions, 28 deletions
diff --git a/zen/dir_watcher.h b/zen/dir_watcher.h index a4a061e8..24af9810 100644 --- a/zen/dir_watcher.h +++ b/zen/dir_watcher.h @@ -8,7 +8,6 @@ #define DIR_WATCHER_348577025748023458 #include <vector> -//#include <memory> #include <chrono> #include <functional> #include "file_error.h" diff --git a/zen/file_access.cpp b/zen/file_access.cpp index af19df87..6a8a36da 100644 --- a/zen/file_access.cpp +++ b/zen/file_access.cpp @@ -273,16 +273,16 @@ void zen::removeDirectoryPlainRecursion(const Zstring& dirPath) //throw FileErro namespace { -std::wstring generateMoveErrorMsg(const Zstring& pathFrom, const Zstring& pathTo) +std::wstring generateMoveErrorMsg(const Zstring& pathFrom, const Zstring& pathTo) { - if (getParentFolderPath(pathFrom) == getParentFolderPath(pathTo)) //pure "rename" - return replaceCpy(replaceCpy(_("Cannot rename %x to %y."), - L"%x", fmtPath(pathFrom)), - L"%y", fmtPath(getItemName(pathTo))); - else //"move" or "move + rename" - return trimCpy(replaceCpy(replaceCpy(_("Cannot move %x to %y."), - L"%x", L'\n' + fmtPath(pathFrom)), - L"%y", L'\n' + fmtPath(pathTo))); + if (getParentFolderPath(pathFrom) == getParentFolderPath(pathTo)) //pure "rename" + return replaceCpy(replaceCpy(_("Cannot rename %x to %y."), + L"%x", fmtPath(pathFrom)), + L"%y", fmtPath(getItemName(pathTo))); + else //"move" or "move + rename" + return trimCpy(replaceCpy(replaceCpy(_("Cannot move %x to %y."), + L"%x", L'\n' + fmtPath(pathFrom)), + L"%y", L'\n' + fmtPath(pathTo))); } /* Usage overview: (avoid circular pattern!) @@ -732,11 +732,11 @@ FileCopyResult zen::copyNewFile(const Zstring& sourceFile, const Zstring& target return { - .fileSize = makeUnsigned(sourceInfo.st_size), + .fileSize = makeUnsigned(sourceInfo.st_size), .sourceModTime = sourceInfo.st_mtim, .sourceFileIdx = sourceInfo.st_ino, .targetFileIdx = targetFileIdx, - .errorModTime = errorModTime, + .errorModTime = errorModTime, }; } diff --git a/zen/format_unit.h b/zen/format_unit.h index 5498e8c2..d7321a97 100644 --- a/zen/format_unit.h +++ b/zen/format_unit.h @@ -9,8 +9,6 @@ #include <string> #include <optional> -//#include <cstdint> -//#include "string_tools.h" namespace zen diff --git a/zen/legacy_compiler.h b/zen/legacy_compiler.h index c853b139..fce7fd7d 100644 --- a/zen/legacy_compiler.h +++ b/zen/legacy_compiler.h @@ -32,7 +32,7 @@ namespace std //W(hy)TF is this not standard? https://stackoverflow.com/a/47735624 template <class Char, class Traits, class Alloc> inline basic_string<Char, Traits, Alloc> operator+(basic_string<Char, Traits, Alloc>&& lhs, const basic_string_view<Char> rhs) -{ return move(lhs.append(rhs.begin(), rhs.end())); } //the move *is* needed!!! +{ return std::move(lhs.append(rhs.begin(), rhs.end())); } //the move *is* needed!!! //template <class Char> inline //basic_string<Char> operator+(const basic_string<Char>& lhs, const basic_string_view<Char>& rhs) { return basic_string<Char>(lhs) + rhs; } @@ -40,9 +40,6 @@ basic_string<Char, Traits, Alloc> operator+(basic_string<Char, Traits, Alloc>&& } //--------------------------------------------------------------------------------- -//support for std::string::resize_and_overwrite() - #define ZEN_HAVE_RESIZE_AND_OVERWRITE 1 - namespace zen { double fromChars(const char* first, const char* last); diff --git a/zen/serialize.h b/zen/serialize.h index 02dcd2b2..f3e4f7ff 100644 --- a/zen/serialize.h +++ b/zen/serialize.h @@ -7,7 +7,6 @@ #ifndef SERIALIZE_H_839405783574356 #define SERIALIZE_H_839405783574356 -//#include <bit> #include <functional> #include "sys_error.h" //keep header clean from specific stream implementations! (e.g.file_io.h)! used by abstract.h! @@ -261,21 +260,13 @@ BinContainer unbufferedLoad(Function tryRead /*(void* buffer, size_t bytesToRead BinContainer buf; for (;;) { -#ifndef ZEN_HAVE_RESIZE_AND_OVERWRITE -#error include legacy_compiler.h! -#endif -#if ZEN_HAVE_RESIZE_AND_OVERWRITE //permature(?) perf optimization; avoid needless zero-initialization: size_t bytesRead = 0; buf.resize_and_overwrite(buf.size() + blockSize, [&, bufSizeOld = buf.size()](char* rawBuf, size_t /*rawBufSize: caveat: may be larger than what's requested*/) + //permature(?) perf optimization; avoid needless zero-initialization: { bytesRead = tryRead(rawBuf + bufSizeOld, blockSize); //throw X; may return short; only 0 means EOF return bufSizeOld + bytesRead; }); -#else - buf.resize(buf.size() + blockSize); //needless zero-initialization! - const size_t bytesRead = tryRead(buf.data() + buf.size() - blockSize, blockSize); //throw X; may return short; only 0 means EOF - buf.resize(buf.size() - blockSize + bytesRead); //caveat: unsigned arithmetics -#endif if (bytesRead == 0) //end of file { //caveat: memory consumption of returned string! diff --git a/zen/thread.h b/zen/thread.h index 2464f8be..27b4c9b8 100644 --- a/zen/thread.h +++ b/zen/thread.h @@ -9,6 +9,7 @@ #include <thread> #include <future> +#include <functional> #include "ring_buffer.h" #include "zstring.h" |