• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

biojppm / rapidyaml / 18160471768

01 Oct 2025 11:19AM UTC coverage: 97.276% (-0.4%) from 97.65%
18160471768

Pull #503

github

web-flow
Merge 8e72e99dd into 653eac974
Pull Request #503: Improve error model, callbacks

1735 of 1782 new or added lines in 31 files covered. (97.36%)

64 existing lines in 7 files now uncovered.

12677 of 13032 relevant lines covered (97.28%)

187443.13 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

96.97
/src_extra/c4/yml/extra/ints_utils.cpp
1
#ifdef RYML_SINGLE_HEADER_INTS
2
    #ifndef _RYML_SINGLE_HEADER_AMALGAMATED_HPP_
3
        #include <ryml_ints.hpp>
4
    #endif
5
#elif defined(RYML_SINGLE_HEADER)
6
    #ifndef _RYML_SINGLE_HEADER_AMALGAMATED_HPP_
7
        #include <ryml_all.hpp>
8
    #endif
9
#endif
10

11
#ifndef _C4_YML_EXTRA_SCALAR_HPP_
12
#include "c4/yml/extra/scalar.hpp"
13
#endif
14

15
#ifndef _C4_YML_EXTRA_INTS_UTILS_HPP_
16
#include "c4/yml/extra/ints_utils.hpp"
17
#endif
18

19
#ifndef _C4_YML_ERROR_HPP_
20
#include "c4/yml/error.hpp"
21
#endif
22

23
#ifndef _C4_BITMASK_HPP_
24
#include "c4/bitmask.hpp"
25
#endif
26

27

28
C4_SUPPRESS_WARNING_GCC_WITH_PUSH("-Wold-style-cast")
29
C4_SUPPRESS_WARNING_CLANG_WITH_PUSH("-Wold-style-cast")
30
// NOLINTBEGIN(hicpp-signed-bitwise)
31

32

33
namespace c4 {
34
template<>
35
c4::EnumSymbols<yml::extra::ievt::EventFlags> esyms<yml::extra::ievt::EventFlags>()
408,652✔
36
{
37
    static constexpr const EnumSymbols<yml::extra::ievt::EventFlags>::Sym syms[] = {
38
        {yml::extra::ievt::KEY_, "KEY_"},
39
        {yml::extra::ievt::VAL_, "VAL_"},
40
        {yml::extra::ievt::SCLR, "SCLR"},
41
        {yml::extra::ievt::BSEQ, "BSEQ"},
42
        {yml::extra::ievt::ESEQ, "ESEQ"},
43
        {yml::extra::ievt::BMAP, "BMAP"},
44
        {yml::extra::ievt::EMAP, "EMAP"},
45
        {yml::extra::ievt::ALIA, "ALIA"},
46
        {yml::extra::ievt::ANCH, "ANCH"},
47
        {yml::extra::ievt::TAG_, "TAG_"},
48
        {yml::extra::ievt::PLAI, "PLAI"},
49
        {yml::extra::ievt::SQUO, "SQUO"},
50
        {yml::extra::ievt::DQUO, "DQUO"},
51
        {yml::extra::ievt::LITL, "LITL"},
52
        {yml::extra::ievt::FOLD, "FOLD"},
53
        {yml::extra::ievt::FLOW, "FLOW"},
54
        {yml::extra::ievt::BLCK, "BLCK"},
55
        {yml::extra::ievt::BDOC, "BDOC"},
56
        {yml::extra::ievt::EDOC, "EDOC"},
57
        {yml::extra::ievt::BSTR, "BSTR"},
58
        {yml::extra::ievt::ESTR, "ESTR"},
59
        {yml::extra::ievt::EXPL, "EXPL"},
60
        {yml::extra::ievt::AREN, "AREN"},
61
        {yml::extra::ievt::PSTR, "PSTR"},
62
        {yml::extra::ievt::UNFILT, "UNFILT"},
63
        {yml::extra::ievt::YAML, "YAML"},
64
        {yml::extra::ievt::TAGD, "TAGD"},
65
        {yml::extra::ievt::TAGV, "TAGV"},
66
    };
67
    return EnumSymbols<yml::extra::ievt::EventFlags>(syms);
408,652✔
68
}
69
namespace yml {
70
namespace extra {
71
namespace ievt {
72
size_t to_chars(substr buf, ievt::DataType flags)
408,652✔
73
{
74
    flags &= ievt::MASK; // clear any other bits
408,652✔
75
    return c4::bm2str<ievt::EventFlags>(flags, buf.str, buf.len);
408,652✔
76
}
77
csubstr to_chars_sub(substr buf, ievt::DataType flags)
408,648✔
78
{
79
    size_t reqsize = ievt::to_chars(buf, flags);
408,648✔
80
    _RYML_CHECK_BASIC(reqsize > 0u);
408,648✔
81
    _RYML_CHECK_BASIC(reqsize < buf.len);
408,648✔
82
    return buf.first(reqsize - 1u);
1,225,944✔
83
}
84
} // namespace ievt
85
} // namespace extra
86
} // namespace yml
87
} // namespace c4
88

89

90
//-----------------------------------------------------------------------------
91
//-----------------------------------------------------------------------------
92
//-----------------------------------------------------------------------------
93

94
namespace c4 {
95
namespace yml {
96
namespace extra {
97

98
void events_ints_print(csubstr parsed_yaml, csubstr arena, ievt::DataType const* evts, ievt::DataType evts_sz)
4✔
99
{
100
    char buf[200];
101
    for(ievt::DataType evtpos = 0, evtnumber = 0;
4✔
102
        evtpos < evts_sz;
68✔
103
        ++evtnumber,
64✔
104
            evtpos += ((evts[evtpos] & ievt::WSTR) ? 3 : 1))
64✔
105
    {
106
        ievt::DataType evt = evts[evtpos];
64✔
107
        csubstr flags = ievt::to_chars_sub(buf, evt);
64✔
108
        printf("[%d][%d] %.*s(0x%x)", evtnumber, evtpos, (int)flags.len, flags.str, evt);
64✔
109
        if (evt & ievt::WSTR)
64✔
110
        {
111
            bool in_arena = evt & ievt::AREN;
24✔
112
            csubstr region = !in_arena ? parsed_yaml : arena;
24✔
113
            bool safe = (evts[evtpos + 1] >= 0)
48✔
114
                && (evts[evtpos + 2] >= 0)
24✔
115
                && (evts[evtpos + 1] <= (int)region.len)
24✔
116
                && ((evts[evtpos + 1] + evts[evtpos + 2]) <= (int)region.len);
48✔
117
            const char *str = safe ? (region.str + evts[evtpos + 1]) : "ERR!!!";
24✔
118
            int len = safe ? evts[evtpos + 2] : 6;
24✔
119
            printf(": %d [%d]~~~%.*s~~~", evts[evtpos+1], evts[evtpos+2], len, str);
24✔
120
            if(in_arena)
24✔
UNCOV
121
                printf(" (arenasz=%zu)", arena.len);
×
122
            else
123
                printf(" (srcsz=%zu)", parsed_yaml.len);
24✔
124
        }
125
        printf("\n");
64✔
126
    }
127
}
4✔
128

129
} // namespace extra
130
} // namespace yml
131
} // namespace c4
132

133
// NOLINTEND(hicpp-signed-bitwise)
134
C4_SUPPRESS_WARNING_CLANG_POP
135
C4_SUPPRESS_WARNING_GCC_POP
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc