mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-22 21:46:15 +02:00
replaced boost::lexical_cast with c++11 functions
This commit is contained in:
parent
734adb8852
commit
c8e58f272f
9 changed files with 10 additions and 36 deletions
|
@ -16,7 +16,6 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <iostream>
|
||||
#include <mutex>
|
||||
#include "common/log.h"
|
||||
|
@ -59,7 +58,7 @@ void ClientConnection::socketRead(void* _to, size_t _bytes)
|
|||
void ClientConnection::start()
|
||||
{
|
||||
tcp::resolver resolver(io_service_);
|
||||
tcp::resolver::query query(tcp::v4(), host_, boost::lexical_cast<string>(port_), boost::asio::ip::resolver_query_base::numeric_service);
|
||||
tcp::resolver::query query(tcp::v4(), host_, std::to_string(port_), boost::asio::ip::resolver_query_base::numeric_service);
|
||||
auto iterator = resolver.resolve(query);
|
||||
logO << "Connecting\n";
|
||||
socket_.reset(new tcp::socket(io_service_));
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
#include <iostream>
|
||||
#include <sys/resource.h>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/program_options.hpp>
|
||||
|
||||
#include "common/daemon.h"
|
||||
|
@ -41,7 +40,7 @@ PcmDevice getPcmDevice(const std::string& soundcard)
|
|||
|
||||
try
|
||||
{
|
||||
soundcardIdx = boost::lexical_cast<int>(soundcard);
|
||||
soundcardIdx = std::stoi(soundcard);
|
||||
for (auto dev: pcmDevices)
|
||||
if (dev.idx == soundcardIdx)
|
||||
return dev;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <iostream>
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#define logD std::clog << kDbg
|
||||
#define logO std::clog << kOut
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
#include <vector>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <iostream>
|
||||
|
||||
#include "sampleFormat.h"
|
||||
|
@ -62,9 +61,9 @@ void SampleFormat::setFormat(const std::string& format)
|
|||
boost::split(strs, format, boost::is_any_of(":"));
|
||||
if (strs.size() == 3)
|
||||
setFormat(
|
||||
boost::lexical_cast<uint32_t>(strs[0]),
|
||||
boost::lexical_cast<uint16_t>(strs[1]),
|
||||
boost::lexical_cast<uint16_t>(strs[2]));
|
||||
std::stoul(strs[0]),
|
||||
std::stoul(strs[1]),
|
||||
std::stoul(strs[2]));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <iostream>
|
||||
#include <mutex>
|
||||
#include "controlSession.h"
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <iostream>
|
||||
|
||||
#include "flacEncoder.h"
|
||||
|
@ -139,9 +138,9 @@ void FlacEncoder::initEncoder()
|
|||
int quality(2);
|
||||
try
|
||||
{
|
||||
quality = boost::lexical_cast<int>(codecOptions_);
|
||||
quality = std::stoi(codecOptions_);
|
||||
}
|
||||
catch(boost::bad_lexical_cast)
|
||||
catch(...)
|
||||
{
|
||||
throw SnapException("Invalid codec option: \"" + codecOptions_ + "\"");
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
|
||||
|
@ -137,9 +136,9 @@ void OggEncoder::initEncoder()
|
|||
double quality = 1.0;
|
||||
try
|
||||
{
|
||||
quality = boost::lexical_cast<double>(qual);
|
||||
quality = std::stod(qual);
|
||||
}
|
||||
catch(boost::bad_lexical_cast)
|
||||
catch(...)
|
||||
{
|
||||
throw SnapException("Invalid codec option: \"" + codecOptions_ + "\"");
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "json.hpp"
|
||||
#include "jsonrpcException.h"
|
||||
|
||||
|
@ -63,25 +62,6 @@ public:
|
|||
return value;
|
||||
}
|
||||
|
||||
// bool isParam(size_t idx, const std::string& param);
|
||||
|
||||
/* template<typename T>
|
||||
T getParam(size_t idx)
|
||||
{
|
||||
if (idx >= params.size())
|
||||
throw JsonInvalidParamsException(*this);
|
||||
try
|
||||
{
|
||||
return boost::lexical_cast<T>(params[idx]);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
throw JsonInvalidParamsException(*this);
|
||||
}
|
||||
}
|
||||
|
||||
bool isParam(size_t idx, const std::string& param);
|
||||
*/
|
||||
|
||||
protected:
|
||||
Json json_;
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
#include "streamSession.h"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <iostream>
|
||||
#include <mutex>
|
||||
#include "common/log.h"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue