summaryrefslogtreecommitdiff
path: root/boost/beast/core/impl/static_buffer.ipp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/beast/core/impl/static_buffer.ipp')
-rw-r--r--boost/beast/core/impl/static_buffer.ipp23
1 files changed, 22 insertions, 1 deletions
diff --git a/boost/beast/core/impl/static_buffer.ipp b/boost/beast/core/impl/static_buffer.ipp
index d93a1e6911..2fdb2d9a8a 100644
--- a/boost/beast/core/impl/static_buffer.ipp
+++ b/boost/beast/core/impl/static_buffer.ipp
@@ -35,10 +35,31 @@ static_buffer_base::
data() const ->
const_buffers_type
{
- using boost::asio::mutable_buffer;
+ using boost::asio::const_buffer;
const_buffers_type result;
if(in_off_ + in_size_ <= capacity_)
{
+ result[0] = const_buffer{begin_ + in_off_, in_size_};
+ result[1] = const_buffer{begin_, 0};
+ }
+ else
+ {
+ result[0] = const_buffer{begin_ + in_off_, capacity_ - in_off_};
+ result[1] = const_buffer{begin_, in_size_ - (capacity_ - in_off_)};
+ }
+ return result;
+}
+
+inline
+auto
+static_buffer_base::
+mutable_data() ->
+ mutable_buffers_type
+{
+ using boost::asio::mutable_buffer;
+ mutable_buffers_type result;
+ if(in_off_ + in_size_ <= capacity_)
+ {
result[0] = mutable_buffer{begin_ + in_off_, in_size_};
result[1] = mutable_buffer{begin_, 0};
}