MCPcopy Create free account
hub / github.com/defold/defold / WriteName

Function WriteName

engine/dlib/src/dlib/mdns.cpp:604–638  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

602 }
603
604 static bool WriteName(uint8_t* data, uint32_t size, uint32_t* offset, const char* name)
605 {
606 const char* cursor = name;
607 while (*cursor)
608 {
609 char label[63];
610 uint32_t label_len = 0;
611 while (*cursor && *cursor != '.')
612 {
613 if (label_len >= sizeof(label))
614 return false;
615
616 if (!DecodeEscapedChar(&cursor, &label[label_len]))
617 return false;
618 ++label_len;
619 }
620
621 if (*offset + 1 + label_len > size)
622 return false;
623
624 data[*offset] = (uint8_t) label_len;
625 ++(*offset);
626 memcpy(data + *offset, label, label_len);
627 *offset += label_len;
628
629 if (*cursor == '.')
630 ++cursor;
631 }
632
633 if (*offset + 1 > size)
634 return false;
635 data[*offset] = 0;
636 ++(*offset);
637 return true;
638 }
639
640 static dmSocket::Socket CreateSocket()
641 {

Callers 7

WriteRecordHeaderFunction · 0.70
BuildSrvRDataFunction · 0.70
WriteRecordPtrFunction · 0.70
BuildQueryMessageFunction · 0.70
BuildProbeMessageFunction · 0.70
IsEncodableDnsNameFunction · 0.70

Calls 1

DecodeEscapedCharFunction · 0.70

Tested by

no test coverage detected