Skip to content

Commit

Permalink
Xcode 15 3 (#258)
Browse files Browse the repository at this point in the history
* Fixed the sources so NC can be built with Xcode15.3

* Fixed the sources so NC can be built with Xcode15.3
  • Loading branch information
mikekazakov authored Apr 25, 2024
1 parent 8e57342 commit 5277700
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
8 changes: 4 additions & 4 deletions Source/Base/include/Base/SpdlogFormatters.h
Original file line number Diff line number Diff line change
@@ -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 <spdlog/fmt/fmt.h>
Expand All @@ -11,7 +11,7 @@ struct fmt::formatter<CGSize> : fmt::formatter<std::string> {
template <typename FormatContext>
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);
}
};

Expand All @@ -22,7 +22,7 @@ struct fmt::formatter<CGPoint> : fmt::formatter<std::string> {
template <typename FormatContext>
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);
}
};

Expand All @@ -33,6 +33,6 @@ struct fmt::formatter<CGRect> : fmt::formatter<std::string> {
template <typename FormatContext>
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);
}
};
3 changes: 2 additions & 1 deletion Source/Panel/include/Panel/TextWidthsCache.h
Original file line number Diff line number Diff line change
@@ -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 <Cocoa/Cocoa.h>
Expand All @@ -8,6 +8,7 @@
#include <mutex>
#include <robin_hood.h>
#include <span>
#include <atomic>

namespace nc::panel {

Expand Down
37 changes: 18 additions & 19 deletions Source/VFS/source/NetWebDAV/Cache.h
Original file line number Diff line number Diff line change
@@ -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 <chrono>
Expand All @@ -8,6 +8,7 @@
#include <optional>
#include <vector>
#include <functional>
#include <atomic>

namespace nc::vfs::webdav {

Expand All @@ -18,51 +19,49 @@ class Cache
public:
Cache();
~Cache();

enum class E {
Ok = 0,
Unknown = 1,
NonExist = 2
};

std::optional<std::vector<PropFindResponse>> Listing( const std::string &_at_path ) const;
std::optional<std::vector<PropFindResponse>> Listing(const std::string &_at_path) const;
std::pair<std::optional<PropFindResponse>, E> Item(const std::string &_at_path) const;

void CommitListing( const std::string &_at_path, std::vector<PropFindResponse> _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<PropFindResponse> _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<void()> _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<PropFindResponse> items; // sorted by .filename
std::vector<bool> dirty_marks;
};
struct Observer
{
struct Observer {
std::function<void()> 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<std::string, Directory> m_Dirs;
mutable std::mutex m_Lock;

std::atomic_ulong m_LastTicket{1};
std::unordered_multimap<std::string, Observer> m_Observers;
mutable std::mutex m_ObserversLock;
};

}
} // namespace nc::vfs::webdav
2 changes: 1 addition & 1 deletion Source/VFS/tests/VFSFTP_IT.mm
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ static void WriteAll(VFSFile &_file, const std::span<const uint8_t> _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);
Expand Down

0 comments on commit 5277700

Please sign in to comment.