Skip to content

Commit d6885cf

Browse files
committed
Replaced boost::lexical_cast with std equivalents.
1 parent 516e105 commit d6885cf

18 files changed

+82
-100
lines changed

boost/network/protocol/http/algorithms/linearize.hpp

+3-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include <cstdint>
1414
#include <boost/algorithm/string/compare.hpp>
1515
#include <boost/concept/requires.hpp>
16-
#include <boost/lexical_cast.hpp>
1716
#include <boost/network/constants.hpp>
1817
#include <boost/network/message/wrappers/body.hpp>
1918
#include <boost/network/protocol/http/message/header/name.hpp>
@@ -87,10 +86,8 @@ OutputIterator linearize(Request const& request,
8786
}
8887
*oi = consts::space_char();
8988
boost::copy(http_slash, oi);
90-
string_type version_major_str =
91-
boost::lexical_cast<string_type>(version_major),
92-
version_minor_str =
93-
boost::lexical_cast<string_type>(version_minor);
89+
string_type version_major_str = std::to_string(version_major),
90+
version_minor_str = std::to_string(version_minor);
9491
boost::copy(version_major_str, oi);
9592
*oi = consts::dot_char();
9693
boost::copy(version_minor_str, oi);
@@ -145,7 +142,7 @@ OutputIterator linearize(Request const& request,
145142
port(request);
146143
#endif
147144
if (port_) {
148-
string_type port_str = boost::lexical_cast<string_type>(*port_);
145+
string_type port_str = std::to_string(*port_);
149146
*oi = consts::colon_char();
150147
boost::copy(port_str, oi);
151148
}

boost/network/protocol/http/client.hpp

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <boost/asio/io_service.hpp>
1616
#include <boost/algorithm/string/classification.hpp>
1717
#include <boost/algorithm/string/split.hpp>
18-
#include <boost/lexical_cast.hpp>
1918
#include <istream>
2019
#include <map>
2120
#include <ostream>

boost/network/protocol/http/client/connection/async_protocol_handler.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ struct http_async_protocol_handler {
163163
std::swap(status, partial_parsed);
164164
status.append(std::begin(result_range), std::end(result_range));
165165
trim(status);
166-
std::uint16_t status_int = lexical_cast<std::uint16_t>(status);
166+
std::uint16_t status_int = std::stoi(status);
167167
status_promise.set_value(status_int);
168168
part_begin = std::end(result_range);
169169
} else if (parsed_ok == false) {

boost/network/protocol/http/client/connection/sync_base.hpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,7 @@ struct sync_connection_base_impl {
195195
} else {
196196
size_t already_read = response_buffer.size();
197197
if (already_read) body_stream << &response_buffer;
198-
size_t length =
199-
lexical_cast<size_t>(std::begin(content_length_range)->second) -
198+
size_t length = std::stoul(std::begin(content_length_range)->second) -
200199
already_read;
201200
if (length == 0) { return;
202201
}

boost/network/protocol/http/client/connection/sync_ssl.hpp

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <boost/function.hpp>
1616
#include <boost/algorithm/string/predicate.hpp>
1717
#include <boost/bind.hpp>
18-
#include <boost/lexical_cast.hpp>
1918
#include <boost/network/protocol/http/request.hpp>
2019
#include <boost/network/protocol/http/traits/resolver_policy.hpp>
2120

boost/network/protocol/http/client/facade.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class basic_client_facade {
116116
if (body != string_type()) {
117117
request << remove_header("Content-Length")
118118
<< header("Content-Length",
119-
boost::lexical_cast<string_type>(body.size()))
119+
std::to_string(body.size()))
120120
<< boost::network::body(body);
121121
}
122122
typename headers_range<basic_request<Tag> >::type content_type_headers =
@@ -221,7 +221,7 @@ class basic_client_facade {
221221
if (body != string_type()) {
222222
request << remove_header("Content-Length")
223223
<< header("Content-Length",
224-
boost::lexical_cast<string_type>(body.size()))
224+
std::to_string(body.size()))
225225
<< boost::network::body(body);
226226
}
227227
typename headers_range<basic_request<Tag> >::type content_type_headers =

boost/network/protocol/http/impl/message.ipp

+2-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_IPP
1111
#define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_IPP
1212

13-
#include <boost/lexical_cast.hpp>
1413
#include <boost/network/protocol/http/message.hpp>
1514
#include <cstdio>
1615
#include <cstdlib>
@@ -121,7 +120,7 @@ message_impl<Tag>::make_query_string(
121120
query_params.begin();
122121
i != query_params.end(); ++i) {
123122
if (i != query_params.begin()) { query_string += '&';
124-
123+
125124
}query_string += url_encode(i->first);
126125
query_string += '=';
127126
query_string += url_encode(i->second);
@@ -147,8 +146,7 @@ message_impl<Tag>::make_set_cookie_header(
147146
}
148147
if (has_max_age) {
149148
set_cookie_header += "; Max-Age=\"";
150-
set_cookie_header +=
151-
boost::lexical_cast<message_impl<Tag>::string_type>(max_age);
149+
set_cookie_header += std::to_string(max_age);
152150
set_cookie_header += '\"';
153151
}
154152
return set_cookie_header;

0 commit comments

Comments
 (0)