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

Function ReadAMFObject

src/brpc/amf.cpp:576–601  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

574}
575
576bool ReadAMFObject(google::protobuf::Message* msg, AMFInputStream* stream) {
577 uint8_t marker;
578 if (stream->cut_u8(&marker) != 1u) {
579 LOG(ERROR) << "stream is not long enough";
580 return false;
581 }
582 if ((AMFMarker)marker == AMF_MARKER_OBJECT) {
583 if (!ReadAMFObjectBody(msg, stream)) {
584 return false;
585 }
586 } else if ((AMFMarker)marker == AMF_MARKER_ECMA_ARRAY) {
587 if (!ReadAMFEcmaArrayBody(msg, stream)) {
588 return false;
589 }
590 } else if ((AMFMarker)marker != AMF_MARKER_NULL) {
591 // Notice that NULL is treated as an object w/o any fields.
592 LOG(ERROR) << "Expected object/null, actually " << marker2str(marker);
593 return false;
594 }
595 if (!msg->IsInitialized()) {
596 LOG(ERROR) << "Missing required fields: "
597 << msg->InitializationErrorString();
598 return false;
599 }
600 return true;
601}
602
603// [Reading AMFObject]
604

Callers 10

TESTFunction · 0.85
LLVMFuzzerTestOneInputFunction · 0.85
ReadMethod · 0.85
OnDataMessageAMF0Method · 0.85
OnConnectMethod · 0.85
OnResultMethod · 0.85
OnStatusMethod · 0.85
OnCreateStreamMethod · 0.85
OnPlay2Method · 0.85
RunMethod · 0.85

Calls 6

ReadAMFObjectBodyFunction · 0.85
ReadAMFEcmaArrayBodyFunction · 0.85
marker2strFunction · 0.85
cut_u8Method · 0.80
IsInitializedMethod · 0.45

Tested by 1

TESTFunction · 0.68