| 126 | } |
| 127 | |
| 128 | void 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 | |
| 147 | void etf_parser::append_atom_utf8(etf_buffer *b, const char *bytes, size_t size) { |
| 148 | if (size < 255) { |
nothing calls this directly
no test coverage detected