GCC Code Coverage Report


Directory: ./
File: libs/http_proto/include/boost/http_proto/impl/source.hpp
Date: 2025-12-04 09:48:34
Exec Total Coverage
Lines: 25 25 100.0%
Functions: 2 2 100.0%
Branches: 12 15 80.0%

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/buffers
8 //
9
10 #ifndef BOOST_BUFFERS_IMPL_SOURCE_HPP
11 #define BOOST_BUFFERS_IMPL_SOURCE_HPP
12
13 #include <boost/http_proto/detail/except.hpp>
14 #include <boost/assert.hpp>
15
16 namespace boost {
17 namespace http_proto {
18
19 inline
20 auto
21 2959 source::
22 results::
23 operator+=(
24 results const& rv) noexcept ->
25 results&
26 {
27
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2959 times.
2959 BOOST_ASSERT(! ec.failed());
28
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2959 times.
2959 BOOST_ASSERT(! finished);
29 2959 ec = rv.ec;
30 2959 bytes += rv.bytes;
31 2959 finished = rv.finished;
32 2959 return *this;
33 }
34
35 //------------------------------------------------
36
37 template<class T>
38 auto
39 991 source::
40 read_impl(
41 T const& bs) ->
42 results
43 {
44 991 results rv;
45 991 constexpr int SmallArraySize = 16;
46 991 buffers::mutable_buffer tmp[SmallArraySize];
47 991 auto const tmp_end =
48 tmp + SmallArraySize;
49 991 auto it = buffers::begin(bs);
50 991 auto const end_ = buffers::end(bs);
51
2/2
✓ Branch 0 taken 991 times.
✓ Branch 1 taken 968 times.
1959 while(it != end_)
52 {
53 991 auto p = tmp;
54 do
55 {
56 1982 *p++ = *it++;
57 }
58 while(
59
3/4
✓ Branch 0 taken 1982 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 991 times.
✓ Branch 3 taken 991 times.
1982 p != tmp_end &&
60 it != end_);
61
1/1
✓ Branch 1 taken 991 times.
991 rv += on_read(boost::span<
62 buffers::mutable_buffer const>(
63 991 tmp, p - tmp));
64
2/2
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 990 times.
991 if(rv.ec.failed())
65 1 return rv;
66
2/2
✓ Branch 0 taken 22 times.
✓ Branch 1 taken 968 times.
990 if(rv.finished)
67 22 break;
68 }
69 990 return rv;
70 }
71
72 } // http_proto
73 } // boost
74
75 #endif
76