diff options
author | Andrej Rode <andrej.rode@ettus.com> | 2017-04-03 18:49:58 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:03:45 -0800 |
commit | 53795c74aead4e6021bc788b788f8ed5b4a0166d (patch) | |
tree | 45e4075f3d8ffdee7dff7c72dd665f5c5b0c746c /host/lib/deps/0001-rpclib-replace-fmt-with-boost-format-but-leave-it-in.patch | |
parent | 6a12add1560545438e1bebc05efbafd05aace4f9 (diff) | |
download | uhd-53795c74aead4e6021bc788b788f8ed5b4a0166d.tar.gz uhd-53795c74aead4e6021bc788b788f8ed5b4a0166d.tar.bz2 uhd-53795c74aead4e6021bc788b788f8ed5b4a0166d.zip |
uhd: add cut-down rpclib source tree and import tool
Diffstat (limited to 'host/lib/deps/0001-rpclib-replace-fmt-with-boost-format-but-leave-it-in.patch')
-rw-r--r-- | host/lib/deps/0001-rpclib-replace-fmt-with-boost-format-but-leave-it-in.patch | 155 |
1 files changed, 155 insertions, 0 deletions
diff --git a/host/lib/deps/0001-rpclib-replace-fmt-with-boost-format-but-leave-it-in.patch b/host/lib/deps/0001-rpclib-replace-fmt-with-boost-format-but-leave-it-in.patch new file mode 100644 index 000000000..0d3bddc20 --- /dev/null +++ b/host/lib/deps/0001-rpclib-replace-fmt-with-boost-format-but-leave-it-in.patch @@ -0,0 +1,155 @@ +From 74505c84e326f8524a374911fcfe5dc29426a274 Mon Sep 17 00:00:00 2001 +From: Andrej Rode <andrej.rode@ettus.com> +Date: Thu, 6 Apr 2017 15:53:37 -0700 +Subject: [PATCH 1/3] rpclib: replace fmt with boost::format (but leave it in + logging) + +Signed-off-by: Andrej Rode <andrej.rode@ettus.com> +--- + lib/rpc/client.cc | 6 +++--- + lib/rpc/detail/client_error.cc | 6 +++--- + lib/rpc/dispatcher.cc | 30 +++++++++++++++--------------- + lib/rpc/rpc_error.cc | 4 ++-- + 4 files changed, 23 insertions(+), 23 deletions(-) + +diff --git a/lib/rpc/client.cc b/lib/rpc/client.cc +index 5ab9780..e5d0117 100644 +--- a/lib/rpc/client.cc ++++ b/lib/rpc/client.cc +@@ -11,7 +11,7 @@ + #include <unordered_map> + + #include "asio.hpp" +-#include "format.h" ++#include <boost/format.hpp> + + #include "rpc/detail/async_writer.h" + #include "rpc/detail/dev_utils.h" +@@ -212,8 +212,8 @@ void client::wait_all_responses() { + + RPCLIB_NORETURN void client::throw_timeout(std::string const& func_name) { + throw rpc::timeout( +- RPCLIB_FMT::format("Timeout of {}ms while calling RPC function '{}'", +- get_timeout(), func_name)); ++ str(boost::format("Timeout of %dms while calling RPC function '%s'") % ++ get_timeout() % func_name)); + } + + client::~client() { +diff --git a/lib/rpc/detail/client_error.cc b/lib/rpc/detail/client_error.cc +index 263141f..deea2f6 100644 +--- a/lib/rpc/detail/client_error.cc ++++ b/lib/rpc/detail/client_error.cc +@@ -1,4 +1,4 @@ +-#include "format.h" ++#include <boost/format.hpp> + + #include "rpc/detail/client_error.h" + +@@ -6,8 +6,8 @@ namespace rpc { + namespace detail { + + client_error::client_error(code c, const std::string &msg) +- : what_(RPCLIB_FMT::format("client error C{0:04x}: {1}", +- static_cast<uint16_t>(c), msg)) {} ++ : what_(str(boost::format("client error C%d: %") % ++ static_cast<uint16_t>(c) % msg)) {} + + const char *client_error::what() const noexcept { return what_.c_str(); } + } +diff --git a/lib/rpc/dispatcher.cc b/lib/rpc/dispatcher.cc +index e8954b8..c502b80 100644 +--- a/lib/rpc/dispatcher.cc ++++ b/lib/rpc/dispatcher.cc +@@ -1,5 +1,5 @@ + #include "rpc/dispatcher.h" +-#include "format.h" ++#include <boost/format.hpp> + #include "rpc/detail/client_error.h" + #include "rpc/this_handler.h" + +@@ -48,18 +48,18 @@ response dispatcher::dispatch_call(RPCLIB_MSGPACK::object const &msg, + return response::make_result(id, std::move(result)); + } catch (rpc::detail::client_error &e) { + return response::make_error( +- id, RPCLIB_FMT::format("rpclib: {}", e.what())); ++ id, str(boost::format("rpclib: %s") % e.what())); + } catch (std::exception &e) { + if (!suppress_exceptions) { + throw; + } + return response::make_error( + id, +- RPCLIB_FMT::format("rpclib: function '{0}' (called with {1} " ++ str(boost::format("rpclib: function '%s' (called with %d " + "arg(s)) " + "threw an exception. The exception " +- "contained this information: {2}.", +- name, args.via.array.size, e.what())); ++ "contained this information: %s.") % ++ name % args.via.array.size % e.what())); + } catch (rpc::detail::handler_error &) { + // doing nothing, the exception was only thrown to + // return immediately +@@ -72,17 +72,17 @@ response dispatcher::dispatch_call(RPCLIB_MSGPACK::object const &msg, + } + return response::make_error( + id, +- RPCLIB_FMT::format("rpclib: function '{0}' (called with {1} " ++ str(boost::format("rpclib: function '%s' (called with %d " + "arg(s)) threw an exception. The exception " + "is not derived from std::exception. No " +- "further information available.", +- name, args.via.array.size)); ++ "further information available.") % ++ name % args.via.array.size)); + } + } + return response::make_error( +- id, RPCLIB_FMT::format("rpclib: server could not find " +- "function '{0}' with argument count {1}.", +- name, args.via.array.size)); ++ id, str(boost::format("rpclib: server could not find " ++ "function '%s' with argument count %d.") % ++ name % args.via.array.size)); + } + + response dispatcher::dispatch_notification(RPCLIB_MSGPACK::object const &msg, +@@ -124,10 +124,10 @@ void dispatcher::enforce_arg_count(std::string const &func, std::size_t found, + if (found != expected) { + throw client_error( + client_error::code::wrong_arity, +- RPCLIB_FMT::format( +- "Function '{0}' was called with an invalid number of " +- "arguments. Expected: {1}, got: {2}", +- func, expected, found)); ++ str(boost::format( ++ "Function '%s' was called with an invalid number of " ++ "arguments. Expected: %d, got: %d") % ++ func % expected % found)); + } + } + +diff --git a/lib/rpc/rpc_error.cc b/lib/rpc/rpc_error.cc +index 8af7006..dcf3c1c 100644 +--- a/lib/rpc/rpc_error.cc ++++ b/lib/rpc/rpc_error.cc +@@ -1,5 +1,5 @@ + #include "rpc/rpc_error.h" +-#include "format.h" ++#include <boost/format.hpp> + + namespace rpc { + +@@ -16,7 +16,7 @@ RPCLIB_MSGPACK::object_handle &rpc_error::get_error() { return ob_h_; } + + timeout::timeout(std::string const &what_arg) : std::runtime_error(what_arg) { + formatted = +- RPCLIB_FMT::format("rpc::timeout: {}", std::runtime_error::what()); ++ str(boost::format("rpc::timeout: %s") % std::runtime_error::what()); + } + + const char *timeout::what() const noexcept { return formatted.data(); } +-- +2.10.2 + |