Add transitive dependencies in appropriate order for the dynamic descriptor pool. Return false if the dependencies could not be added to the pool.
| 471 | // pool. |
| 472 | // Return false if the dependencies could not be added to the pool. |
| 473 | bool AddDepsToPool(const google::protobuf::FileDescriptor* descriptor, |
| 474 | google::protobuf::DescriptorPool& pool) { |
| 475 | for (int i = 0; i < descriptor->dependency_count(); i++) { |
| 476 | if (!AddDepsToPool(descriptor->dependency(i), pool)) { |
| 477 | return false; |
| 478 | } |
| 479 | } |
| 480 | google::protobuf::FileDescriptorProto descriptor_proto; |
| 481 | descriptor->CopyTo(&descriptor_proto); |
| 482 | return pool.BuildFile(descriptor_proto) != nullptr; |
| 483 | } |
| 484 | |
| 485 | // Equivalent descriptors managed by separate descriptor pools are not equal, so |
| 486 | // the underlying messages are not considered equal. |