mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
moved std::to_string to util.h from android
This commit is contained in:
parent
07cc547bab
commit
a5be4c9d0e
@ -8,12 +8,6 @@
|
||||
#include "Identity.h"
|
||||
#include "ClientContext.h"
|
||||
|
||||
#ifdef ANDROID
|
||||
# include "to_string.h"
|
||||
#else
|
||||
# define to_string(x) std::to_string(x)
|
||||
#endif
|
||||
|
||||
namespace i2p
|
||||
{
|
||||
namespace client
|
||||
@ -298,7 +292,7 @@ namespace client
|
||||
template<typename Section, typename Type>
|
||||
std::string ClientContext::GetI2CPOption (const Section& section, const std::string& name, const Type& value) const
|
||||
{
|
||||
return section.second.get (boost::property_tree::ptree::path_type (name, '/'), to_string (value));
|
||||
return section.second.get (boost::property_tree::ptree::path_type (name, '/'), std::to_string (value));
|
||||
}
|
||||
|
||||
template<typename Section>
|
||||
|
19
HTTP.cpp
19
HTTP.cpp
@ -10,13 +10,6 @@
|
||||
#include <algorithm>
|
||||
#include <ctime>
|
||||
|
||||
#ifdef ANDROID
|
||||
# include "to_string.h"
|
||||
# include <errno.h>
|
||||
#else
|
||||
# define to_string(x) std::to_string(x)
|
||||
#endif
|
||||
|
||||
namespace i2p {
|
||||
namespace http {
|
||||
const std::vector<std::string> HTTP_METHODS = {
|
||||
@ -187,11 +180,7 @@ namespace http {
|
||||
out += user + "@";
|
||||
}
|
||||
if (port) {
|
||||
#ifndef ANDROID
|
||||
out += host + ":" + to_string(port);
|
||||
#else
|
||||
out += host + ":" + tostr::to_string(port);
|
||||
#endif
|
||||
out += host + ":" + std::to_string(port);
|
||||
} else {
|
||||
out += host;
|
||||
}
|
||||
@ -349,11 +338,7 @@ namespace http {
|
||||
if (status == "OK" && code != 200)
|
||||
status = HTTPCodeToStatus(code); // update
|
||||
if (body.length() > 0 && headers.count("Content-Length") == 0)
|
||||
#ifndef ANDROID
|
||||
add_header("Content-Length", to_string(body.length()).c_str());
|
||||
#else
|
||||
add_header("Content-Length", tostr::to_string(body.length()).c_str());
|
||||
#endif
|
||||
add_header("Content-Length", std::to_string(body.length()).c_str());
|
||||
/* build response */
|
||||
std::stringstream ss;
|
||||
ss << version << " " << code << " " << status << CRLF;
|
||||
|
@ -25,12 +25,6 @@
|
||||
// For image and info
|
||||
#include "version.h"
|
||||
|
||||
#ifdef ANDROID
|
||||
# include "to_string.h"
|
||||
#else
|
||||
# define to_string(x) std::to_string(x)
|
||||
#endif
|
||||
|
||||
namespace i2p {
|
||||
namespace http {
|
||||
const char *itoopieFavicon =
|
||||
@ -236,8 +230,8 @@ namespace http {
|
||||
clientTunnelCount += i2p::tunnel::tunnels.CountInboundTunnels();
|
||||
size_t transitTunnelCount = i2p::tunnel::tunnels.CountTransitTunnels();
|
||||
|
||||
s << "<b>Client Tunnels:</b> " << to_string(clientTunnelCount) << " ";
|
||||
s << "<b>Transit Tunnels:</b> " << to_string(transitTunnelCount) << "<br>\r\n";
|
||||
s << "<b>Client Tunnels:</b> " << std::to_string(clientTunnelCount) << " ";
|
||||
s << "<b>Transit Tunnels:</b> " << std::to_string(transitTunnelCount) << "<br>\r\n";
|
||||
}
|
||||
|
||||
void ShowJumpServices (std::stringstream& s, const std::string& address)
|
||||
|
@ -25,12 +25,6 @@
|
||||
#include "version.h"
|
||||
#include "I2PControl.h"
|
||||
|
||||
#ifdef ANDROID
|
||||
# include "to_string.h"
|
||||
#else
|
||||
# define to_string(x) std::to_string(x)
|
||||
#endif
|
||||
|
||||
namespace i2p
|
||||
{
|
||||
namespace client
|
||||
@ -321,7 +315,7 @@ namespace client
|
||||
}
|
||||
InsertParam (results, "API", api);
|
||||
results << ",";
|
||||
std::string token = to_string(i2p::util::GetSecondsSinceEpoch ());
|
||||
std::string token = std::to_string(i2p::util::GetSecondsSinceEpoch ());
|
||||
m_Tokens.insert (token);
|
||||
InsertParam (results, "Token", token);
|
||||
}
|
||||
|
@ -16,13 +16,6 @@
|
||||
#include "NetDb.h"
|
||||
#include "util.h"
|
||||
|
||||
|
||||
#ifdef ANDROID
|
||||
# include "to_string.h"
|
||||
#else
|
||||
# define to_string(x) std::to_string(x)
|
||||
#endif
|
||||
|
||||
namespace i2p
|
||||
{
|
||||
namespace data
|
||||
@ -379,7 +372,7 @@ namespace data
|
||||
boost::asio::io_service service;
|
||||
boost::system::error_code ecode;
|
||||
auto it = boost::asio::ip::tcp::resolver(service).resolve (
|
||||
boost::asio::ip::tcp::resolver::query (u.host_, to_string (u.port_)), ecode);
|
||||
boost::asio::ip::tcp::resolver::query (u.host_, std::to_string (u.port_)), ecode);
|
||||
if (!ecode)
|
||||
{
|
||||
boost::asio::ssl::context ctx(service, boost::asio::ssl::context::sslv23);
|
||||
|
@ -12,12 +12,6 @@
|
||||
#include "Family.h"
|
||||
#include "RouterContext.h"
|
||||
|
||||
#ifdef ANDROID
|
||||
# include "to_string.h"
|
||||
#else
|
||||
# define to_string(x) std::to_string(x)
|
||||
#endif
|
||||
|
||||
namespace i2p
|
||||
{
|
||||
RouterContext context;
|
||||
@ -62,7 +56,7 @@ namespace i2p
|
||||
routerInfo.AddNTCPAddress (host.c_str(), port);
|
||||
routerInfo.SetCaps (i2p::data::RouterInfo::eReachable |
|
||||
i2p::data::RouterInfo::eSSUTesting | i2p::data::RouterInfo::eSSUIntroducer); // LR, BC
|
||||
routerInfo.SetProperty ("netId", to_string (I2PD_NET_ID));
|
||||
routerInfo.SetProperty ("netId", std::to_string (I2PD_NET_ID));
|
||||
routerInfo.SetProperty ("router.version", I2P_VERSION);
|
||||
routerInfo.CreateBuffer (m_Keys);
|
||||
m_RouterInfo.SetRouterIdentity (GetIdentity ());
|
||||
|
Loading…
Reference in New Issue
Block a user