summaryrefslogtreecommitdiff
path: root/gr-uhd/lib/usrp_block_impl.cc
diff options
context:
space:
mode:
authorJohannes Demel <demel@ant.uni-bremen.de>2020-06-09 10:20:50 +0200
committerMarcus Müller <marcus@hostalia.de>2020-06-22 15:27:17 +0200
commitf356b83f005c6ae90ec93e51a35f06daced1d085 (patch)
treed60fbe48f4775fb6ab97be0c1978a4f1090b7760 /gr-uhd/lib/usrp_block_impl.cc
parent587303c5d87c07e2efc6ae94ad85e317251e5844 (diff)
gr-uhd: Fix pmt_dict/pmt_pair checks
The PMT API changed. Previously, dicts and pairs would pass both checks `is_pair` and `is_dict`. Now, pmt_dict is a subclass of pmt_pair. Thus, a pair does not pass `is_dict` anymore while a dict still passes `is_pair`.
Diffstat (limited to 'gr-uhd/lib/usrp_block_impl.cc')
-rw-r--r--gr-uhd/lib/usrp_block_impl.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/gr-uhd/lib/usrp_block_impl.cc b/gr-uhd/lib/usrp_block_impl.cc
index 5eab8fad0f..7e6a140780 100644
--- a/gr-uhd/lib/usrp_block_impl.cc
+++ b/gr-uhd/lib/usrp_block_impl.cc
@@ -487,15 +487,18 @@ void usrp_block_impl::msg_handler_command(pmt::pmt_t msg)
}
// End of legacy backward compat code.
- // Apparently, pmt::is_dict does not return true for pairs anymore. Yeah!
- if (pmt::is_pair(msg)) {
- GR_LOG_DEBUG(d_logger,
- boost::format("Command message is pair, converting to dict: %s") %
- msg);
+ // pmt_dict is a subclass of pmt_pair. Make sure we use pmt_pair!
+ // Old behavior was that these checks were interchangably. Be aware of this change!
+ if (!(pmt::is_dict(msg)) && pmt::is_pair(msg)) {
+ GR_LOG_DEBUG(
+ d_logger,
+ boost::format(
+ "Command message is pair, converting to dict: '%s': car(%s), cdr(%s)") %
+ msg % pmt::car(msg) % pmt::cdr(msg));
msg = pmt::dict_add(pmt::make_dict(), pmt::car(msg), pmt::cdr(msg));
}
- // Turn pair into dict
+ // Make sure, we use dicts!
if (!pmt::is_dict(msg)) {
GR_LOG_ERROR(d_logger,
boost::format("Command message is neither dict nor pair: %s") % msg);