diff options
| author | Stefan Boberg <[email protected]> | 2022-02-02 10:48:51 +0100 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2022-02-02 10:49:05 +0100 |
| commit | 362fa4336e71dae5472e6a9f9ba06ff253ac5607 (patch) | |
| tree | 63a9b9c56de686594428867a3cc0bc8dc78132c4 | |
| parent | Revised TODO (diff) | |
| download | zen-362fa4336e71dae5472e6a9f9ba06ff253ac5607.tar.xz zen-362fa4336e71dae5472e6a9f9ba06ff253ac5607.zip | |
clang-format
| -rw-r--r-- | zen/cmds/top.cpp | 3 | ||||
| -rw-r--r-- | zen/internalfile.cpp | 6 | ||||
| -rw-r--r-- | zencore/compactbinary.cpp | 4 | ||||
| -rw-r--r-- | zencore/filesystem.cpp | 2 | ||||
| -rw-r--r-- | zencore/include/zencore/refcount.h | 7 | ||||
| -rw-r--r-- | zencore/include/zencore/zencore.h | 15 | ||||
| -rw-r--r-- | zencore/iobuffer.cpp | 2 | ||||
| -rw-r--r-- | zencore/thread.cpp | 6 | ||||
| -rw-r--r-- | zenserver-test/cachepolicy-tests.cpp | 10 | ||||
| -rw-r--r-- | zenserver/cache/structuredcachestore.h | 14 | ||||
| -rw-r--r-- | zenserver/upstream/jupiter.h | 4 |
11 files changed, 37 insertions, 36 deletions
diff --git a/zen/cmds/top.cpp b/zen/cmds/top.cpp index f5b9d654a..21e4dc60e 100644 --- a/zen/cmds/top.cpp +++ b/zen/cmds/top.cpp @@ -78,7 +78,8 @@ PsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) return 0; } - State.Snapshot([&](const ZenServerState::ZenServerEntry& Entry) { ZEN_CONSOLE("Port {} : pid {}", Entry.EffectiveListenPort, Entry.Pid); }); + State.Snapshot( + [&](const ZenServerState::ZenServerEntry& Entry) { ZEN_CONSOLE("Port {} : pid {}", Entry.EffectiveListenPort, Entry.Pid); }); return 0; } diff --git a/zen/internalfile.cpp b/zen/internalfile.cpp index c1ffe6f5f..804375ce2 100644 --- a/zen/internalfile.cpp +++ b/zen/internalfile.cpp @@ -258,9 +258,9 @@ InternalFile::Read(void* Data, uint64_t Size, uint64_t Offset) HRESULT hRes = m_File.Read(Data, gsl::narrow<DWORD>(Size), &ovl); Success = SUCCEEDED(hRes); #else - int Fd = int(intptr_t(m_File)); - int BytesRead = pread(Fd, Data, Size, Offset); - Success = (BytesRead > 0); + int Fd = int(intptr_t(m_File)); + int BytesRead = pread(Fd, Data, Size, Offset); + Success = (BytesRead > 0); #endif if (Success) diff --git a/zencore/compactbinary.cpp b/zencore/compactbinary.cpp index cded378a1..902ec26c8 100644 --- a/zencore/compactbinary.cpp +++ b/zencore/compactbinary.cpp @@ -54,7 +54,7 @@ GetPlatformToDateTimeBiasInSeconds() #if ZEN_PLATFORM_WINDOWS const uint64_t PlatformEpochYear = 1601; #else - const uint64_t PlatformEpochYear = 1970; + const uint64_t PlatformEpochYear = 1970; #endif const uint64_t DateTimeEpochYear = 1; return uint64_t(double(PlatformEpochYear - DateTimeEpochYear) * 365.2425) * 86400; @@ -71,7 +71,7 @@ DateTime::Now() GetSystemTimeAsFileTime(&SysTime); return DateTime{(EpochBias * SecsTo100nsTicks) + (uint64_t(SysTime.dwHighDateTime) << 32) | SysTime.dwLowDateTime}; #else - int64_t SecondsSinceUnixEpoch = time(nullptr); + int64_t SecondsSinceUnixEpoch = time(nullptr); return DateTime{(EpochBias + SecondsSinceUnixEpoch) * SecsTo100nsTicks}; #endif } diff --git a/zencore/filesystem.cpp b/zencore/filesystem.cpp index ee49aa474..ab606301c 100644 --- a/zencore/filesystem.cpp +++ b/zencore/filesystem.cpp @@ -703,7 +703,7 @@ ScanFile(std::filesystem::path Path, const uint64_t ChunkSize, std::function<voi ProcessFunc(ReadBuffer.data(), dwBytesRead); } #else - int Fd = open(Path.c_str(), O_RDONLY | O_CLOEXEC); + int Fd = open(Path.c_str(), O_RDONLY | O_CLOEXEC); if (Fd < 0) { return false; diff --git a/zencore/include/zencore/refcount.h b/zencore/include/zencore/refcount.h index 254a22db5..7befbb338 100644 --- a/zencore/include/zencore/refcount.h +++ b/zencore/include/zencore/refcount.h @@ -114,7 +114,7 @@ public: private: T* m_Ref = nullptr; - template <typename U> + template<typename U> friend class RefPtr; }; @@ -135,8 +135,9 @@ public: inline ~Ref() { m_Ref && m_Ref->Release(); } template<typename DerivedType> - requires DerivedFrom<DerivedType, T> - inline Ref(const Ref<DerivedType>& Rhs) : Ref(Rhs.m_Ref) {} + requires DerivedFrom<DerivedType, T> inline Ref(const Ref<DerivedType>& Rhs) : Ref(Rhs.m_Ref) + { + } [[nodiscard]] inline bool IsNull() const { return m_Ref == nullptr; } inline explicit operator bool() const { return m_Ref != nullptr; } diff --git a/zencore/include/zencore/zencore.h b/zencore/include/zencore/zencore.h index 023b237cd..bd5e5a531 100644 --- a/zencore/include/zencore/zencore.h +++ b/zencore/include/zencore/zencore.h @@ -153,7 +153,7 @@ concept DerivedFrom = std::derived_from<D, B>; template<class T> concept Integral = std::is_integral_v<T>; template<class T> -concept SignedIntegral = Integral<T> && std::is_signed_v<T>; +concept SignedIntegral = Integral<T>&& std::is_signed_v<T>; template<class T> concept UnsignedIntegral = Integral<T> && !std::is_signed_v<T>; template<class F, class... A> @@ -162,7 +162,7 @@ concept Invocable = requires(F&& f, A&&... a) std::invoke(std::forward<F>(f), std::forward<A>(a)...); }; template<class D, class B> -concept DerivedFrom = std::is_base_of_v<B, D> && std::is_convertible_v<const volatile D*, const volatile B*>; +concept DerivedFrom = std::is_base_of_v<B, D>&& std::is_convertible_v<const volatile D*, const volatile B*>; #endif #if defined(__cpp_lib_ranges) @@ -239,13 +239,12 @@ static_assert(sizeof(wchar_t) == 2, "wchar_t is expected to be two bytes in size # define ZEN_DEBUG_SECTION ZEN_CODE_SECTION(".zcold") #endif -namespace zen +namespace zen { +class AssertException : public std::logic_error { - class AssertException : public std::logic_error - { - public: - AssertException(const char* Msg) : std::logic_error(Msg) {} - }; +public: + AssertException(const char* Msg) : std::logic_error(Msg) {} +}; } // namespace zen diff --git a/zencore/iobuffer.cpp b/zencore/iobuffer.cpp index e2aaa3169..57abbfb48 100644 --- a/zencore/iobuffer.cpp +++ b/zencore/iobuffer.cpp @@ -513,7 +513,7 @@ IoBufferBuilder::MakeFromTemporaryFile(const std::filesystem::path& FileName) Handle = DataFile.Detach(); #else - int Fd = open(FileName.native().c_str(), O_RDONLY); + int Fd = open(FileName.native().c_str(), O_RDONLY); if (Fd < 0) { return {}; diff --git a/zencore/thread.cpp b/zencore/thread.cpp index 2cc4d8a96..a123eec82 100644 --- a/zencore/thread.cpp +++ b/zencore/thread.cpp @@ -163,7 +163,7 @@ Event::Set() #if ZEN_PLATFORM_WINDOWS SetEvent(m_EventHandle); #else - auto* Inner = (EventInner*)m_EventHandle; + auto* Inner = (EventInner*)m_EventHandle; { std::unique_lock Lock(Inner->Mutex); Inner->bSet = true; @@ -316,7 +316,7 @@ NamedEvent::Close() #if ZEN_PLATFORM_WINDOWS CloseHandle(m_EventHandle); #elif ZEN_PLATFORM_LINUX || ZEN_PLATFORM_MAC - int Fd = int(intptr_t(m_EventHandle) & 0xffff'ffff); + int Fd = int(intptr_t(m_EventHandle) & 0xffff'ffff); if (flock(Fd, LOCK_EX | LOCK_NB) == 0) { @@ -580,7 +580,7 @@ ProcessHandle::Terminate(int ExitCode) bSuccess = (WaitResult != WAIT_OBJECT_0); #elif ZEN_PLATFORM_LINUX || ZEN_PLATFORM_MAC ZEN_UNUSED(ExitCode); - bSuccess = (kill(m_Pid, SIGKILL) == 0); + bSuccess = (kill(m_Pid, SIGKILL) == 0); #endif if (!bSuccess) diff --git a/zenserver-test/cachepolicy-tests.cpp b/zenserver-test/cachepolicy-tests.cpp index d3135439c..79d78e522 100644 --- a/zenserver-test/cachepolicy-tests.cpp +++ b/zenserver-test/cachepolicy-tests.cpp @@ -72,7 +72,7 @@ TEST_CASE("cacherecordpolicy") { SUBCASE("policy with no values") { - CachePolicy Policy = CachePolicy::SkipData | CachePolicy::QueryLocal | CachePolicy::PartialRecord; + CachePolicy Policy = CachePolicy::SkipData | CachePolicy::QueryLocal | CachePolicy::PartialRecord; CachePolicy ValuePolicy = Policy & CacheValuePolicy::PolicyMask; CacheRecordPolicy RecordPolicy; CacheRecordPolicyBuilder Builder(Policy); @@ -101,11 +101,11 @@ TEST_CASE("cacherecordpolicy") SUBCASE("policy with values") { - CachePolicy DefaultPolicy = CachePolicy::StoreRemote | CachePolicy::QueryLocal | CachePolicy::PartialRecord; + CachePolicy DefaultPolicy = CachePolicy::StoreRemote | CachePolicy::QueryLocal | CachePolicy::PartialRecord; CachePolicy DefaultValuePolicy = DefaultPolicy & CacheValuePolicy::PolicyMask; - CachePolicy PartialOverlap = CachePolicy::StoreRemote; - CachePolicy NoOverlap = CachePolicy::QueryRemote; - CachePolicy UnionPolicy = DefaultPolicy | PartialOverlap | NoOverlap | CachePolicy::PartialRecord; + CachePolicy PartialOverlap = CachePolicy::StoreRemote; + CachePolicy NoOverlap = CachePolicy::QueryRemote; + CachePolicy UnionPolicy = DefaultPolicy | PartialOverlap | NoOverlap | CachePolicy::PartialRecord; CacheRecordPolicy RecordPolicy; CacheRecordPolicyBuilder Builder(DefaultPolicy); diff --git a/zenserver/cache/structuredcachestore.h b/zenserver/cache/structuredcachestore.h index 4f162c0ba..9ffc06b28 100644 --- a/zenserver/cache/structuredcachestore.h +++ b/zenserver/cache/structuredcachestore.h @@ -84,12 +84,12 @@ struct DiskLocation } static const uint64_t kOffsetMask = 0x0000'ffFF'ffFF'ffFFull; - static const uint64_t kSizeMask = 0x00FF'0000'0000'0000ull; // Most significant bits of value size (lower 32 bits in LowerSize) + static const uint64_t kSizeMask = 0x00FF'0000'0000'0000ull; // Most significant bits of value size (lower 32 bits in LowerSize) static const uint64_t kFlagsMask = 0xff00'0000'0000'0000ull; - static const uint64_t kStandaloneFile = 0x8000'0000'0000'0000ull; // Stored as a separate file - static const uint64_t kStructured = 0x4000'0000'0000'0000ull; // Serialized as compact binary - static const uint64_t kTombStone = 0x2000'0000'0000'0000ull; // Represents a deleted key/value - static const uint64_t kCompressed = 0x1000'0000'0000'0000ull; // Stored in compressed buffer format + static const uint64_t kStandaloneFile = 0x8000'0000'0000'0000ull; // Stored as a separate file + static const uint64_t kStructured = 0x4000'0000'0000'0000ull; // Serialized as compact binary + static const uint64_t kTombStone = 0x2000'0000'0000'0000ull; // Represents a deleted key/value + static const uint64_t kCompressed = 0x1000'0000'0000'0000ull; // Stored in compressed buffer format static uint64_t CombineOffsetAndFlags(uint64_t Offset, uint64_t Flags) { return Offset | Flags; } @@ -104,11 +104,11 @@ struct DiskLocation { ContentType = ZenContentType::kCbObject; } - + if (IsFlagSet(DiskLocation::kCompressed)) { ContentType = ZenContentType::kCompressedBinary; - } + } return ContentType; } diff --git a/zenserver/upstream/jupiter.h b/zenserver/upstream/jupiter.h index bb1797393..7117ef9e7 100644 --- a/zenserver/upstream/jupiter.h +++ b/zenserver/upstream/jupiter.h @@ -22,10 +22,10 @@ namespace detail { struct CloudCacheSessionState; } -class IoBuffer; +class CbObjectView; class CloudCacheClient; +class IoBuffer; struct IoHash; -class CbObjectView; /** * Cached access token, for use with `Authorization:` header |