Skip to content

Commit 5c6ff2d

Browse files
committed
Attempted to fix as many compilation failures as possible for VS2015.
1 parent 20d94c8 commit 5c6ff2d

File tree

11 files changed

+33
-20
lines changed

11 files changed

+33
-20
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ struct async_client
3131
typedef typename resolver<Tag>::type resolver_type;
3232
typedef typename string<Tag>::type string_type;
3333

34-
typedef std::function<void(boost::iterator_range<char const*> const&,
34+
typedef typename std::array<typename char_<Tag>::type, 1024>::const_iterator const_iterator;
35+
typedef iterator_range<const_iterator> char_const_range;
36+
37+
typedef std::function<void(char_const_range,
3538
boost::system::error_code const&)>
3639
body_callback_function_type;
3740

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ struct http_async_connection
6161
typedef typename base::string_type string_type;
6262
typedef typename base::request request;
6363
typedef typename base::resolver_base::resolve_function resolve_function;
64+
typedef typename base::char_const_range char_const_range;
6465
typedef
6566
typename base::body_callback_function_type body_callback_function_type;
6667
typedef
@@ -128,7 +129,7 @@ struct http_async_connection
128129
this->destination_promise.set_exception(std::make_exception_ptr(error));
129130
this->body_promise.set_exception(std::make_exception_ptr(error));
130131
if ( callback )
131-
callback( boost::iterator_range<const char*>(), ec );
132+
callback( char_const_range(), ec );
132133
this->timer_.cancel();
133134
}
134135

