GCC Code Coverage Report


Directory: ./
File: libs/http_proto/src/source.cpp
Date: 2025-12-04 09:48:34
Exec Total Coverage
Lines: 16 17 94.1%
Functions: 1 1 100.0%
Branches: 10 11 90.9%

Line Branch Exec Source
1 //
2 // Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com)
3 // Copyright (c) 2025 Mohammad Nejati
4 //
5 // Distributed under the Boost Software License, Version 1.0. (See accompanying
6 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 //
8 // Official repository: https://github.com/cppalliance/http_proto
9 //
10
11 #include <boost/http_proto/source.hpp>
12
13 namespace boost {
14 namespace http_proto {
15
16 auto
17 996 source::
18 on_read(
19 boost::span<buffers::mutable_buffer const> bs) ->
20 results
21 {
22 996 results rv;
23 996 auto it = bs.begin();
24 996 auto const end_ = bs.end();
25
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 995 times.
996 if(it == end_)
26 1 return rv;
27 do
28 {
29 1968 buffers::mutable_buffer b(*it++);
30
1/1
✓ Branch 1 taken 1968 times.
1968 auto rs = on_read(b);
31 1968 rv += rs;
32
2/2
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 1964 times.
1968 if(rs.ec.failed())
33 4 return rv;
34
2/2
✓ Branch 0 taken 23 times.
✓ Branch 1 taken 1941 times.
1964 if(rs.finished)
35 23 break;
36 // source must fill the entire buffer
37 // if it is not finished
38
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1941 times.
1941 if(b.size() != rs.bytes)
39 detail::throw_logic_error();
40 }
41
2/2
✓ Branch 0 taken 973 times.
✓ Branch 1 taken 968 times.
1941 while(it != end_);
42 991 return rv;
43 }
44
45 } // http_proto
46 } // boost
47