MCPcopy Create free account
hub / github.com/bytedance/Fastbot_Android / VerifyUnion

Function VerifyUnion

native/thirdpart/flatbuffers/reflection.cpp:526–549  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

524 const flatbuffers::Table *table, bool required);
525
526bool VerifyUnion(flatbuffers::Verifier &v, const reflection::Schema &schema,
527 uint8_t utype, const uint8_t *elem,
528 const reflection::Field &union_field) {
529 if (!utype) return true; // Not present.
530 auto fb_enum = schema.enums()->Get(union_field.type()->index());
531 if (utype >= fb_enum->values()->size()) return false;
532 auto elem_type = fb_enum->values()->Get(utype)->union_type();
533 switch (elem_type->base_type()) {
534 case reflection::Obj: {
535 auto elem_obj = schema.objects()->Get(elem_type->index());
536 if (elem_obj->is_struct()) {
537 return v.VerifyFromPointer(elem, elem_obj->bytesize());
538 } else {
539 return VerifyObject(v, schema, *elem_obj,
540 reinterpret_cast<const flatbuffers::Table *>(elem),
541 true);
542 }
543 }
544 case reflection::String:
545 return v.VerifyString(
546 reinterpret_cast<const flatbuffers::String *>(elem));
547 default: return false;
548 }
549}
550
551bool VerifyVector(flatbuffers::Verifier &v, const reflection::Schema &schema,
552 const flatbuffers::Table &table,

Callers 2

VerifyVectorFunction · 0.85
VerifyObjectFunction · 0.85

Calls 3

VerifyObjectFunction · 0.85
GetMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected