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

Function CompareProbeData

engine/dlib/src/dlib/mdns.cpp:853–865  ·  view source on GitHub ↗

RFC 6762 compares tentative records lexicographically as unsigned bytes.

Source from the content-addressed store, hash-verified

851
852 // RFC 6762 compares tentative records lexicographically as unsigned bytes.
853 static int CompareProbeData(const uint8_t* a, uint16_t a_length, const uint8_t* b, uint16_t b_length)
854 {
855 const uint16_t min_length = a_length < b_length ? a_length : b_length;
856 for (uint16_t i = 0; i < min_length; ++i)
857 {
858 if (a[i] != b[i])
859 return a[i] < b[i] ? -1 : 1;
860 }
861
862 if (a_length != b_length)
863 return a_length < b_length ? -1 : 1;
864 return 0;
865 }
866
867 // Records sort by class, then type, then raw rdata bytes, matching the
868 // simultaneous-probe tiebreak order from RFC 6762 section 8.2.

Callers 1

CompareProbeRecordFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected