MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / _loadhexaesc

Method _loadhexaesc

src/Chain/libraries/glua/glua_tokenparser.cpp:226–249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

224 }
225
226 void GluaTokenParser::_loadhexaesc(std::string &code, std::stringstream *ss)
227 {
228 --_parsing_buff_len;
229 int c1 = _current_char(code);
230 ss && *ss << (char)c1;
231 ++_parsing_pos;
232 int c2 = _current_char(code);
233 ss && *ss << (char)c2;
234 ++_parsing_pos;
235 if (!is_base16_digit(c1) || !is_base16_digit(c2))
236 {
237 THROW_PERROR("hex wrong format");
238 return;
239 }
240 int r1 = hexchar_to_base10(c1);
241 int r2 = hexchar_to_base10(c2);
242 int d = (r1 << 4) + r2;
243 char s[4];
244 snprintf(s, 4, "%d", d);
245 for (size_t i = 0; i < strlen(s); ++i)
246 {
247 _save_to_buff(s[i]);
248 }
249 }
250
251 void GluaTokenParser::_loadutf8esc(std::string &code, std::stringstream *ss)
252 {

Callers

nothing calls this directly

Calls 3

is_base16_digitFunction · 0.85
hexchar_to_base10Function · 0.85
snprintfFunction · 0.85

Tested by

no test coverage detected