From f9a264860c23b8381adbc0b9766e1b677a07da78 Mon Sep 17 00:00:00 2001 From: B Stack Date: Mon, 4 Jan 2021 08:08:11 -0500 Subject: add upstream 11.5 --- zen/base64.h | 16 ++++++++-------- zen/basic_math.h | 2 +- zen/file_traverser.cpp | 15 +++++++-------- zen/string_traits.h | 2 +- zen/utf.h | 2 +- 5 files changed, 18 insertions(+), 19 deletions(-) (limited to 'zen') diff --git a/zen/base64.h b/zen/base64.h index b39a6a52..f03a1433 100644 --- a/zen/base64.h +++ b/zen/base64.h @@ -13,14 +13,14 @@ namespace zen { -//https://en.wikipedia.org/wiki/Base64 -/* -Usage: - const std::string input = "Sample text"; - std::string output; - zen::encodeBase64(input.begin(), input.end(), std::back_inserter(output)); - //output contains "U2FtcGxlIHRleHQ=" -*/ +/* https://en.wikipedia.org/wiki/Base64 + + Usage: + const std::string input = "Sample text"; + std::string output; + zen::encodeBase64(input.begin(), input.end(), std::back_inserter(output)); + //output contains "U2FtcGxlIHRleHQ=" */ + template OutputIterator encodeBase64(InputIterator first, InputIterator last, OutputIterator result); //nothrow! diff --git a/zen/basic_math.h b/zen/basic_math.h index 0f5191e3..2171ee24 100644 --- a/zen/basic_math.h +++ b/zen/basic_math.h @@ -175,7 +175,7 @@ auto integerDivideRoundUp(N numerator, D denominator) { static_assert(zen::IsInteger::value); static_assert(zen::IsInteger::value); - assert(numerator > 0 && denominator > 0); + assert(numerator >= 0 && denominator > 0); return (numerator + denominator - 1) / denominator; } diff --git a/zen/file_traverser.cpp b/zen/file_traverser.cpp index 0afc28ee..aa48cb85 100644 --- a/zen/file_traverser.cpp +++ b/zen/file_traverser.cpp @@ -8,7 +8,7 @@ #include "file_error.h" - #include //::pathconf() + //#include //::pathconf() #include #include @@ -50,7 +50,7 @@ void zen::traverseFolder(const Zstring& dirPath, const Zstring& itemName = itemNameRaw; if (itemName.empty()) //checks result of normalizeUtfForPosix, too! - throw FileError(replaceCpy(_("Cannot read directory %x."), L"%x", fmtPath(dirPath)), formatSystemError("readdir", L"", L"Folder contains child item without a name.")); + throw FileError(replaceCpy(_("Cannot read directory %x."), L"%x", fmtPath(dirPath)), formatSystemError("readdir", L"", L"Folder contains an item without name.")); const Zstring& itemPath = appendSeparator(dirPath) + itemName; @@ -82,13 +82,12 @@ void zen::traverseFolder(const Zstring& dirPath, if (onFile) onFile({ itemName, itemPath, makeUnsigned(statData.st_size), statData.st_mtime }); } - /* - It may be a good idea to not check "S_ISREG(statData.st_mode)" explicitly and to not issue an error message on other types to support these scenarios: - - RTS setup watch (essentially wants to read directories only) - - removeDirectory (wants to delete everything; pipes can be deleted just like files via "unlink") - However an "open" on a pipe will block (https://sourceforge.net/p/freefilesync/bugs/221/), so the copy routines need to be smarter!! - */ + /* It may be a good idea to not check "S_ISREG(statData.st_mode)" explicitly and to not issue an error message on other types to support these scenarios: + - RTS setup watch (essentially wants to read directories only) + - removeDirectory (wants to delete everything; pipes can be deleted just like files via "unlink") + + However an "open" on a pipe will block (https://sourceforge.net/p/freefilesync/bugs/221/), so the copy routines need to be smarter!! */ } } catch (const FileError& e) diff --git a/zen/string_traits.h b/zen/string_traits.h index 333c92c7..d9ce589c 100644 --- a/zen/string_traits.h +++ b/zen/string_traits.h @@ -36,7 +36,7 @@ namespace zen //reference a sub-string for consumption by zen string_tools //=> std::string_view seems decent, but of course fucks up in one regard: construction -template auto makeStringView(Iterator first, Iterator last); +template auto makeStringView(Iterator first, Iterator last); //e.g. this constructor is not available (at least on clang) template auto makeStringView(Iterator first, size_t len); diff --git a/zen/utf.h b/zen/utf.h index ced185fd..541bc785 100644 --- a/zen/utf.h +++ b/zen/utf.h @@ -14,7 +14,7 @@ namespace zen { -//convert all(!) char- and wchar_t-based "string-like" objects applying a UTF8 conversions (but only if necessary!) +//convert all(!) char- and wchar_t-based "string-like" objects applying UTF conversions (but only if necessary!) template TargetString utfTo(const SourceString& str); -- cgit