| 298 | } |
| 299 | |
| 300 | bool 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 | |
| 320 | bool ParseFeatureMapEntry(protobuf::io::CodedInputStream* stream, |
| 321 | parsed::FeatureMapEntry* feature_map_entry) { |
no test coverage detected