From f384894d47ee1f18e9359c4e4ea951ddf36511a1 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 16 Dec 2017 18:56:39 +0000 Subject: Remove calls to stringbf in favour of CTF --- netfs/fuse/fuseApp.cpp | 4 +++- netfs/unittests/mockDaemon.cpp | 2 +- netfs/unittests/mockDaemon.h | 3 +++ netfs/unittests/testCore.cpp | 5 +++-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/netfs/fuse/fuseApp.cpp b/netfs/fuse/fuseApp.cpp index b980af8..17319ec 100644 --- a/netfs/fuse/fuseApp.cpp +++ b/netfs/fuse/fuseApp.cpp @@ -7,6 +7,7 @@ #include #include #include +#include namespace AdHoc { template class Cache; @@ -86,6 +87,7 @@ NetFS::FuseApp::configureFromFile(const std::string & configPath, const std::str return AdHoc::safeMapLookup(ReadConfiguration(configPath)->Resources, resourceName); } +AdHocFormatter(IceEndpointFmt, "%? -h %? -p %?"); NetFS::Client::ResourcePtr NetFS::FuseApp::configureFromUri(const std::string & uriString) const { @@ -93,7 +95,7 @@ NetFS::FuseApp::configureFromUri(const std::string & uriString) const NetFS::Client::ResourcePtr r = new NetFS::Client::Resource(); r->ExportName = uri.path->string(); - r->Endpoints.push_back(stringbf("%s -h %s -p %d", uri.scheme, uri.host, uri.port ? *uri.port : 4000)); + r->Endpoints.push_back(IceEndpointFmt::get(uri.scheme, uri.host, uri.port ? *uri.port : 4000)); if (uri.password) { r->AuthToken = *uri.password; } diff --git a/netfs/unittests/mockDaemon.cpp b/netfs/unittests/mockDaemon.cpp index b428e28..7fe8389 100644 --- a/netfs/unittests/mockDaemon.cpp +++ b/netfs/unittests/mockDaemon.cpp @@ -4,7 +4,7 @@ #include const boost::filesystem::path TestExportRoot(binDir / - stringbf("testExport-%d", getpid())); + UniqueExport::get(getpid())); MockDaemon::MockDaemon(const std::string & ep) : NetFSDaemon(), diff --git a/netfs/unittests/mockDaemon.h b/netfs/unittests/mockDaemon.h index a0de8b4..ae6614b 100644 --- a/netfs/unittests/mockDaemon.h +++ b/netfs/unittests/mockDaemon.h @@ -3,6 +3,9 @@ #include #include +#include + +AdHocFormatter(UniqueExport, "testExport-%?"); class DLL_PUBLIC MockDaemon : public NetFSDaemon { public: diff --git a/netfs/unittests/testCore.cpp b/netfs/unittests/testCore.cpp index 4b12871..76b3c4c 100644 --- a/netfs/unittests/testCore.cpp +++ b/netfs/unittests/testCore.cpp @@ -7,7 +7,7 @@ #include #include -const auto testExport = stringbf("testExport-%d", getpid()); +const auto testExport = UniqueExport::get(getpid()); const std::string testEndpoint("tcp -h localhost -p 12012"); const std::string testUri("tcp://localhost:12012/testvol"); @@ -18,10 +18,11 @@ operator==(const struct stat & a, const struct stat & b) } namespace std { + AdHocFormatter(StatDebug, "dev: %? inode: %?"); // LCOV_EXCL_START ostream & operator<<(ostream & s, const struct stat & ss) { - return s << "dev: " << ss.st_dev << " inode: " << ss.st_ino; + return StatDebug::write(s, ss.st_dev, ss.st_ino); } // LCOV_EXCL_STOP } -- cgit v1.2.3