aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Ridgers <[email protected]>2022-01-10 12:07:03 +0100
committerMartin Ridgers <[email protected]>2022-01-10 13:22:28 +0100
commit9086231f3923c0df6d9ef817441bfae5e134e8ff (patch)
tree739a41ca51910d9319cb6c04af435bf9b4c6d5cd
parentVcpkg's manifest mode is no longer in use (diff)
downloadzen-9086231f3923c0df6d9ef817441bfae5e134e8ff.tar.xz
zen-9086231f3923c0df6d9ef817441bfae5e134e8ff.zip
Converted use of _format UDL to fmt::format
-rw-r--r--zen/cmds/cache.cpp4
-rw-r--r--zen/internalfile.cpp12
-rw-r--r--zencore/compactbinary.cpp45
-rw-r--r--zencore/except.cpp3
-rw-r--r--zencore/filesystem.cpp20
-rw-r--r--zencore/iobuffer.cpp6
-rw-r--r--zencore/thread.cpp9
-rw-r--r--zenhttp/httpasio.cpp3
-rw-r--r--zenhttp/httpsys.cpp4
-rw-r--r--zenserver-test/projectclient.cpp6
-rw-r--r--zenserver-test/zenserver-test.cpp142
-rw-r--r--zenserver/cache/cachetracking.cpp7
-rw-r--r--zenserver/cache/structuredcache.cpp4
-rw-r--r--zenserver/cache/structuredcachestore.cpp18
-rw-r--r--zenserver/compute/apply.cpp18
-rw-r--r--zenserver/config.cpp6
-rw-r--r--zenserver/projectstore.cpp19
-rw-r--r--zenserver/testing/httptest.cpp6
-rw-r--r--zenserver/testing/launch.cpp4
-rw-r--r--zenserver/upstream/jupiter.cpp1
-rw-r--r--zenserver/upstream/upstreamapply.cpp17
-rw-r--r--zenserver/upstream/upstreamcache.cpp18
-rw-r--r--zenserver/zenserver.cpp15
-rw-r--r--zenstore/basicfile.cpp8
-rw-r--r--zenstore/caslog.cpp8
-rw-r--r--zenstore/compactcas.cpp2
-rw-r--r--zenstore/filecas.cpp16
-rw-r--r--zenstore/gc.cpp4
-rw-r--r--zenutil/zenserverprocess.cpp4
29 files changed, 172 insertions, 257 deletions
diff --git a/zen/cmds/cache.cpp b/zen/cmds/cache.cpp
index 2a911c8c7..f1b953af5 100644
--- a/zen/cmds/cache.cpp
+++ b/zen/cmds/cache.cpp
@@ -13,8 +13,6 @@ ZEN_THIRD_PARTY_INCLUDES_START
#include <cpr/cpr.h>
ZEN_THIRD_PARTY_INCLUDES_END
-using namespace fmt::literals;
-
DropCommand::DropCommand()
{
m_Options.add_options()("h,help", "Print help");
@@ -35,7 +33,7 @@ DropCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
ZEN_INFO("Dropping cache bucket '{}' from '{}'", m_BucketName, m_HostName);
cpr::Session Session;
- Session.SetUrl({"{}/z$/{}"_format(m_HostName, m_BucketName)});
+ Session.SetUrl({fmt::format("{}/z$/{}", m_HostName, m_BucketName)});
cpr::Response Result = Session.Delete();
if (zen::IsHttpSuccessCode(Result.status_code))
diff --git a/zen/internalfile.cpp b/zen/internalfile.cpp
index a1f07992b..dbafcb549 100644
--- a/zen/internalfile.cpp
+++ b/zen/internalfile.cpp
@@ -192,8 +192,7 @@ InternalFile::OpenWrite(std::filesystem::path FileName, bool IsCreate)
if (Success)
{
- using namespace fmt::literals;
- zen::ThrowLastError("Failed to open file for writing: '{}'"_format(FileName));
+ zen::ThrowLastError(fmt::format("Failed to open file for writing: '{}'", FileName));
}
}
@@ -218,8 +217,7 @@ InternalFile::OpenRead(std::filesystem::path FileName)
if (Success)
{
- using namespace fmt::literals;
- zen::ThrowLastError("Failed to open file for reading: '{}'"_format(FileName));
+ zen::ThrowLastError(fmt::format("Failed to open file for reading: '{}'", FileName));
}
}
@@ -267,8 +265,7 @@ InternalFile::Read(void* Data, uint64_t Size, uint64_t Offset)
if (Success)
{
- using namespace fmt::literals;
- zen::ThrowLastError("Failed to read from file '{}'"_format("")); // zen::PathFromHandle(m_File)));
+ zen::ThrowLastError(fmt::format("Failed to read from file '{}'", "")); // zen::PathFromHandle(m_File)));
}
}
@@ -293,7 +290,6 @@ InternalFile::Write(const void* Data, uint64_t Size, uint64_t Offset)
if (Success)
{
- using namespace fmt::literals;
- zen::ThrowLastError("Failed to write to file '{}'"_format(zen::PathFromHandle(m_File)));
+ zen::ThrowLastError(fmt::format("Failed to write to file '{}'", zen::PathFromHandle(m_File)));
}
}
diff --git a/zencore/compactbinary.cpp b/zencore/compactbinary.cpp
index 494b45581..cded378a1 100644
--- a/zencore/compactbinary.cpp
+++ b/zencore/compactbinary.cpp
@@ -197,8 +197,6 @@ DateTime::GetDate(int& Year, int& Month, int& Day) const
std::string
DateTime::ToString(const char* Format) const
{
- using namespace fmt::literals;
-
ExtendableStringBuilder<32> Result;
int Year, Month, Day;
@@ -215,32 +213,32 @@ DateTime::ToString(const char* Format) const
// case 'a': Result.Append(IsMorning() ? TEXT("am") : TEXT("pm")); break;
// case 'A': Result.Append(IsMorning() ? TEXT("AM") : TEXT("PM")); break;
case 'd':
- Result.Append("{:02}"_format(Day));
+ Result.Append(fmt::format("{:02}", Day));
break;
// case 'D': Result.Appendf(TEXT("%03i"), GetDayOfYear()); break;
case 'm':
- Result.Append("{:02}"_format(Month));
+ Result.Append(fmt::format("{:02}", Month));
break;
case 'y':
- Result.Append("{:02}"_format(Year % 100));
+ Result.Append(fmt::format("{:02}", Year % 100));
break;
case 'Y':
- Result.Append("{:04}"_format(Year));
+ Result.Append(fmt::format("{:04}", Year));
break;
case 'h':
- Result.Append("{:02}"_format(GetHour12()));
+ Result.Append(fmt::format("{:02}", GetHour12()));
break;
case 'H':
- Result.Append("{:02}"_format(GetHour()));
+ Result.Append(fmt::format("{:02}", GetHour()));
break;
case 'M':
- Result.Append("{:02}"_format(GetMinute()));
+ Result.Append(fmt::format("{:02}", GetMinute()));
break;
case 'S':
- Result.Append("{:02}"_format(GetSecond()));
+ Result.Append(fmt::format("{:02}", GetSecond()));
break;
case 's':
- Result.Append("{:03}"_format(GetMillisecond()));
+ Result.Append(fmt::format("{:03}", GetMillisecond()));
break;
default:
Result.Append(*Format);
@@ -282,8 +280,6 @@ TimeSpan::Set(int Days, int Hours, int Minutes, int Seconds, int FractionNano)
std::string
TimeSpan::ToString(const char* Format) const
{
- using namespace fmt::literals;
-
StringBuilder<128> Result;
Result.Append((int64_t(Ticks) < 0) ? '-' : '+');
@@ -295,31 +291,31 @@ TimeSpan::ToString(const char* Format) const
switch (*Format)
{
case 'd':
- Result.Append("{}"_format(GetDays()));
+ Result.Append(fmt::format("{}", GetDays()));
break;
case 'D':
- Result.Append("{:08}"_format(GetDays()));
+ Result.Append(fmt::format("{:08}", GetDays()));
break;
case 'h':
- Result.Append("{:02}"_format(GetHours()));
+ Result.Append(fmt::format("{:02}", GetHours()));
break;
case 'm':
- Result.Append("{:02}"_format(GetMinutes()));
+ Result.Append(fmt::format("{:02}", GetMinutes()));
break;
case 's':
- Result.Append("{:02}"_format(GetSeconds()));
+ Result.Append(fmt::format("{:02}", GetSeconds()));
break;
case 'f':
- Result.Append("{:03}"_format(GetFractionMilli()));
+ Result.Append(fmt::format("{:03}", GetFractionMilli()));
break;
case 'u':
- Result.Append("{:06}"_format(GetFractionMicro()));
+ Result.Append(fmt::format("{:06}", GetFractionMicro()));
break;
case 't':
- Result.Append("{:07}"_format(GetFractionTicks()));
+ Result.Append(fmt::format("{:07}", GetFractionTicks()));
break;
case 'n':
- Result.Append("{:09}"_format(GetFractionNano()));
+ Result.Append(fmt::format("{:09}", GetFractionNano()));
break;
default:
Result.Append(*Format);
@@ -1442,7 +1438,6 @@ public:
void WriteField(CbFieldView Field)
{
- using namespace fmt::literals;
using namespace std::literals;
WriteOptionalComma();
@@ -1512,7 +1507,7 @@ public:
const float Value = Accessor.AsFloat32();
if (std::isfinite(Value))
{
- Builder.Append("{:.9g}"_format(Value));
+ Builder.Append(fmt::format("{:.9g}", Value));
}
else
{
@@ -1525,7 +1520,7 @@ public:
const double Value = Accessor.AsFloat64();
if (std::isfinite(Value))
{
- Builder.Append("{:.17g}"_format(Value));
+ Builder.Append(fmt::format("{:.17g}", Value));
}
else
{
diff --git a/zencore/except.cpp b/zencore/except.cpp
index b4ad5acf2..2749d1984 100644
--- a/zencore/except.cpp
+++ b/zencore/except.cpp
@@ -79,9 +79,8 @@ GetSystemErrorAsString(uint32_t ErrorCode)
void
ThrowLastErrorImpl(std::string_view Message, const std::source_location& Location)
{
- using namespace fmt::literals;
throw std::system_error(std::error_code(zen::GetLastError(), std::system_category()),
- "{}({}): {}"_format(Location.file_name(), Location.line(), Message));
+ fmt::format("{}({}): {}", Location.file_name(), Location.line(), Message));
}
#else
void
diff --git a/zencore/filesystem.cpp b/zencore/filesystem.cpp
index 2507037ea..bed08b3f5 100644
--- a/zencore/filesystem.cpp
+++ b/zencore/filesystem.cpp
@@ -487,8 +487,6 @@ CopyFile(std::filesystem::path FromPath, std::filesystem::path ToPath, const Cop
&CancelFlag,
/* dwCopyFlags */ 0);
#else
- using namespace fmt::literals;
-
struct ScopedFd
{
~ScopedFd() { close(Fd); }
@@ -499,7 +497,7 @@ CopyFile(std::filesystem::path FromPath, std::filesystem::path ToPath, const Cop
int FromFd = open(FromPath.c_str(), O_RDONLY | O_CLOEXEC);
if (FromFd < 0)
{
- ThrowLastError("failed to open file {}"_format(FromPath));
+ ThrowLastError(fmt::format("failed to open file {}", FromPath));
}
ScopedFd $From = {FromFd};
@@ -507,7 +505,7 @@ CopyFile(std::filesystem::path FromPath, std::filesystem::path ToPath, const Cop
int ToFd = open(ToPath.c_str(), O_WRONLY | O_CREAT | O_EXCL | O_CLOEXEC, 0644);
if (ToFd < 0)
{
- ThrowLastError("failed to create file {}"_format(ToPath));
+ ThrowLastError(fmt::format("failed to create file {}", ToPath));
}
ScopedFd $To = {ToFd};
@@ -543,8 +541,6 @@ CopyFile(std::filesystem::path FromPath, std::filesystem::path ToPath, const Cop
void
WriteFile(std::filesystem::path Path, const IoBuffer* const* Data, size_t BufferCount)
{
- using namespace fmt::literals;
-
#if ZEN_PLATFORM_WINDOWS
CAtlFile Outfile;
HRESULT hRes = Outfile.Create(Path.c_str(), GENERIC_WRITE, FILE_SHARE_READ, CREATE_ALWAYS);
@@ -557,7 +553,7 @@ WriteFile(std::filesystem::path Path, const IoBuffer* const* Data, size_t Buffer
if (FAILED(hRes))
{
- ThrowSystemException(hRes, "File open failed for '{}'"_format(Path).c_str());
+ ThrowSystemException(hRes, fmt::format("File open failed for '{}'", Path).c_str());
}
#else
@@ -571,7 +567,7 @@ WriteFile(std::filesystem::path Path, const IoBuffer* const* Data, size_t Buffer
if (Fd < 0)
{
- ThrowLastError("File open failed for '{}'"_format(Path));
+ ThrowLastError(fmt::format("File open failed for '{}'", Path));
}
#endif
@@ -590,12 +586,12 @@ WriteFile(std::filesystem::path Path, const IoBuffer* const* Data, size_t Buffer
hRes = Outfile.Write(DataPtr, gsl::narrow_cast<uint32_t>(WriteSize));
if (FAILED(hRes))
{
- ThrowSystemException(hRes, "File write failed for '{}'"_format(Path).c_str());
+ ThrowSystemException(hRes, fmt::format("File write failed for '{}'", Path).c_str());
}
#else
if (write(Fd, DataPtr, WriteSize) != int64_t(WriteSize))
{
- ThrowLastError("File write failed for '{}'"_format(Path));
+ ThrowLastError(fmt::format("File write failed for '{}'", Path));
}
#endif // ZEN_PLATFORM_WINDOWS
@@ -867,14 +863,12 @@ FileSystemTraversal::TraverseFileSystem(const std::filesystem::path& RootDir, Tr
}
}
#else
- using namespace fmt::literals;
-
/* Could also implement this using Linux's getdents() syscall */
DIR* Dir = opendir(RootDir.c_str());
if (Dir == nullptr)
{
- ThrowLastError("Failed to open directory for traversal: {}"_format(RootDir.c_str()));
+ ThrowLastError(fmt::format("Failed to open directory for traversal: {}", RootDir.c_str()));
}
for (struct dirent* Entry; (Entry = readdir(Dir));)
diff --git a/zencore/iobuffer.cpp b/zencore/iobuffer.cpp
index 30865068a..b6bbedc40 100644
--- a/zencore/iobuffer.cpp
+++ b/zencore/iobuffer.cpp
@@ -231,8 +231,6 @@ static RwLock g_MappingLock;
void
IoBufferExtendedCore::Materialize() const
{
- using namespace fmt::literals;
-
// The synchronization scheme here is very primitive, if we end up with
// a lot of contention we can make it more fine-grained
@@ -264,7 +262,7 @@ IoBufferExtendedCore::Materialize() const
if (NewMmapHandle == nullptr)
{
throw std::system_error(std::error_code(::GetLastError(), std::system_category()),
- "CreateFileMapping failed on file '{}'"_format(zen::PathFromHandle(m_FileHandle)));
+ fmt::format("CreateFileMapping failed on file '{}'", zen::PathFromHandle(m_FileHandle)));
}
NewFlags |= kOwnsMmap;
@@ -291,7 +289,7 @@ IoBufferExtendedCore::Materialize() const
{
throw std::system_error(
std::error_code(zen::GetLastError(), std::system_category()),
- "MapViewOfFile failed (offset {:#x}, size {:#x}) file: '{}'"_format(MapOffset, MapSize, zen::PathFromHandle(m_FileHandle)));
+ fmt::format("MapViewOfFile failed (offset {:#x}, size {:#x}) file: '{}'", MapOffset, MapSize, zen::PathFromHandle(m_FileHandle)));
}
m_MappedPointer = MappedBase;
diff --git a/zencore/thread.cpp b/zencore/thread.cpp
index 358256b1d..97d44e733 100644
--- a/zencore/thread.cpp
+++ b/zencore/thread.cpp
@@ -310,8 +310,7 @@ NamedEvent::NamedEvent(std::string_view EventName)
int Fd = open(EventPath.c_str(), O_RDWR|O_CREAT, 0644);
if (Fd < 0)
{
- using namespace fmt::literals;
- ThrowLastError("Failed to create '{}' for named event"_format(EventPath));
+ ThrowLastError(fmt::format("Failed to create '{}' for named event", EventPath));
}
// Use the file path to generate an IPC key
@@ -631,8 +630,7 @@ ProcessHandle::Initialize(int Pid)
if (!m_ProcessHandle)
{
- using namespace fmt::literals;
- ThrowLastError("ProcessHandle::Initialize(pid: {}) failed"_format(Pid));
+ ThrowLastError(fmt::format("ProcessHandle::Initialize(pid: {}) failed", Pid));
}
m_Pid = Pid;
@@ -1113,8 +1111,7 @@ IsProcessRunning(int pid)
return false;
}
- using namespace fmt::literals;
- ThrowSystemError(Error, "failed to open process with pid {}"_format(pid));
+ ThrowSystemError(Error, fmt::format("failed to open process with pid {}", pid));
}
CloseHandle(hProc);
diff --git a/zenhttp/httpasio.cpp b/zenhttp/httpasio.cpp
index 6c2d65bb6..7a6efd884 100644
--- a/zenhttp/httpasio.cpp
+++ b/zenhttp/httpasio.cpp
@@ -28,7 +28,6 @@ ZEN_THIRD_PARTY_INCLUDES_END
namespace zen::asio_http {
using namespace std::literals;
-using namespace fmt::literals;
struct HttpAcceptor;
struct HttpRequest;
@@ -1135,7 +1134,7 @@ HttpAsioServerImpl::Start(uint16_t Port, int ThreadCount)
for (int i = 0; i < ThreadCount; ++i)
{
m_ThreadPool.emplace_back([this, Index = i + 1] {
- SetCurrentThreadName("asio worker {}"_format(Index));
+ SetCurrentThreadName(fmt::format("asio worker {}", Index));
try
{
diff --git a/zenhttp/httpsys.cpp b/zenhttp/httpsys.cpp
index a17c2661c..67ff6b46b 100644
--- a/zenhttp/httpsys.cpp
+++ b/zenhttp/httpsys.cpp
@@ -674,8 +674,6 @@ HttpAsyncWorkRequest::HandleCompletion(ULONG IoResult, ULONG_PTR NumberOfBytesTr
void
HttpAsyncWorkRequest::AsyncWorkItem::Execute()
{
- using namespace fmt::literals;
-
try
{
HttpSysServerRequest& ThisRequest = Tx.ServerRequest();
@@ -705,7 +703,7 @@ HttpAsyncWorkRequest::AsyncWorkItem::Execute()
}
catch (std::exception& Ex)
{
- return (void)Tx.IssueNextRequest(new HttpMessageResponseRequest(Tx, 500, "Exception thrown in async work: '{}'"_format(Ex.what())));
+ return (void)Tx.IssueNextRequest(new HttpMessageResponseRequest(Tx, 500, fmt::format("Exception thrown in async work: '{}'", Ex.what())));
}
}
diff --git a/zenserver-test/projectclient.cpp b/zenserver-test/projectclient.cpp
index 88608bfe0..597838e0d 100644
--- a/zenserver-test/projectclient.cpp
+++ b/zenserver-test/projectclient.cpp
@@ -19,8 +19,6 @@
namespace zen {
-using namespace fmt::literals;
-
struct ProjectClientConnection
{
ProjectClientConnection(int BasePort) { Connect(BasePort); }
@@ -45,7 +43,7 @@ struct ProjectClientConnection
{
ZEN_WARN("failed while creating named pipe {}", WideToUtf8(PipeName));
- throw std::system_error(GetLastError(), std::system_category(), "Failed to open named pipe '{}'"_format(WideToUtf8(PipeName)));
+ throw std::system_error(GetLastError(), std::system_category(), fmt::format("Failed to open named pipe '{}'", WideToUtf8(PipeName)));
}
// Change to message mode
@@ -56,7 +54,7 @@ struct ProjectClientConnection
{
throw std::system_error(GetLastError(),
std::system_category(),
- "Failed to change named pipe '{}' to message mode"_format(WideToUtf8(PipeName)));
+ fmt::format("Failed to change named pipe '{}' to message mode", WideToUtf8(PipeName)));
}
m_hPipe.Attach(hPipe); // This now owns the handle and will close it
diff --git a/zenserver-test/zenserver-test.cpp b/zenserver-test/zenserver-test.cpp
index 9c53bf80f..d5e68caed 100644
--- a/zenserver-test/zenserver-test.cpp
+++ b/zenserver-test/zenserver-test.cpp
@@ -71,7 +71,6 @@ ZEN_THIRD_PARTY_INCLUDES_END
# undef DOCTEST_CONFIG_IMPLEMENT
#endif
-using namespace fmt::literals;
using namespace std::literals;
#if ZEN_PLATFORM_LINUX || ZEN_PLATFORM_MAC
@@ -173,8 +172,7 @@ private:
return;
}
- using namespace fmt::literals;
- zen::ThrowLastError("HTTP client error! '{}'"_format(Error.message()));
+ zen::ThrowLastError(fmt::format("HTTP client error! '{}'", Error.message()));
}
int OnHeader(const char* Data, size_t Bytes)
@@ -344,8 +342,6 @@ HttpConnectionPool::~HttpConnectionPool()
std::unique_ptr<HttpClientConnection>
HttpConnectionPool::GetConnection()
{
- using namespace fmt::literals;
-
zen::RwLock::ExclusiveLockScope ScopedLock(m_Lock);
if (m_AvailableConnections.empty())
@@ -361,7 +357,7 @@ HttpConnectionPool::GetConnection()
if (ErrCode)
{
- zen::ThrowLastError("Unabled to resolve '{}'"_format(m_HostName));
+ zen::ThrowLastError(fmt::format("Unabled to resolve '{}'", m_HostName));
}
asio::ip::tcp::socket Socket{m_Context};
@@ -369,7 +365,7 @@ HttpConnectionPool::GetConnection()
if (ErrCode)
{
- zen::ThrowLastError("Failed connecting '{}:{}'"_format(m_HostName, m_Port));
+ zen::ThrowLastError(fmt::format("Failed connecting '{}:{}'", m_HostName, m_Port));
}
return std::make_unique<HttpClientConnection>(m_Context, this, std::move(Socket));
@@ -835,7 +831,7 @@ TEST_CASE("multi.basic")
ZEN_INFO("query batch {} started (thread {}) for port {}", BatchNo, ThreadId, PortNumber);
cpr::Session cli;
- cli.SetUrl(cpr::Url{"http://localhost:{}/test/hello"_format(PortNumber)});
+ cli.SetUrl(cpr::Url{fmt::format("http://localhost:{}/test/hello", PortNumber)});
for (int i = 0; i < 10000; ++i)
{
@@ -882,7 +878,7 @@ TEST_CASE("cas.basic")
std::mt19937_64 mt;
- auto BaseUri = "http://localhost:{}/cas"_format(PortNumber);
+ auto BaseUri = fmt::format("http://localhost:{}/cas", PortNumber);
cpr::Session cli;
cli.SetUrl(cpr::Url{BaseUri});
@@ -945,7 +941,7 @@ TEST_CASE("cas.basic")
for (int i = 0; i < IterationCount; ++i)
{
zen::ExtendableStringBuilder<128> Uri;
- Uri << "http://localhost:{}/cas/"_format(PortNumber);
+ Uri << fmt::format("http://localhost:{}/cas/", PortNumber);
ChunkHashes[i].ToHexString(Uri);
auto res = cpr::Get(cpr::Url{Uri.c_str()});
@@ -979,7 +975,7 @@ TEST_CASE("project.basic")
std::mt19937_64 mt;
zen::StringBuilder<64> BaseUri;
- BaseUri << "http://localhost:{}/prj/test"_format(PortNumber);
+ BaseUri << fmt::format("http://localhost:{}/prj/test", PortNumber);
std::filesystem::path BinPath = zen::GetRunningExecutablePath();
std::filesystem::path RootPath = BinPath.parent_path().parent_path();
@@ -1147,13 +1143,13 @@ namespace utils {
{
return ZenConfig{.DataDir = TestEnv.CreateNewTestDir(),
.Port = Port,
- .BaseUri = "http://localhost:{}/z$"_format(Port),
+ .BaseUri = fmt::format("http://localhost:{}/z$", Port),
.Args = std::move(Args)};
}
static ZenConfig NewWithUpstream(uint16_t UpstreamPort)
{
- return New(13337, "--debug --upstream-thread-count=0 --upstream-zen-url=http://localhost:{}"_format(UpstreamPort));
+ return New(13337, fmt::format("--debug --upstream-thread-count=0 --upstream-zen-url=http://localhost:{}", UpstreamPort));
}
void Spawn(ZenServerInstance& Inst)
@@ -1182,7 +1178,7 @@ TEST_CASE("zcache.basic")
const uint16_t PortNumber = 13337;
const int kIterationCount = 100;
- const auto BaseUri = "http://localhost:{}/z$"_format(PortNumber);
+ const auto BaseUri = fmt::format("http://localhost:{}/z$", PortNumber);
auto HashKey = [](int i) -> zen::IoHash { return zen::IoHash::HashBuffer(&i, sizeof i); };
@@ -1204,7 +1200,7 @@ TEST_CASE("zcache.basic")
zen::IoHash Key = HashKey(i);
- cpr::Response Result = cpr::Put(cpr::Url{"{}/{}/{}"_format(BaseUri, "test", Key)},
+ cpr::Response Result = cpr::Put(cpr::Url{fmt::format("{}/{}/{}", BaseUri, "test", Key)},
cpr::Body{(const char*)MemOut.Data(), MemOut.Size()},
cpr::Header{{"Content-Type", "application/x-ue-cb"}});
@@ -1217,7 +1213,7 @@ TEST_CASE("zcache.basic")
{
zen::IoHash Key = zen::IoHash::HashBuffer(&i, sizeof i);
- cpr::Response Result = cpr::Get(cpr::Url{"{}/{}/{}"_format(BaseUri, "test", Key)});
+ cpr::Response Result = cpr::Get(cpr::Url{fmt::format("{}/{}/{}", BaseUri, "test", Key)});
CHECK(Result.status_code == 200);
}
@@ -1233,7 +1229,7 @@ TEST_CASE("zcache.basic")
zen::IoHash Key = HashKey(442);
- cpr::Response Result = cpr::Put(cpr::Url{"{}/{}/{}"_format(BaseUri, "te!st", Key)},
+ cpr::Response Result = cpr::Put(cpr::Url{fmt::format("{}/{}/{}", BaseUri, "te!st", Key)},
cpr::Body{(const char*)MemOut.Data(), MemOut.Size()},
cpr::Header{{"Content-Type", "application/x-ue-cb"}});
@@ -1255,7 +1251,7 @@ TEST_CASE("zcache.basic")
{
zen::IoHash Key = HashKey(i);
- cpr::Response Result = cpr::Get(cpr::Url{"{}/{}/{}"_format(BaseUri, "test", Key)});
+ cpr::Response Result = cpr::Get(cpr::Url{fmt::format("{}/{}/{}", BaseUri, "test", Key)});
CHECK(Result.status_code == 200);
}
@@ -1325,7 +1321,7 @@ TEST_CASE("zcache.cbpackage")
{
std::filesystem::path TestDir = TestEnv.CreateNewTestDir();
const uint16_t PortNumber = 13337;
- const auto BaseUri = "http://localhost:{}/z$"_format(PortNumber);
+ const auto BaseUri = fmt::format("http://localhost:{}/z$", PortNumber);
ZenServerInstance Instance1(TestEnv);
Instance1.SetTestDir(TestDir);
@@ -1339,7 +1335,7 @@ TEST_CASE("zcache.cbpackage")
// PUT
{
zen::IoBuffer Body = SerializeToBuffer(ExpectedPackage);
- cpr::Response Result = cpr::Put(cpr::Url{"{}/{}/{}"_format(BaseUri, Bucket, Key)},
+ cpr::Response Result = cpr::Put(cpr::Url{fmt::format("{}/{}/{}", BaseUri, Bucket, Key)},
cpr::Body{(const char*)Body.Data(), Body.Size()},
cpr::Header{{"Content-Type", "application/x-ue-cbpkg"}});
CHECK(Result.status_code == 201);
@@ -1348,7 +1344,7 @@ TEST_CASE("zcache.cbpackage")
// GET
{
cpr::Response Result =
- cpr::Get(cpr::Url{"{}/{}/{}"_format(BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}});
+ cpr::Get(cpr::Url{fmt::format("{}/{}/{}", BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}});
CHECK(Result.status_code == 200);
zen::IoBuffer Response(zen::IoBuffer::Wrap, Result.text.data(), Result.text.size());
@@ -1368,8 +1364,8 @@ TEST_CASE("zcache.cbpackage")
const uint16_t LocalPortNumber = 13337;
const uint16_t RemotePortNumber = 13338;
- const auto LocalBaseUri = "http://localhost:{}/z$"_format(LocalPortNumber);
- const auto RemoteBaseUri = "http://localhost:{}/z$"_format(RemotePortNumber);
+ const auto LocalBaseUri = fmt::format("http://localhost:{}/z$", LocalPortNumber);
+ const auto RemoteBaseUri = fmt::format("http://localhost:{}/z$", RemotePortNumber);
ZenServerInstance RemoteInstance(TestEnv);
RemoteInstance.SetTestDir(RemoteDataDir);
@@ -1379,7 +1375,7 @@ TEST_CASE("zcache.cbpackage")
ZenServerInstance LocalInstance(TestEnv);
LocalInstance.SetTestDir(LocalDataDir);
LocalInstance.SpawnServer(LocalPortNumber,
- "--upstream-thread-count=0 --upstream-zen-url=http://localhost:{}"_format(RemotePortNumber));
+ fmt::format("--upstream-thread-count=0 --upstream-zen-url=http://localhost:{}", RemotePortNumber));
LocalInstance.WaitUntilReady();
const std::string_view Bucket = "mosdef"sv;
@@ -1389,7 +1385,7 @@ TEST_CASE("zcache.cbpackage")
// Store the cache record package in the local instance
{
zen::IoBuffer Body = SerializeToBuffer(ExpectedPackage);
- cpr::Response Result = cpr::Put(cpr::Url{"{}/{}/{}"_format(LocalBaseUri, Bucket, Key)},
+ cpr::Response Result = cpr::Put(cpr::Url{fmt::format("{}/{}/{}", LocalBaseUri, Bucket, Key)},
cpr::Body{(const char*)Body.Data(), Body.Size()},
cpr::Header{{"Content-Type", "application/x-ue-cbpkg"}});
@@ -1399,7 +1395,7 @@ TEST_CASE("zcache.cbpackage")
// The cache record can be retrieved as a package from the local instance
{
cpr::Response Result =
- cpr::Get(cpr::Url{"{}/{}/{}"_format(LocalBaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}});
+ cpr::Get(cpr::Url{fmt::format("{}/{}/{}", LocalBaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}});
CHECK(Result.status_code == 200);
zen::IoBuffer Body(zen::IoBuffer::Wrap, Result.text.data(), Result.text.size());
@@ -1412,7 +1408,7 @@ TEST_CASE("zcache.cbpackage")
// The cache record can be retrieved as a package from the remote instance
{
cpr::Response Result =
- cpr::Get(cpr::Url{"{}/{}/{}"_format(RemoteBaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}});
+ cpr::Get(cpr::Url{fmt::format("{}/{}/{}", RemoteBaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}});
CHECK(Result.status_code == 200);
zen::IoBuffer Body(zen::IoBuffer::Wrap, Result.text.data(), Result.text.size());
@@ -1431,8 +1427,8 @@ TEST_CASE("zcache.cbpackage")
const uint16_t LocalPortNumber = 13337;
const uint16_t RemotePortNumber = 13338;
- const auto LocalBaseUri = "http://localhost:{}/z$"_format(LocalPortNumber);
- const auto RemoteBaseUri = "http://localhost:{}/z$"_format(RemotePortNumber);
+ const auto LocalBaseUri = fmt::format("http://localhost:{}/z$", LocalPortNumber);
+ const auto RemoteBaseUri = fmt::format("http://localhost:{}/z$", RemotePortNumber);
ZenServerInstance RemoteInstance(TestEnv);
RemoteInstance.SetTestDir(RemoteDataDir);
@@ -1442,7 +1438,7 @@ TEST_CASE("zcache.cbpackage")
ZenServerInstance LocalInstance(TestEnv);
LocalInstance.SetTestDir(LocalDataDir);
LocalInstance.SpawnServer(LocalPortNumber,
- "--upstream-thread-count=0 --upstream-zen-url=http://localhost:{}"_format(RemotePortNumber));
+ fmt::format("--upstream-thread-count=0 --upstream-zen-url=http://localhost:{}", RemotePortNumber));
LocalInstance.WaitUntilReady();
const std::string_view Bucket = "mosdef"sv;
@@ -1452,7 +1448,7 @@ TEST_CASE("zcache.cbpackage")
// Store the cache record package in upstream cache
{
zen::IoBuffer Body = SerializeToBuffer(ExpectedPackage);
- cpr::Response Result = cpr::Put(cpr::Url{"{}/{}/{}"_format(RemoteBaseUri, Bucket, Key)},
+ cpr::Response Result = cpr::Put(cpr::Url{fmt::format("{}/{}/{}", RemoteBaseUri, Bucket, Key)},
cpr::Body{(const char*)Body.Data(), Body.Size()},
cpr::Header{{"Content-Type", "application/x-ue-cbpkg"}});
@@ -1462,7 +1458,7 @@ TEST_CASE("zcache.cbpackage")
// The cache record can be retrieved as a package from the local cache
{
cpr::Response Result =
- cpr::Get(cpr::Url{"{}/{}/{}"_format(LocalBaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}});
+ cpr::Get(cpr::Url{fmt::format("{}/{}/{}", LocalBaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}});
CHECK(Result.status_code == 200);
zen::IoBuffer Body(zen::IoBuffer::Wrap, Result.text.data(), Result.text.size());
@@ -1533,20 +1529,20 @@ TEST_CASE("zcache.policy")
// Store binary cache value upstream
{
- cpr::Response Result = cpr::Put(cpr::Url{"{}/{}/{}"_format(UpstreamCfg.BaseUri, Bucket, Key)},
+ cpr::Response Result = cpr::Put(cpr::Url{fmt::format("{}/{}/{}", UpstreamCfg.BaseUri, Bucket, Key)},
cpr::Body{(const char*)BinaryValue.GetData(), BinaryValue.GetSize()},
cpr::Header{{"Content-Type", "application/octet-stream"}});
CHECK(Result.status_code == 201);
}
{
- cpr::Response Result = cpr::Get(cpr::Url{"{}/{}/{}?query=local"_format(LocalCfg.BaseUri, Bucket, Key)},
+ cpr::Response Result = cpr::Get(cpr::Url{fmt::format("{}/{}/{}?query=local", LocalCfg.BaseUri, Bucket, Key)},
cpr::Header{{"Accept", "application/octet-stream"}});
CHECK(Result.status_code == 404);
}
{
- cpr::Response Result = cpr::Get(cpr::Url{"{}/{}/{}?query=local,remote"_format(LocalCfg.BaseUri, Bucket, Key)},
+ cpr::Response Result = cpr::Get(cpr::Url{fmt::format("{}/{}/{}?query=local,remote", LocalCfg.BaseUri, Bucket, Key)},
cpr::Header{{"Accept", "application/octet-stream"}});
CHECK(Result.status_code == 200);
}
@@ -1568,21 +1564,21 @@ TEST_CASE("zcache.policy")
// Store binary cache value locally
{
- cpr::Response Result = cpr::Put(cpr::Url{"{}/{}/{}?store=local"_format(LocalCfg.BaseUri, Bucket, Key)},
+ cpr::Response Result = cpr::Put(cpr::Url{fmt::format("{}/{}/{}?store=local", LocalCfg.BaseUri, Bucket, Key)},
cpr::Body{(const char*)BinaryValue.GetData(), BinaryValue.GetSize()},
cpr::Header{{"Content-Type", "application/octet-stream"}});
CHECK(Result.status_code == 201);
}
{
- cpr::Response Result = cpr::Get(cpr::Url{"{}/{}/{}"_format(UpstreamCfg.BaseUri, Bucket, Key)},
+ cpr::Response Result = cpr::Get(cpr::Url{fmt::format("{}/{}/{}", UpstreamCfg.BaseUri, Bucket, Key)},
cpr::Header{{"Accept", "application/octet-stream"}});
CHECK(Result.status_code == 404);
}
{
cpr::Response Result =
- cpr::Get(cpr::Url{"{}/{}/{}"_format(LocalCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/octet-stream"}});
+ cpr::Get(cpr::Url{fmt::format("{}/{}/{}", LocalCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/octet-stream"}});
CHECK(Result.status_code == 200);
}
}
@@ -1603,21 +1599,21 @@ TEST_CASE("zcache.policy")
// Store binary cache value locally and upstream
{
- cpr::Response Result = cpr::Put(cpr::Url{"{}/{}/{}?store=local,remote"_format(LocalCfg.BaseUri, Bucket, Key)},
+ cpr::Response Result = cpr::Put(cpr::Url{fmt::format("{}/{}/{}?store=local,remote", LocalCfg.BaseUri, Bucket, Key)},
cpr::Body{(const char*)BinaryValue.GetData(), BinaryValue.GetSize()},
cpr::Header{{"Content-Type", "application/octet-stream"}});
CHECK(Result.status_code == 201);
}
{
- cpr::Response Result = cpr::Get(cpr::Url{"{}/{}/{}"_format(UpstreamCfg.BaseUri, Bucket, Key)},
+ cpr::Response Result = cpr::Get(cpr::Url{fmt::format("{}/{}/{}", UpstreamCfg.BaseUri, Bucket, Key)},
cpr::Header{{"Accept", "application/octet-stream"}});
CHECK(Result.status_code == 200);
}
{
cpr::Response Result =
- cpr::Get(cpr::Url{"{}/{}/{}"_format(LocalCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/octet-stream"}});
+ cpr::Get(cpr::Url{fmt::format("{}/{}/{}", LocalCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/octet-stream"}});
CHECK(Result.status_code == 200);
}
}
@@ -1640,20 +1636,20 @@ TEST_CASE("zcache.policy")
// Store package upstream
{
- cpr::Response Result = cpr::Put(cpr::Url{"{}/{}/{}"_format(UpstreamCfg.BaseUri, Bucket, Key)},
+ cpr::Response Result = cpr::Put(cpr::Url{fmt::format("{}/{}/{}", UpstreamCfg.BaseUri, Bucket, Key)},
cpr::Body{(const char*)Buf.GetData(), Buf.GetSize()},
cpr::Header{{"Content-Type", "application/x-ue-cbpkg"}});
CHECK(Result.status_code == 201);
}
{
- cpr::Response Result = cpr::Get(cpr::Url{"{}/{}/{}?query=local"_format(LocalCfg.BaseUri, Bucket, Key)},
+ cpr::Response Result = cpr::Get(cpr::Url{fmt::format("{}/{}/{}?query=local", LocalCfg.BaseUri, Bucket, Key)},
cpr::Header{{"Accept", "application/x-ue-cbpkg"}});
CHECK(Result.status_code == 404);
}
{
- cpr::Response Result = cpr::Get(cpr::Url{"{}/{}/{}?query=local,remote"_format(LocalCfg.BaseUri, Bucket, Key)},
+ cpr::Response Result = cpr::Get(cpr::Url{fmt::format("{}/{}/{}?query=local,remote", LocalCfg.BaseUri, Bucket, Key)},
cpr::Header{{"Accept", "application/x-ue-cbpkg"}});
CHECK(Result.status_code == 200);
}
@@ -1677,7 +1673,7 @@ TEST_CASE("zcache.policy")
// Store packge locally
{
- cpr::Response Result = cpr::Put(cpr::Url{"{}/{}/{}?store=local"_format(LocalCfg.BaseUri, Bucket, Key)},
+ cpr::Response Result = cpr::Put(cpr::Url{fmt::format("{}/{}/{}?store=local", LocalCfg.BaseUri, Bucket, Key)},
cpr::Body{(const char*)Buf.GetData(), Buf.GetSize()},
cpr::Header{{"Content-Type", "application/x-ue-cbpkg"}});
CHECK(Result.status_code == 201);
@@ -1685,13 +1681,13 @@ TEST_CASE("zcache.policy")
{
cpr::Response Result =
- cpr::Get(cpr::Url{"{}/{}/{}"_format(UpstreamCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}});
+ cpr::Get(cpr::Url{fmt::format("{}/{}/{}", UpstreamCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}});
CHECK(Result.status_code == 404);
}
{
cpr::Response Result =
- cpr::Get(cpr::Url{"{}/{}/{}"_format(LocalCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}});
+ cpr::Get(cpr::Url{fmt::format("{}/{}/{}", LocalCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}});
CHECK(Result.status_code == 200);
}
}
@@ -1714,7 +1710,7 @@ TEST_CASE("zcache.policy")
// Store package locally and upstream
{
- cpr::Response Result = cpr::Put(cpr::Url{"{}/{}/{}?store=local,remote"_format(LocalCfg.BaseUri, Bucket, Key)},
+ cpr::Response Result = cpr::Put(cpr::Url{fmt::format("{}/{}/{}?store=local,remote", LocalCfg.BaseUri, Bucket, Key)},
cpr::Body{(const char*)Buf.GetData(), Buf.GetSize()},
cpr::Header{{"Content-Type", "application/x-ue-cbpkg"}});
CHECK(Result.status_code == 201);
@@ -1722,13 +1718,13 @@ TEST_CASE("zcache.policy")
{
cpr::Response Result =
- cpr::Get(cpr::Url{"{}/{}/{}"_format(UpstreamCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}});
+ cpr::Get(cpr::Url{fmt::format("{}/{}/{}", UpstreamCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}});
CHECK(Result.status_code == 200);
}
{
cpr::Response Result =
- cpr::Get(cpr::Url{"{}/{}/{}"_format(LocalCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}});
+ cpr::Get(cpr::Url{fmt::format("{}/{}/{}", LocalCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}});
CHECK(Result.status_code == 200);
}
}
@@ -1750,14 +1746,14 @@ TEST_CASE("zcache.policy")
auto Buf = ToBuffer(Package);
CHECK(Package.GetAttachments().size() != 0);
- cpr::Response Result = cpr::Put(cpr::Url{"{}/{}/{}"_format(LocalCfg.BaseUri, Bucket, Key)},
+ cpr::Response Result = cpr::Put(cpr::Url{fmt::format("{}/{}/{}", LocalCfg.BaseUri, Bucket, Key)},
cpr::Body{(const char*)Buf.GetData(), Buf.GetSize()},
cpr::Header{{"Content-Type", "application/x-ue-cbpkg"}});
CHECK(Result.status_code == 201);
}
{
- cpr::Response Result = cpr::Get(cpr::Url{"{}/{}/{}?skip=attachments"_format(LocalCfg.BaseUri, Bucket, Key)},
+ cpr::Response Result = cpr::Get(cpr::Url{fmt::format("{}/{}/{}?skip=attachments", LocalCfg.BaseUri, Bucket, Key)},
cpr::Header{{"Accept", "application/x-ue-cbpkg"}});
CHECK(Result.status_code == 200);
@@ -1780,7 +1776,7 @@ TEST_CASE("zcache.policy")
{
cpr::Response Result =
- cpr::Get(cpr::Url{"{}/{}/{}"_format(LocalCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}});
+ cpr::Get(cpr::Url{fmt::format("{}/{}/{}", LocalCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}});
CHECK(Result.status_code == 200);
zen::IoBuffer Body(zen::IoBuffer::Wrap, Result.text.data(), Result.text.size());
@@ -1813,14 +1809,14 @@ TEST_CASE("zcache.policy")
auto Buf = ToBuffer(Package);
CHECK(Package.GetAttachments().size() != 0);
- cpr::Response Result = cpr::Put(cpr::Url{"{}/{}/{}"_format(UpstreamCfg.BaseUri, Bucket, Key)},
+ cpr::Response Result = cpr::Put(cpr::Url{fmt::format("{}/{}/{}", UpstreamCfg.BaseUri, Bucket, Key)},
cpr::Body{(const char*)Buf.GetData(), Buf.GetSize()},
cpr::Header{{"Content-Type", "application/x-ue-cbpkg"}});
CHECK(Result.status_code == 201);
}
{
- cpr::Response Result = cpr::Get(cpr::Url{"{}/{}/{}?skip=attachments"_format(LocalCfg.BaseUri, Bucket, Key)},
+ cpr::Response Result = cpr::Get(cpr::Url{fmt::format("{}/{}/{}?skip=attachments", LocalCfg.BaseUri, Bucket, Key)},
cpr::Header{{"Accept", "application/x-ue-cbpkg"}});
CHECK(Result.status_code == 200);
@@ -1843,7 +1839,7 @@ TEST_CASE("zcache.policy")
{
cpr::Response Result =
- cpr::Get(cpr::Url{"{}/{}/{}"_format(LocalCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}});
+ cpr::Get(cpr::Url{fmt::format("{}/{}/{}", LocalCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}});
CHECK(Result.status_code == 200);
zen::IoBuffer Body(zen::IoBuffer::Wrap, Result.text.data(), Result.text.size());
@@ -1871,7 +1867,7 @@ TEST_CASE("zcache.policy")
// Store package
{
- cpr::Response Result = cpr::Put(cpr::Url{"{}/{}/{}"_format(Cfg.BaseUri, Bucket, Key)},
+ cpr::Response Result = cpr::Put(cpr::Url{fmt::format("{}/{}/{}", Cfg.BaseUri, Bucket, Key)},
cpr::Body{(const char*)Buf.GetData(), Buf.GetSize()},
cpr::Header{{"Content-Type", "application/x-ue-cbpkg"}});
CHECK(Result.status_code == 201);
@@ -1879,7 +1875,7 @@ TEST_CASE("zcache.policy")
// Get package
{
- cpr::Response Result = cpr::Get(cpr::Url{"{}/{}/{}?skip=data"_format(Cfg.BaseUri, Bucket, Key)},
+ cpr::Response Result = cpr::Get(cpr::Url{fmt::format("{}/{}/{}?skip=data", Cfg.BaseUri, Bucket, Key)},
cpr::Header{{"Accept", "application/x-ue-cbpkg"}});
CHECK(IsHttpSuccessCode(Result.status_code));
CHECK(Result.text.size() == 0);
@@ -1887,7 +1883,7 @@ TEST_CASE("zcache.policy")
// Get record
{
- cpr::Response Result = cpr::Get(cpr::Url{"{}/{}/{}?skip=data"_format(Cfg.BaseUri, Bucket, Key)},
+ cpr::Response Result = cpr::Get(cpr::Url{fmt::format("{}/{}/{}?skip=data", Cfg.BaseUri, Bucket, Key)},
cpr::Header{{"Accept", "application/x-ue-cbobject"}});
CHECK(IsHttpSuccessCode(Result.status_code));
CHECK(Result.text.size() == 0);
@@ -1895,7 +1891,7 @@ TEST_CASE("zcache.policy")
// Get payload
{
- cpr::Response Result = cpr::Get(cpr::Url{"{}/{}/{}/{}?skip=data"_format(Cfg.BaseUri, Bucket, Key, PayloadId)},
+ cpr::Response Result = cpr::Get(cpr::Url{fmt::format("{}/{}/{}/{}?skip=data", Cfg.BaseUri, Bucket, Key, PayloadId)},
cpr::Header{{"Accept", "application/x-ue-comp"}});
CHECK(IsHttpSuccessCode(Result.status_code));
CHECK(Result.text.size() == 0);
@@ -1915,7 +1911,7 @@ TEST_CASE("zcache.policy")
// Store binary cache value
{
- cpr::Response Result = cpr::Put(cpr::Url{"{}/{}/{}"_format(Cfg.BaseUri, Bucket, Key)},
+ cpr::Response Result = cpr::Put(cpr::Url{fmt::format("{}/{}/{}", Cfg.BaseUri, Bucket, Key)},
cpr::Body{(const char*)BinaryValue.GetData(), BinaryValue.GetSize()},
cpr::Header{{"Content-Type", "application/octet-stream"}});
CHECK(Result.status_code == 201);
@@ -1923,7 +1919,7 @@ TEST_CASE("zcache.policy")
// Get package
{
- cpr::Response Result = cpr::Get(cpr::Url{"{}/{}/{}?skip=data"_format(Cfg.BaseUri, Bucket, Key)},
+ cpr::Response Result = cpr::Get(cpr::Url{fmt::format("{}/{}/{}?skip=data", Cfg.BaseUri, Bucket, Key)},
cpr::Header{{"Accept", "application/octet-stream"}});
CHECK(IsHttpSuccessCode(Result.status_code));
CHECK(Result.text.size() == 0);
@@ -1980,7 +1976,7 @@ TEST_CASE("zcache.rpc")
IoBuffer Payload = ToIoBuffer(CacheRecord);
- cpr::Response Result = cpr::Put(cpr::Url{"{}/{}/{}{}"_format(BaseUri, CacheKey.Bucket, CacheKey.Hash, Query)},
+ cpr::Response Result = cpr::Put(cpr::Url{fmt::format("{}/{}/{}{}", BaseUri, CacheKey.Bucket, CacheKey.Hash, Query)},
cpr::Body{(const char*)Payload.Data(), Payload.Size()},
cpr::Header{{"Content-Type", "application/x-ue-cbpkg"}});
@@ -2024,7 +2020,7 @@ TEST_CASE("zcache.rpc")
BinaryWriter Body;
Request.Save(Body);
- cpr::Response Result = cpr::Post(cpr::Url{"{}/$rpc"_format(BaseUri)},
+ cpr::Response Result = cpr::Post(cpr::Url{fmt::format("{}/$rpc", BaseUri)},
cpr::Header{{"Content-Type", "application/x-ue-cb"}, {"Accept", "application/x-ue-cbpkg"}},
cpr::Body{(const char*)Body.GetData(), Body.GetSize()});
@@ -2062,7 +2058,7 @@ TEST_CASE("zcache.rpc")
{
std::filesystem::path TestDir = TestEnv.CreateNewTestDir();
const uint16_t PortNumber = 13337;
- const auto BaseUri = "http://localhost:{}/z$"_format(PortNumber);
+ const auto BaseUri = fmt::format("http://localhost:{}/z$", PortNumber);
ZenServerInstance Inst(TestEnv);
Inst.SetTestDir(TestDir);
@@ -2094,7 +2090,7 @@ TEST_CASE("zcache.rpc")
{
std::filesystem::path TestDir = TestEnv.CreateNewTestDir();
const uint16_t PortNumber = 13337;
- const auto BaseUri = "http://localhost:{}/z$"_format(PortNumber);
+ const auto BaseUri = fmt::format("http://localhost:{}/z$", PortNumber);
ZenServerInstance Inst(TestEnv);
Inst.SetTestDir(TestDir);
@@ -2142,7 +2138,7 @@ TEST_CASE("zcache.rpc")
{
std::filesystem::path TestDir = TestEnv.CreateNewTestDir();
const uint16_t PortNumber = 13337;
- const auto BaseUri = "http://localhost:{}/z$"_format(PortNumber);
+ const auto BaseUri = fmt::format("http://localhost:{}/z$", PortNumber);
ZenServerInstance Inst(TestEnv);
Inst.SetTestDir(TestDir);
@@ -2260,7 +2256,7 @@ struct RemoteExecutionRequest
void Prep()
{
- cpr::Response Response = cpr::Post(cpr::Url("{}/prep"_format(m_BaseUri)), cpr::Body((const char*)m_MemOut.Data(), m_MemOut.Size()));
+ cpr::Response Response = cpr::Post(cpr::Url(fmt::format("{}/prep", m_BaseUri)), cpr::Body((const char*)m_MemOut.Data(), m_MemOut.Size()));
if (Response.status_code < 300)
{
@@ -2354,8 +2350,8 @@ private:
std::string m_HostName;
int m_PortNumber;
std::filesystem::path m_TreePath;
- const std::string m_BaseUri = "http://{}:{}/exec/jobs"_format(m_HostName, m_PortNumber);
- const std::string m_CasUri = "http://{}:{}/cas"_format(m_HostName, m_PortNumber);
+ const std::string m_BaseUri = fmt::format("http://{}:{}/exec/jobs", m_HostName, m_PortNumber);
+ const std::string m_CasUri = fmt::format("http://{}:{}/cas", m_HostName, m_PortNumber);
Visitor m_Visit{m_TreePath};
zen::BinaryWriter m_MemOut;
};
@@ -2485,17 +2481,17 @@ TEST_CASE("http.basics")
const std::string BaseUri = Instance.GetBaseUri();
{
- cpr::Response r = cpr::Get(cpr::Url{"{}/testing/hello"_format(BaseUri)});
+ cpr::Response r = cpr::Get(cpr::Url{fmt::format("{}/testing/hello", BaseUri)});
CHECK(IsHttpSuccessCode(r.status_code));
}
{
- cpr::Response r = cpr::Post(cpr::Url{"{}/testing/hello"_format(BaseUri)});
+ cpr::Response r = cpr::Post(cpr::Url{fmt::format("{}/testing/hello", BaseUri)});
CHECK_EQ(r.status_code, 404);
}
{
- cpr::Response r = cpr::Post(cpr::Url{"{}/testing/echo"_format(BaseUri)}, cpr::Body{"yoyoyoyo"});
+ cpr::Response r = cpr::Post(cpr::Url{fmt::format("{}/testing/echo", BaseUri)}, cpr::Body{"yoyoyoyo"});
CHECK_EQ(r.status_code, 200);
CHECK_EQ(r.text, "yoyoyoyo");
}
diff --git a/zenserver/cache/cachetracking.cpp b/zenserver/cache/cachetracking.cpp
index ae132f37f..9119e3122 100644
--- a/zenserver/cache/cachetracking.cpp
+++ b/zenserver/cache/cachetracking.cpp
@@ -26,8 +26,6 @@ ZEN_THIRD_PARTY_INCLUDES_END
namespace zen {
-using namespace fmt::literals;
-
namespace rocksdb = ROCKSDB_NAMESPACE;
static constinit auto Epoch = std::chrono::time_point<std::chrono::system_clock>{};
@@ -180,14 +178,14 @@ struct ZenCacheTracker::Impl
}
else
{
- throw std::runtime_error("column family iteration failed for '{}': '{}'"_format(RocksdbPath, Status.getState()).c_str());
+ throw std::runtime_error(fmt::format("column family iteration failed for '{}': '{}'", RocksdbPath, Status.getState()).c_str());
}
Status = rocksdb::DB::Open(Options, RocksdbPath, ColumnDescriptors, &m_RocksDbColumnHandles, &Db);
if (!Status.ok())
{
- throw std::runtime_error("database open failed for '{}': '{}'"_format(RocksdbPath, Status.getState()).c_str());
+ throw std::runtime_error(fmt::format("database open failed for '{}': '{}'", RocksdbPath, Status.getState()).c_str());
}
m_RocksDb.reset(Db);
@@ -297,7 +295,6 @@ ZenCacheTracker::IterateSnapshots(std::function<void(uint64_t TimeStamp, CbObjec
TEST_CASE("z$.tracker")
{
- using namespace fmt::literals;
using namespace std::literals;
const uint64_t t0 = GetCurrentCacheTimeStamp();
diff --git a/zenserver/cache/structuredcache.cpp b/zenserver/cache/structuredcache.cpp
index 1d43d372b..3bcc3be87 100644
--- a/zenserver/cache/structuredcache.cpp
+++ b/zenserver/cache/structuredcache.cpp
@@ -813,8 +813,6 @@ HttpStructuredCacheService::HandleRpcGetCacheRecords(zen::HttpServerRequest& Req
{
ZEN_TRACE_CPU("Z$::RpcGetCacheRecords");
- using namespace fmt::literals;
-
CbPackage RpcResponse;
CacheRecordPolicy Policy;
CbObjectView Params = RpcRequest["Params"sv].AsObjectView();
@@ -1011,8 +1009,6 @@ HttpStructuredCacheService::HandleRpcGetCachePayloads(zen::HttpServerRequest& Re
{
ZEN_TRACE_CPU("Z$::RpcGetCachePayloads");
- using namespace fmt::literals;
-
ZEN_ASSERT(RpcRequest["Method"sv].AsString() == "GetCachePayloads"sv);
std::vector<CacheChunkRequest> ChunkRequests;
diff --git a/zenserver/cache/structuredcachestore.cpp b/zenserver/cache/structuredcachestore.cpp
index e74becb3a..4dd2f4264 100644
--- a/zenserver/cache/structuredcachestore.cpp
+++ b/zenserver/cache/structuredcachestore.cpp
@@ -38,7 +38,6 @@ ZEN_THIRD_PARTY_INCLUDES_END
namespace zen {
-using namespace fmt::literals;
namespace fs = std::filesystem;
static CbObject
@@ -1066,14 +1065,14 @@ ZenCacheDiskLayer::CacheBucket::PutStandaloneCacheValue(const IoHash& HashKey, c
if (Ec)
{
- throw std::system_error(Ec, "Failed to open temporary file for put at '{}'"_format(m_BucketDir));
+ throw std::system_error(Ec, fmt::format("Failed to open temporary file for put at '{}'", m_BucketDir));
}
DataFile.WriteAll(Value.Value, Ec);
if (Ec)
{
- throw std::system_error(Ec, "Failed to write payload ({} bytes) to file"_format(NiceBytes(Value.Value.Size())));
+ throw std::system_error(Ec, fmt::format("Failed to write payload ({} bytes) to file", NiceBytes(Value.Value.Size())));
}
// Move file into place (atomically)
@@ -1113,7 +1112,7 @@ ZenCacheDiskLayer::CacheBucket::PutStandaloneCacheValue(const IoHash& HashKey, c
if (Ec)
{
- throw std::system_error(Ec, "Failed to finalize file '{}'"_format(DataFilePath.ToUtf8()));
+ throw std::system_error(Ec, fmt::format("Failed to finalize file '{}'", DataFilePath.ToUtf8()));
}
}
@@ -1396,7 +1395,6 @@ ZenCacheDiskLayer::TotalSize() const
#if ZEN_WITH_TESTS
using namespace std::literals;
-using namespace fmt::literals;
namespace testutils {
IoHash CreateKey(size_t KeyValue) { return IoHash::HashBuffer(&KeyValue, sizeof(size_t)); }
@@ -1483,7 +1481,7 @@ TEST_CASE("z$.size")
for (size_t Key = 0; Key < Count; ++Key)
{
const size_t Bucket = Key % 4;
- Zcs.Put("test_bucket-{}"_format(Bucket), IoHash::HashBuffer(&Key, sizeof(uint32_t)), {.Value = Buffer});
+ Zcs.Put(fmt::format("test_bucket-{}", Bucket), IoHash::HashBuffer(&Key, sizeof(uint32_t)), {.Value = Buffer});
}
CacheSize = Zcs.StorageSize();
@@ -1501,7 +1499,7 @@ TEST_CASE("z$.size")
for (size_t Bucket = 0; Bucket < 4; ++Bucket)
{
- Zcs.DropBucket("test_bucket-{}"_format(Bucket));
+ Zcs.DropBucket(fmt::format("test_bucket-{}", Bucket));
}
CHECK_EQ(0, Zcs.StorageSize().DiskSize);
}
@@ -1526,7 +1524,7 @@ TEST_CASE("z$.size")
for (size_t Key = 0; Key < Count; ++Key)
{
const size_t Bucket = Key % 4;
- Zcs.Put("test_bucket-{}"_format(Bucket), IoHash::HashBuffer(&Key, sizeof(uint32_t)), {.Value = Buffer});
+ Zcs.Put(fmt::format("test_bucket-{}", Bucket), IoHash::HashBuffer(&Key, sizeof(uint32_t)), {.Value = Buffer});
}
CacheSize = Zcs.StorageSize();
@@ -1544,7 +1542,7 @@ TEST_CASE("z$.size")
for (size_t Bucket = 0; Bucket < 4; ++Bucket)
{
- Zcs.DropBucket("test_bucket-{}"_format(Bucket));
+ Zcs.DropBucket(fmt::format("test_bucket-{}", Bucket));
}
CHECK_EQ(0, Zcs.StorageSize().DiskSize);
}
@@ -1585,7 +1583,7 @@ TEST_CASE("z$.gc")
for (size_t Idx = 0; auto& Cid : Cids)
{
- Record.AddBinaryAttachment("attachment-{}"_format(Idx++), Cid);
+ Record.AddBinaryAttachment(fmt::format("attachment-{}", Idx++), Cid);
}
IoBuffer Buffer = Record.Save().GetBuffer().AsIoBuffer();
diff --git a/zenserver/compute/apply.cpp b/zenserver/compute/apply.cpp
index d483fd4f7..95902a752 100644
--- a/zenserver/compute/apply.cpp
+++ b/zenserver/compute/apply.cpp
@@ -61,8 +61,6 @@ BasicFunctionJob::~BasicFunctionJob()
bool
BasicFunctionJob::SpawnJob(std::filesystem::path ExePath, std::wstring CommandLine)
{
- using namespace fmt::literals;
-
STARTUPINFOEX StartupInfo = {sizeof(STARTUPINFOEX)};
PROCESS_INFORMATION ProcessInfo{};
@@ -82,7 +80,7 @@ BasicFunctionJob::SpawnJob(std::filesystem::path ExePath, std::wstring CommandLi
if (!Created)
{
- throw std::system_error(::GetLastError(), std::system_category(), "Failed to create process '{}'"_format(ExePath).c_str());
+ throw std::system_error(::GetLastError(), std::system_category(), fmt::format("Failed to create process '{}'", ExePath).c_str());
}
m_ProcessId = ProcessInfo.dwProcessId;
@@ -714,7 +712,6 @@ CbPackage
HttpFunctionService::ExecAction(const WorkerDesc& Worker, CbObject Action)
{
using namespace std::literals;
- using namespace fmt::literals;
std::filesystem::path SandboxPath = CreateNewSandbox();
@@ -735,12 +732,12 @@ HttpFunctionService::ExecAction(const WorkerDesc& Worker, CbObject Action)
if (!DataBuffer)
{
- throw std::runtime_error("worker CAS chunk '{}' missing"_format(ChunkHash));
+ throw std::runtime_error(fmt::format("worker CAS chunk '{}' missing", ChunkHash));
}
if (DataBuffer.Size() != Size)
{
- throw std::runtime_error("worker CAS chunk '{}' size: {}, action spec expected {}"_format(ChunkHash, DataBuffer.Size(), Size));
+ throw std::runtime_error(fmt::format("worker CAS chunk '{}' size: {}, action spec expected {}", ChunkHash, DataBuffer.Size(), Size));
}
zen::WriteFile(FilePath, DataBuffer);
@@ -766,12 +763,12 @@ HttpFunctionService::ExecAction(const WorkerDesc& Worker, CbObject Action)
if (!DataBuffer)
{
- throw std::runtime_error("worker CAS chunk '{}' missing"_format(ChunkHash));
+ throw std::runtime_error(fmt::format("worker CAS chunk '{}' missing", ChunkHash));
}
if (DataBuffer.Size() != Size)
{
- throw std::runtime_error("worker CAS chunk '{}' size: {}, action spec expected {}"_format(ChunkHash, DataBuffer.Size(), Size));
+ throw std::runtime_error(fmt::format("worker CAS chunk '{}' size: {}, action spec expected {}", ChunkHash, DataBuffer.Size(), Size));
}
zen::WriteFile(FilePath, DataBuffer);
@@ -790,7 +787,7 @@ HttpFunctionService::ExecAction(const WorkerDesc& Worker, CbObject Action)
if (!DataBuffer)
{
- throw std::runtime_error("input CID chunk '{}' missing"_format(Cid));
+ throw std::runtime_error(fmt::format("input CID chunk '{}' missing", Cid));
}
zen::WriteFile(FilePath, DataBuffer);
@@ -942,11 +939,10 @@ HttpFunctionService::ExecActionUpstream(const WorkerDesc& Worker, CbObject Actio
HttpResponseCode
HttpFunctionService::ExecActionUpstreamResult(const IoHash& WorkerId, const IoHash& ActionId, CbPackage& Package)
{
- using namespace fmt::literals;
auto Status = m_UpstreamApply->GetStatus(WorkerId, ActionId);
if (!Status.Success)
{
- // throw std::runtime_error("Action {}/{} not found"_format(WorkerId.ToHexString(), ActionId.ToHexString()).c_str());
+ // throw std::runtime_error(fmt::format("Action {}/{} not found", WorkerId.ToHexString(), ActionId.ToHexString()).c_str());
return HttpResponseCode::NotFound;
}
diff --git a/zenserver/config.cpp b/zenserver/config.cpp
index 722bc3b97..9fd4bfa69 100644
--- a/zenserver/config.cpp
+++ b/zenserver/config.cpp
@@ -394,8 +394,6 @@ ParseCliOptions(int argc, char* argv[], ZenServerOptions& ServerOptions)
void
ParseConfigFile(const std::filesystem::path& Path, ZenServerOptions& ServerOptions)
{
- using namespace fmt::literals;
-
zen::IoBuffer LuaScript = zen::IoBufferBuilder::MakeFromFile(Path);
if (LuaScript)
@@ -433,14 +431,14 @@ ParseConfigFile(const std::filesystem::path& Path, ZenServerOptions& ServerOptio
std::string ErrorString = sol::to_string(config.status());
- throw std::runtime_error("{} error: {}"_format(ErrorString, err.what()));
+ throw std::runtime_error(fmt::format("{} error: {}", ErrorString, err.what()));
}
config();
}
catch (std::exception& e)
{
- throw std::runtime_error("failed to load config script ('{}'): {}"_format(Path, e.what()).c_str());
+ throw std::runtime_error(fmt::format("failed to load config script ('{}'): {}", Path, e.what()).c_str());
}
if (sol::optional<sol::table> ServerConfig = lua["server"])
diff --git a/zenserver/projectstore.cpp b/zenserver/projectstore.cpp
index 4f9897e07..8221199f1 100644
--- a/zenserver/projectstore.cpp
+++ b/zenserver/projectstore.cpp
@@ -42,8 +42,6 @@ ZEN_THIRD_PARTY_INCLUDES_END
namespace zen {
-using namespace fmt::literals;
-
#if USE_ROCKSDB
namespace rocksdb = ROCKSDB_NAMESPACE;
#endif
@@ -154,14 +152,14 @@ struct ProjectStore::OplogStorage : public RefCounted
}
else
{
- throw std::runtime_error("column family iteration failed for '{}': '{}'"_format(RocksdbPath, Status.getState()).c_str());
+ throw std::runtime_error(fmt::format("column family iteration failed for '{}': '{}'", RocksdbPath, Status.getState()).c_str());
}
Status = rocksdb::DB::Open(Options, RocksdbPath, ColumnDescriptors, &m_RocksDbColumnHandles, &Db);
if (!Status.ok())
{
- throw std::runtime_error("database open failed for '{}': '{}'"_format(RocksdbPath, Status.getState()).c_str());
+ throw std::runtime_error(fmt::format("database open failed for '{}': '{}'", RocksdbPath, Status.getState()).c_str());
}
m_RocksDb.reset(Db);
@@ -1560,7 +1558,7 @@ HttpProjectService::HttpProjectService(CidStore& Store, ProjectStore* Projects)
if (!legacy::TryLoadCbPackage(Package, Payload, &UniqueBuffer::Alloc, &Resolver))
{
std::filesystem::path BadPackagePath =
- Oplog.TempPath() / "bad_packages" / "session{}_request{}"_format(HttpReq.SessionId(), HttpReq.RequestId());
+ Oplog.TempPath() / "bad_packages" / fmt::format("session{}_request{}", HttpReq.SessionId(), HttpReq.RequestId());
ZEN_ERROR("Received malformed package! Saving payload to '{}'", BadPackagePath);
@@ -1609,8 +1607,6 @@ HttpProjectService::HttpProjectService(CidStore& Store, ProjectStore* Projects)
},
HttpVerb::kGet);
- using namespace fmt::literals;
-
m_Router.RegisterRoute(
"{project}/oplog/{log}",
[this](HttpRouterRequest& Req) {
@@ -1623,7 +1619,7 @@ HttpProjectService::HttpProjectService(CidStore& Store, ProjectStore* Projects)
{
return Req.ServerRequest().WriteResponse(HttpResponseCode::NotFound,
HttpContentType::kText,
- "project {} not found"_format(ProjectId));
+ fmt::format("project {} not found", ProjectId));
}
ProjectStore::Project& Prj = *ProjectIt;
@@ -1638,7 +1634,7 @@ HttpProjectService::HttpProjectService(CidStore& Store, ProjectStore* Projects)
{
return Req.ServerRequest().WriteResponse(HttpResponseCode::NotFound,
HttpContentType::kText,
- "oplog {} not found in project {}"_format(OplogId, ProjectId));
+ fmt::format("oplog {} not found in project {}", OplogId, ProjectId));
}
ProjectStore::Oplog& Log = *OplogIt;
@@ -1777,7 +1773,7 @@ HttpProjectService::HttpProjectService(CidStore& Store, ProjectStore* Projects)
{
return Req.ServerRequest().WriteResponse(HttpResponseCode::NotFound,
HttpContentType::kText,
- "project {} not found"_format(ProjectId));
+ fmt::format("project {} not found", ProjectId));
}
const ProjectStore::Project& Prj = *ProjectIt;
@@ -1801,7 +1797,7 @@ HttpProjectService::HttpProjectService(CidStore& Store, ProjectStore* Projects)
{
return Req.ServerRequest().WriteResponse(HttpResponseCode::NotFound,
HttpContentType::kText,
- "project {} not found"_format(ProjectId));
+ fmt::format("project {} not found", ProjectId));
}
m_ProjectStore->DeleteProject(ProjectId);
@@ -2142,7 +2138,6 @@ LocalProjectService::~LocalProjectService()
TEST_CASE("prj.store")
{
- using namespace fmt::literals;
using namespace std::literals;
ScopedTemporaryDirectory TempDir;
diff --git a/zenserver/testing/httptest.cpp b/zenserver/testing/httptest.cpp
index 924546762..eedf06661 100644
--- a/zenserver/testing/httptest.cpp
+++ b/zenserver/testing/httptest.cpp
@@ -8,8 +8,6 @@
namespace zen {
-using namespace fmt::literals;
-
HttpTestingService::HttpTestingService()
{
m_Router.RegisterRoute(
@@ -25,7 +23,7 @@ HttpTestingService::HttpTestingService()
Sleep(1000);
Request.WriteResponse(HttpResponseCode::OK,
HttpContentType::kText,
- "hello, took me {}"_format(NiceTimeSpanMs(Timer.GetElapsedTimeMs())));
+ fmt::format("hello, took me {}", NiceTimeSpanMs(Timer.GetElapsedTimeMs())));
});
},
HttpVerb::kGet);
@@ -38,7 +36,7 @@ HttpTestingService::HttpTestingService()
Sleep(60000);
Request.WriteResponse(HttpResponseCode::OK,
HttpContentType::kText,
- "hello, took me {}"_format(NiceTimeSpanMs(Timer.GetElapsedTimeMs())));
+ fmt::format("hello, took me {}", NiceTimeSpanMs(Timer.GetElapsedTimeMs())));
});
},
HttpVerb::kGet);
diff --git a/zenserver/testing/launch.cpp b/zenserver/testing/launch.cpp
index 706594b10..f315ec1b4 100644
--- a/zenserver/testing/launch.cpp
+++ b/zenserver/testing/launch.cpp
@@ -55,8 +55,6 @@ BasicJob::~BasicJob()
bool
BasicJob::SpawnJob(std::filesystem::path ExePath, std::wstring CommandLine)
{
- using namespace fmt::literals;
-
STARTUPINFOEX StartupInfo = {sizeof(STARTUPINFOEX)};
PROCESS_INFORMATION ProcessInfo{};
@@ -76,7 +74,7 @@ BasicJob::SpawnJob(std::filesystem::path ExePath, std::wstring CommandLine)
if (!Created)
{
- throw std::system_error(::GetLastError(), std::system_category(), "Failed to create process '{}'"_format(ExePath).c_str());
+ throw std::system_error(::GetLastError(), std::system_category(), fmt::format("Failed to create process '{}'", ExePath).c_str());
}
m_ProcessId = ProcessInfo.dwProcessId;
diff --git a/zenserver/upstream/jupiter.cpp b/zenserver/upstream/jupiter.cpp
index ffb9b1cbf..c952d8e10 100644
--- a/zenserver/upstream/jupiter.cpp
+++ b/zenserver/upstream/jupiter.cpp
@@ -25,7 +25,6 @@ ZEN_THIRD_PARTY_INCLUDES_END
#include <json11.hpp>
using namespace std::literals;
-using namespace fmt::literals;
namespace zen {
diff --git a/zenserver/upstream/upstreamapply.cpp b/zenserver/upstream/upstreamapply.cpp
index f8a8c3e62..fe7f7d9c8 100644
--- a/zenserver/upstream/upstreamapply.cpp
+++ b/zenserver/upstream/upstreamapply.cpp
@@ -53,10 +53,9 @@ namespace detail {
, m_CasStore(CasStore)
, m_CidStore(CidStore)
{
- using namespace fmt::literals;
- m_DisplayName = "Horde - '{}'"_format(Options.ServiceUrl);
+ m_DisplayName = fmt::format("Horde - '{}'", Options.ServiceUrl);
m_Client = new CloudCacheClient(Options);
- m_ChannelId = "zen-{}"_format(zen::GetSessionIdString());
+ m_ChannelId = fmt::format("zen-{}", zen::GetSessionIdString());
}
virtual ~HordeUpstreamApplyEndpoint() = default;
@@ -442,14 +441,13 @@ namespace detail {
if (Outcome != ComputeTaskOutcome::Success)
{
- using namespace fmt::literals;
const std::string_view Detail = TaskStatus["d"sv].AsString();
if (!Detail.empty())
{
return {.Error{.ErrorCode = -1,
- .Reason = "Task {}: {}"_format(ComputeTaskOutcomeToString(Outcome), std::string(Detail))}};
+ .Reason = fmt::format("Task {}: {}", ComputeTaskOutcomeToString(Outcome), std::string(Detail))}};
}
- return {.Error{.ErrorCode = -1, .Reason = "Task {}"_format(ComputeTaskOutcomeToString(Outcome))}};
+ return {.Error{.ErrorCode = -1, .Reason = fmt::format("Task {}", ComputeTaskOutcomeToString(Outcome))}};
}
const IoHash TaskId = TaskStatus["h"sv].AsObjectAttachment();
@@ -713,8 +711,6 @@ namespace detail {
[[nodiscard]] bool ProcessApplyKey(const UpstreamApplyRecord& ApplyRecord, UpstreamData& Data)
{
- using namespace fmt::literals;
-
std::string ExecutablePath;
std::map<std::string, std::string> Environment;
std::set<std::filesystem::path> InputFiles;
@@ -749,7 +745,7 @@ namespace detail {
for (auto& It : ApplyRecord.WorkerDescriptor["dirs"sv])
{
std::string_view Directory = It.AsString();
- std::string DummyFile = "{}/.zen_empty_file"_format(Directory);
+ std::string DummyFile = fmt::format("{}/.zen_empty_file", Directory);
InputFiles.insert(DummyFile);
Data.Blobs[EmptyBufferId] = EmptyBuffer;
InputFileHashes[DummyFile] = EmptyBufferId;
@@ -816,7 +812,6 @@ namespace detail {
Data.Objects[SandboxHash] = std::move(Sandbox);
{
- using namespace fmt::literals;
std::string_view HostPlatform = ApplyRecord.WorkerDescriptor["host"sv].AsString();
if (HostPlatform.empty())
{
@@ -829,7 +824,7 @@ namespace detail {
bool Exclusive = ApplyRecord.WorkerDescriptor["exclusive"sv].AsBool();
// TODO: Remove override when Horde accepts the UE style Host Platforms (Win64, Linux, Mac)
- std::string Condition = "Platform == '{}'"_format(HostPlatform);
+ std::string Condition = fmt::format("Platform == '{}'", HostPlatform);
if (HostPlatform == "Win64")
{
Condition += " && Pool == 'Win-RemoteExec'";
diff --git a/zenserver/upstream/upstreamcache.cpp b/zenserver/upstream/upstreamcache.cpp
index 38179f490..eb9d4fa95 100644
--- a/zenserver/upstream/upstreamcache.cpp
+++ b/zenserver/upstream/upstreamcache.cpp
@@ -270,8 +270,6 @@ namespace detail {
{
ZEN_TRACE_CPU("Upstream::Horde::PutCacheRecord");
- using namespace fmt::literals;
-
ZEN_ASSERT(CacheRecord.PayloadIds.size() == Payloads.size());
const int32_t MaxAttempts = 3;
@@ -313,7 +311,7 @@ namespace detail {
if (It == std::end(CacheRecord.PayloadIds))
{
- OutReason = "payload '{}' MISSING from local cache"_format(PayloadId);
+ OutReason = fmt::format("payload '{}' MISSING from local cache", PayloadId);
return false;
}
@@ -329,7 +327,7 @@ namespace detail {
if (!BlobResult.Success)
{
- OutReason = "upload payload '{}' FAILED, reason '{}'"_format(PayloadId, BlobResult.Reason);
+ OutReason = fmt::format("upload payload '{}' FAILED, reason '{}'", PayloadId, BlobResult.Reason);
return false;
}
@@ -350,7 +348,7 @@ namespace detail {
if (!RefResult.Success)
{
- return {.Reason = "upload cache record '{}/{}' FAILED, reason '{}'"_format(CacheRecord.Key.Bucket,
+ return {.Reason = fmt::format("upload cache record '{}/{}' FAILED, reason '{}'", CacheRecord.Key.Bucket,
CacheRecord.Key.Hash,
RefResult.Reason),
.Success = false};
@@ -371,7 +369,7 @@ namespace detail {
if (!FinalizeResult.Success)
{
- return {.Reason = "finalize cache record '{}/{}' FAILED, reason '{}'"_format(CacheRecord.Key.Bucket,
+ return {.Reason = fmt::format("finalize cache record '{}/{}' FAILED, reason '{}'", CacheRecord.Key.Bucket,
CacheRecord.Key.Hash,
FinalizeResult.Reason),
.Success = false};
@@ -389,7 +387,7 @@ namespace detail {
if (!FinalizeResult.Success)
{
- return {.Reason = "finalize '{}/{}' FAILED, reason '{}'"_format(CacheRecord.Key.Bucket,
+ return {.Reason = fmt::format("finalize '{}/{}' FAILED, reason '{}'", CacheRecord.Key.Bucket,
CacheRecord.Key.Hash,
FinalizeResult.Reason),
.Success = false};
@@ -403,7 +401,7 @@ namespace detail {
Sb << MissingHash.ToHexString() << ",";
}
- return {.Reason = "finalize '{}/{}' FAILED, still needs payload(s) '{}'"_format(CacheRecord.Key.Bucket,
+ return {.Reason = fmt::format("finalize '{}/{}' FAILED, still needs payload(s) '{}'", CacheRecord.Key.Bucket,
CacheRecord.Key.Hash,
Sb.ToString()),
.Success = false};
@@ -480,8 +478,6 @@ namespace detail {
virtual UpstreamEndpointHealth Initialize() override
{
- using namespace fmt::literals;
-
const ZenEndpoint& Ep = GetEndpoint();
if (Ep.Ok)
{
@@ -500,8 +496,6 @@ namespace detail {
virtual UpstreamEndpointHealth CheckHealth() override
{
- using namespace fmt::literals;
-
try
{
if (m_Client.IsNull())
diff --git a/zenserver/zenserver.cpp b/zenserver/zenserver.cpp
index 6e5d2fe93..40d40e908 100644
--- a/zenserver/zenserver.cpp
+++ b/zenserver/zenserver.cpp
@@ -114,7 +114,6 @@ ZEN_THIRD_PARTY_INCLUDES_END
namespace zen {
using namespace std::literals;
-using namespace fmt::literals;
namespace utils {
asio::error_code ResolveHostname(asio::io_context& Ctx,
@@ -139,7 +138,7 @@ namespace utils {
{
for (const asio::ip::tcp::endpoint Ep : Endpoints)
{
- OutEndpoints.push_back("http://{}:{}"_format(Ep.address().to_string(), Ep.port()));
+ OutEndpoints.push_back(fmt::format("http://{}:{}", Ep.address().to_string(), Ep.port()));
}
}
@@ -152,8 +151,6 @@ class ZenServer : public IHttpStatusProvider
public:
void Initialize(const ZenServerOptions& ServerOptions, ZenServerState::ZenServerEntry* ServerEntry)
{
- using namespace fmt::literals;
-
m_ServerEntry = ServerEntry;
m_DebugOptionForcedCrash = ServerOptions.ShouldCrash;
const int ParentPid = ServerOptions.OwnerPid;
@@ -180,11 +177,11 @@ public:
// Initialize/check mutex based on base port
- std::string MutexName = "zen_{}"_format(ServerOptions.BasePort);
+ std::string MutexName = fmt::format("zen_{}", ServerOptions.BasePort);
if (zen::NamedMutex::Exists(MutexName) || ((m_ServerMutex.Create(MutexName) == false)))
{
- throw std::runtime_error("Failed to create mutex '{}' - is another instance already running?"_format(MutexName).c_str());
+ throw std::runtime_error(fmt::format("Failed to create mutex '{}' - is another instance already running?", MutexName).c_str());
}
InitializeState(ServerOptions);
@@ -585,7 +582,7 @@ ZenServer::InitializeState(const ZenServerOptions& ServerOptions)
else
{
WipeState = true;
- WipeReason = "No manifest present at '{}'"_format(ManifestPath);
+ WipeReason = fmt::format("No manifest present at '{}'", ManifestPath);
}
}
else
@@ -598,7 +595,7 @@ ZenServer::InitializeState(const ZenServerOptions& ServerOptions)
ZEN_ERROR("Manifest validation failed: {}, state will be wiped", ValidationResult);
WipeState = true;
- WipeReason = "Validation of manifest at '{}' failed: {}"_format(ManifestPath, ValidationResult);
+ WipeReason = fmt::format("Validation of manifest at '{}' failed: {}", ManifestPath, ValidationResult);
}
else
{
@@ -609,7 +606,7 @@ ZenServer::InitializeState(const ZenServerOptions& ServerOptions)
if (ManifestVersion != ZEN_CFG_SCHEMA_VERSION)
{
WipeState = true;
- WipeReason = "Manifest schema version: {}, differs from required: {}"_format(ManifestVersion, ZEN_CFG_SCHEMA_VERSION);
+ WipeReason = fmt::format("Manifest schema version: {}, differs from required: {}", ManifestVersion, ZEN_CFG_SCHEMA_VERSION);
}
}
}
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)));
}
}
diff --git a/zenstore/caslog.cpp b/zenstore/caslog.cpp
index dc4891e9f..055e3feda 100644
--- a/zenstore/caslog.cpp
+++ b/zenstore/caslog.cpp
@@ -24,8 +24,6 @@
namespace zen {
-using namespace fmt::literals;
-
uint32_t
CasLogFile::FileHeader::ComputeChecksum()
{
@@ -50,7 +48,7 @@ CasLogFile::Open(std::filesystem::path FileName, size_t RecordSize, bool IsCreat
if (Ec)
{
- throw std::system_error(Ec, "Failed to open log file '{}'"_format(FileName));
+ throw std::system_error(Ec, fmt::format("Failed to open log file '{}'", FileName));
}
uint64_t AppendOffset = 0;
@@ -76,7 +74,7 @@ CasLogFile::Open(std::filesystem::path FileName, size_t RecordSize, bool IsCreat
if ((0 != memcmp(Header.Magic, FileHeader::MagicSequence, sizeof Header.Magic)) || (Header.Checksum != Header.ComputeChecksum()))
{
- throw std::runtime_error("Mangled log header (invalid header magic) in '{}'"_format(FileName));
+ throw std::runtime_error(fmt::format("Mangled log header (invalid header magic) in '{}'", FileName));
}
AppendOffset = m_File.FileSize();
@@ -153,7 +151,7 @@ CasLogFile::Append(const void* DataPointer, uint64_t DataSize)
if (Ec)
{
- throw std::system_error(Ec, "Failed to write to log file '{}'"_format(PathFromHandle(m_File.Handle())));
+ throw std::system_error(Ec, fmt::format("Failed to write to log file '{}'", PathFromHandle(m_File.Handle())));
}
}
diff --git a/zenstore/compactcas.cpp b/zenstore/compactcas.cpp
index aa60ec37b..3bf0c70df 100644
--- a/zenstore/compactcas.cpp
+++ b/zenstore/compactcas.cpp
@@ -31,8 +31,6 @@
namespace zen {
-using namespace fmt::literals;
-
CasContainerStrategy::CasContainerStrategy(const CasStoreConfiguration& Config, CasGc& Gc)
: GcStorage(Gc)
, m_Config(Config)
diff --git a/zenstore/filecas.cpp b/zenstore/filecas.cpp
index fb0f80436..533c99569 100644
--- a/zenstore/filecas.cpp
+++ b/zenstore/filecas.cpp
@@ -35,8 +35,6 @@ ZEN_THIRD_PARTY_INCLUDES_END
namespace zen {
-using namespace fmt::literals;
-
FileCasStrategy::ShardingHelper::ShardingHelper(const std::filesystem::path& RootPath, const IoHash& ChunkHash)
{
ShardedPath.Append(RootPath.c_str());
@@ -241,7 +239,7 @@ FileCasStrategy::InsertChunk(IoBuffer Chunk, const IoHash& ChunkHash)
if (FAILED(hRes))
{
- ThrowSystemException(hRes, "Failed to open shard directory '{}'"_format(FilePath));
+ ThrowSystemException(hRes, fmt::format("Failed to open shard directory '{}'", FilePath));
}
// Retry rename/move
@@ -386,7 +384,7 @@ FileCasStrategy::InsertChunk(const void* const ChunkData, const size_t ChunkSize
if (FAILED(hRes))
{
- ThrowSystemException(hRes, "Failed to open shard file '{}'"_format(Name.ShardedPath.ToUtf8()));
+ ThrowSystemException(hRes, fmt::format("Failed to open shard file '{}'", Name.ShardedPath.ToUtf8()));
}
#else
// Attempt to exclusively create the file.
@@ -409,10 +407,10 @@ FileCasStrategy::InsertChunk(const void* const ChunkData, const size_t ChunkSize
break;
}
}
- ThrowLastError("Failed creating shard directory '{}'"_format(Name.ShardedPath));
+ ThrowLastError(fmt::format("Failed creating shard directory '{}'", Name.ShardedPath));
default:
- ThrowLastError("Unexpected error occurred opening shard file '{}'"_format(Name.ShardedPath));
+ ThrowLastError(fmt::format("Unexpected error occurred opening shard file '{}'", Name.ShardedPath));
}
}
@@ -723,8 +721,6 @@ FileCasStrategy::CollectGarbage(GcContext& GcCtx)
TEST_CASE("cas.file.move")
{
- using namespace fmt::literals;
-
// specifying an absolute path here can be helpful when using procmon to dig into things
ScopedTemporaryDirectory TempDir; // {"d:\\filecas_testdir"};
@@ -769,7 +765,7 @@ TEST_CASE("cas.file.move")
*reinterpret_cast<int*>(Payload.MutableData()) = i;
PayloadHashes.push_back(IoHash::HashBuffer(Payload));
- std::filesystem::path PayloadPath{TempDir.Path() / "payload_{}_{}"_format(w, i)};
+ std::filesystem::path PayloadPath{TempDir.Path() / fmt::format("payload_{}_{}", w, i)};
WriteFile(PayloadPath, Payload);
}
}
@@ -781,7 +777,7 @@ TEST_CASE("cas.file.move")
for (int i = 0; i < kItemCount; ++i)
{
- std::filesystem::path PayloadPath{TempDir.Path() / "payload_{}_{}"_format(w, i)};
+ std::filesystem::path PayloadPath{TempDir.Path() / fmt::format("payload_{}_{}", w, i)};
IoBuffer Payload = IoBufferBuilder::MakeFromTemporaryFile(PayloadPath);
Buffers.push_back(Payload);
Sync.arrive_and_wait();
diff --git a/zenstore/gc.cpp b/zenstore/gc.cpp
index 92942b09f..0e93f1c3d 100644
--- a/zenstore/gc.cpp
+++ b/zenstore/gc.cpp
@@ -429,8 +429,6 @@ GcScheduler::Trigger(const GcScheduler::TriggerParams& Params)
void
GcScheduler::SchedulerThread()
{
- using namespace fmt::literals;
-
std::chrono::seconds WaitTime = m_Config.MonitorInterval;
for (;;)
@@ -474,7 +472,7 @@ GcScheduler::SchedulerThread()
NiceBytes(Space.Free),
NiceBytes(Space.Total),
m_Config.Interval.count()
- ? "{} until next GC"_format(NiceTimeSpanMs(uint64_t(std::chrono::milliseconds(RemaingTime).count())))
+ ? fmt::format("{} until next GC", NiceTimeSpanMs(uint64_t(std::chrono::milliseconds(RemaingTime).count())))
: std::string("next scheduled GC no set"));
// TODO: Trigger GC if max disk usage water mark is reached
diff --git a/zenutil/zenserverprocess.cpp b/zenutil/zenserverprocess.cpp
index 8eb510bb5..fe6236d18 100644
--- a/zenutil/zenserverprocess.cpp
+++ b/zenutil/zenserverprocess.cpp
@@ -650,9 +650,7 @@ ZenServerInstance::GetBaseUri() const
{
ZEN_ASSERT(m_BasePort);
- using namespace fmt::literals;
-
- return "http://localhost:{}"_format(m_BasePort);
+ return fmt::format("http://localhost:{}", m_BasePort);
}
} // namespace zen