221 {
222 const size_t bsize = buffer.size();
223 if (
offset + 1 >= bsize) {
224 return boost::none;
225 }
226
228 if (!rname) {
229 return boost::none;
230 }
231
232 if (
offset + 10 >= bsize) {
233 return boost::none;
234 }
235
237 res.name = std::move(*rname);
238 const uint16_t *data_16 =
reinterpret_cast<const uint16_t*
>(buffer.data() +
offset);
239 res.type = endian::big_to_native(data_16[0]);
240 res.rclass = endian::big_to_native(data_16[1]);
241 res.ttl = endian::big_to_native(*reinterpret_cast<const uint32_t*>(data_16 + 2));
242 uint16_t rdlength = endian::big_to_native(data_16[4]);
243
245 if (
offset + rdlength > bsize) {
246 return boost::none;
247 }
248
250 res.data = std::vector<char>(buffer.begin() +
offset, buffer.begin() +
offset + rdlength);
252
253 return std::move(res);
254 }
Slic3r::Polygons offset(const Slic3r::Polygon &polygon, const float delta, JoinType joinType, double miterLimit)
Definition ClipperUtils.cpp:582
static optional< DnsName > decode(const std::vector< char > &buffer, size_t &offset, unsigned depth=0)
Definition Bonjour.cpp:70
DnsResource()
Definition Bonjour.cpp:214