MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / ReadBytes

Function ReadBytes

tensorflow/core/util/proto/decode.h:339–359  ·  view source on GitHub ↗

Reads a string, submessage, or other variable-length field from a serialized proto. May read all or part of a repeated field.

Source from the content-addressed store, hash-verified

337// serialized proto.
338// May read all or part of a repeated field.
339inline Status ReadBytes(CodedInputStream* input, int index, void* datap) {
340 tstring* data = reinterpret_cast<tstring*>(datap) + index;
341
342#ifdef USE_TSTRING
343 uint32 length;
344 if (!input->ReadVarint32(&length)) {
345 return errors::DataLoss("Failed reading bytes");
346 }
347
348 data->resize_uninitialized(length);
349
350 if (!input->ReadRaw(data->data(), length)) {
351 return errors::DataLoss("Failed reading bytes");
352 }
353#else // USE_TSTRING
354 if (!WireFormatLite::ReadBytes(input, data)) {
355 return errors::DataLoss("Failed reading bytes");
356 }
357#endif // USE_TSTRING
358 return Status::OK();
359}
360
361// Reads a tag-delimited field (TYPE_GROUP) from a serialized proto,
362// as a bytestring.

Callers 1

ReadValueFunction · 0.85

Calls 3

ReadVarint32Method · 0.80
resize_uninitializedMethod · 0.80
dataMethod · 0.45

Tested by

no test coverage detected