MCPcopy Create free account
hub / github.com/apache/brpc / unbox

Function unbox

src/mcpack2pb/parser.cpp:253–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

251}
252
253size_t unbox(InputStream* stream) {
254 FieldLongHead head;
255 if (stream->cut_packed_pod(&head) != sizeof(FieldLongHead)) {
256 CHECK(false) << "Input buffer is not enough";
257 return 0;
258 }
259 if (head.type() != FIELD_OBJECT) {
260 CHECK(false) << "type=" << type2str(head.type()) << " is not object";
261 return 0;
262 }
263 if (!(head.type() & FIELD_NON_DELETED_MASK)) {
264 CHECK(false) << "The item is deleted";
265 return 0;
266 }
267 if (head.name_size() != 0) {
268 CHECK(false) << "The object should not have name";
269 return 0;
270 }
271 return head.value_size();
272}
273
274std::ostream& operator<<(std::ostream& os, const UnparsedValue& value) {
275 // TODO(gejun): More info.

Callers 2

ParseNsheadMetaMethod · 0.85
ParseResponseFunction · 0.85

Calls 5

cut_packed_podMethod · 0.80
type2strFunction · 0.70
typeMethod · 0.45
name_sizeMethod · 0.45
value_sizeMethod · 0.45

Tested by

no test coverage detected