| 210 | } |
| 211 | |
| 212 | std::string readName(const char*& ptr, const char* end, const char* begin) |
| 213 | { |
| 214 | std::string name; |
| 215 | while (true) |
| 216 | { |
| 217 | const auto count = readU8(ptr, end); |
| 218 | if (count == 0) |
| 219 | break; |
| 220 | if (count & 0b11000000) |
| 221 | { |
| 222 | // Compressed data |
| 223 | const auto offset = (static_cast<int>(count & 0b00111111) << 8) + readU8(ptr, end); |
| 224 | const auto* messagePtr = begin + offset; |
| 225 | name += readName(messagePtr, end, begin); |
| 226 | break; |
| 227 | } |
| 228 | name += std::string(ptr, count) + '.'; |
| 229 | ptr += count; |
| 230 | } |
| 231 | if (!name.empty() && (name.back() == '.')) |
| 232 | name.pop_back(); |
| 233 | return name; |
| 234 | } |
| 235 | |
| 236 | struct Query |
| 237 | { |