aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2022-03-21 12:42:45 +0100
committerDan Engelbrecht <[email protected]>2022-03-21 12:42:45 +0100
commitd35df614722024ccdb746332eceda2b7a6cd0b80 (patch)
tree57203b27fd9fd76a62b066140a0a7cf307012eb4
parentMissing return statement in websocket.h (diff)
downloadzen-d35df614722024ccdb746332eceda2b7a6cd0b80.tar.xz
zen-d35df614722024ccdb746332eceda2b7a6cd0b80.zip
clang-format
-rw-r--r--zen/internalfile.cpp6
-rw-r--r--zencore/compactbinary.cpp4
-rw-r--r--zencore/filesystem.cpp2
-rw-r--r--zencore/include/zencore/iobuffer.h3
-rw-r--r--zencore/include/zencore/refcount.h5
-rw-r--r--zencore/include/zencore/zencore.h15
-rw-r--r--zencore/iobuffer.cpp2
-rw-r--r--zencore/thread.cpp6
-rw-r--r--zenserver/compute/apply.cpp8
-rw-r--r--zenserver/frontend/frontend.cpp108
-rw-r--r--zenserver/frontend/frontend.h12
-rw-r--r--zenserver/frontend/zipfs.cpp151
-rw-r--r--zenserver/frontend/zipfs.h16
-rw-r--r--zenserver/zenserver.cpp2
14 files changed, 172 insertions, 168 deletions
diff --git a/zen/internalfile.cpp b/zen/internalfile.cpp
index b3b587a41..2ade86e29 100644
--- a/zen/internalfile.cpp
+++ b/zen/internalfile.cpp
@@ -262,9 +262,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 7cc6db68a..808e4f39a 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 79563190c..041abaf1d 100644
--- a/zencore/filesystem.cpp
+++ b/zencore/filesystem.cpp
@@ -707,7 +707,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/iobuffer.h b/zencore/include/zencore/iobuffer.h
index 449236127..bc8cfdc0f 100644
--- a/zencore/include/zencore/iobuffer.h
+++ b/zencore/include/zencore/iobuffer.h
@@ -70,7 +70,6 @@ ToString(ZenContentType ContentType)
return "png"sv;
case ZenContentType::kIcon:
return "icon"sv;
-
}
}
@@ -349,7 +348,7 @@ public:
/** Create a buffer which references a sequence of bytes inside another buffer
*/
- ZENCORE_API IoBuffer(const IoBuffer& OuterBuffer, size_t Offset, size_t SizeBytes=~0ull);
+ ZENCORE_API IoBuffer(const IoBuffer& OuterBuffer, size_t Offset, size_t SizeBytes = ~0ull);
/** Create a buffer which references a range of bytes which we assume will live
* for the entire life time.
diff --git a/zencore/include/zencore/refcount.h b/zencore/include/zencore/refcount.h
index 7befbb338..32c282600 100644
--- a/zencore/include/zencore/refcount.h
+++ b/zencore/include/zencore/refcount.h
@@ -135,9 +135,8 @@ 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 60ebd0f5f..1e5689d87 100644
--- a/zencore/include/zencore/zencore.h
+++ b/zencore/include/zencore/zencore.h
@@ -154,7 +154,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>
@@ -163,7 +163,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)
@@ -240,12 +240,13 @@ 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 {
-class AssertException : public std::logic_error
+namespace zen
{
-public:
- AssertException(const char* Msg) : std::logic_error(Msg) {}
-};
+ class AssertException : public std::logic_error
+ {
+ public:
+ AssertException(const char* Msg) : std::logic_error(Msg) {}
+ };
} // namespace zen
diff --git a/zencore/iobuffer.cpp b/zencore/iobuffer.cpp
index 57abbfb48..e2aaa3169 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 c2ecc8d72..77b75bae3 100644
--- a/zencore/thread.cpp
+++ b/zencore/thread.cpp
@@ -180,7 +180,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;
@@ -334,7 +334,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)
{
@@ -599,7 +599,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/compute/apply.cpp b/zenserver/compute/apply.cpp
index 044078aa4..694e9f662 100644
--- a/zenserver/compute/apply.cpp
+++ b/zenserver/compute/apply.cpp
@@ -174,10 +174,10 @@ SandboxedFunctionJob::GrantNamedObjectAccess(PWSTR ObjectName, SE_OBJECT_TYPE Ob
.grfAccessMode = GRANT_ACCESS,
.grfInheritance = grfInhericance,
.Trustee = {.pMultipleTrustee = nullptr,
- .MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE,
- .TrusteeForm = TRUSTEE_IS_SID,
- .TrusteeType = TRUSTEE_IS_GROUP,
- .ptstrName = (PWSTR)m_AppContainerSid}};
+ .MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE,
+ .TrusteeForm = TRUSTEE_IS_SID,
+ .TrusteeType = TRUSTEE_IS_GROUP,
+ .ptstrName = (PWSTR)m_AppContainerSid}};
PACL OldAcl = nullptr;
diff --git a/zenserver/frontend/frontend.cpp b/zenserver/frontend/frontend.cpp
index b87d7e313..6d576876f 100644
--- a/zenserver/frontend/frontend.cpp
+++ b/zenserver/frontend/frontend.cpp
@@ -15,15 +15,16 @@ ZEN_THIRD_PARTY_INCLUDES_END
namespace zen {
//////////////////////////////////////////////////////////////////////////
-static IoBuffer FindZipFsInBinary(const IoBuffer& BinBuffer)
+static IoBuffer
+FindZipFsInBinary(const IoBuffer& BinBuffer)
{
if (BinBuffer.GetSize() < 4)
{
return {};
}
- uintptr_t Cursor = uintptr_t(BinBuffer.GetData());
- size_t BinSize = 0;
+ uintptr_t Cursor = uintptr_t(BinBuffer.GetData());
+ size_t BinSize = 0;
uint32_t Magic = *(uint32_t*)(BinBuffer.GetData());
#if ZEN_PLATFORM_LINUX
@@ -31,35 +32,35 @@ static IoBuffer FindZipFsInBinary(const IoBuffer& BinBuffer)
{
struct Elf64Header
{
- char Ident[16];
- uint16_t Type;
- uint16_t Machine;
- uint32_t Version;
- uint64_t Entry;
- uint64_t ProgHeaderOffset;
- uint64_t SectionHeaderOffset;
- uint32_t Flags;
- uint16_t EhSize;
- uint16_t ProgHeaderEntrySize;
- uint16_t ProgHeaderCount;
- uint16_t SectionHeaderEntrySize;
- uint16_t SectionHeaderCount;
- uint16_t SectionStringIndex;
+ char Ident[16];
+ uint16_t Type;
+ uint16_t Machine;
+ uint32_t Version;
+ uint64_t Entry;
+ uint64_t ProgHeaderOffset;
+ uint64_t SectionHeaderOffset;
+ uint32_t Flags;
+ uint16_t EhSize;
+ uint16_t ProgHeaderEntrySize;
+ uint16_t ProgHeaderCount;
+ uint16_t SectionHeaderEntrySize;
+ uint16_t SectionHeaderCount;
+ uint16_t SectionStringIndex;
};
struct SectionHeader
{
- uint32_t NameIndex;
- uint32_t Type;
- uint64_t Flags;
- uint64_t Address;
- uint64_t Offset;
- uint64_t Size;
- uint64_t _Other[3];
+ uint32_t NameIndex;
+ uint32_t Type;
+ uint64_t Flags;
+ uint64_t Address;
+ uint64_t Offset;
+ uint64_t Size;
+ uint64_t _Other[3];
};
const auto* Elf = (Elf64Header*)Cursor;
- if (Elf->Ident[4] != 0x02) // Elf64
+ if (Elf->Ident[4] != 0x02) // Elf64
{
return {};
}
@@ -76,21 +77,21 @@ static IoBuffer FindZipFsInBinary(const IoBuffer& BinBuffer)
*/
// What if the section headers aren't the last thing in the fiile though?
- BinSize = Elf->SectionHeaderEntrySize;
+ BinSize = Elf->SectionHeaderEntrySize;
BinSize *= Elf->SectionHeaderCount;
BinSize += Elf->SectionHeaderOffset;
}
#elif ZEN_PLATFORM_WINDOWS
if ((Magic & 0xffff) == 0x5a4d)
{
- const auto* Dos = (IMAGE_DOS_HEADER*)Cursor;
- const auto* Nt = (IMAGE_NT_HEADERS64*)(Cursor + Dos->e_lfanew);
+ const auto* Dos = (IMAGE_DOS_HEADER*)Cursor;
+ const auto* Nt = (IMAGE_NT_HEADERS64*)(Cursor + Dos->e_lfanew);
const auto* Section = (IMAGE_SECTION_HEADER*)(uintptr_t(&Nt->OptionalHeader) + Nt->FileHeader.SizeOfOptionalHeader);
for (int i = 0, n = Nt->FileHeader.NumberOfSections; i < n; ++i, ++Section)
{
uint32_t SectionEnd = Section->PointerToRawData + Section->SizeOfRawData;
- BinSize = (SectionEnd > BinSize) ? SectionEnd : BinSize;
+ BinSize = (SectionEnd > BinSize) ? SectionEnd : BinSize;
}
}
#elif ZEN_PLATFORM_MAC
@@ -98,35 +99,35 @@ static IoBuffer FindZipFsInBinary(const IoBuffer& BinBuffer)
{
struct MachInt32
{
- operator uint32_t () const { return ByteSwap(Value); }
- uint32_t Value;
+ operator uint32_t() const { return ByteSwap(Value); }
+ uint32_t Value;
};
struct MachFatArch
{
- MachInt32 CpuType;
- MachInt32 SubType;
- MachInt32 Offset;
- MachInt32 Size;
- MachInt32 Alignment;
+ MachInt32 CpuType;
+ MachInt32 SubType;
+ MachInt32 Offset;
+ MachInt32 Size;
+ MachInt32 Alignment;
};
struct MachFatHeader
{
uint32_t Magic;
MachInt32 NumArchs;
- MachFatArch Archs[];
+ MachFatArch Archs[];
};
const auto* Header = (MachFatHeader*)Cursor;
for (int i = 0, n = Header->NumArchs; i < n; ++i)
{
- const MachFatArch* Arch = Header->Archs + i;
- uint32_t ArchEnd = Arch->Offset + Arch->Size;
- BinSize = (ArchEnd > BinSize) ? ArchEnd : BinSize;
+ const MachFatArch* Arch = Header->Archs + i;
+ uint32_t ArchEnd = Arch->Offset + Arch->Size;
+ BinSize = (ArchEnd > BinSize) ? ArchEnd : BinSize;
}
}
-#endif // win/linux/mac
+#endif // win/linux/mac
if (!BinSize || BinSize > BinBuffer.GetSize())
{
@@ -137,13 +138,12 @@ static IoBuffer FindZipFsInBinary(const IoBuffer& BinBuffer)
}
////////////////////////////////////////////////////////////////////////////////
-HttpFrontendService::HttpFrontendService(std::filesystem::path Directory)
-: m_Directory(Directory)
+HttpFrontendService::HttpFrontendService(std::filesystem::path Directory) : m_Directory(Directory)
{
std::filesystem::path SelfPath = GetRunningExecutablePath();
// Locate a .zip file appended onto the end of this binary
- IoBuffer SelfBuffer = IoBufferBuilder::MakeFromFile(SelfPath);
+ IoBuffer SelfBuffer = IoBufferBuilder::MakeFromFile(SelfPath);
IoBuffer SelfTailBuffer = FindZipFsInBinary(SelfBuffer);
if (SelfTailBuffer)
{
@@ -193,7 +193,8 @@ HttpFrontendService::HandleRequest(zen::HttpServerRequest& Request)
using namespace std::literals;
std::string_view Uri = Request.RelativeUri();
- for (; Uri[0] == '/'; Uri = Uri.substr(1));
+ for (; Uri[0] == '/'; Uri = Uri.substr(1))
+ ;
if (Uri.empty())
{
Uri = "index.html"sv;
@@ -209,15 +210,20 @@ HttpFrontendService::HandleRequest(zen::HttpServerRequest& Request)
// Map the file extension to a MIME type. To keep things constrained, only a
// small subset of file extensions is allowed.
HttpContentType ContentType = HttpContentType::kCOUNT;
- size_t DotIndex = Uri.rfind(".");
+ size_t DotIndex = Uri.rfind(".");
if (DotIndex != Uri.npos)
{
const std::string_view DotExt = Uri.substr(DotIndex);
- if (DotExt == ".html") ContentType = HttpContentType::kHTML;
- else if (DotExt == ".js") ContentType = HttpContentType::kJSON;
- else if (DotExt == ".css") ContentType = HttpContentType::kCSS;
- else if (DotExt == ".png") ContentType = HttpContentType::kPNG;
- else if (DotExt == ".ico") ContentType = HttpContentType::kIcon;
+ if (DotExt == ".html")
+ ContentType = HttpContentType::kHTML;
+ else if (DotExt == ".js")
+ ContentType = HttpContentType::kJSON;
+ else if (DotExt == ".css")
+ ContentType = HttpContentType::kCSS;
+ else if (DotExt == ".png")
+ ContentType = HttpContentType::kPNG;
+ else if (DotExt == ".ico")
+ ContentType = HttpContentType::kIcon;
}
if (ContentType == HttpContentType::kCOUNT)
diff --git a/zenserver/frontend/frontend.h b/zenserver/frontend/frontend.h
index bf5298169..6eac20620 100644
--- a/zenserver/frontend/frontend.h
+++ b/zenserver/frontend/frontend.h
@@ -12,14 +12,14 @@ namespace zen {
class HttpFrontendService final : public zen::HttpService
{
public:
- HttpFrontendService(std::filesystem::path Directory);
- virtual ~HttpFrontendService();
- virtual const char* BaseUri() const override;
- virtual void HandleRequest(zen::HttpServerRequest& Request) override;
+ HttpFrontendService(std::filesystem::path Directory);
+ virtual ~HttpFrontendService();
+ virtual const char* BaseUri() const override;
+ virtual void HandleRequest(zen::HttpServerRequest& Request) override;
private:
- ZipFs m_ZipFs;
- std::filesystem::path m_Directory;
+ ZipFs m_ZipFs;
+ std::filesystem::path m_Directory;
};
} // namespace zen
diff --git a/zenserver/frontend/zipfs.cpp b/zenserver/frontend/zipfs.cpp
index 5fb9d0177..91c6629a0 100644
--- a/zenserver/frontend/zipfs.cpp
+++ b/zenserver/frontend/zipfs.cpp
@@ -12,83 +12,84 @@ namespace {
# pragma warning(disable : 4200)
#endif
-using ZipInt16 = uint16_t;
+ using ZipInt16 = uint16_t;
-struct ZipInt32
-{
- operator uint32_t () const { return *(uint32_t*)Parts; }
- uint16_t Parts[2];
-};
-
-struct EocdRecord
-{
- enum : uint32_t {
- Magic = 0x0605'4b50,
+ struct ZipInt32
+ {
+ operator uint32_t() const { return *(uint32_t*)Parts; }
+ uint16_t Parts[2];
};
- ZipInt32 Signature;
- ZipInt16 ThisDiskIndex;
- ZipInt16 CdStartDiskIndex;
- ZipInt16 CdRecordThisDiskCount;
- ZipInt16 CdRecordCount;
- ZipInt32 CdSize;
- ZipInt32 CdOffset;
- ZipInt16 CommentSize;
- char Comment[];
-};
-
-struct CentralDirectoryRecord
-{
- enum : uint32_t {
- Magic = 0x0201'4b50,
+
+ struct EocdRecord
+ {
+ enum : uint32_t
+ {
+ Magic = 0x0605'4b50,
+ };
+ ZipInt32 Signature;
+ ZipInt16 ThisDiskIndex;
+ ZipInt16 CdStartDiskIndex;
+ ZipInt16 CdRecordThisDiskCount;
+ ZipInt16 CdRecordCount;
+ ZipInt32 CdSize;
+ ZipInt32 CdOffset;
+ ZipInt16 CommentSize;
+ char Comment[];
};
- ZipInt32 Signature;
- ZipInt16 VersionMadeBy;
- ZipInt16 VersionRequired;
- ZipInt16 Flags;
- ZipInt16 CompressionMethod;
- ZipInt16 LastModTime;
- ZipInt16 LastModDate;
- ZipInt32 Crc32;
- ZipInt32 CompressedSize;
- ZipInt32 OriginalSize;
- ZipInt16 FileNameLength;
- ZipInt16 ExtraFieldLength;
- ZipInt16 CommentLength;
- ZipInt16 DiskIndex;
- ZipInt16 InternalFileAttr;
- ZipInt32 ExternalFileAttr;
- ZipInt32 Offset;
- char FileName[];
-};
-
-struct LocalFileHeader
-{
- enum : uint32_t {
- Magic = 0x0304'4b50,
+ struct CentralDirectoryRecord
+ {
+ enum : uint32_t
+ {
+ Magic = 0x0201'4b50,
+ };
+
+ ZipInt32 Signature;
+ ZipInt16 VersionMadeBy;
+ ZipInt16 VersionRequired;
+ ZipInt16 Flags;
+ ZipInt16 CompressionMethod;
+ ZipInt16 LastModTime;
+ ZipInt16 LastModDate;
+ ZipInt32 Crc32;
+ ZipInt32 CompressedSize;
+ ZipInt32 OriginalSize;
+ ZipInt16 FileNameLength;
+ ZipInt16 ExtraFieldLength;
+ ZipInt16 CommentLength;
+ ZipInt16 DiskIndex;
+ ZipInt16 InternalFileAttr;
+ ZipInt32 ExternalFileAttr;
+ ZipInt32 Offset;
+ char FileName[];
};
- ZipInt32 Signature;
- ZipInt16 VersionRequired;
- ZipInt16 Flags;
- ZipInt16 CompressionMethod;
- ZipInt16 LastModTime;
- ZipInt16 LastModDate;
- ZipInt32 Crc32;
- ZipInt32 CompressedSize;
- ZipInt32 OriginalSize;
- ZipInt16 FileNameLength;
- ZipInt16 ExtraFieldLength;
- char FileName[];
-};
+ struct LocalFileHeader
+ {
+ enum : uint32_t
+ {
+ Magic = 0x0304'4b50,
+ };
+
+ ZipInt32 Signature;
+ ZipInt16 VersionRequired;
+ ZipInt16 Flags;
+ ZipInt16 CompressionMethod;
+ ZipInt16 LastModTime;
+ ZipInt16 LastModDate;
+ ZipInt32 Crc32;
+ ZipInt32 CompressedSize;
+ ZipInt32 OriginalSize;
+ ZipInt16 FileNameLength;
+ ZipInt16 ExtraFieldLength;
+ char FileName[];
+ };
#if ZEN_COMPILER_MSC
# pragma warning(pop)
#endif
-} // namespace
-
-
+} // namespace
//////////////////////////////////////////////////////////////////////////
ZipFs::ZipFs(IoBuffer&& Buffer)
@@ -102,7 +103,7 @@ ZipFs::ZipFs(IoBuffer&& Buffer)
}
const auto* EocdCursor = (EocdRecord*)(Cursor - sizeof(EocdRecord));
-
+
// It is more correct to search backwards for EocdRecord::Magic as the
// comment can be of a variable length. But here we're not going to support
// zip files with comments.
@@ -138,19 +139,20 @@ ZipFs::ZipFs(IoBuffer&& Buffer)
}
uint32_t ExtraBytes = Cd.FileNameLength + Cd.ExtraFieldLength + Cd.CommentLength;
- CdCursor = (CentralDirectoryRecord*)(Cd.FileName + ExtraBytes);
+ CdCursor = (CentralDirectoryRecord*)(Cd.FileName + ExtraBytes);
}
-
+
m_Buffer = std::move(Buffer);
}
//////////////////////////////////////////////////////////////////////////
-IoBuffer ZipFs::GetFile(const std::string_view& FileName) const
+IoBuffer
+ZipFs::GetFile(const std::string_view& FileName) const
{
FileMap::iterator Iter = m_Files.find(FileName);
if (Iter == m_Files.end())
{
- return{};
+ return {};
}
FileItem& Item = Iter->second;
@@ -160,11 +162,8 @@ IoBuffer ZipFs::GetFile(const std::string_view& FileName) const
}
const auto* Lfh = (LocalFileHeader*)(Item.GetData());
- Item = MemoryView(
- Lfh->FileName + Lfh->FileNameLength + Lfh->ExtraFieldLength,
- Lfh->OriginalSize
- );
+ Item = MemoryView(Lfh->FileName + Lfh->FileNameLength + Lfh->ExtraFieldLength, Lfh->OriginalSize);
return IoBuffer(IoBuffer::Wrap, Item.GetData(), Item.GetSize());
}
-} // namespace zen
+} // namespace zen
diff --git a/zenserver/frontend/zipfs.h b/zenserver/frontend/zipfs.h
index a304e9ff5..b877e278e 100644
--- a/zenserver/frontend/zipfs.h
+++ b/zenserver/frontend/zipfs.h
@@ -10,15 +10,15 @@ namespace zen {
class ZipFs
{
public:
- ZipFs() = default;
- ZipFs(IoBuffer&& Buffer);
- IoBuffer GetFile(const std::string_view& FileName) const;
+ ZipFs() = default;
+ ZipFs(IoBuffer&& Buffer);
+ IoBuffer GetFile(const std::string_view& FileName) const;
private:
- using FileItem = MemoryView;
- using FileMap = std::unordered_map<std::string_view, FileItem>;
- FileMap mutable m_Files;
- IoBuffer m_Buffer;
+ using FileItem = MemoryView;
+ using FileMap = std::unordered_map<std::string_view, FileItem>;
+ FileMap mutable m_Files;
+ IoBuffer m_Buffer;
};
-} // namespace zen
+} // namespace zen
diff --git a/zenserver/zenserver.cpp b/zenserver/zenserver.cpp
index bed60a82a..d8e97b117 100644
--- a/zenserver/zenserver.cpp
+++ b/zenserver/zenserver.cpp
@@ -106,8 +106,8 @@ ZEN_THIRD_PARTY_INCLUDES_END
#include "cache/structuredcachestore.h"
#include "compute/apply.h"
#include "diag/diagsvcs.h"
-#include "frontend/frontend.h"
#include "experimental/usnjournal.h"
+#include "frontend/frontend.h"
#include "monitoring/httpstats.h"
#include "monitoring/httpstatus.h"
#include "projectstore.h"