GCC Code Coverage Report


Directory: ./
File: libs/http/include/boost/http/impl/sink.hpp
Date: 2026-01-20 13:56:46
Exec Total Coverage
Lines: 21 22 95.5%
Functions: 2 2 100.0%
Branches: 11 15 73.3%

Line Branch Exec Source
1 //
2 // Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com)
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 //
7 // Official repository: https://github.com/cppalliance/http
8 //
9
10 #ifndef BOOST_HTTP_IMPL_SINK_HPP
11 #define BOOST_HTTP_IMPL_SINK_HPP
12
13 #include <boost/capy/buffers.hpp>
14 #include <boost/capy/buffers/range.hpp>
15 #include <boost/http/detail/except.hpp>
16 #include <boost/assert.hpp>
17
18 namespace boost {
19 namespace http {
20
21 inline
22 auto
23 36639 sink::
24 results::
25 operator+=(
26 results const& rv) noexcept ->
27 results&
28 {
29
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 36639 times.
36639 BOOST_ASSERT(! ec.failed());
30 36639 ec = rv.ec;
31 36639 bytes += rv.bytes;
32 36639 return *this;
33 }
34
35 //------------------------------------------------
36
37 template<class T>
38 auto
39 18438 sink::
40 write_impl(
41 T const& bs,
42 bool more) ->
43 results
44 {
45 18438 results rv;
46 18438 constexpr int SmallArraySize = 16;
47 18438 capy::const_buffer tmp[SmallArraySize];
48 18438 auto const tmp_end = tmp + SmallArraySize;
49 18438 auto it = capy::begin(bs);
50 18438 auto const end_ = capy::end(bs);
51
2/2
✓ Branch 0 taken 18438 times.
✓ Branch 1 taken 18438 times.
36876 while(it != end_)
52 {
53 18438 auto p = tmp;
54 do
55 {
56 36876 *p++ = *it++;
57 }
58 while(
59
3/4
✓ Branch 0 taken 36876 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 18438 times.
✓ Branch 3 taken 18438 times.
36876 p != tmp_end &&
60 it != end_);
61
1/1
✓ Branch 1 taken 18438 times.
18438 rv += on_write(boost::span<
62 capy::const_buffer const>(
63 18438 tmp, p - tmp),
64
3/4
✓ Branch 0 taken 18438 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 18126 times.
✓ Branch 3 taken 312 times.
18438 it != end_ || more);
65
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 18438 times.
18438 if(rv.ec.failed())
66 return rv;
67 }
68 18438 return rv;
69 }
70
71 } // http
72 } // boost
73
74 #endif
75