mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-25 23:16:14 +02:00
to_string and stoul for Android c++11
This commit is contained in:
parent
d51642aa2b
commit
76d19efe0c
3 changed files with 20 additions and 4 deletions
|
@ -57,7 +57,7 @@ void ClientConnection::socketRead(void* _to, size_t _bytes)
|
||||||
void ClientConnection::start()
|
void ClientConnection::start()
|
||||||
{
|
{
|
||||||
tcp::resolver resolver(io_service_);
|
tcp::resolver resolver(io_service_);
|
||||||
tcp::resolver::query query(tcp::v4(), host_, std::to_string(port_), asio::ip::resolver_query_base::numeric_service);
|
tcp::resolver::query query(tcp::v4(), host_, utl::to_string(port_), asio::ip::resolver_query_base::numeric_service);
|
||||||
auto iterator = resolver.resolve(query);
|
auto iterator = resolver.resolve(query);
|
||||||
logO << "Connecting\n";
|
logO << "Connecting\n";
|
||||||
socket_.reset(new tcp::socket(io_service_));
|
socket_.reset(new tcp::socket(io_service_));
|
||||||
|
|
|
@ -159,6 +159,22 @@ static std::string getMacAddress(int sock)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
namespace utl
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
static std::string to_string(const T& t)
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << t;
|
||||||
|
return ss.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
static long stoul(const std::string& s)
|
||||||
|
{
|
||||||
|
return atol(s.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -61,9 +61,9 @@ void SampleFormat::setFormat(const std::string& format)
|
||||||
strs = split(format, ':');
|
strs = split(format, ':');
|
||||||
if (strs.size() == 3)
|
if (strs.size() == 3)
|
||||||
setFormat(
|
setFormat(
|
||||||
std::stoul(strs[0]),
|
utl::stoul(strs[0]),
|
||||||
std::stoul(strs[1]),
|
utl::stoul(strs[1]),
|
||||||
std::stoul(strs[2]));
|
utl::stoul(strs[2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue