update boost on linux

This commit is contained in:
Bassem Girgis
2019-08-10 16:06:25 -05:00
parent 76ad52be58
commit 861b918727
5363 changed files with 483306 additions and 116507 deletions

View File

@@ -2,7 +2,7 @@
// impl/buffered_read_stream.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -15,10 +15,13 @@
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
#include <boost/asio/associated_allocator.hpp>
#include <boost/asio/associated_executor.hpp>
#include <boost/asio/detail/handler_alloc_helpers.hpp>
#include <boost/asio/detail/handler_cont_helpers.hpp>
#include <boost/asio/detail/handler_invoke_helpers.hpp>
#include <boost/asio/detail/handler_type_requirements.hpp>
#include <boost/asio/detail/non_const_lvalue.hpp>
#include <boost/asio/detail/push_options.hpp>
@@ -136,8 +139,60 @@ namespace detail
boost_asio_handler_invoke_helpers::invoke(
function, this_handler->handler_);
}
struct initiate_async_buffered_fill
{
template <typename ReadHandler, typename Stream>
void operator()(BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
buffered_stream_storage* storage, Stream* next_layer) const
{
// If you get an error on the following line it means that your handler
// does not meet the documented type requirements for a ReadHandler.
BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
non_const_lvalue<ReadHandler> handler2(handler);
std::size_t previous_size = storage->size();
storage->resize(storage->capacity());
next_layer->async_read_some(
buffer(
storage->data() + previous_size,
storage->size() - previous_size),
buffered_fill_handler<typename decay<ReadHandler>::type>(
*storage, previous_size, handler2.value));
}
};
} // namespace detail
#if !defined(GENERATING_DOCUMENTATION)
template <typename ReadHandler, typename Allocator>
struct associated_allocator<
detail::buffered_fill_handler<ReadHandler>, Allocator>
{
typedef typename associated_allocator<ReadHandler, Allocator>::type type;
static type get(const detail::buffered_fill_handler<ReadHandler>& h,
const Allocator& a = Allocator()) BOOST_ASIO_NOEXCEPT
{
return associated_allocator<ReadHandler, Allocator>::get(h.handler_, a);
}
};
template <typename ReadHandler, typename Executor>
struct associated_executor<
detail::buffered_fill_handler<ReadHandler>, Executor>
{
typedef typename associated_executor<ReadHandler, Executor>::type type;
static type get(const detail::buffered_fill_handler<ReadHandler>& h,
const Executor& ex = Executor()) BOOST_ASIO_NOEXCEPT
{
return associated_executor<ReadHandler, Executor>::get(h.handler_, ex);
}
};
#endif // !defined(GENERATING_DOCUMENTATION)
template <typename Stream>
template <typename ReadHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
@@ -145,25 +200,9 @@ BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
buffered_read_stream<Stream>::async_fill(
BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
{
// If you get an error on the following line it means that your handler does
// not meet the documented type requirements for a ReadHandler.
BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
detail::async_result_init<
ReadHandler, void (boost::system::error_code, std::size_t)> init(
BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
std::size_t previous_size = storage_.size();
storage_.resize(storage_.capacity());
next_layer_.async_read_some(
buffer(
storage_.data() + previous_size,
storage_.size() - previous_size),
detail::buffered_fill_handler<BOOST_ASIO_HANDLER_TYPE(
ReadHandler, void (boost::system::error_code, std::size_t))>(
storage_, previous_size, init.handler));
return init.result.get();
return async_initiate<ReadHandler,
void (boost::system::error_code, std::size_t)>(
detail::initiate_async_buffered_fill(), handler, &storage_, &next_layer_);
}
template <typename Stream>
@@ -171,7 +210,8 @@ template <typename MutableBufferSequence>
std::size_t buffered_read_stream<Stream>::read_some(
const MutableBufferSequence& buffers)
{
if (boost::asio::buffer_size(buffers) == 0)
using boost::asio::buffer_size;
if (buffer_size(buffers) == 0)
return 0;
if (storage_.empty())
@@ -187,7 +227,8 @@ std::size_t buffered_read_stream<Stream>::read_some(
{
ec = boost::system::error_code();
if (boost::asio::buffer_size(buffers) == 0)
using boost::asio::buffer_size;
if (buffer_size(buffers) == 0)
return 0;
if (storage_.empty() && !this->fill(ec))
@@ -206,7 +247,7 @@ namespace detail
const MutableBufferSequence& buffers, ReadHandler& handler)
: storage_(storage),
buffers_(buffers),
handler_(handler)
handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))
{
}
@@ -294,8 +335,78 @@ namespace detail
boost_asio_handler_invoke_helpers::invoke(
function, this_handler->handler_);
}
struct initiate_async_buffered_read_some
{
template <typename ReadHandler, typename Stream,
typename MutableBufferSequence>
void operator()(BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
buffered_stream_storage* storage, Stream* next_layer,
const MutableBufferSequence& buffers) const
{
// If you get an error on the following line it means that your handler
// does not meet the documented type requirements for a ReadHandler.
BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
using boost::asio::buffer_size;
non_const_lvalue<ReadHandler> handler2(handler);
if (buffer_size(buffers) == 0 || !storage->empty())
{
next_layer->async_read_some(BOOST_ASIO_MUTABLE_BUFFER(0, 0),
buffered_read_some_handler<MutableBufferSequence,
typename decay<ReadHandler>::type>(
*storage, buffers, handler2.value));
}
else
{
initiate_async_buffered_fill()(
buffered_read_some_handler<MutableBufferSequence,
typename decay<ReadHandler>::type>(
*storage, buffers, handler2.value),
storage, next_layer);
}
}
};
} // namespace detail
#if !defined(GENERATING_DOCUMENTATION)
template <typename MutableBufferSequence,
typename ReadHandler, typename Allocator>
struct associated_allocator<
detail::buffered_read_some_handler<MutableBufferSequence, ReadHandler>,
Allocator>
{
typedef typename associated_allocator<ReadHandler, Allocator>::type type;
static type get(
const detail::buffered_read_some_handler<
MutableBufferSequence, ReadHandler>& h,
const Allocator& a = Allocator()) BOOST_ASIO_NOEXCEPT
{
return associated_allocator<ReadHandler, Allocator>::get(h.handler_, a);
}
};
template <typename MutableBufferSequence,
typename ReadHandler, typename Executor>
struct associated_executor<
detail::buffered_read_some_handler<MutableBufferSequence, ReadHandler>,
Executor>
{
typedef typename associated_executor<ReadHandler, Executor>::type type;
static type get(
const detail::buffered_read_some_handler<
MutableBufferSequence, ReadHandler>& h,
const Executor& ex = Executor()) BOOST_ASIO_NOEXCEPT
{
return associated_executor<ReadHandler, Executor>::get(h.handler_, ex);
}
};
#endif // !defined(GENERATING_DOCUMENTATION)
template <typename Stream>
template <typename MutableBufferSequence, typename ReadHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
@@ -304,31 +415,10 @@ buffered_read_stream<Stream>::async_read_some(
const MutableBufferSequence& buffers,
BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
{
// If you get an error on the following line it means that your handler does
// not meet the documented type requirements for a ReadHandler.
BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
detail::async_result_init<
ReadHandler, void (boost::system::error_code, std::size_t)> init(
BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
if (boost::asio::buffer_size(buffers) == 0 || !storage_.empty())
{
next_layer_.async_read_some(boost::asio::mutable_buffers_1(0, 0),
detail::buffered_read_some_handler<
MutableBufferSequence, BOOST_ASIO_HANDLER_TYPE(
ReadHandler, void (boost::system::error_code, std::size_t))>(
storage_, buffers, init.handler));
}
else
{
this->async_fill(detail::buffered_read_some_handler<
MutableBufferSequence, BOOST_ASIO_HANDLER_TYPE(
ReadHandler, void (boost::system::error_code, std::size_t))>(
storage_, buffers, init.handler));
}
return init.result.get();
return async_initiate<ReadHandler,
void (boost::system::error_code, std::size_t)>(
detail::initiate_async_buffered_read_some(),
handler, &storage_, &next_layer_, buffers);
}
template <typename Stream>