@@ -321,7 +322,7 @@ struct http_async_connection
321322
// body (in the case of a HEAD request).
322323
this->body_promise.set_value("");
323324
if ( callback )
324-
callback( boost::iterator_range<const char*>(), boost::asio::error::eof );
325+
callback( char_const_range(), boost::asio::error::eof );
325326
this->destination_promise.set_value("");
326327
this->source_promise.set_value("");
327328
// this->part.assign('\0');
@@ -392,7 +393,9 @@ struct http_async_connection
392393
} else {
393394
string_type body_string;
394395
std::swap(body_string, this->partial_parsed);
395-
body_string.append(this->part.begin(), bytes_transferred);
396+
auto it = this->part.begin();
397+
std::advance(it, bytes_transferred);
398+
body_string.append(this->part.begin(), it);
396399
if (this->is_chunk_encoding) {
397400
this->body_promise.set_value(parse_chunk_encoding(body_string));
398401
} else {
@@ -468,7 +471,7 @@ struct http_async_connection
468471
this->body_promise.set_exception(std::make_exception_ptr(error));
469472
}
470473
else
471-
callback( boost::iterator_range<const char*>(), report_code );
474+
callback( char_const_range(), report_code );
472475
break;
473476
default:
474477
BOOST_ASSERT(false && "Bug, report this to the developers!");

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,9 @@ struct http_async_protocol_handler {
328328
void parse_body(Delegate& delegate_, Callback callback, size_t bytes) {
329329
// TODO(dberris): we should really not use a string for the partial body
330330
// buffer.
331-
partial_parsed.append(part_begin, bytes);
331+
auto it = part_begin;
332+
std::advance(it, bytes);
333+
partial_parsed.append(part_begin, it);
332334
part_begin = part.begin();
333335
delegate_->read_some(
334336
boost::asio::mutable_buffers_1(part.data(), part.size()), callback);

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,15 @@ class basic_client_facade {
4040
/** The response type. This models the HTTP Response concept.*/
4141
typedef basic_response<Tag> response;
4242

43+
typedef typename std::array<typename char_<Tag>::type, 1024>::const_iterator const_iterator;
44+
typedef iterator_range<const_iterator> char_const_range;
45+
4346
/**
4447
* This callback is invoked with a range representing part of the response's
4548
* body as it comes in. In case of errors, the second argument is an error
4649
* code.
4750
*/
48-
typedef std::function<void(iterator_range<char const*> const&,
51+
typedef std::function<void(char_const_range,
4952
boost::system::error_code const&)>
5053
body_callback_function_type;
5154

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
// http://www.boost.org/LICENSE_1_0.txt)
88

99
#include <boost/range/iterator_range.hpp>
10+
#include <array>
1011
#include <system_error>
1112

1213
#ifndef BOOST_NETWORK_HTTP_BODY_CALLBACK
1314
#define BOOST_NETWORK_HTTP_BODY_CALLBACK(function_name, range_name, \
1415
error_name) \
15-
void function_name(boost::iterator_range<const char*> const& (range_name), \
16+
void function_name(boost::iterator_range<std::array<char, 1024>::const_iterator> (range_name), \
1617
boost::system::error_code const& (error_name))
1718
#endif
1819

boost/network/protocol/http/policies/async_connection.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ struct async_connection_policy : resolver_policy<Tag>::type {
3030
typedef typename resolver_base::resolve_function resolve_function;
3131
typedef typename resolver_base::resolve_completion_function
3232
resolve_completion_function;
33-
typedef std::function<void(iterator_range<char const*> const&,
33+
typedef typename std::array<typename char_<Tag>::type, 1024>::const_iterator const_iterator;
34+
typedef iterator_range<const_iterator> char_const_range;
35+
typedef std::function<void(char_const_range,
3436
boost::system::error_code const&)>
3537
body_callback_function_type;
3638
typedef std::function<bool(string_type&)> body_generator_function_type;

boost/network/protocol/http/server/async_connection.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ struct async_connection
579579
}
580580
new_start = std::end(result_range);
581581
auto self = this->shared_from_this();
582-
thread_pool().post([this, self] { handler(request_, self); });
582+
thread_pool().post([self] () { self->handler(self->request_, self); });
583583
return;
584584
} else {
585585
partial_parsed.append(std::begin(result_range),

boost/network/protocol/stream_handler.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ struct stream_handler {
120120
tcp_sock_->shutdown(boost::asio::ip::tcp::socket::shutdown_send, e);
121121
}
122122
}
123-
catch (const boost::system::system_error& e) {
123+
catch (const boost::system::system_error&) {
124124

125125
}
126126
}

boost/network/uri/builder.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#ifndef __BOOST_NETWORK_URI_BUILDER_INC__
77
#define __BOOST_NETWORK_URI_BUILDER_INC__
88

9-
#include <asio/ip/address.hpp>
9+
#include <boost/asio/ip/address.hpp>
1010
#include <boost/network/uri/uri.hpp>
1111

1212
namespace boost {
@@ -51,31 +51,31 @@ class builder {
5151

5252
builder &host(const string_type &host) { return set_host(host); }
5353

54-
builder &set_host(const ::asio::ip::address &address) {
54+
builder &set_host(const boost::asio::ip::address &address) {
5555
uri_.uri_.append(address.to_string());
5656
uri_.parse();
5757
return *this;
5858
}
5959

60-
builder &host(const ::asio::ip::address &host) { return set_host(host); }
60+
builder &host(const boost::asio::ip::address &host) { return set_host(host); }
6161

62-
builder &set_host(const ::asio::ip::address_v4 &address) {
62+
builder &set_host(const boost::asio::ip::address_v4 &address) {
6363
uri_.uri_.append(address.to_string());
6464
uri_.parse();
6565
return *this;
6666
}
6767

68-
builder &host(const ::asio::ip::address_v4 &host) { return set_host(host); }
68+
builder &host(const boost::asio::ip::address_v4 &host) { return set_host(host); }
6969

70-
builder &set_host(const ::asio::ip::address_v6 &address) {
70+
builder &set_host(const boost::asio::ip::address_v6 &address) {
7171
uri_.uri_.append("[");
7272
uri_.uri_.append(address.to_string());
7373
uri_.uri_.append("]");
7474
uri_.parse();
7575
return *this;
7676
}
7777

78-
builder &host(const ::asio::ip::address_v6 &host) { return set_host(host); }
78+
builder &host(const boost::asio::ip::address_v6 &host) { return set_host(host); }
7979

8080
builder &set_port(const string_type &port) {
8181
uri_.uri_.append(":");

boost/network/utils/thread_pool.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include <memory>
1111
#include <functional>
1212
#include <boost/asio/io_service.hpp>
13-
#include <asio/io_service.hpp>
1413
#include <boost/network/tags.hpp>
1514
#include <boost/scope_exit.hpp>
1615
#include <boost/network/utils/thread_group.hpp>

0 commit comments

Comments
 (0)