Add transitive dependencies in appropriate order for the dynamic descriptor pool. Return false if the dependencies could not be added to the pool.
| 452 | // pool. |
| 453 | // Return false if the dependencies could not be added to the pool. |
| 454 | bool AddDepsToPool(const google::protobuf::FileDescriptor* descriptor, |
| 455 | google::protobuf::DescriptorPool& pool) { |
| 456 | for (int i = 0; i < descriptor->dependency_count(); i++) { |
| 457 | if (!AddDepsToPool(descriptor->dependency(i), pool)) { |
| 458 | return false; |
| 459 | } |
| 460 | } |
| 461 | google::protobuf::FileDescriptorProto descriptor_proto; |
| 462 | descriptor->CopyTo(&descriptor_proto); |
| 463 | return pool.BuildFile(descriptor_proto) != nullptr; |
| 464 | } |
| 465 | |
| 466 | // Equivalent descriptors managed by separate descriptor pools are not equal, so |
| 467 | // the underlying messages are not considered equal. |