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

Function ReadAMFObjectBody

src/brpc/amf.cpp:501–527  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

499}
500
501static bool ReadAMFObjectBody(google::protobuf::Message* message,
502 AMFInputStream* stream) {
503 const google::protobuf::Descriptor* desc = message->GetDescriptor();
504 std::string name;
505 while (ReadAMFShortStringBody(&name, stream)) {
506 if (name.empty()) {
507 uint8_t marker;
508 if (stream->cut_u8(&marker) != 1u) {
509 LOG(ERROR) << "stream is not long enough";
510 return false;
511 }
512 if ((AMFMarker)marker != AMF_MARKER_OBJECT_END) {
513 LOG(ERROR) << "marker=" << marker
514 << " after empty name is not object end";
515 return false;
516 }
517 break;
518 }
519 const google::protobuf::FieldDescriptor* field = desc->FindFieldByName(name);
520 RPC_VLOG_IF(field == NULL) << "Unknown field=" << desc->full_name()
521 << "." << name;
522 if (!ReadAMFObjectField(stream, message, field)) {
523 return false;
524 }
525 }
526 return true;
527}
528
529static bool SkipAMFObjectBody(AMFInputStream* stream) {
530 std::string name;

Callers 3

ReadAMFObjectFieldFunction · 0.85
ReadAMFObjectFunction · 0.85
ReadAMFArrayItemFunction · 0.85

Calls 5

ReadAMFShortStringBodyFunction · 0.85
ReadAMFObjectFieldFunction · 0.85
cut_u8Method · 0.80
GetDescriptorMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected