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

biojppm / rapidyaml / 18079894742

28 Sep 2025 09:11PM UTC coverage: 97.379% (+0.07%) from 97.312%
18079894742

Pull #536

github

web-flow
Merge c015e2875 into 9a044c88b
Pull Request #536: Int handler

926 of 934 new or added lines in 17 files covered. (99.14%)

12147 of 12474 relevant lines covered (97.38%)

196096.12 hits per line

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

96.88
/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_BITMASK_HPP_
20
#include "c4/bitmask.hpp"
21
#endif
22

23

24
C4_SUPPRESS_WARNING_GCC_WITH_PUSH("-Wold-style-cast")
25
C4_SUPPRESS_WARNING_CLANG_WITH_PUSH("-Wold-style-cast")
26
// NOLINTBEGIN(hicpp-signed-bitwise)
27

28

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

84

85
//-----------------------------------------------------------------------------
86
//-----------------------------------------------------------------------------
87
//-----------------------------------------------------------------------------
88

89
namespace c4 {
90
namespace yml {
91
namespace extra {
92

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

126
} // namespace extra
127
} // namespace yml
128
} // namespace c4
129

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

© 2026 Coveralls, Inc