Switch to a single upb_Decode.
diff --git a/cmake/google/protobuf/descriptor.upb.h b/cmake/google/protobuf/descriptor.upb.h index 6b69a2e..73438dc 100644 --- a/cmake/google/protobuf/descriptor.upb.h +++ b/cmake/google/protobuf/descriptor.upb.h
@@ -169,7 +169,7 @@ UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_parse(const char* buf, size_t size, upb_Arena* arena) { google_protobuf_FileDescriptorSet* ret = google_protobuf_FileDescriptorSet_new(arena); if (!ret) return NULL; - if (upb_decode(buf, size, ret, &google_protobuf_FileDescriptorSet_msginit, arena) != kUpb_DecodeStatus_Ok) { + if (upb_Decode(buf, size, ret, &google_protobuf_FileDescriptorSet_msginit, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { return NULL; } return ret; @@ -179,7 +179,7 @@ int options, upb_Arena* arena) { google_protobuf_FileDescriptorSet* ret = google_protobuf_FileDescriptorSet_new(arena); if (!ret) return NULL; - if (_upb_decode(buf, size, ret, &google_protobuf_FileDescriptorSet_msginit, extreg, options, arena) != + if (upb_Decode(buf, size, ret, &google_protobuf_FileDescriptorSet_msginit, extreg, options, arena) != kUpb_DecodeStatus_Ok) { return NULL; } @@ -217,7 +217,7 @@ UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { google_protobuf_FileDescriptorProto* ret = google_protobuf_FileDescriptorProto_new(arena); if (!ret) return NULL; - if (upb_decode(buf, size, ret, &google_protobuf_FileDescriptorProto_msginit, arena) != kUpb_DecodeStatus_Ok) { + if (upb_Decode(buf, size, ret, &google_protobuf_FileDescriptorProto_msginit, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { return NULL; } return ret; @@ -227,7 +227,7 @@ int options, upb_Arena* arena) { google_protobuf_FileDescriptorProto* ret = google_protobuf_FileDescriptorProto_new(arena); if (!ret) return NULL; - if (_upb_decode(buf, size, ret, &google_protobuf_FileDescriptorProto_msginit, extreg, options, arena) != + if (upb_Decode(buf, size, ret, &google_protobuf_FileDescriptorProto_msginit, extreg, options, arena) != kUpb_DecodeStatus_Ok) { return NULL; } @@ -401,7 +401,7 @@ UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { google_protobuf_DescriptorProto* ret = google_protobuf_DescriptorProto_new(arena); if (!ret) return NULL; - if (upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_msginit, arena) != kUpb_DecodeStatus_Ok) { + if (upb_Decode(buf, size, ret, &google_protobuf_DescriptorProto_msginit, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { return NULL; } return ret; @@ -411,7 +411,7 @@ int options, upb_Arena* arena) { google_protobuf_DescriptorProto* ret = google_protobuf_DescriptorProto_new(arena); if (!ret) return NULL; - if (_upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_msginit, extreg, options, arena) != + if (upb_Decode(buf, size, ret, &google_protobuf_DescriptorProto_msginit, extreg, options, arena) != kUpb_DecodeStatus_Ok) { return NULL; } @@ -575,7 +575,7 @@ UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_parse(const char* buf, size_t size, upb_Arena* arena) { google_protobuf_DescriptorProto_ExtensionRange* ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena); if (!ret) return NULL; - if (upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_ExtensionRange_msginit, arena) != kUpb_DecodeStatus_Ok) { + if (upb_Decode(buf, size, ret, &google_protobuf_DescriptorProto_ExtensionRange_msginit, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { return NULL; } return ret; @@ -585,7 +585,7 @@ int options, upb_Arena* arena) { google_protobuf_DescriptorProto_ExtensionRange* ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena); if (!ret) return NULL; - if (_upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_ExtensionRange_msginit, extreg, options, arena) != + if (upb_Decode(buf, size, ret, &google_protobuf_DescriptorProto_ExtensionRange_msginit, extreg, options, arena) != kUpb_DecodeStatus_Ok) { return NULL; } @@ -641,7 +641,7 @@ UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_parse(const char* buf, size_t size, upb_Arena* arena) { google_protobuf_DescriptorProto_ReservedRange* ret = google_protobuf_DescriptorProto_ReservedRange_new(arena); if (!ret) return NULL; - if (upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_ReservedRange_msginit, arena) != kUpb_DecodeStatus_Ok) { + if (upb_Decode(buf, size, ret, &google_protobuf_DescriptorProto_ReservedRange_msginit, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { return NULL; } return ret; @@ -651,7 +651,7 @@ int options, upb_Arena* arena) { google_protobuf_DescriptorProto_ReservedRange* ret = google_protobuf_DescriptorProto_ReservedRange_new(arena); if (!ret) return NULL; - if (_upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_ReservedRange_msginit, extreg, options, arena) != + if (upb_Decode(buf, size, ret, &google_protobuf_DescriptorProto_ReservedRange_msginit, extreg, options, arena) != kUpb_DecodeStatus_Ok) { return NULL; } @@ -690,7 +690,7 @@ UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_parse(const char* buf, size_t size, upb_Arena* arena) { google_protobuf_ExtensionRangeOptions* ret = google_protobuf_ExtensionRangeOptions_new(arena); if (!ret) return NULL; - if (upb_decode(buf, size, ret, &google_protobuf_ExtensionRangeOptions_msginit, arena) != kUpb_DecodeStatus_Ok) { + if (upb_Decode(buf, size, ret, &google_protobuf_ExtensionRangeOptions_msginit, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { return NULL; } return ret; @@ -700,7 +700,7 @@ int options, upb_Arena* arena) { google_protobuf_ExtensionRangeOptions* ret = google_protobuf_ExtensionRangeOptions_new(arena); if (!ret) return NULL; - if (_upb_decode(buf, size, ret, &google_protobuf_ExtensionRangeOptions_msginit, extreg, options, arena) != + if (upb_Decode(buf, size, ret, &google_protobuf_ExtensionRangeOptions_msginit, extreg, options, arena) != kUpb_DecodeStatus_Ok) { return NULL; } @@ -738,7 +738,7 @@ UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { google_protobuf_FieldDescriptorProto* ret = google_protobuf_FieldDescriptorProto_new(arena); if (!ret) return NULL; - if (upb_decode(buf, size, ret, &google_protobuf_FieldDescriptorProto_msginit, arena) != kUpb_DecodeStatus_Ok) { + if (upb_Decode(buf, size, ret, &google_protobuf_FieldDescriptorProto_msginit, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { return NULL; } return ret; @@ -748,7 +748,7 @@ int options, upb_Arena* arena) { google_protobuf_FieldDescriptorProto* ret = google_protobuf_FieldDescriptorProto_new(arena); if (!ret) return NULL; - if (_upb_decode(buf, size, ret, &google_protobuf_FieldDescriptorProto_msginit, extreg, options, arena) != + if (upb_Decode(buf, size, ret, &google_protobuf_FieldDescriptorProto_msginit, extreg, options, arena) != kUpb_DecodeStatus_Ok) { return NULL; } @@ -868,7 +868,7 @@ UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { google_protobuf_OneofDescriptorProto* ret = google_protobuf_OneofDescriptorProto_new(arena); if (!ret) return NULL; - if (upb_decode(buf, size, ret, &google_protobuf_OneofDescriptorProto_msginit, arena) != kUpb_DecodeStatus_Ok) { + if (upb_Decode(buf, size, ret, &google_protobuf_OneofDescriptorProto_msginit, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { return NULL; } return ret; @@ -878,7 +878,7 @@ int options, upb_Arena* arena) { google_protobuf_OneofDescriptorProto* ret = google_protobuf_OneofDescriptorProto_new(arena); if (!ret) return NULL; - if (_upb_decode(buf, size, ret, &google_protobuf_OneofDescriptorProto_msginit, extreg, options, arena) != + if (upb_Decode(buf, size, ret, &google_protobuf_OneofDescriptorProto_msginit, extreg, options, arena) != kUpb_DecodeStatus_Ok) { return NULL; } @@ -926,7 +926,7 @@ UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { google_protobuf_EnumDescriptorProto* ret = google_protobuf_EnumDescriptorProto_new(arena); if (!ret) return NULL; - if (upb_decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_msginit, arena) != kUpb_DecodeStatus_Ok) { + if (upb_Decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_msginit, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { return NULL; } return ret; @@ -936,7 +936,7 @@ int options, upb_Arena* arena) { google_protobuf_EnumDescriptorProto* ret = google_protobuf_EnumDescriptorProto_new(arena); if (!ret) return NULL; - if (_upb_decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_msginit, extreg, options, arena) != + if (upb_Decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_msginit, extreg, options, arena) != kUpb_DecodeStatus_Ok) { return NULL; } @@ -1025,7 +1025,7 @@ UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_parse(const char* buf, size_t size, upb_Arena* arena) { google_protobuf_EnumDescriptorProto_EnumReservedRange* ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena); if (!ret) return NULL; - if (upb_decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena) != kUpb_DecodeStatus_Ok) { + if (upb_Decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { return NULL; } return ret; @@ -1035,7 +1035,7 @@ int options, upb_Arena* arena) { google_protobuf_EnumDescriptorProto_EnumReservedRange* ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena); if (!ret) return NULL; - if (_upb_decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, extreg, options, arena) != + if (upb_Decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, extreg, options, arena) != kUpb_DecodeStatus_Ok) { return NULL; } @@ -1074,7 +1074,7 @@ UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { google_protobuf_EnumValueDescriptorProto* ret = google_protobuf_EnumValueDescriptorProto_new(arena); if (!ret) return NULL; - if (upb_decode(buf, size, ret, &google_protobuf_EnumValueDescriptorProto_msginit, arena) != kUpb_DecodeStatus_Ok) { + if (upb_Decode(buf, size, ret, &google_protobuf_EnumValueDescriptorProto_msginit, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { return NULL; } return ret; @@ -1084,7 +1084,7 @@ int options, upb_Arena* arena) { google_protobuf_EnumValueDescriptorProto* ret = google_protobuf_EnumValueDescriptorProto_new(arena); if (!ret) return NULL; - if (_upb_decode(buf, size, ret, &google_protobuf_EnumValueDescriptorProto_msginit, extreg, options, arena) != + if (upb_Decode(buf, size, ret, &google_protobuf_EnumValueDescriptorProto_msginit, extreg, options, arena) != kUpb_DecodeStatus_Ok) { return NULL; } @@ -1140,7 +1140,7 @@ UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { google_protobuf_ServiceDescriptorProto* ret = google_protobuf_ServiceDescriptorProto_new(arena); if (!ret) return NULL; - if (upb_decode(buf, size, ret, &google_protobuf_ServiceDescriptorProto_msginit, arena) != kUpb_DecodeStatus_Ok) { + if (upb_Decode(buf, size, ret, &google_protobuf_ServiceDescriptorProto_msginit, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { return NULL; } return ret; @@ -1150,7 +1150,7 @@ int options, upb_Arena* arena) { google_protobuf_ServiceDescriptorProto* ret = google_protobuf_ServiceDescriptorProto_new(arena); if (!ret) return NULL; - if (_upb_decode(buf, size, ret, &google_protobuf_ServiceDescriptorProto_msginit, extreg, options, arena) != + if (upb_Decode(buf, size, ret, &google_protobuf_ServiceDescriptorProto_msginit, extreg, options, arena) != kUpb_DecodeStatus_Ok) { return NULL; } @@ -1213,7 +1213,7 @@ UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { google_protobuf_MethodDescriptorProto* ret = google_protobuf_MethodDescriptorProto_new(arena); if (!ret) return NULL; - if (upb_decode(buf, size, ret, &google_protobuf_MethodDescriptorProto_msginit, arena) != kUpb_DecodeStatus_Ok) { + if (upb_Decode(buf, size, ret, &google_protobuf_MethodDescriptorProto_msginit, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { return NULL; } return ret; @@ -1223,7 +1223,7 @@ int options, upb_Arena* arena) { google_protobuf_MethodDescriptorProto* ret = google_protobuf_MethodDescriptorProto_new(arena); if (!ret) return NULL; - if (_upb_decode(buf, size, ret, &google_protobuf_MethodDescriptorProto_msginit, extreg, options, arena) != + if (upb_Decode(buf, size, ret, &google_protobuf_MethodDescriptorProto_msginit, extreg, options, arena) != kUpb_DecodeStatus_Ok) { return NULL; } @@ -1303,7 +1303,7 @@ UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_parse(const char* buf, size_t size, upb_Arena* arena) { google_protobuf_FileOptions* ret = google_protobuf_FileOptions_new(arena); if (!ret) return NULL; - if (upb_decode(buf, size, ret, &google_protobuf_FileOptions_msginit, arena) != kUpb_DecodeStatus_Ok) { + if (upb_Decode(buf, size, ret, &google_protobuf_FileOptions_msginit, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { return NULL; } return ret; @@ -1313,7 +1313,7 @@ int options, upb_Arena* arena) { google_protobuf_FileOptions* ret = google_protobuf_FileOptions_new(arena); if (!ret) return NULL; - if (_upb_decode(buf, size, ret, &google_protobuf_FileOptions_msginit, extreg, options, arena) != + if (upb_Decode(buf, size, ret, &google_protobuf_FileOptions_msginit, extreg, options, arena) != kUpb_DecodeStatus_Ok) { return NULL; } @@ -1511,7 +1511,7 @@ UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_parse(const char* buf, size_t size, upb_Arena* arena) { google_protobuf_MessageOptions* ret = google_protobuf_MessageOptions_new(arena); if (!ret) return NULL; - if (upb_decode(buf, size, ret, &google_protobuf_MessageOptions_msginit, arena) != kUpb_DecodeStatus_Ok) { + if (upb_Decode(buf, size, ret, &google_protobuf_MessageOptions_msginit, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { return NULL; } return ret; @@ -1521,7 +1521,7 @@ int options, upb_Arena* arena) { google_protobuf_MessageOptions* ret = google_protobuf_MessageOptions_new(arena); if (!ret) return NULL; - if (_upb_decode(buf, size, ret, &google_protobuf_MessageOptions_msginit, extreg, options, arena) != + if (upb_Decode(buf, size, ret, &google_protobuf_MessageOptions_msginit, extreg, options, arena) != kUpb_DecodeStatus_Ok) { return NULL; } @@ -1591,7 +1591,7 @@ UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_parse(const char* buf, size_t size, upb_Arena* arena) { google_protobuf_FieldOptions* ret = google_protobuf_FieldOptions_new(arena); if (!ret) return NULL; - if (upb_decode(buf, size, ret, &google_protobuf_FieldOptions_msginit, arena) != kUpb_DecodeStatus_Ok) { + if (upb_Decode(buf, size, ret, &google_protobuf_FieldOptions_msginit, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { return NULL; } return ret; @@ -1601,7 +1601,7 @@ int options, upb_Arena* arena) { google_protobuf_FieldOptions* ret = google_protobuf_FieldOptions_new(arena); if (!ret) return NULL; - if (_upb_decode(buf, size, ret, &google_protobuf_FieldOptions_msginit, extreg, options, arena) != + if (upb_Decode(buf, size, ret, &google_protobuf_FieldOptions_msginit, extreg, options, arena) != kUpb_DecodeStatus_Ok) { return NULL; } @@ -1687,7 +1687,7 @@ UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_parse(const char* buf, size_t size, upb_Arena* arena) { google_protobuf_OneofOptions* ret = google_protobuf_OneofOptions_new(arena); if (!ret) return NULL; - if (upb_decode(buf, size, ret, &google_protobuf_OneofOptions_msginit, arena) != kUpb_DecodeStatus_Ok) { + if (upb_Decode(buf, size, ret, &google_protobuf_OneofOptions_msginit, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { return NULL; } return ret; @@ -1697,7 +1697,7 @@ int options, upb_Arena* arena) { google_protobuf_OneofOptions* ret = google_protobuf_OneofOptions_new(arena); if (!ret) return NULL; - if (_upb_decode(buf, size, ret, &google_protobuf_OneofOptions_msginit, extreg, options, arena) != + if (upb_Decode(buf, size, ret, &google_protobuf_OneofOptions_msginit, extreg, options, arena) != kUpb_DecodeStatus_Ok) { return NULL; } @@ -1735,7 +1735,7 @@ UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_parse(const char* buf, size_t size, upb_Arena* arena) { google_protobuf_EnumOptions* ret = google_protobuf_EnumOptions_new(arena); if (!ret) return NULL; - if (upb_decode(buf, size, ret, &google_protobuf_EnumOptions_msginit, arena) != kUpb_DecodeStatus_Ok) { + if (upb_Decode(buf, size, ret, &google_protobuf_EnumOptions_msginit, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { return NULL; } return ret; @@ -1745,7 +1745,7 @@ int options, upb_Arena* arena) { google_protobuf_EnumOptions* ret = google_protobuf_EnumOptions_new(arena); if (!ret) return NULL; - if (_upb_decode(buf, size, ret, &google_protobuf_EnumOptions_msginit, extreg, options, arena) != + if (upb_Decode(buf, size, ret, &google_protobuf_EnumOptions_msginit, extreg, options, arena) != kUpb_DecodeStatus_Ok) { return NULL; } @@ -1799,7 +1799,7 @@ UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_parse(const char* buf, size_t size, upb_Arena* arena) { google_protobuf_EnumValueOptions* ret = google_protobuf_EnumValueOptions_new(arena); if (!ret) return NULL; - if (upb_decode(buf, size, ret, &google_protobuf_EnumValueOptions_msginit, arena) != kUpb_DecodeStatus_Ok) { + if (upb_Decode(buf, size, ret, &google_protobuf_EnumValueOptions_msginit, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { return NULL; } return ret; @@ -1809,7 +1809,7 @@ int options, upb_Arena* arena) { google_protobuf_EnumValueOptions* ret = google_protobuf_EnumValueOptions_new(arena); if (!ret) return NULL; - if (_upb_decode(buf, size, ret, &google_protobuf_EnumValueOptions_msginit, extreg, options, arena) != + if (upb_Decode(buf, size, ret, &google_protobuf_EnumValueOptions_msginit, extreg, options, arena) != kUpb_DecodeStatus_Ok) { return NULL; } @@ -1855,7 +1855,7 @@ UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_parse(const char* buf, size_t size, upb_Arena* arena) { google_protobuf_ServiceOptions* ret = google_protobuf_ServiceOptions_new(arena); if (!ret) return NULL; - if (upb_decode(buf, size, ret, &google_protobuf_ServiceOptions_msginit, arena) != kUpb_DecodeStatus_Ok) { + if (upb_Decode(buf, size, ret, &google_protobuf_ServiceOptions_msginit, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { return NULL; } return ret; @@ -1865,7 +1865,7 @@ int options, upb_Arena* arena) { google_protobuf_ServiceOptions* ret = google_protobuf_ServiceOptions_new(arena); if (!ret) return NULL; - if (_upb_decode(buf, size, ret, &google_protobuf_ServiceOptions_msginit, extreg, options, arena) != + if (upb_Decode(buf, size, ret, &google_protobuf_ServiceOptions_msginit, extreg, options, arena) != kUpb_DecodeStatus_Ok) { return NULL; } @@ -1911,7 +1911,7 @@ UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_parse(const char* buf, size_t size, upb_Arena* arena) { google_protobuf_MethodOptions* ret = google_protobuf_MethodOptions_new(arena); if (!ret) return NULL; - if (upb_decode(buf, size, ret, &google_protobuf_MethodOptions_msginit, arena) != kUpb_DecodeStatus_Ok) { + if (upb_Decode(buf, size, ret, &google_protobuf_MethodOptions_msginit, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { return NULL; } return ret; @@ -1921,7 +1921,7 @@ int options, upb_Arena* arena) { google_protobuf_MethodOptions* ret = google_protobuf_MethodOptions_new(arena); if (!ret) return NULL; - if (_upb_decode(buf, size, ret, &google_protobuf_MethodOptions_msginit, extreg, options, arena) != + if (upb_Decode(buf, size, ret, &google_protobuf_MethodOptions_msginit, extreg, options, arena) != kUpb_DecodeStatus_Ok) { return NULL; } @@ -1975,7 +1975,7 @@ UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_parse(const char* buf, size_t size, upb_Arena* arena) { google_protobuf_UninterpretedOption* ret = google_protobuf_UninterpretedOption_new(arena); if (!ret) return NULL; - if (upb_decode(buf, size, ret, &google_protobuf_UninterpretedOption_msginit, arena) != kUpb_DecodeStatus_Ok) { + if (upb_Decode(buf, size, ret, &google_protobuf_UninterpretedOption_msginit, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { return NULL; } return ret; @@ -1985,7 +1985,7 @@ int options, upb_Arena* arena) { google_protobuf_UninterpretedOption* ret = google_protobuf_UninterpretedOption_new(arena); if (!ret) return NULL; - if (_upb_decode(buf, size, ret, &google_protobuf_UninterpretedOption_msginit, extreg, options, arena) != + if (upb_Decode(buf, size, ret, &google_protobuf_UninterpretedOption_msginit, extreg, options, arena) != kUpb_DecodeStatus_Ok) { return NULL; } @@ -2071,7 +2071,7 @@ UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_parse(const char* buf, size_t size, upb_Arena* arena) { google_protobuf_UninterpretedOption_NamePart* ret = google_protobuf_UninterpretedOption_NamePart_new(arena); if (!ret) return NULL; - if (upb_decode(buf, size, ret, &google_protobuf_UninterpretedOption_NamePart_msginit, arena) != kUpb_DecodeStatus_Ok) { + if (upb_Decode(buf, size, ret, &google_protobuf_UninterpretedOption_NamePart_msginit, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { return NULL; } return ret; @@ -2081,7 +2081,7 @@ int options, upb_Arena* arena) { google_protobuf_UninterpretedOption_NamePart* ret = google_protobuf_UninterpretedOption_NamePart_new(arena); if (!ret) return NULL; - if (_upb_decode(buf, size, ret, &google_protobuf_UninterpretedOption_NamePart_msginit, extreg, options, arena) != + if (upb_Decode(buf, size, ret, &google_protobuf_UninterpretedOption_NamePart_msginit, extreg, options, arena) != kUpb_DecodeStatus_Ok) { return NULL; } @@ -2120,7 +2120,7 @@ UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_parse(const char* buf, size_t size, upb_Arena* arena) { google_protobuf_SourceCodeInfo* ret = google_protobuf_SourceCodeInfo_new(arena); if (!ret) return NULL; - if (upb_decode(buf, size, ret, &google_protobuf_SourceCodeInfo_msginit, arena) != kUpb_DecodeStatus_Ok) { + if (upb_Decode(buf, size, ret, &google_protobuf_SourceCodeInfo_msginit, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { return NULL; } return ret; @@ -2130,7 +2130,7 @@ int options, upb_Arena* arena) { google_protobuf_SourceCodeInfo* ret = google_protobuf_SourceCodeInfo_new(arena); if (!ret) return NULL; - if (_upb_decode(buf, size, ret, &google_protobuf_SourceCodeInfo_msginit, extreg, options, arena) != + if (upb_Decode(buf, size, ret, &google_protobuf_SourceCodeInfo_msginit, extreg, options, arena) != kUpb_DecodeStatus_Ok) { return NULL; } @@ -2168,7 +2168,7 @@ UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_parse(const char* buf, size_t size, upb_Arena* arena) { google_protobuf_SourceCodeInfo_Location* ret = google_protobuf_SourceCodeInfo_Location_new(arena); if (!ret) return NULL; - if (upb_decode(buf, size, ret, &google_protobuf_SourceCodeInfo_Location_msginit, arena) != kUpb_DecodeStatus_Ok) { + if (upb_Decode(buf, size, ret, &google_protobuf_SourceCodeInfo_Location_msginit, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { return NULL; } return ret; @@ -2178,7 +2178,7 @@ int options, upb_Arena* arena) { google_protobuf_SourceCodeInfo_Location* ret = google_protobuf_SourceCodeInfo_Location_new(arena); if (!ret) return NULL; - if (_upb_decode(buf, size, ret, &google_protobuf_SourceCodeInfo_Location_msginit, extreg, options, arena) != + if (upb_Decode(buf, size, ret, &google_protobuf_SourceCodeInfo_Location_msginit, extreg, options, arena) != kUpb_DecodeStatus_Ok) { return NULL; } @@ -2250,7 +2250,7 @@ UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_parse(const char* buf, size_t size, upb_Arena* arena) { google_protobuf_GeneratedCodeInfo* ret = google_protobuf_GeneratedCodeInfo_new(arena); if (!ret) return NULL; - if (upb_decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_msginit, arena) != kUpb_DecodeStatus_Ok) { + if (upb_Decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_msginit, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { return NULL; } return ret; @@ -2260,7 +2260,7 @@ int options, upb_Arena* arena) { google_protobuf_GeneratedCodeInfo* ret = google_protobuf_GeneratedCodeInfo_new(arena); if (!ret) return NULL; - if (_upb_decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_msginit, extreg, options, arena) != + if (upb_Decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_msginit, extreg, options, arena) != kUpb_DecodeStatus_Ok) { return NULL; } @@ -2298,7 +2298,7 @@ UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_parse(const char* buf, size_t size, upb_Arena* arena) { google_protobuf_GeneratedCodeInfo_Annotation* ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena); if (!ret) return NULL; - if (upb_decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_Annotation_msginit, arena) != kUpb_DecodeStatus_Ok) { + if (upb_Decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_Annotation_msginit, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { return NULL; } return ret; @@ -2308,7 +2308,7 @@ int options, upb_Arena* arena) { google_protobuf_GeneratedCodeInfo_Annotation* ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena); if (!ret) return NULL; - if (_upb_decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_Annotation_msginit, extreg, options, arena) != + if (upb_Decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_Annotation_msginit, extreg, options, arena) != kUpb_DecodeStatus_Ok) { return NULL; }
diff --git a/python/descriptor.c b/python/descriptor.c index 7a15326..f60188b 100644 --- a/python/descriptor.c +++ b/python/descriptor.c
@@ -126,9 +126,9 @@ char* pb = upb_Encode(opts, layout, arena, &size); upb_Message* opts2 = upb_Message_New(m, arena); assert(opts2); - bool ok = _upb_decode(pb, size, opts2, upb_MessageDef_MiniTable(m), - upb_DefPool_ExtensionRegistry(symtab), 0, - arena) == kUpb_DecodeStatus_Ok; + bool ok = upb_Decode(pb, size, opts2, upb_MessageDef_MiniTable(m), + upb_DefPool_ExtensionRegistry(symtab), 0, + arena) == kUpb_DecodeStatus_Ok; (void)ok; assert(ok);
diff --git a/python/message.c b/python/message.c index 37d0aec..4821ade 100644 --- a/python/message.c +++ b/python/message.c
@@ -1153,7 +1153,7 @@ int options = UPB_DECODE_MAXDEPTH(state->allow_oversize_protos ? UINT32_MAX : 100); upb_DecodeStatus status = - _upb_decode(buf, size, self->ptr.msg, layout, extreg, options, arena); + upb_Decode(buf, size, self->ptr.msg, layout, extreg, options, arena); Py_XDECREF(bytes); if (status != kUpb_DecodeStatus_Ok) { PyErr_Format(state->decode_error_class, "Error parsing message");
diff --git a/rename.sed b/rename.sed index ebf6afa..c695397 100644 --- a/rename.sed +++ b/rename.sed
@@ -442,3 +442,4 @@ s/\bupb_extreg\b/upb_ExtensionRegistry/g; s/upb_extreg_new/upb_ExtensionRegistry_New/g; s/upb_msg\b/upb_Message/g; +s/_upb_decode\b/upb_Decode/g;
diff --git a/run_sed.sh b/run_sed.sh index a8ee7fa..8d57b74 100644 --- a/run_sed.sh +++ b/run_sed.sh
@@ -1,3 +1,8 @@ shopt -s globstar sed -i -f rename.sed **/*.c **/*.cc **/*.h **/*.hpp **/*.py + +# Since sed can't handle multi-line patterns: +perl -i -pe 'BEGIN{undef $/;} s/\bupb_decode\(([^,\)]+),([^,]+),([^,]+),([^,]+),([^,\)]+)\)/upb_Decode(\1, \2, \3, \4, NULL, 0, \5)/smg' **/*.c **/*.cc **/*.h **/*.hpp +perl -i -pe 'BEGIN{undef $/;} s/\bupb_Encode\(([^,\)]+),([^,]+),([^,]+),([^,\)]+)\)/upb_Encode(\1, \2, 0, \3, \4)/smg' **/*.c **/*.cc **/*.h **/*.hpp + clang-format -i **/*.c **/*.cc **/*.h **/*.hpp
diff --git a/tests/conformance_upb.c b/tests/conformance_upb.c index 39b85bf..c985229 100644 --- a/tests/conformance_upb.c +++ b/tests/conformance_upb.c
@@ -88,8 +88,8 @@ bool parse_proto(upb_Message* msg, const upb_MessageDef* m, const ctx* c) { upb_StringView proto = conformance_ConformanceRequest_protobuf_payload(c->request); - if (upb_decode(proto.data, proto.size, msg, upb_MessageDef_MiniTable(m), - c->arena) == kUpb_DecodeStatus_Ok) { + if (upb_Decode(proto.data, proto.size, msg, upb_MessageDef_MiniTable(m), NULL, + 0, c->arena) == kUpb_DecodeStatus_Ok) { return true; } else { static const char msg[] = "Parse error";
diff --git a/upb/bindings/lua/msg.c b/upb/bindings/lua/msg.c index 9770362..edfc842 100644 --- a/upb/bindings/lua/msg.c +++ b/upb/bindings/lua/msg.c
@@ -962,8 +962,8 @@ buf = upb_Arena_Malloc(arena, len); memcpy(buf, pb, len); - upb_DecodeStatus status = _upb_decode(buf, len, msg, layout, NULL, - kUpb_DecodeOption_AliasString, arena); + upb_DecodeStatus status = upb_Decode(buf, len, msg, layout, NULL, + kUpb_DecodeOption_AliasString, arena); if (status != kUpb_DecodeStatus_Ok) { lua_pushstring(L, "Error decoding protobuf.");
diff --git a/upb/decode.c b/upb/decode.c index d4fa664..ed84d43 100644 --- a/upb/decode.c +++ b/upb/decode.c
@@ -1057,10 +1057,10 @@ return kUpb_DecodeStatus_Ok; } -upb_DecodeStatus _upb_decode(const char* buf, size_t size, void* msg, - const upb_MiniTable* l, - const upb_ExtensionRegistry* extreg, int options, - upb_Arena* arena) { +upb_DecodeStatus upb_Decode(const char* buf, size_t size, void* msg, + const upb_MiniTable* l, + const upb_ExtensionRegistry* extreg, int options, + upb_Arena* arena) { upb_Decoder state; unsigned depth = (unsigned)options >> 16;
diff --git a/upb/decode.h b/upb/decode.h index 965e44a..1fa8131 100644 --- a/upb/decode.h +++ b/upb/decode.h
@@ -80,16 +80,10 @@ kUpb_DecodeStatus_MissingRequired = 5, } upb_DecodeStatus; -upb_DecodeStatus _upb_decode(const char* buf, size_t size, upb_Message* msg, - const upb_MiniTable* l, - const upb_ExtensionRegistry* extreg, int options, - upb_Arena* arena); - -UPB_INLINE -upb_DecodeStatus upb_decode(const char* buf, size_t size, upb_Message* msg, - const upb_MiniTable* l, upb_Arena* arena) { - return _upb_decode(buf, size, msg, l, NULL, 0, arena); -} +upb_DecodeStatus upb_Decode(const char* buf, size_t size, upb_Message* msg, + const upb_MiniTable* l, + const upb_ExtensionRegistry* extreg, int options, + upb_Arena* arena); #ifdef __cplusplus } /* extern "C" */
diff --git a/upb/json_encode.c b/upb/json_encode.c index 048b855..a63b3c6 100644 --- a/upb/json_encode.c +++ b/upb/json_encode.c
@@ -383,7 +383,7 @@ upb_Arena* arena = jsonenc_arena(e); upb_Message* any = upb_Message_New(any_m, arena); - if (upb_decode(value.data, value.size, any, any_layout, arena) != + if (upb_Decode(value.data, value.size, any, any_layout, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { jsonenc_err(e, "Error decoding message in Any"); }
diff --git a/upb/msg_test.cc b/upb/msg_test.cc index 042a4d2..cd6fdf6 100644 --- a/upb/msg_test.cc +++ b/upb/msg_test.cc
@@ -246,8 +246,8 @@ // Fails, because required fields are missing. EXPECT_EQ(kUpb_DecodeStatus_MissingRequired, - _upb_decode(NULL, 0, test_msg, &upb_test_TestRequiredFields_msginit, - NULL, kUpb_DecodeOption_CheckRequired, arena.ptr())); + upb_Decode(NULL, 0, test_msg, &upb_test_TestRequiredFields_msginit, + NULL, kUpb_DecodeOption_CheckRequired, arena.ptr())); upb_test_TestRequiredFields_set_required_int32(test_msg, 1); size_t size; @@ -259,9 +259,9 @@ // Fails, but the code path is slightly different because the serialized // payload is not empty. EXPECT_EQ(kUpb_DecodeStatus_MissingRequired, - _upb_decode(serialized, size, test_msg, - &upb_test_TestRequiredFields_msginit, NULL, - kUpb_DecodeOption_CheckRequired, arena.ptr())); + upb_Decode(serialized, size, test_msg, + &upb_test_TestRequiredFields_msginit, NULL, + kUpb_DecodeOption_CheckRequired, arena.ptr())); empty_msg = upb_test_EmptyMessage_new(arena.ptr()); upb_test_TestRequiredFields_set_required_int32(test_msg, 1); @@ -270,8 +270,8 @@ // Succeeds, because required fields are present (though not in the input). EXPECT_EQ(kUpb_DecodeStatus_Ok, - _upb_decode(NULL, 0, test_msg, &upb_test_TestRequiredFields_msginit, - NULL, kUpb_DecodeOption_CheckRequired, arena.ptr())); + upb_Decode(NULL, 0, test_msg, &upb_test_TestRequiredFields_msginit, + NULL, kUpb_DecodeOption_CheckRequired, arena.ptr())); // Serialize a complete payload. serialized = @@ -288,9 +288,9 @@ upb_test_TestRequiredFields_set_optional_message( test_msg2, upb_test_TestRequiredFields_new(arena.ptr())); EXPECT_EQ(kUpb_DecodeStatus_Ok, - _upb_decode(serialized, size, test_msg2, - &upb_test_TestRequiredFields_msginit, NULL, - kUpb_DecodeOption_CheckRequired, arena.ptr())); + upb_Decode(serialized, size, test_msg2, + &upb_test_TestRequiredFields_msginit, NULL, + kUpb_DecodeOption_CheckRequired, arena.ptr())); } TEST(MessageTest, DecodeRequiredFieldsSubMessage) {
diff --git a/upbc/protoc-gen-upb.cc b/upbc/protoc-gen-upb.cc index b9a7318..f27aab9 100644 --- a/upbc/protoc-gen-upb.cc +++ b/upbc/protoc-gen-upb.cc
@@ -418,7 +418,7 @@ UPB_INLINE $0* $0_parse(const char* buf, size_t size, upb_Arena* arena) { $0* ret = $0_new(arena); if (!ret) return NULL; - if (upb_decode(buf, size, ret, &$1, arena) != kUpb_DecodeStatus_Ok) { + if (upb_Decode(buf, size, ret, &$1, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { return NULL; } return ret; @@ -428,7 +428,7 @@ int options, upb_Arena* arena) { $0* ret = $0_new(arena); if (!ret) return NULL; - if (_upb_decode(buf, size, ret, &$1, extreg, options, arena) != + if (upb_Decode(buf, size, ret, &$1, extreg, options, arena) != kUpb_DecodeStatus_Ok) { return NULL; }