diff options
Diffstat (limited to 'host/lib/usrp')
-rw-r--r-- | host/lib/usrp/subdev_spec.cpp | 12 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_impl.cpp | 7 |
2 files changed, 13 insertions, 6 deletions
diff --git a/host/lib/usrp/subdev_spec.cpp b/host/lib/usrp/subdev_spec.cpp index 95d2cbb12..c905eab7d 100644 --- a/host/lib/usrp/subdev_spec.cpp +++ b/host/lib/usrp/subdev_spec.cpp @@ -16,15 +16,21 @@ // #include <uhd/usrp/subdev_spec.hpp> -#include <uhd/utils/algorithm.hpp> +#include <boost/algorithm/string.hpp> //for split +#include <boost/tokenizer.hpp> #include <boost/format.hpp> #include <boost/foreach.hpp> #include <stdexcept> #include <sstream> +#include <vector> using namespace uhd; using namespace uhd::usrp; +#define pair_tokenizer(inp) \ + boost::tokenizer<boost::char_separator<char> > \ + (inp, boost::char_separator<char>(" ")) + subdev_spec_pair_t::subdev_spec_pair_t( const std::string &db_name, const std::string &sd_name ): @@ -39,9 +45,9 @@ bool usrp::operator==(const subdev_spec_pair_t &lhs, const subdev_spec_pair_t &r } subdev_spec_t::subdev_spec_t(const std::string &markup){ - BOOST_FOREACH(const std::string &pair, std::split_string(markup)){ + BOOST_FOREACH(const std::string &pair, pair_tokenizer(markup)){ if (pair == "") continue; - std::vector<std::string> db_sd = std::split_string(pair, ":"); + std::vector<std::string> db_sd; boost::split(db_sd, pair, boost::is_any_of(":")); switch(db_sd.size()){ case 1: this->push_back(subdev_spec_pair_t("", db_sd.front())); break; case 2: this->push_back(subdev_spec_pair_t(db_sd.front(), db_sd.back())); break; diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp index f910999d4..06ca61e13 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.cpp +++ b/host/lib/usrp/usrp2/usrp2_impl.cpp @@ -22,7 +22,7 @@ #include <uhd/utils/assert.hpp> #include <uhd/utils/static.hpp> #include <uhd/utils/warning.hpp> -#include <uhd/utils/algorithm.hpp> +#include <boost/algorithm/string.hpp> //for split #include <boost/assign/list_of.hpp> #include <boost/format.hpp> #include <boost/foreach.hpp> @@ -31,6 +31,7 @@ #include <boost/bind.hpp> #include <boost/asio.hpp> //htonl and ntohl #include <iostream> +#include <vector> using namespace uhd; using namespace uhd::usrp; @@ -47,8 +48,8 @@ template <class T> std::string num2str(T num){ //! separate indexed device addresses into a vector of device addresses device_addrs_t sep_indexed_dev_addrs(const device_addr_t &dev_addr){ //------------ support old deprecated way and print warning -------- - if (dev_addr.has_key("addr")){ - std::vector<std::string> addrs = std::split_string(dev_addr["addr"]); + if (dev_addr.has_key("addr") and not dev_addr["addr"].empty()){ + std::vector<std::string> addrs; boost::split(addrs, dev_addr["addr"], boost::is_any_of(" ")); if (addrs.size() > 1){ device_addr_t fixed_dev_addr = dev_addr; fixed_dev_addr.pop("addr"); |