GCC Code Coverage Report


Directory: libs/http_proto/
File: boost/http_proto/impl/source.hpp
Date: 2024-07-03 18:58:30
Exec Total Coverage
Lines: 24 25 96.0%
Functions: 2 2 100.0%
Branches: 11 16 68.8%

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