From 5277700cf0758eafe4ed72ba73fd338139772d5c Mon Sep 17 00:00:00 2001 From: "Michael G. Kazakov" Date: Thu, 25 Apr 2024 22:19:47 +0100 Subject: [PATCH] Xcode 15 3 (#258) * Fixed the sources so NC can be built with Xcode15.3 * Fixed the sources so NC can be built with Xcode15.3 --- Source/Base/include/Base/SpdlogFormatters.h | 8 ++--- Source/Panel/include/Panel/TextWidthsCache.h | 3 +- Source/VFS/source/NetWebDAV/Cache.h | 37 ++++++++++---------- Source/VFS/tests/VFSFTP_IT.mm | 2 +- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Source/Base/include/Base/SpdlogFormatters.h b/Source/Base/include/Base/SpdlogFormatters.h index bae924d27..7216015f9 100644 --- a/Source/Base/include/Base/SpdlogFormatters.h +++ b/Source/Base/include/Base/SpdlogFormatters.h @@ -1,4 +1,4 @@ -// Copyright (C) 2022 Michael Kazakov. Subject to GNU General Public License version 3. +// Copyright (C) 2022-2024 Michael Kazakov. Subject to GNU General Public License version 3. #pragma once #include @@ -11,7 +11,7 @@ struct fmt::formatter : fmt::formatter { template auto format(const CGSize &sz, FormatContext &ctx) { - return format_to(ctx.out(), "({}, {})", sz.width, sz.height); + return fmt::format_to(ctx.out(), "({}, {})", sz.width, sz.height); } }; @@ -22,7 +22,7 @@ struct fmt::formatter : fmt::formatter { template auto format(const CGPoint &pt, FormatContext &ctx) { - return format_to(ctx.out(), "({}, {})", pt.x, pt.y); + return fmt::format_to(ctx.out(), "({}, {})", pt.x, pt.y); } }; @@ -33,6 +33,6 @@ struct fmt::formatter : fmt::formatter { template auto format(const CGRect &rc, FormatContext &ctx) { - return format_to(ctx.out(), "({}, {}, {}, {})", rc.origin.x, rc.origin.y, rc.size.width, rc.size.height); + return fmt::format_to(ctx.out(), "({}, {}, {}, {})", rc.origin.x, rc.origin.y, rc.size.width, rc.size.height); } }; diff --git a/Source/Panel/include/Panel/TextWidthsCache.h b/Source/Panel/include/Panel/TextWidthsCache.h index 8358e859a..7cbbbe038 100644 --- a/Source/Panel/include/Panel/TextWidthsCache.h +++ b/Source/Panel/include/Panel/TextWidthsCache.h @@ -1,4 +1,4 @@ -// Copyright (C) 2017-2022 Michael Kazakov. Subject to GNU General Public License version 3. +// Copyright (C) 2017-2024 Michael Kazakov. Subject to GNU General Public License version 3. #pragma once #include @@ -8,6 +8,7 @@ #include #include #include +#include namespace nc::panel { diff --git a/Source/VFS/source/NetWebDAV/Cache.h b/Source/VFS/source/NetWebDAV/Cache.h index 1cd8cce88..509864e8f 100644 --- a/Source/VFS/source/NetWebDAV/Cache.h +++ b/Source/VFS/source/NetWebDAV/Cache.h @@ -1,4 +1,4 @@ -// Copyright (C) 2017-2023 Michael Kazakov. Subject to GNU General Public License version 3. +// Copyright (C) 2017-2024 Michael Kazakov. Subject to GNU General Public License version 3. #pragma once #include @@ -8,6 +8,7 @@ #include #include #include +#include namespace nc::vfs::webdav { @@ -18,51 +19,49 @@ class Cache public: Cache(); ~Cache(); - + enum class E { Ok = 0, Unknown = 1, NonExist = 2 }; - std::optional> Listing( const std::string &_at_path ) const; + std::optional> Listing(const std::string &_at_path) const; std::pair, E> Item(const std::string &_at_path) const; - void CommitListing( const std::string &_at_path, std::vector _items ); - void DiscardListing( const std::string &_at_path ); - void CommitMkDir( const std::string &_at_path ); - void CommitRmDir( const std::string &_at_path ); - void CommitMkFile( const std::string &_at_path ); - void CommitUnlink( const std::string &_at_path ); - void CommitMove( const std::string &_old_path, const std::string &_new_path ); + void CommitListing(const std::string &_at_path, std::vector _items); + void DiscardListing(const std::string &_at_path); + void CommitMkDir(const std::string &_at_path); + void CommitRmDir(const std::string &_at_path); + void CommitMkFile(const std::string &_at_path); + void CommitUnlink(const std::string &_at_path); + void CommitMove(const std::string &_old_path, const std::string &_new_path); unsigned long Observe(const std::string &_path, std::function _handler); void StopObserving(unsigned long _ticket); private: - struct Directory - { + struct Directory { std::chrono::nanoseconds fetch_time = std::chrono::nanoseconds{0}; bool has_dirty_items = false; - + std::vector items; // sorted by .filename std::vector dirty_marks; }; - struct Observer - { + struct Observer { std::function callback; unsigned long ticket; }; - void Notify( const std::string &_changed_dir_path ); + void Notify(const std::string &_changed_dir_path); static bool IsOutdated(const Directory &); - + std::unordered_map m_Dirs; mutable std::mutex m_Lock; - + std::atomic_ulong m_LastTicket{1}; std::unordered_multimap m_Observers; mutable std::mutex m_ObserversLock; }; -} +} // namespace nc::vfs::webdav diff --git a/Source/VFS/tests/VFSFTP_IT.mm b/Source/VFS/tests/VFSFTP_IT.mm index d87a920fb..74e1d309f 100644 --- a/Source/VFS/tests/VFSFTP_IT.mm +++ b/Source/VFS/tests/VFSFTP_IT.mm @@ -305,7 +305,7 @@ static void WriteAll(VFSFile &_file, const std::span _bytes) const auto deadline = std::chrono::system_clock::now() + std::chrono::seconds(1); while( finished == false ) { std::this_thread::sleep_for(std::chrono::milliseconds(10)); - REQUIRE(std::chrono::system_clock::now() < deadline); + REQUIRE((std::chrono::system_clock::now() < deadline)); } th.join(); VFSEasyDelete("/TestCancellation", host);