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

Method decode_float

src/dpp/etf.cpp:371–393  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

369}
370
371json etf_parser::decode_float() {
372
373 const uint8_t FLOAT_LENGTH = 31;
374 const char* floatStr = read_string(FLOAT_LENGTH);
375
376 if (floatStr == NULL) {
377 return json();
378 }
379
380 double number;
381 char null_terminated[FLOAT_LENGTH + 1] = {0};
382
383 memcpy(null_terminated, floatStr, FLOAT_LENGTH);
384
385 auto count = sscanf(null_terminated, "%lf", &number);
386
387 if (count != 1) {
388 return json();
389 }
390
391 json j = number;
392 return j;
393}
394
395json etf_parser::decode_new_float() {
396 union {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected