MCPcopy Create free account
hub / github.com/brainboxdotcc/DPP / append_atom

Method append_atom

src/dpp/etf.cpp:128–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126}
127
128void etf_parser::append_atom(etf_buffer *b, const char *bytes, size_t size) {
129 if (size < 255) {
130 unsigned char buf[2] = {ett_atom_small, (unsigned char)size};
131 buffer_write(b, (const char *)buf, 2);
132 buffer_write(b, (const char *)bytes, size);
133 } else {
134 unsigned char buf[3];
135 buf[0] = ett_atom;
136
137 if (size > 0xFFFF) {
138 throw dpp::parse_exception(err_etf, "ETF: Atom too large");
139 }
140
141 store_16_bits(buf + 1, size);
142 buffer_write(b, (const char *)buf, 3);
143 buffer_write(b, (const char *)bytes, size);
144 }
145}
146
147void etf_parser::append_atom_utf8(etf_buffer *b, const char *bytes, size_t size) {
148 if (size < 255) {

Callers

nothing calls this directly

Calls 1

parse_exceptionClass · 0.85

Tested by

no test coverage detected