From 40e63a657ca66c7b3535e7851ef69709d6ca5528 Mon Sep 17 00:00:00 2001 From: Martin Ridgers Date: Fri, 7 Jan 2022 12:59:09 +0100 Subject: Missing include --- zenstore/basicfile.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'zenstore/basicfile.cpp') diff --git a/zenstore/basicfile.cpp b/zenstore/basicfile.cpp index 80d9a2204..fcd65f67d 100644 --- a/zenstore/basicfile.cpp +++ b/zenstore/basicfile.cpp @@ -15,6 +15,7 @@ # include # include # include +# include #endif #include -- cgit v1.2.3 From b56ee944101c3e46a2c58631fc768642f6a3461d Mon Sep 17 00:00:00 2001 From: Martin Ridgers Date: Fri, 7 Jan 2022 12:59:34 +0100 Subject: Enabled POSIX-compatible implementations on Mac --- zenstore/basicfile.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'zenstore/basicfile.cpp') diff --git a/zenstore/basicfile.cpp b/zenstore/basicfile.cpp index fcd65f67d..41d296cbb 100644 --- a/zenstore/basicfile.cpp +++ b/zenstore/basicfile.cpp @@ -335,11 +335,9 @@ LockFile::LockFile() LockFile::~LockFile() { -#if ZEN_PLATFORM_LINUX +#if ZEN_PLATFORM_LINUX || ZEN_PLATFORM_MAC int Fd = int(intptr_t(m_FileHandle)); flock(Fd, LOCK_UN | LOCK_NB); -#elif ZEN_PLATFORM_MAC -# error check flock() support #endif } @@ -369,7 +367,7 @@ LockFile::Create(std::filesystem::path FileName, CbObject Payload, std::error_co return; } -#elif ZEN_PLATFORM_LINUX +#elif ZEN_PLATFORM_LINUX || ZEN_PLATFORM_MAC int Fd = open(FileName.c_str(), O_RDWR | O_CREAT, 0666); if (Fd < 0) { @@ -386,8 +384,6 @@ LockFile::Create(std::filesystem::path FileName, CbObject Payload, std::error_co } void* FileHandle = (void*)uintptr_t(Fd); -#else -# error check flock() support #endif m_FileHandle = FileHandle; -- cgit v1.2.3 From 9086231f3923c0df6d9ef817441bfae5e134e8ff Mon Sep 17 00:00:00 2001 From: Martin Ridgers Date: Mon, 10 Jan 2022 12:07:03 +0100 Subject: Converted use of _format UDL to fmt::format --- zenstore/basicfile.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'zenstore/basicfile.cpp') diff --git a/zenstore/basicfile.cpp b/zenstore/basicfile.cpp index 41d296cbb..dcd9a8575 100644 --- a/zenstore/basicfile.cpp +++ b/zenstore/basicfile.cpp @@ -23,8 +23,6 @@ namespace zen { -using namespace fmt::literals; - BasicFile::~BasicFile() { Close(); @@ -38,7 +36,7 @@ BasicFile::Open(std::filesystem::path FileName, bool IsCreate) if (Ec) { - throw std::system_error(Ec, "failed to open file '{}'"_format(FileName)); + throw std::system_error(Ec, fmt::format("failed to open file '{}'", FileName)); } } @@ -133,7 +131,7 @@ BasicFile::Read(void* Data, uint64_t BytesToRead, uint64_t FileOffset) if (!Success) { - ThrowLastError("Failed to read from file '{}'"_format(zen::PathFromHandle(m_FileHandle))); + ThrowLastError(fmt::format("Failed to read from file '{}'", zen::PathFromHandle(m_FileHandle))); } BytesToRead -= NumberOfBytesToRead; @@ -239,7 +237,7 @@ BasicFile::Write(const void* Data, uint64_t Size, uint64_t Offset) if (Ec) { - throw std::system_error(Ec, "Failed to write to file '{}'"_format(zen::PathFromHandle(m_FileHandle))); + throw std::system_error(Ec, fmt::format("Failed to write to file '{}'", zen::PathFromHandle(m_FileHandle))); } } -- cgit v1.2.3