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

Function ParseString

tensorflow/core/util/example_proto_fast_parsing.cc:300–318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

298}
299
300bool ParseString(protobuf::io::CodedInputStream* stream, StringPiece* result) {
301 DCHECK(stream != nullptr);
302 DCHECK(result != nullptr);
303 uint32 length;
304 if (!stream->ReadVarint32(&length)) return false;
305 if (length == 0) {
306 *result = StringPiece(nullptr, 0);
307 return true;
308 }
309 const void* stream_alias;
310 int stream_size;
311 if (!stream->GetDirectBufferPointer(&stream_alias, &stream_size)) {
312 return false;
313 }
314 if (static_cast<uint32>(stream_size) < length) return false;
315 *result = StringPiece(static_cast<const char*>(stream_alias), length);
316 stream->Skip(length);
317 return true;
318}
319
320bool ParseFeatureMapEntry(protobuf::io::CodedInputStream* stream,
321 parsed::FeatureMapEntry* feature_map_entry) {

Callers 4

ParseMethod · 0.85
ParseAttributeHelperMethod · 0.85
ParseFeatureMapEntryFunction · 0.85
FastParseSequenceExampleFunction · 0.85

Calls 2

ReadVarint32Method · 0.80
SkipMethod · 0.45

Tested by

no test coverage detected