199 {
200 const size_t bsize = buffer.size();
201 if (
offset + 1 >= bsize) {
202 return boost::none;
203 }
204
206 if (!rname) {
207 return boost::none;
208 }
209
210 if (
offset + 10 >= bsize) {
211 return boost::none;
212 }
213
215 res.name = std::move(*rname);
217 res.type = endian::big_to_native(data_16[0]);
218 res.rclass = endian::big_to_native(data_16[1]);
219 res.ttl = endian::big_to_native(*
reinterpret_cast<const uint32_t*
>(data_16 + 2));
220 uint16_t rdlength = endian::big_to_native(data_16[4]);
221
223 if (
offset + rdlength > bsize) {
224 return boost::none;
225 }
226
228 res.data = std::vector<char>(buffer.begin() +
offset, buffer.begin() +
offset + rdlength);
230
231 return std::move(res);
232 }
Slic3r::Polygons offset(const Slic3r::Polygon &polygon, const float delta, ClipperLib::JoinType joinType, double miterLimit)
Definition ClipperUtils.cpp:416
static optional< DnsName > decode(const std::vector< char > &buffer, size_t &offset, unsigned depth=0)
Definition Bonjour.cpp:48
DnsResource()
Definition Bonjour.cpp:192
unsigned __int16 uint16_t
Definition unistd.h:78
unsigned __int32 uint32_t
Definition unistd.h:79