google-protobuf 4.27.2 → 4.28.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of google-protobuf might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/ext/google/protobuf_c/convert.c +39 -14
- data/ext/google/protobuf_c/defs.c +1 -1
- data/ext/google/protobuf_c/map.c +72 -20
- data/ext/google/protobuf_c/map.h +6 -2
- data/ext/google/protobuf_c/message.c +74 -35
- data/ext/google/protobuf_c/message.h +1 -1
- data/ext/google/protobuf_c/protobuf.c +11 -9
- data/ext/google/protobuf_c/protobuf.h +3 -7
- data/ext/google/protobuf_c/repeated_field.c +61 -17
- data/ext/google/protobuf_c/repeated_field.h +5 -1
- data/ext/google/protobuf_c/ruby-upb.c +570 -275
- data/ext/google/protobuf_c/ruby-upb.h +1341 -584
- data/lib/google/protobuf/descriptor_pb.rb +1 -1
- data/lib/google/protobuf/ffi/descriptor.rb +1 -2
- data/lib/google/protobuf/ffi/internal/arena.rb +0 -6
- data/lib/google/protobuf/ffi/internal/convert.rb +13 -6
- data/lib/google/protobuf/ffi/map.rb +45 -21
- data/lib/google/protobuf/ffi/message.rb +182 -60
- data/lib/google/protobuf/ffi/repeated_field.rb +42 -16
- metadata +3 -3
@@ -341,10 +341,81 @@ void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
|
|
341
341
|
#define UPB_DESC_MINITABLE(sym) &google__protobuf__##sym##_msg_init
|
342
342
|
#endif
|
343
343
|
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
344
|
+
|
345
|
+
// Linker arrays combine elements from multiple translation units into a single
|
346
|
+
// array that can be iterated over at runtime.
|
347
|
+
//
|
348
|
+
// It is an alternative to pre-main "registration" functions.
|
349
|
+
//
|
350
|
+
// Usage:
|
351
|
+
//
|
352
|
+
// // In N translation units.
|
353
|
+
// UPB_LINKARR_APPEND(foo_array) static int elems[3] = {1, 2, 3};
|
354
|
+
//
|
355
|
+
// // At runtime:
|
356
|
+
// UPB_LINKARR_DECLARE(foo_array, int);
|
357
|
+
//
|
358
|
+
// void f() {
|
359
|
+
// const int* start = UPB_LINKARR_START(foo_array);
|
360
|
+
// const int* stop = UPB_LINKARR_STOP(foo_array);
|
361
|
+
// for (const int* p = start; p < stop; p++) {
|
362
|
+
// // Windows can introduce zero padding, so we have to skip zeroes.
|
363
|
+
// if (*p != 0) {
|
364
|
+
// vec.push_back(*p);
|
365
|
+
// }
|
366
|
+
// }
|
367
|
+
// }
|
368
|
+
|
369
|
+
#if defined(__ELF__) || defined(__wasm__)
|
370
|
+
|
371
|
+
#define UPB_LINKARR_APPEND(name) \
|
372
|
+
__attribute__((retain, used, section("linkarr_" #name)))
|
373
|
+
#define UPB_LINKARR_DECLARE(name, type) \
|
374
|
+
extern type const __start_linkarr_##name; \
|
375
|
+
extern type const __stop_linkarr_##name; \
|
376
|
+
UPB_LINKARR_APPEND(name) type UPB_linkarr_internal_empty_##name[1]
|
377
|
+
#define UPB_LINKARR_START(name) (&__start_linkarr_##name)
|
378
|
+
#define UPB_LINKARR_STOP(name) (&__stop_linkarr_##name)
|
379
|
+
|
380
|
+
#elif defined(__MACH__)
|
381
|
+
|
382
|
+
/* As described in: https://stackoverflow.com/a/22366882 */
|
383
|
+
#define UPB_LINKARR_APPEND(name) \
|
384
|
+
__attribute__((retain, used, section("__DATA,__la_" #name)))
|
385
|
+
#define UPB_LINKARR_DECLARE(name, type) \
|
386
|
+
extern type const __start_linkarr_##name __asm( \
|
387
|
+
"section$start$__DATA$__la_" #name); \
|
388
|
+
extern type const __stop_linkarr_##name __asm( \
|
389
|
+
"section$end$__DATA$" \
|
390
|
+
"__la_" #name); \
|
391
|
+
UPB_LINKARR_APPEND(name) type UPB_linkarr_internal_empty_##name[1]
|
392
|
+
#define UPB_LINKARR_START(name) (&__start_linkarr_##name)
|
393
|
+
#define UPB_LINKARR_STOP(name) (&__stop_linkarr_##name)
|
394
|
+
|
395
|
+
#elif defined(_MSC_VER) && defined(__clang__)
|
396
|
+
|
397
|
+
/* See:
|
398
|
+
* https://devblogs.microsoft.com/oldnewthing/20181107-00/?p=100155
|
399
|
+
* https://devblogs.microsoft.com/oldnewthing/20181108-00/?p=100165
|
400
|
+
* https://devblogs.microsoft.com/oldnewthing/20181109-00/?p=100175 */
|
401
|
+
|
402
|
+
// Usage of __attribute__ here probably means this is Clang-specific, and would
|
403
|
+
// not work on MSVC.
|
404
|
+
#define UPB_LINKARR_APPEND(name) \
|
405
|
+
__declspec(allocate("la_" #name "$j")) __attribute__((retain, used))
|
406
|
+
#define UPB_LINKARR_DECLARE(name, type) \
|
407
|
+
__declspec(allocate("la_" #name "$a")) type __start_linkarr_##name; \
|
408
|
+
__declspec(allocate("la_" #name "$z")) type __stop_linkarr_##name; \
|
409
|
+
UPB_LINKARR_APPEND(name) type UPB_linkarr_internal_empty_##name[1] = {0}
|
410
|
+
#define UPB_LINKARR_START(name) (&__start_linkarr_##name)
|
411
|
+
#define UPB_LINKARR_STOP(name) (&__stop_linkarr_##name)
|
412
|
+
|
413
|
+
#else
|
414
|
+
|
415
|
+
// Linker arrays are not supported on this platform. Make appends a no-op but
|
416
|
+
// don't define the other macros.
|
417
|
+
#define UPB_LINKARR_APPEND(name)
|
418
|
+
|
348
419
|
#endif
|
349
420
|
|
350
421
|
|
@@ -404,14 +475,16 @@ void upb_Status_VAppendErrorFormat(upb_Status* status, const char* fmt,
|
|
404
475
|
* google/protobuf/descriptor.proto
|
405
476
|
*
|
406
477
|
* Do not edit -- your changes will be discarded when the file is
|
407
|
-
* regenerated.
|
478
|
+
* regenerated.
|
479
|
+
* NO CHECKED-IN PROTOBUF GENCODE */
|
408
480
|
|
409
481
|
#include <stddef.h>
|
410
482
|
|
411
483
|
// Must be last.
|
412
484
|
|
413
|
-
|
414
|
-
|
485
|
+
extern const struct upb_MiniTable UPB_PRIVATE(_kUpb_MiniTable_StaticallyTreeShaken);
|
486
|
+
static const upb_MiniTableSubInternal google_protobuf_FileDescriptorSet_submsgs[1] = {
|
487
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__FileDescriptorProto_msg_init_ptr},
|
415
488
|
};
|
416
489
|
|
417
490
|
static const upb_MiniTableField google_protobuf_FileDescriptorSet__fields[1] = {
|
@@ -431,13 +504,14 @@ const upb_MiniTable google__protobuf__FileDescriptorSet_msg_init = {
|
|
431
504
|
})
|
432
505
|
};
|
433
506
|
|
434
|
-
|
435
|
-
|
436
|
-
{.UPB_PRIVATE(submsg) = &
|
437
|
-
{.UPB_PRIVATE(submsg) = &
|
438
|
-
{.UPB_PRIVATE(submsg) = &
|
439
|
-
{.UPB_PRIVATE(submsg) = &
|
440
|
-
{.UPB_PRIVATE(submsg) = &
|
507
|
+
const upb_MiniTable* google__protobuf__FileDescriptorSet_msg_init_ptr = &google__protobuf__FileDescriptorSet_msg_init;
|
508
|
+
static const upb_MiniTableSubInternal google_protobuf_FileDescriptorProto_submsgs[7] = {
|
509
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__DescriptorProto_msg_init_ptr},
|
510
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__EnumDescriptorProto_msg_init_ptr},
|
511
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__ServiceDescriptorProto_msg_init_ptr},
|
512
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__FieldDescriptorProto_msg_init_ptr},
|
513
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__FileOptions_msg_init_ptr},
|
514
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__SourceCodeInfo_msg_init_ptr},
|
441
515
|
{.UPB_PRIVATE(subenum) = &google_protobuf_Edition_enum_init},
|
442
516
|
};
|
443
517
|
|
@@ -484,15 +558,16 @@ const upb_MiniTable google__protobuf__FileDescriptorProto_msg_init = {
|
|
484
558
|
})
|
485
559
|
};
|
486
560
|
|
487
|
-
|
488
|
-
|
489
|
-
{.UPB_PRIVATE(submsg) = &
|
490
|
-
{.UPB_PRIVATE(submsg) = &
|
491
|
-
{.UPB_PRIVATE(submsg) = &
|
492
|
-
{.UPB_PRIVATE(submsg) = &
|
493
|
-
{.UPB_PRIVATE(submsg) = &
|
494
|
-
{.UPB_PRIVATE(submsg) = &
|
495
|
-
{.UPB_PRIVATE(submsg) = &
|
561
|
+
const upb_MiniTable* google__protobuf__FileDescriptorProto_msg_init_ptr = &google__protobuf__FileDescriptorProto_msg_init;
|
562
|
+
static const upb_MiniTableSubInternal google_protobuf_DescriptorProto_submsgs[8] = {
|
563
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__FieldDescriptorProto_msg_init_ptr},
|
564
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__DescriptorProto_msg_init_ptr},
|
565
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__EnumDescriptorProto_msg_init_ptr},
|
566
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__DescriptorProto__ExtensionRange_msg_init_ptr},
|
567
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__FieldDescriptorProto_msg_init_ptr},
|
568
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__MessageOptions_msg_init_ptr},
|
569
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__OneofDescriptorProto_msg_init_ptr},
|
570
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__DescriptorProto__ReservedRange_msg_init_ptr},
|
496
571
|
};
|
497
572
|
|
498
573
|
static const upb_MiniTableField google_protobuf_DescriptorProto__fields[10] = {
|
@@ -535,8 +610,9 @@ const upb_MiniTable google__protobuf__DescriptorProto_msg_init = {
|
|
535
610
|
})
|
536
611
|
};
|
537
612
|
|
538
|
-
|
539
|
-
|
613
|
+
const upb_MiniTable* google__protobuf__DescriptorProto_msg_init_ptr = &google__protobuf__DescriptorProto_msg_init;
|
614
|
+
static const upb_MiniTableSubInternal google_protobuf_DescriptorProto_ExtensionRange_submsgs[1] = {
|
615
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__ExtensionRangeOptions_msg_init_ptr},
|
540
616
|
};
|
541
617
|
|
542
618
|
static const upb_MiniTableField google_protobuf_DescriptorProto_ExtensionRange__fields[3] = {
|
@@ -554,6 +630,7 @@ const upb_MiniTable google__protobuf__DescriptorProto__ExtensionRange_msg_init =
|
|
554
630
|
#endif
|
555
631
|
};
|
556
632
|
|
633
|
+
const upb_MiniTable* google__protobuf__DescriptorProto__ExtensionRange_msg_init_ptr = &google__protobuf__DescriptorProto__ExtensionRange_msg_init;
|
557
634
|
static const upb_MiniTableField google_protobuf_DescriptorProto_ReservedRange__fields[2] = {
|
558
635
|
{1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)},
|
559
636
|
{2, 16, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)},
|
@@ -568,10 +645,11 @@ const upb_MiniTable google__protobuf__DescriptorProto__ReservedRange_msg_init =
|
|
568
645
|
#endif
|
569
646
|
};
|
570
647
|
|
571
|
-
|
572
|
-
|
573
|
-
{.UPB_PRIVATE(submsg) = &
|
574
|
-
{.UPB_PRIVATE(submsg) = &
|
648
|
+
const upb_MiniTable* google__protobuf__DescriptorProto__ReservedRange_msg_init_ptr = &google__protobuf__DescriptorProto__ReservedRange_msg_init;
|
649
|
+
static const upb_MiniTableSubInternal google_protobuf_ExtensionRangeOptions_submsgs[4] = {
|
650
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__ExtensionRangeOptions__Declaration_msg_init_ptr},
|
651
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__FeatureSet_msg_init_ptr},
|
652
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__UninterpretedOption_msg_init_ptr},
|
575
653
|
{.UPB_PRIVATE(subenum) = &google_protobuf_ExtensionRangeOptions_VerificationState_enum_init},
|
576
654
|
};
|
577
655
|
|
@@ -625,6 +703,7 @@ const upb_MiniTable google__protobuf__ExtensionRangeOptions_msg_init = {
|
|
625
703
|
})
|
626
704
|
};
|
627
705
|
|
706
|
+
const upb_MiniTable* google__protobuf__ExtensionRangeOptions_msg_init_ptr = &google__protobuf__ExtensionRangeOptions_msg_init;
|
628
707
|
static const upb_MiniTableField google_protobuf_ExtensionRangeOptions_Declaration__fields[5] = {
|
629
708
|
{1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)},
|
630
709
|
{2, UPB_SIZE(20, 24), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
|
@@ -642,8 +721,9 @@ const upb_MiniTable google__protobuf__ExtensionRangeOptions__Declaration_msg_ini
|
|
642
721
|
#endif
|
643
722
|
};
|
644
723
|
|
645
|
-
|
646
|
-
|
724
|
+
const upb_MiniTable* google__protobuf__ExtensionRangeOptions__Declaration_msg_init_ptr = &google__protobuf__ExtensionRangeOptions__Declaration_msg_init;
|
725
|
+
static const upb_MiniTableSubInternal google_protobuf_FieldDescriptorProto_submsgs[3] = {
|
726
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__FieldOptions_msg_init_ptr},
|
647
727
|
{.UPB_PRIVATE(subenum) = &google_protobuf_FieldDescriptorProto_Label_enum_init},
|
648
728
|
{.UPB_PRIVATE(subenum) = &google_protobuf_FieldDescriptorProto_Type_enum_init},
|
649
729
|
};
|
@@ -671,8 +751,9 @@ const upb_MiniTable google__protobuf__FieldDescriptorProto_msg_init = {
|
|
671
751
|
#endif
|
672
752
|
};
|
673
753
|
|
674
|
-
|
675
|
-
|
754
|
+
const upb_MiniTable* google__protobuf__FieldDescriptorProto_msg_init_ptr = &google__protobuf__FieldDescriptorProto_msg_init;
|
755
|
+
static const upb_MiniTableSubInternal google_protobuf_OneofDescriptorProto_submsgs[1] = {
|
756
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__OneofOptions_msg_init_ptr},
|
676
757
|
};
|
677
758
|
|
678
759
|
static const upb_MiniTableField google_protobuf_OneofDescriptorProto__fields[2] = {
|
@@ -689,10 +770,11 @@ const upb_MiniTable google__protobuf__OneofDescriptorProto_msg_init = {
|
|
689
770
|
#endif
|
690
771
|
};
|
691
772
|
|
692
|
-
|
693
|
-
|
694
|
-
{.UPB_PRIVATE(submsg) = &
|
695
|
-
{.UPB_PRIVATE(submsg) = &
|
773
|
+
const upb_MiniTable* google__protobuf__OneofDescriptorProto_msg_init_ptr = &google__protobuf__OneofDescriptorProto_msg_init;
|
774
|
+
static const upb_MiniTableSubInternal google_protobuf_EnumDescriptorProto_submsgs[3] = {
|
775
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__EnumValueDescriptorProto_msg_init_ptr},
|
776
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__EnumOptions_msg_init_ptr},
|
777
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init_ptr},
|
696
778
|
};
|
697
779
|
|
698
780
|
static const upb_MiniTableField google_protobuf_EnumDescriptorProto__fields[5] = {
|
@@ -722,6 +804,7 @@ const upb_MiniTable google__protobuf__EnumDescriptorProto_msg_init = {
|
|
722
804
|
})
|
723
805
|
};
|
724
806
|
|
807
|
+
const upb_MiniTable* google__protobuf__EnumDescriptorProto_msg_init_ptr = &google__protobuf__EnumDescriptorProto_msg_init;
|
725
808
|
static const upb_MiniTableField google_protobuf_EnumDescriptorProto_EnumReservedRange__fields[2] = {
|
726
809
|
{1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)},
|
727
810
|
{2, 16, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)},
|
@@ -736,8 +819,9 @@ const upb_MiniTable google__protobuf__EnumDescriptorProto__EnumReservedRange_msg
|
|
736
819
|
#endif
|
737
820
|
};
|
738
821
|
|
739
|
-
|
740
|
-
|
822
|
+
const upb_MiniTable* google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init_ptr = &google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init;
|
823
|
+
static const upb_MiniTableSubInternal google_protobuf_EnumValueDescriptorProto_submsgs[1] = {
|
824
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__EnumValueOptions_msg_init_ptr},
|
741
825
|
};
|
742
826
|
|
743
827
|
static const upb_MiniTableField google_protobuf_EnumValueDescriptorProto__fields[3] = {
|
@@ -755,9 +839,10 @@ const upb_MiniTable google__protobuf__EnumValueDescriptorProto_msg_init = {
|
|
755
839
|
#endif
|
756
840
|
};
|
757
841
|
|
758
|
-
|
759
|
-
|
760
|
-
{.UPB_PRIVATE(submsg) = &
|
842
|
+
const upb_MiniTable* google__protobuf__EnumValueDescriptorProto_msg_init_ptr = &google__protobuf__EnumValueDescriptorProto_msg_init;
|
843
|
+
static const upb_MiniTableSubInternal google_protobuf_ServiceDescriptorProto_submsgs[2] = {
|
844
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__MethodDescriptorProto_msg_init_ptr},
|
845
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__ServiceOptions_msg_init_ptr},
|
761
846
|
};
|
762
847
|
|
763
848
|
static const upb_MiniTableField google_protobuf_ServiceDescriptorProto__fields[3] = {
|
@@ -781,8 +866,9 @@ const upb_MiniTable google__protobuf__ServiceDescriptorProto_msg_init = {
|
|
781
866
|
})
|
782
867
|
};
|
783
868
|
|
784
|
-
|
785
|
-
|
869
|
+
const upb_MiniTable* google__protobuf__ServiceDescriptorProto_msg_init_ptr = &google__protobuf__ServiceDescriptorProto_msg_init;
|
870
|
+
static const upb_MiniTableSubInternal google_protobuf_MethodDescriptorProto_submsgs[1] = {
|
871
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__MethodOptions_msg_init_ptr},
|
786
872
|
};
|
787
873
|
|
788
874
|
static const upb_MiniTableField google_protobuf_MethodDescriptorProto__fields[6] = {
|
@@ -803,9 +889,10 @@ const upb_MiniTable google__protobuf__MethodDescriptorProto_msg_init = {
|
|
803
889
|
#endif
|
804
890
|
};
|
805
891
|
|
806
|
-
|
807
|
-
|
808
|
-
{.UPB_PRIVATE(submsg) = &
|
892
|
+
const upb_MiniTable* google__protobuf__MethodDescriptorProto_msg_init_ptr = &google__protobuf__MethodDescriptorProto_msg_init;
|
893
|
+
static const upb_MiniTableSubInternal google_protobuf_FileOptions_submsgs[3] = {
|
894
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__FeatureSet_msg_init_ptr},
|
895
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__UninterpretedOption_msg_init_ptr},
|
809
896
|
{.UPB_PRIVATE(subenum) = &google_protobuf_FileOptions_OptimizeMode_enum_init},
|
810
897
|
};
|
811
898
|
|
@@ -876,9 +963,10 @@ const upb_MiniTable google__protobuf__FileOptions_msg_init = {
|
|
876
963
|
})
|
877
964
|
};
|
878
965
|
|
879
|
-
|
880
|
-
|
881
|
-
{.UPB_PRIVATE(submsg) = &
|
966
|
+
const upb_MiniTable* google__protobuf__FileOptions_msg_init_ptr = &google__protobuf__FileOptions_msg_init;
|
967
|
+
static const upb_MiniTableSubInternal google_protobuf_MessageOptions_submsgs[2] = {
|
968
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__FeatureSet_msg_init_ptr},
|
969
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__UninterpretedOption_msg_init_ptr},
|
882
970
|
};
|
883
971
|
|
884
972
|
static const upb_MiniTableField google_protobuf_MessageOptions__fields[7] = {
|
@@ -934,11 +1022,12 @@ const upb_MiniTable google__protobuf__MessageOptions_msg_init = {
|
|
934
1022
|
})
|
935
1023
|
};
|
936
1024
|
|
937
|
-
|
938
|
-
|
939
|
-
{.UPB_PRIVATE(submsg) = &
|
940
|
-
{.UPB_PRIVATE(submsg) = &
|
941
|
-
{.UPB_PRIVATE(submsg) = &
|
1025
|
+
const upb_MiniTable* google__protobuf__MessageOptions_msg_init_ptr = &google__protobuf__MessageOptions_msg_init;
|
1026
|
+
static const upb_MiniTableSubInternal google_protobuf_FieldOptions_submsgs[8] = {
|
1027
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__FieldOptions__EditionDefault_msg_init_ptr},
|
1028
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__FeatureSet_msg_init_ptr},
|
1029
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__FieldOptions__FeatureSupport_msg_init_ptr},
|
1030
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__UninterpretedOption_msg_init_ptr},
|
942
1031
|
{.UPB_PRIVATE(subenum) = &google_protobuf_FieldOptions_CType_enum_init},
|
943
1032
|
{.UPB_PRIVATE(subenum) = &google_protobuf_FieldOptions_JSType_enum_init},
|
944
1033
|
{.UPB_PRIVATE(subenum) = &google_protobuf_FieldOptions_OptionRetention_enum_init},
|
@@ -1005,7 +1094,8 @@ const upb_MiniTable google__protobuf__FieldOptions_msg_init = {
|
|
1005
1094
|
})
|
1006
1095
|
};
|
1007
1096
|
|
1008
|
-
|
1097
|
+
const upb_MiniTable* google__protobuf__FieldOptions_msg_init_ptr = &google__protobuf__FieldOptions_msg_init;
|
1098
|
+
static const upb_MiniTableSubInternal google_protobuf_FieldOptions_EditionDefault_submsgs[1] = {
|
1009
1099
|
{.UPB_PRIVATE(subenum) = &google_protobuf_Edition_enum_init},
|
1010
1100
|
};
|
1011
1101
|
|
@@ -1023,7 +1113,8 @@ const upb_MiniTable google__protobuf__FieldOptions__EditionDefault_msg_init = {
|
|
1023
1113
|
#endif
|
1024
1114
|
};
|
1025
1115
|
|
1026
|
-
|
1116
|
+
const upb_MiniTable* google__protobuf__FieldOptions__EditionDefault_msg_init_ptr = &google__protobuf__FieldOptions__EditionDefault_msg_init;
|
1117
|
+
static const upb_MiniTableSubInternal google_protobuf_FieldOptions_FeatureSupport_submsgs[3] = {
|
1027
1118
|
{.UPB_PRIVATE(subenum) = &google_protobuf_Edition_enum_init},
|
1028
1119
|
{.UPB_PRIVATE(subenum) = &google_protobuf_Edition_enum_init},
|
1029
1120
|
{.UPB_PRIVATE(subenum) = &google_protobuf_Edition_enum_init},
|
@@ -1045,9 +1136,10 @@ const upb_MiniTable google__protobuf__FieldOptions__FeatureSupport_msg_init = {
|
|
1045
1136
|
#endif
|
1046
1137
|
};
|
1047
1138
|
|
1048
|
-
|
1049
|
-
|
1050
|
-
{.UPB_PRIVATE(submsg) = &
|
1139
|
+
const upb_MiniTable* google__protobuf__FieldOptions__FeatureSupport_msg_init_ptr = &google__protobuf__FieldOptions__FeatureSupport_msg_init;
|
1140
|
+
static const upb_MiniTableSubInternal google_protobuf_OneofOptions_submsgs[2] = {
|
1141
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__FeatureSet_msg_init_ptr},
|
1142
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__UninterpretedOption_msg_init_ptr},
|
1051
1143
|
};
|
1052
1144
|
|
1053
1145
|
static const upb_MiniTableField google_protobuf_OneofOptions__fields[2] = {
|
@@ -1098,9 +1190,10 @@ const upb_MiniTable google__protobuf__OneofOptions_msg_init = {
|
|
1098
1190
|
})
|
1099
1191
|
};
|
1100
1192
|
|
1101
|
-
|
1102
|
-
|
1103
|
-
{.UPB_PRIVATE(submsg) = &
|
1193
|
+
const upb_MiniTable* google__protobuf__OneofOptions_msg_init_ptr = &google__protobuf__OneofOptions_msg_init;
|
1194
|
+
static const upb_MiniTableSubInternal google_protobuf_EnumOptions_submsgs[2] = {
|
1195
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__FeatureSet_msg_init_ptr},
|
1196
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__UninterpretedOption_msg_init_ptr},
|
1104
1197
|
};
|
1105
1198
|
|
1106
1199
|
static const upb_MiniTableField google_protobuf_EnumOptions__fields[5] = {
|
@@ -1154,10 +1247,11 @@ const upb_MiniTable google__protobuf__EnumOptions_msg_init = {
|
|
1154
1247
|
})
|
1155
1248
|
};
|
1156
1249
|
|
1157
|
-
|
1158
|
-
|
1159
|
-
{.UPB_PRIVATE(submsg) = &
|
1160
|
-
{.UPB_PRIVATE(submsg) = &
|
1250
|
+
const upb_MiniTable* google__protobuf__EnumOptions_msg_init_ptr = &google__protobuf__EnumOptions_msg_init;
|
1251
|
+
static const upb_MiniTableSubInternal google_protobuf_EnumValueOptions_submsgs[3] = {
|
1252
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__FeatureSet_msg_init_ptr},
|
1253
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__FieldOptions__FeatureSupport_msg_init_ptr},
|
1254
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__UninterpretedOption_msg_init_ptr},
|
1161
1255
|
};
|
1162
1256
|
|
1163
1257
|
static const upb_MiniTableField google_protobuf_EnumValueOptions__fields[5] = {
|
@@ -1211,9 +1305,10 @@ const upb_MiniTable google__protobuf__EnumValueOptions_msg_init = {
|
|
1211
1305
|
})
|
1212
1306
|
};
|
1213
1307
|
|
1214
|
-
|
1215
|
-
|
1216
|
-
{.UPB_PRIVATE(submsg) = &
|
1308
|
+
const upb_MiniTable* google__protobuf__EnumValueOptions_msg_init_ptr = &google__protobuf__EnumValueOptions_msg_init;
|
1309
|
+
static const upb_MiniTableSubInternal google_protobuf_ServiceOptions_submsgs[2] = {
|
1310
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__FeatureSet_msg_init_ptr},
|
1311
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__UninterpretedOption_msg_init_ptr},
|
1217
1312
|
};
|
1218
1313
|
|
1219
1314
|
static const upb_MiniTableField google_protobuf_ServiceOptions__fields[3] = {
|
@@ -1265,9 +1360,10 @@ const upb_MiniTable google__protobuf__ServiceOptions_msg_init = {
|
|
1265
1360
|
})
|
1266
1361
|
};
|
1267
1362
|
|
1268
|
-
|
1269
|
-
|
1270
|
-
{.UPB_PRIVATE(submsg) = &
|
1363
|
+
const upb_MiniTable* google__protobuf__ServiceOptions_msg_init_ptr = &google__protobuf__ServiceOptions_msg_init;
|
1364
|
+
static const upb_MiniTableSubInternal google_protobuf_MethodOptions_submsgs[3] = {
|
1365
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__FeatureSet_msg_init_ptr},
|
1366
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__UninterpretedOption_msg_init_ptr},
|
1271
1367
|
{.UPB_PRIVATE(subenum) = &google_protobuf_MethodOptions_IdempotencyLevel_enum_init},
|
1272
1368
|
};
|
1273
1369
|
|
@@ -1321,8 +1417,9 @@ const upb_MiniTable google__protobuf__MethodOptions_msg_init = {
|
|
1321
1417
|
})
|
1322
1418
|
};
|
1323
1419
|
|
1324
|
-
|
1325
|
-
|
1420
|
+
const upb_MiniTable* google__protobuf__MethodOptions_msg_init_ptr = &google__protobuf__MethodOptions_msg_init;
|
1421
|
+
static const upb_MiniTableSubInternal google_protobuf_UninterpretedOption_submsgs[1] = {
|
1422
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__UninterpretedOption__NamePart_msg_init_ptr},
|
1326
1423
|
};
|
1327
1424
|
|
1328
1425
|
static const upb_MiniTableField google_protobuf_UninterpretedOption__fields[7] = {
|
@@ -1350,6 +1447,7 @@ const upb_MiniTable google__protobuf__UninterpretedOption_msg_init = {
|
|
1350
1447
|
})
|
1351
1448
|
};
|
1352
1449
|
|
1450
|
+
const upb_MiniTable* google__protobuf__UninterpretedOption_msg_init_ptr = &google__protobuf__UninterpretedOption_msg_init;
|
1353
1451
|
static const upb_MiniTableField google_protobuf_UninterpretedOption_NamePart__fields[2] = {
|
1354
1452
|
{1, UPB_SIZE(12, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
|
1355
1453
|
{2, 9, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
|
@@ -1364,7 +1462,8 @@ const upb_MiniTable google__protobuf__UninterpretedOption__NamePart_msg_init = {
|
|
1364
1462
|
#endif
|
1365
1463
|
};
|
1366
1464
|
|
1367
|
-
|
1465
|
+
const upb_MiniTable* google__protobuf__UninterpretedOption__NamePart_msg_init_ptr = &google__protobuf__UninterpretedOption__NamePart_msg_init;
|
1466
|
+
static const upb_MiniTableSubInternal google_protobuf_FeatureSet_submsgs[6] = {
|
1368
1467
|
{.UPB_PRIVATE(subenum) = &google_protobuf_FeatureSet_FieldPresence_enum_init},
|
1369
1468
|
{.UPB_PRIVATE(subenum) = &google_protobuf_FeatureSet_EnumType_enum_init},
|
1370
1469
|
{.UPB_PRIVATE(subenum) = &google_protobuf_FeatureSet_RepeatedFieldEncoding_enum_init},
|
@@ -1391,8 +1490,9 @@ const upb_MiniTable google__protobuf__FeatureSet_msg_init = {
|
|
1391
1490
|
#endif
|
1392
1491
|
};
|
1393
1492
|
|
1394
|
-
|
1395
|
-
|
1493
|
+
const upb_MiniTable* google__protobuf__FeatureSet_msg_init_ptr = &google__protobuf__FeatureSet_msg_init;
|
1494
|
+
static const upb_MiniTableSubInternal google_protobuf_FeatureSetDefaults_submsgs[3] = {
|
1495
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init_ptr},
|
1396
1496
|
{.UPB_PRIVATE(subenum) = &google_protobuf_Edition_enum_init},
|
1397
1497
|
{.UPB_PRIVATE(subenum) = &google_protobuf_Edition_enum_init},
|
1398
1498
|
};
|
@@ -1416,9 +1516,10 @@ const upb_MiniTable google__protobuf__FeatureSetDefaults_msg_init = {
|
|
1416
1516
|
})
|
1417
1517
|
};
|
1418
1518
|
|
1419
|
-
|
1420
|
-
|
1421
|
-
{.UPB_PRIVATE(submsg) = &
|
1519
|
+
const upb_MiniTable* google__protobuf__FeatureSetDefaults_msg_init_ptr = &google__protobuf__FeatureSetDefaults_msg_init;
|
1520
|
+
static const upb_MiniTableSubInternal google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_submsgs[3] = {
|
1521
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__FeatureSet_msg_init_ptr},
|
1522
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__FeatureSet_msg_init_ptr},
|
1422
1523
|
{.UPB_PRIVATE(subenum) = &google_protobuf_Edition_enum_init},
|
1423
1524
|
};
|
1424
1525
|
|
@@ -1437,8 +1538,9 @@ const upb_MiniTable google__protobuf__FeatureSetDefaults__FeatureSetEditionDefau
|
|
1437
1538
|
#endif
|
1438
1539
|
};
|
1439
1540
|
|
1440
|
-
|
1441
|
-
|
1541
|
+
const upb_MiniTable* google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init_ptr = &google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init;
|
1542
|
+
static const upb_MiniTableSubInternal google_protobuf_SourceCodeInfo_submsgs[1] = {
|
1543
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__SourceCodeInfo__Location_msg_init_ptr},
|
1442
1544
|
};
|
1443
1545
|
|
1444
1546
|
static const upb_MiniTableField google_protobuf_SourceCodeInfo__fields[1] = {
|
@@ -1458,6 +1560,7 @@ const upb_MiniTable google__protobuf__SourceCodeInfo_msg_init = {
|
|
1458
1560
|
})
|
1459
1561
|
};
|
1460
1562
|
|
1563
|
+
const upb_MiniTable* google__protobuf__SourceCodeInfo_msg_init_ptr = &google__protobuf__SourceCodeInfo_msg_init;
|
1461
1564
|
static const upb_MiniTableField google_protobuf_SourceCodeInfo_Location__fields[5] = {
|
1462
1565
|
{1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)},
|
1463
1566
|
{2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)},
|
@@ -1485,8 +1588,9 @@ const upb_MiniTable google__protobuf__SourceCodeInfo__Location_msg_init = {
|
|
1485
1588
|
})
|
1486
1589
|
};
|
1487
1590
|
|
1488
|
-
|
1489
|
-
|
1591
|
+
const upb_MiniTable* google__protobuf__SourceCodeInfo__Location_msg_init_ptr = &google__protobuf__SourceCodeInfo__Location_msg_init;
|
1592
|
+
static const upb_MiniTableSubInternal google_protobuf_GeneratedCodeInfo_submsgs[1] = {
|
1593
|
+
{.UPB_PRIVATE(submsg) = &google__protobuf__GeneratedCodeInfo__Annotation_msg_init_ptr},
|
1490
1594
|
};
|
1491
1595
|
|
1492
1596
|
static const upb_MiniTableField google_protobuf_GeneratedCodeInfo__fields[1] = {
|
@@ -1506,7 +1610,8 @@ const upb_MiniTable google__protobuf__GeneratedCodeInfo_msg_init = {
|
|
1506
1610
|
})
|
1507
1611
|
};
|
1508
1612
|
|
1509
|
-
|
1613
|
+
const upb_MiniTable* google__protobuf__GeneratedCodeInfo_msg_init_ptr = &google__protobuf__GeneratedCodeInfo_msg_init;
|
1614
|
+
static const upb_MiniTableSubInternal google_protobuf_GeneratedCodeInfo_Annotation_submsgs[1] = {
|
1510
1615
|
{.UPB_PRIVATE(subenum) = &google_protobuf_GeneratedCodeInfo_Annotation_Semantic_enum_init},
|
1511
1616
|
};
|
1512
1617
|
|
@@ -1531,42 +1636,7 @@ const upb_MiniTable google__protobuf__GeneratedCodeInfo__Annotation_msg_init = {
|
|
1531
1636
|
})
|
1532
1637
|
};
|
1533
1638
|
|
1534
|
-
|
1535
|
-
&google__protobuf__FileDescriptorSet_msg_init,
|
1536
|
-
&google__protobuf__FileDescriptorProto_msg_init,
|
1537
|
-
&google__protobuf__DescriptorProto_msg_init,
|
1538
|
-
&google__protobuf__DescriptorProto__ExtensionRange_msg_init,
|
1539
|
-
&google__protobuf__DescriptorProto__ReservedRange_msg_init,
|
1540
|
-
&google__protobuf__ExtensionRangeOptions_msg_init,
|
1541
|
-
&google__protobuf__ExtensionRangeOptions__Declaration_msg_init,
|
1542
|
-
&google__protobuf__FieldDescriptorProto_msg_init,
|
1543
|
-
&google__protobuf__OneofDescriptorProto_msg_init,
|
1544
|
-
&google__protobuf__EnumDescriptorProto_msg_init,
|
1545
|
-
&google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init,
|
1546
|
-
&google__protobuf__EnumValueDescriptorProto_msg_init,
|
1547
|
-
&google__protobuf__ServiceDescriptorProto_msg_init,
|
1548
|
-
&google__protobuf__MethodDescriptorProto_msg_init,
|
1549
|
-
&google__protobuf__FileOptions_msg_init,
|
1550
|
-
&google__protobuf__MessageOptions_msg_init,
|
1551
|
-
&google__protobuf__FieldOptions_msg_init,
|
1552
|
-
&google__protobuf__FieldOptions__EditionDefault_msg_init,
|
1553
|
-
&google__protobuf__FieldOptions__FeatureSupport_msg_init,
|
1554
|
-
&google__protobuf__OneofOptions_msg_init,
|
1555
|
-
&google__protobuf__EnumOptions_msg_init,
|
1556
|
-
&google__protobuf__EnumValueOptions_msg_init,
|
1557
|
-
&google__protobuf__ServiceOptions_msg_init,
|
1558
|
-
&google__protobuf__MethodOptions_msg_init,
|
1559
|
-
&google__protobuf__UninterpretedOption_msg_init,
|
1560
|
-
&google__protobuf__UninterpretedOption__NamePart_msg_init,
|
1561
|
-
&google__protobuf__FeatureSet_msg_init,
|
1562
|
-
&google__protobuf__FeatureSetDefaults_msg_init,
|
1563
|
-
&google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init,
|
1564
|
-
&google__protobuf__SourceCodeInfo_msg_init,
|
1565
|
-
&google__protobuf__SourceCodeInfo__Location_msg_init,
|
1566
|
-
&google__protobuf__GeneratedCodeInfo_msg_init,
|
1567
|
-
&google__protobuf__GeneratedCodeInfo__Annotation_msg_init,
|
1568
|
-
};
|
1569
|
-
|
1639
|
+
const upb_MiniTable* google__protobuf__GeneratedCodeInfo__Annotation_msg_init_ptr = &google__protobuf__GeneratedCodeInfo__Annotation_msg_init;
|
1570
1640
|
const upb_MiniTableEnum google_protobuf_Edition_enum_init = {
|
1571
1641
|
64,
|
1572
1642
|
9,
|
@@ -1729,6 +1799,42 @@ const upb_MiniTableEnum google_protobuf_MethodOptions_IdempotencyLevel_enum_init
|
|
1729
1799
|
},
|
1730
1800
|
};
|
1731
1801
|
|
1802
|
+
static const upb_MiniTable *messages_layout[33] = {
|
1803
|
+
&google__protobuf__FileDescriptorSet_msg_init,
|
1804
|
+
&google__protobuf__FileDescriptorProto_msg_init,
|
1805
|
+
&google__protobuf__DescriptorProto_msg_init,
|
1806
|
+
&google__protobuf__DescriptorProto__ExtensionRange_msg_init,
|
1807
|
+
&google__protobuf__DescriptorProto__ReservedRange_msg_init,
|
1808
|
+
&google__protobuf__ExtensionRangeOptions_msg_init,
|
1809
|
+
&google__protobuf__ExtensionRangeOptions__Declaration_msg_init,
|
1810
|
+
&google__protobuf__FieldDescriptorProto_msg_init,
|
1811
|
+
&google__protobuf__OneofDescriptorProto_msg_init,
|
1812
|
+
&google__protobuf__EnumDescriptorProto_msg_init,
|
1813
|
+
&google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init,
|
1814
|
+
&google__protobuf__EnumValueDescriptorProto_msg_init,
|
1815
|
+
&google__protobuf__ServiceDescriptorProto_msg_init,
|
1816
|
+
&google__protobuf__MethodDescriptorProto_msg_init,
|
1817
|
+
&google__protobuf__FileOptions_msg_init,
|
1818
|
+
&google__protobuf__MessageOptions_msg_init,
|
1819
|
+
&google__protobuf__FieldOptions_msg_init,
|
1820
|
+
&google__protobuf__FieldOptions__EditionDefault_msg_init,
|
1821
|
+
&google__protobuf__FieldOptions__FeatureSupport_msg_init,
|
1822
|
+
&google__protobuf__OneofOptions_msg_init,
|
1823
|
+
&google__protobuf__EnumOptions_msg_init,
|
1824
|
+
&google__protobuf__EnumValueOptions_msg_init,
|
1825
|
+
&google__protobuf__ServiceOptions_msg_init,
|
1826
|
+
&google__protobuf__MethodOptions_msg_init,
|
1827
|
+
&google__protobuf__UninterpretedOption_msg_init,
|
1828
|
+
&google__protobuf__UninterpretedOption__NamePart_msg_init,
|
1829
|
+
&google__protobuf__FeatureSet_msg_init,
|
1830
|
+
&google__protobuf__FeatureSetDefaults_msg_init,
|
1831
|
+
&google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init,
|
1832
|
+
&google__protobuf__SourceCodeInfo_msg_init,
|
1833
|
+
&google__protobuf__SourceCodeInfo__Location_msg_init,
|
1834
|
+
&google__protobuf__GeneratedCodeInfo_msg_init,
|
1835
|
+
&google__protobuf__GeneratedCodeInfo__Annotation_msg_init,
|
1836
|
+
};
|
1837
|
+
|
1732
1838
|
static const upb_MiniTableEnum *enums_layout[17] = {
|
1733
1839
|
&google_protobuf_Edition_enum_init,
|
1734
1840
|
&google_protobuf_ExtensionRangeOptions_VerificationState_enum_init,
|
@@ -2614,6 +2720,7 @@ static upb_MessageValue jsondec_bool(jsondec* d, const upb_FieldDef* f) {
|
|
2614
2720
|
/* Composite types (array/message/map) ****************************************/
|
2615
2721
|
|
2616
2722
|
static void jsondec_array(jsondec* d, upb_Message* msg, const upb_FieldDef* f) {
|
2723
|
+
UPB_ASSERT(!upb_Message_IsFrozen(msg));
|
2617
2724
|
upb_Array* arr = upb_Message_Mutable(msg, f, d->arena).array;
|
2618
2725
|
|
2619
2726
|
jsondec_arrstart(d);
|
@@ -2627,6 +2734,7 @@ static void jsondec_array(jsondec* d, upb_Message* msg, const upb_FieldDef* f) {
|
|
2627
2734
|
}
|
2628
2735
|
|
2629
2736
|
static void jsondec_map(jsondec* d, upb_Message* msg, const upb_FieldDef* f) {
|
2737
|
+
UPB_ASSERT(!upb_Message_IsFrozen(msg));
|
2630
2738
|
upb_Map* map = upb_Message_Mutable(msg, f, d->arena).map;
|
2631
2739
|
const upb_MessageDef* entry = upb_FieldDef_MessageSubDef(f);
|
2632
2740
|
const upb_FieldDef* key_f = upb_MessageDef_FindFieldByNumber(entry, 1);
|
@@ -2648,6 +2756,7 @@ static void jsondec_map(jsondec* d, upb_Message* msg, const upb_FieldDef* f) {
|
|
2648
2756
|
|
2649
2757
|
static void jsondec_tomsg(jsondec* d, upb_Message* msg,
|
2650
2758
|
const upb_MessageDef* m) {
|
2759
|
+
UPB_ASSERT(!upb_Message_IsFrozen(msg));
|
2651
2760
|
if (upb_MessageDef_WellKnownType(m) == kUpb_WellKnown_Unspecified) {
|
2652
2761
|
jsondec_object(d, msg, m);
|
2653
2762
|
} else {
|
@@ -2668,6 +2777,7 @@ static upb_MessageValue jsondec_msg(jsondec* d, const upb_FieldDef* f) {
|
|
2668
2777
|
|
2669
2778
|
static void jsondec_field(jsondec* d, upb_Message* msg,
|
2670
2779
|
const upb_MessageDef* m) {
|
2780
|
+
UPB_ASSERT(!upb_Message_IsFrozen(msg));
|
2671
2781
|
upb_StringView name;
|
2672
2782
|
const upb_FieldDef* f;
|
2673
2783
|
const upb_FieldDef* preserved;
|
@@ -2706,7 +2816,7 @@ static void jsondec_field(jsondec* d, upb_Message* msg,
|
|
2706
2816
|
}
|
2707
2817
|
|
2708
2818
|
if (upb_FieldDef_RealContainingOneof(f) &&
|
2709
|
-
|
2819
|
+
upb_Message_WhichOneofByDef(msg, upb_FieldDef_ContainingOneof(f))) {
|
2710
2820
|
jsondec_err(d, "More than one field for this oneof.");
|
2711
2821
|
}
|
2712
2822
|
|
@@ -2733,6 +2843,7 @@ static void jsondec_field(jsondec* d, upb_Message* msg,
|
|
2733
2843
|
|
2734
2844
|
static void jsondec_object(jsondec* d, upb_Message* msg,
|
2735
2845
|
const upb_MessageDef* m) {
|
2846
|
+
UPB_ASSERT(!upb_Message_IsFrozen(msg));
|
2736
2847
|
jsondec_objstart(d);
|
2737
2848
|
while (jsondec_objnext(d)) {
|
2738
2849
|
jsondec_field(d, msg, m);
|
@@ -2833,6 +2944,7 @@ static int64_t jsondec_unixtime(int y, int m, int d, int h, int min, int s) {
|
|
2833
2944
|
|
2834
2945
|
static void jsondec_timestamp(jsondec* d, upb_Message* msg,
|
2835
2946
|
const upb_MessageDef* m) {
|
2947
|
+
UPB_ASSERT(!upb_Message_IsFrozen(msg));
|
2836
2948
|
upb_MessageValue seconds;
|
2837
2949
|
upb_MessageValue nanos;
|
2838
2950
|
upb_StringView str = jsondec_string(d);
|
@@ -2898,6 +3010,7 @@ malformed:
|
|
2898
3010
|
|
2899
3011
|
static void jsondec_duration(jsondec* d, upb_Message* msg,
|
2900
3012
|
const upb_MessageDef* m) {
|
3013
|
+
UPB_ASSERT(!upb_Message_IsFrozen(msg));
|
2901
3014
|
upb_MessageValue seconds;
|
2902
3015
|
upb_MessageValue nanos;
|
2903
3016
|
upb_StringView str = jsondec_string(d);
|
@@ -2930,6 +3043,7 @@ static void jsondec_duration(jsondec* d, upb_Message* msg,
|
|
2930
3043
|
|
2931
3044
|
static void jsondec_listvalue(jsondec* d, upb_Message* msg,
|
2932
3045
|
const upb_MessageDef* m) {
|
3046
|
+
UPB_ASSERT(!upb_Message_IsFrozen(msg));
|
2933
3047
|
const upb_FieldDef* values_f = upb_MessageDef_FindFieldByNumber(m, 1);
|
2934
3048
|
const upb_MessageDef* value_m = upb_FieldDef_MessageSubDef(values_f);
|
2935
3049
|
const upb_MiniTable* value_layout = upb_MessageDef_MiniTable(value_m);
|
@@ -2948,6 +3062,7 @@ static void jsondec_listvalue(jsondec* d, upb_Message* msg,
|
|
2948
3062
|
|
2949
3063
|
static void jsondec_struct(jsondec* d, upb_Message* msg,
|
2950
3064
|
const upb_MessageDef* m) {
|
3065
|
+
UPB_ASSERT(!upb_Message_IsFrozen(msg));
|
2951
3066
|
const upb_FieldDef* fields_f = upb_MessageDef_FindFieldByNumber(m, 1);
|
2952
3067
|
const upb_MessageDef* entry_m = upb_FieldDef_MessageSubDef(fields_f);
|
2953
3068
|
const upb_FieldDef* value_f = upb_MessageDef_FindFieldByNumber(entry_m, 2);
|
@@ -2970,6 +3085,7 @@ static void jsondec_struct(jsondec* d, upb_Message* msg,
|
|
2970
3085
|
|
2971
3086
|
static void jsondec_wellknownvalue(jsondec* d, upb_Message* msg,
|
2972
3087
|
const upb_MessageDef* m) {
|
3088
|
+
UPB_ASSERT(!upb_Message_IsFrozen(msg));
|
2973
3089
|
upb_MessageValue val;
|
2974
3090
|
const upb_FieldDef* f;
|
2975
3091
|
upb_Message* submsg;
|
@@ -3058,6 +3174,7 @@ static upb_StringView jsondec_mask(jsondec* d, const char* buf,
|
|
3058
3174
|
|
3059
3175
|
static void jsondec_fieldmask(jsondec* d, upb_Message* msg,
|
3060
3176
|
const upb_MessageDef* m) {
|
3177
|
+
UPB_ASSERT(!upb_Message_IsFrozen(msg));
|
3061
3178
|
/* repeated string paths = 1; */
|
3062
3179
|
const upb_FieldDef* paths_f = upb_MessageDef_FindFieldByNumber(m, 1);
|
3063
3180
|
upb_Array* arr = upb_Message_Mutable(msg, paths_f, d->arena).array;
|
@@ -3081,6 +3198,7 @@ static void jsondec_fieldmask(jsondec* d, upb_Message* msg,
|
|
3081
3198
|
|
3082
3199
|
static void jsondec_anyfield(jsondec* d, upb_Message* msg,
|
3083
3200
|
const upb_MessageDef* m) {
|
3201
|
+
UPB_ASSERT(!upb_Message_IsFrozen(msg));
|
3084
3202
|
if (upb_MessageDef_WellKnownType(m) == kUpb_WellKnown_Unspecified) {
|
3085
3203
|
/* For regular types: {"@type": "[user type]", "f1": <V1>, "f2": <V2>}
|
3086
3204
|
* where f1, f2, etc. are the normal fields of this type. */
|
@@ -3099,6 +3217,7 @@ static void jsondec_anyfield(jsondec* d, upb_Message* msg,
|
|
3099
3217
|
|
3100
3218
|
static const upb_MessageDef* jsondec_typeurl(jsondec* d, upb_Message* msg,
|
3101
3219
|
const upb_MessageDef* m) {
|
3220
|
+
UPB_ASSERT(!upb_Message_IsFrozen(msg));
|
3102
3221
|
const upb_FieldDef* type_url_f = upb_MessageDef_FindFieldByNumber(m, 1);
|
3103
3222
|
const upb_MessageDef* type_m;
|
3104
3223
|
upb_StringView type_url = jsondec_string(d);
|
@@ -3128,6 +3247,7 @@ static const upb_MessageDef* jsondec_typeurl(jsondec* d, upb_Message* msg,
|
|
3128
3247
|
}
|
3129
3248
|
|
3130
3249
|
static void jsondec_any(jsondec* d, upb_Message* msg, const upb_MessageDef* m) {
|
3250
|
+
UPB_ASSERT(!upb_Message_IsFrozen(msg));
|
3131
3251
|
/* string type_url = 1;
|
3132
3252
|
* bytes value = 2; */
|
3133
3253
|
const upb_FieldDef* value_f = upb_MessageDef_FindFieldByNumber(m, 2);
|
@@ -3196,6 +3316,7 @@ static void jsondec_any(jsondec* d, upb_Message* msg, const upb_MessageDef* m) {
|
|
3196
3316
|
|
3197
3317
|
static void jsondec_wrapper(jsondec* d, upb_Message* msg,
|
3198
3318
|
const upb_MessageDef* m) {
|
3319
|
+
UPB_ASSERT(!upb_Message_IsFrozen(msg));
|
3199
3320
|
const upb_FieldDef* value_f = upb_MessageDef_FindFieldByNumber(m, 1);
|
3200
3321
|
upb_JsonMessageValue val = jsondec_value(d, value_f);
|
3201
3322
|
UPB_ASSUME(val.ignore == false); // Wrapper cannot be an enum.
|
@@ -3204,6 +3325,7 @@ static void jsondec_wrapper(jsondec* d, upb_Message* msg,
|
|
3204
3325
|
|
3205
3326
|
static void jsondec_wellknown(jsondec* d, upb_Message* msg,
|
3206
3327
|
const upb_MessageDef* m) {
|
3328
|
+
UPB_ASSERT(!upb_Message_IsFrozen(msg));
|
3207
3329
|
switch (upb_MessageDef_WellKnownType(m)) {
|
3208
3330
|
case kUpb_WellKnown_Any:
|
3209
3331
|
jsondec_any(d, msg, m);
|
@@ -3244,6 +3366,7 @@ static void jsondec_wellknown(jsondec* d, upb_Message* msg,
|
|
3244
3366
|
|
3245
3367
|
static bool upb_JsonDecoder_Decode(jsondec* const d, upb_Message* const msg,
|
3246
3368
|
const upb_MessageDef* const m) {
|
3369
|
+
UPB_ASSERT(!upb_Message_IsFrozen(msg));
|
3247
3370
|
if (UPB_SETJMP(d->err)) return false;
|
3248
3371
|
|
3249
3372
|
jsondec_tomsg(d, msg, m);
|
@@ -3318,7 +3441,7 @@ static void jsonenc_value(jsonenc* e, const upb_Message* msg,
|
|
3318
3441
|
|
3319
3442
|
UPB_NORETURN static void jsonenc_err(jsonenc* e, const char* msg) {
|
3320
3443
|
upb_Status_SetErrorMessage(e->status, msg);
|
3321
|
-
|
3444
|
+
UPB_LONGJMP(e->err, 1);
|
3322
3445
|
}
|
3323
3446
|
|
3324
3447
|
UPB_PRINTF(2, 3)
|
@@ -3327,7 +3450,7 @@ UPB_NORETURN static void jsonenc_errf(jsonenc* e, const char* fmt, ...) {
|
|
3327
3450
|
va_start(argp, fmt);
|
3328
3451
|
upb_Status_VSetErrorFormat(e->status, fmt, argp);
|
3329
3452
|
va_end(argp);
|
3330
|
-
|
3453
|
+
UPB_LONGJMP(e->err, 1);
|
3331
3454
|
}
|
3332
3455
|
|
3333
3456
|
static upb_Arena* jsonenc_arena(jsonenc* e) {
|
@@ -4084,6 +4207,10 @@ upb_alloc upb_alloc_global = {&upb_global_allocfunc};
|
|
4084
4207
|
|
4085
4208
|
// Must be last.
|
4086
4209
|
|
4210
|
+
static UPB_ATOMIC(size_t) max_block_size = 32 << 10;
|
4211
|
+
|
4212
|
+
void upb_Arena_SetMaxBlockSize(size_t max) { max_block_size = max; }
|
4213
|
+
|
4087
4214
|
typedef struct upb_MemBlock {
|
4088
4215
|
// Atomic only for the benefit of SpaceAllocated().
|
4089
4216
|
UPB_ATOMIC(struct upb_MemBlock*) next;
|
@@ -4321,7 +4448,14 @@ static bool _upb_Arena_AllocBlock(upb_Arena* a, size_t size) {
|
|
4321
4448
|
if (!ai->block_alloc) return false;
|
4322
4449
|
upb_MemBlock* last_block = upb_Atomic_Load(&ai->blocks, memory_order_acquire);
|
4323
4450
|
size_t last_size = last_block != NULL ? last_block->size : 128;
|
4324
|
-
|
4451
|
+
|
4452
|
+
// Don't naturally grow beyond the max block size.
|
4453
|
+
size_t clamped_size = UPB_MIN(last_size * 2, max_block_size);
|
4454
|
+
|
4455
|
+
// We may need to exceed the max block size if the user requested a large
|
4456
|
+
// allocation.
|
4457
|
+
size_t block_size = UPB_MAX(size, clamped_size) + kUpb_MemblockReserve;
|
4458
|
+
|
4325
4459
|
upb_MemBlock* block =
|
4326
4460
|
upb_malloc(_upb_ArenaInternal_BlockAlloc(ai), block_size);
|
4327
4461
|
|
@@ -4632,10 +4766,8 @@ bool upb_Message_SetMapEntry(upb_Map* map, const upb_MiniTable* m,
|
|
4632
4766
|
const upb_MiniTableField* f,
|
4633
4767
|
upb_Message* map_entry_message, upb_Arena* arena) {
|
4634
4768
|
UPB_ASSERT(!upb_Message_IsFrozen(map_entry_message));
|
4635
|
-
|
4636
|
-
|
4637
|
-
const upb_MiniTable* map_entry_mini_table = upb_MiniTableSub_Message(
|
4638
|
-
m->UPB_PRIVATE(subs)[f->UPB_PRIVATE(submsg_index)]);
|
4769
|
+
const upb_MiniTable* map_entry_mini_table =
|
4770
|
+
upb_MiniTable_MapEntrySubMessage(m, f);
|
4639
4771
|
UPB_ASSERT(map_entry_mini_table);
|
4640
4772
|
const upb_MiniTableField* map_entry_key_field =
|
4641
4773
|
upb_MiniTable_MapKey(map_entry_mini_table);
|
@@ -5227,74 +5359,18 @@ void upb_Message_Freeze(upb_Message* msg, const upb_MiniTable* m) {
|
|
5227
5359
|
|
5228
5360
|
// Must be last.
|
5229
5361
|
|
5230
|
-
#define kUpb_BaseField_Begin ((size_t)-1)
|
5231
|
-
#define kUpb_Extension_Begin ((size_t)-1)
|
5232
5362
|
|
5233
5363
|
#ifdef __cplusplus
|
5234
5364
|
extern "C" {
|
5235
5365
|
#endif
|
5236
5366
|
|
5237
|
-
static bool _upb_Message_NextBaseField(const upb_Message* msg,
|
5238
|
-
const upb_MiniTable* m,
|
5239
|
-
const upb_MiniTableField** out_f,
|
5240
|
-
upb_MessageValue* out_v, size_t* iter) {
|
5241
|
-
const size_t count = upb_MiniTable_FieldCount(m);
|
5242
|
-
size_t i = *iter;
|
5243
|
-
|
5244
|
-
while (++i < count) {
|
5245
|
-
const upb_MiniTableField* f = upb_MiniTable_GetFieldByIndex(m, i);
|
5246
|
-
const void* src = UPB_PRIVATE(_upb_Message_DataPtr)(msg, f);
|
5247
|
-
|
5248
|
-
upb_MessageValue val;
|
5249
|
-
UPB_PRIVATE(_upb_MiniTableField_DataCopy)(f, &val, src);
|
5250
|
-
|
5251
|
-
// Skip field if unset or empty.
|
5252
|
-
if (upb_MiniTableField_HasPresence(f)) {
|
5253
|
-
if (!upb_Message_HasBaseField(msg, f)) continue;
|
5254
|
-
} else {
|
5255
|
-
if (UPB_PRIVATE(_upb_MiniTableField_DataIsZero)(f, src)) continue;
|
5256
|
-
|
5257
|
-
if (upb_MiniTableField_IsArray(f)) {
|
5258
|
-
if (upb_Array_Size(val.array_val) == 0) continue;
|
5259
|
-
} else if (upb_MiniTableField_IsMap(f)) {
|
5260
|
-
if (upb_Map_Size(val.map_val) == 0) continue;
|
5261
|
-
}
|
5262
|
-
}
|
5263
|
-
|
5264
|
-
*out_f = f;
|
5265
|
-
*out_v = val;
|
5266
|
-
*iter = i;
|
5267
|
-
return true;
|
5268
|
-
}
|
5269
|
-
|
5270
|
-
return false;
|
5271
|
-
}
|
5272
|
-
|
5273
|
-
static bool _upb_Message_NextExtension(const upb_Message* msg,
|
5274
|
-
const upb_MiniTable* m,
|
5275
|
-
const upb_MiniTableExtension** out_e,
|
5276
|
-
upb_MessageValue* out_v, size_t* iter) {
|
5277
|
-
size_t count;
|
5278
|
-
const upb_Extension* exts = UPB_PRIVATE(_upb_Message_Getexts)(msg, &count);
|
5279
|
-
size_t i = *iter;
|
5280
|
-
|
5281
|
-
if (++i < count) {
|
5282
|
-
*out_e = exts[i].ext;
|
5283
|
-
*out_v = exts[i].data;
|
5284
|
-
*iter = i;
|
5285
|
-
return true;
|
5286
|
-
}
|
5287
|
-
|
5288
|
-
return false;
|
5289
|
-
}
|
5290
|
-
|
5291
5367
|
bool upb_Message_IsEmpty(const upb_Message* msg, const upb_MiniTable* m) {
|
5292
5368
|
if (upb_Message_ExtensionCount(msg)) return false;
|
5293
5369
|
|
5294
5370
|
const upb_MiniTableField* f;
|
5295
5371
|
upb_MessageValue v;
|
5296
5372
|
size_t iter = kUpb_BaseField_Begin;
|
5297
|
-
return !_upb_Message_NextBaseField(msg, m, &f, &v, &iter);
|
5373
|
+
return !UPB_PRIVATE(_upb_Message_NextBaseField)(msg, m, &f, &v, &iter);
|
5298
5374
|
}
|
5299
5375
|
|
5300
5376
|
static bool _upb_Array_IsEqual(const upb_Array* arr1, const upb_Array* arr2,
|
@@ -5356,8 +5432,10 @@ static bool _upb_Message_BaseFieldsAreEqual(const upb_Message* msg1,
|
|
5356
5432
|
const upb_MiniTableField *f1, *f2;
|
5357
5433
|
upb_MessageValue val1, val2;
|
5358
5434
|
|
5359
|
-
const bool got1 =
|
5360
|
-
|
5435
|
+
const bool got1 =
|
5436
|
+
UPB_PRIVATE(_upb_Message_NextBaseField)(msg1, m, &f1, &val1, &iter1);
|
5437
|
+
const bool got2 =
|
5438
|
+
UPB_PRIVATE(_upb_Message_NextBaseField)(msg2, m, &f2, &val2, &iter2);
|
5361
5439
|
|
5362
5440
|
if (got1 != got2) return false; // Must have identical field counts.
|
5363
5441
|
if (!got1) return true; // Loop termination condition.
|
@@ -5397,7 +5475,7 @@ static bool _upb_Message_ExtensionsAreEqual(const upb_Message* msg1,
|
|
5397
5475
|
|
5398
5476
|
// Iterate over all extensions for msg1, and search msg2 for each extension.
|
5399
5477
|
size_t iter1 = kUpb_Extension_Begin;
|
5400
|
-
while (_upb_Message_NextExtension(msg1, m, &e, &val1, &iter1)) {
|
5478
|
+
while (UPB_PRIVATE(_upb_Message_NextExtension)(msg1, m, &e, &val1, &iter1)) {
|
5401
5479
|
const upb_Extension* ext2 = UPB_PRIVATE(_upb_Message_Getext)(msg2, e);
|
5402
5480
|
if (!ext2) return false;
|
5403
5481
|
|
@@ -5538,9 +5616,9 @@ static upb_Map* upb_Message_Map_DeepClone(const upb_Map* map,
|
|
5538
5616
|
const upb_MiniTableField* f,
|
5539
5617
|
upb_Message* clone,
|
5540
5618
|
upb_Arena* arena) {
|
5541
|
-
|
5542
|
-
const upb_MiniTable* map_entry_table =
|
5543
|
-
mini_table
|
5619
|
+
UPB_ASSERT(!upb_Message_IsFrozen(clone));
|
5620
|
+
const upb_MiniTable* map_entry_table =
|
5621
|
+
upb_MiniTable_MapEntrySubMessage(mini_table, f);
|
5544
5622
|
UPB_ASSERT(map_entry_table);
|
5545
5623
|
|
5546
5624
|
const upb_MiniTableField* key_field = upb_MiniTable_MapKey(map_entry_table);
|
@@ -5582,6 +5660,7 @@ static bool upb_Message_Array_DeepClone(const upb_Array* array,
|
|
5582
5660
|
const upb_MiniTable* mini_table,
|
5583
5661
|
const upb_MiniTableField* field,
|
5584
5662
|
upb_Message* clone, upb_Arena* arena) {
|
5663
|
+
UPB_ASSERT(!upb_Message_IsFrozen(clone));
|
5585
5664
|
UPB_PRIVATE(_upb_MiniTableField_CheckIsArray)(field);
|
5586
5665
|
upb_Array* cloned_array = upb_Array_DeepClone(
|
5587
5666
|
array, upb_MiniTableField_CType(field),
|
@@ -5607,6 +5686,7 @@ static bool upb_Clone_ExtensionValue(
|
|
5607
5686
|
upb_Message* _upb_Message_Copy(upb_Message* dst, const upb_Message* src,
|
5608
5687
|
const upb_MiniTable* mini_table,
|
5609
5688
|
upb_Arena* arena) {
|
5689
|
+
UPB_ASSERT(!upb_Message_IsFrozen(dst));
|
5610
5690
|
upb_StringView empty_string = upb_StringView_FromDataAndSize(NULL, 0);
|
5611
5691
|
// Only copy message area skipping upb_Message_Internal.
|
5612
5692
|
memcpy(dst + 1, src + 1, mini_table->UPB_PRIVATE(size) - sizeof(upb_Message));
|
@@ -5633,10 +5713,10 @@ upb_Message* _upb_Message_Copy(upb_Message* dst, const upb_Message* src,
|
|
5633
5713
|
if (dst_sub_message == NULL) {
|
5634
5714
|
return NULL;
|
5635
5715
|
}
|
5636
|
-
_upb_Message_SetTaggedMessagePtr
|
5637
|
-
|
5638
|
-
|
5639
|
-
|
5716
|
+
UPB_PRIVATE(_upb_Message_SetTaggedMessagePtr)
|
5717
|
+
(dst, field,
|
5718
|
+
UPB_PRIVATE(_upb_TaggedMessagePtr_Pack)(dst_sub_message,
|
5719
|
+
is_empty));
|
5640
5720
|
}
|
5641
5721
|
} break;
|
5642
5722
|
case kUpb_CType_String:
|
@@ -5713,6 +5793,7 @@ upb_Message* _upb_Message_Copy(upb_Message* dst, const upb_Message* src,
|
|
5713
5793
|
|
5714
5794
|
bool upb_Message_DeepCopy(upb_Message* dst, const upb_Message* src,
|
5715
5795
|
const upb_MiniTable* mini_table, upb_Arena* arena) {
|
5796
|
+
UPB_ASSERT(!upb_Message_IsFrozen(dst));
|
5716
5797
|
upb_Message_Clear(dst, mini_table);
|
5717
5798
|
return _upb_Message_Copy(dst, src, mini_table, arena) != NULL;
|
5718
5799
|
}
|
@@ -5729,6 +5810,7 @@ upb_Message* upb_Message_DeepClone(const upb_Message* msg,
|
|
5729
5810
|
// Performs a shallow copy. TODO: Extend to handle unknown fields.
|
5730
5811
|
void upb_Message_ShallowCopy(upb_Message* dst, const upb_Message* src,
|
5731
5812
|
const upb_MiniTable* m) {
|
5813
|
+
UPB_ASSERT(!upb_Message_IsFrozen(dst));
|
5732
5814
|
memcpy(dst, src, m->UPB_PRIVATE(size));
|
5733
5815
|
}
|
5734
5816
|
|
@@ -5741,6 +5823,36 @@ upb_Message* upb_Message_ShallowClone(const upb_Message* msg,
|
|
5741
5823
|
return clone;
|
5742
5824
|
}
|
5743
5825
|
|
5826
|
+
#include "stddef.h"
|
5827
|
+
|
5828
|
+
// Must be last.
|
5829
|
+
|
5830
|
+
bool upb_Message_MergeFrom(upb_Message* dst, const upb_Message* src,
|
5831
|
+
const upb_MiniTable* mt,
|
5832
|
+
const upb_ExtensionRegistry* extreg,
|
5833
|
+
upb_Arena* arena) {
|
5834
|
+
char* buf = NULL;
|
5835
|
+
size_t size = 0;
|
5836
|
+
// This tmp arena is used to hold the bytes for `src` serialized. This bends
|
5837
|
+
// the typical "no hidden allocations" design of upb, but under a properly
|
5838
|
+
// optimized implementation this extra allocation would not be necessary and
|
5839
|
+
// so we don't want to unnecessarily have the bad API or bloat the passed-in
|
5840
|
+
// arena with this very-short-term allocation.
|
5841
|
+
upb_Arena* encode_arena = upb_Arena_New();
|
5842
|
+
upb_EncodeStatus e_status = upb_Encode(src, mt, 0, encode_arena, &buf, &size);
|
5843
|
+
if (e_status != kUpb_EncodeStatus_Ok) {
|
5844
|
+
upb_Arena_Free(encode_arena);
|
5845
|
+
return false;
|
5846
|
+
}
|
5847
|
+
upb_DecodeStatus d_status = upb_Decode(buf, size, dst, mt, extreg, 0, arena);
|
5848
|
+
if (d_status != kUpb_DecodeStatus_Ok) {
|
5849
|
+
upb_Arena_Free(encode_arena);
|
5850
|
+
return false;
|
5851
|
+
}
|
5852
|
+
upb_Arena_Free(encode_arena);
|
5853
|
+
return true;
|
5854
|
+
}
|
5855
|
+
|
5744
5856
|
|
5745
5857
|
#include <stddef.h>
|
5746
5858
|
#include <stdint.h>
|
@@ -6248,11 +6360,15 @@ static void upb_MtDecoder_AllocateSubs(upb_MtDecoder* d,
|
|
6248
6360
|
upb_SubCounts sub_counts) {
|
6249
6361
|
uint32_t total_count = sub_counts.submsg_count + sub_counts.subenum_count;
|
6250
6362
|
size_t subs_bytes = sizeof(*d->table->UPB_PRIVATE(subs)) * total_count;
|
6251
|
-
|
6363
|
+
size_t ptrs_bytes = sizeof(upb_MiniTable*) * sub_counts.submsg_count;
|
6364
|
+
upb_MiniTableSubInternal* subs = upb_Arena_Malloc(d->arena, subs_bytes);
|
6365
|
+
const upb_MiniTable** subs_ptrs = upb_Arena_Malloc(d->arena, ptrs_bytes);
|
6252
6366
|
upb_MdDecoder_CheckOutOfMemory(&d->base, subs);
|
6367
|
+
upb_MdDecoder_CheckOutOfMemory(&d->base, subs_ptrs);
|
6253
6368
|
uint32_t i = 0;
|
6254
6369
|
for (; i < sub_counts.submsg_count; i++) {
|
6255
|
-
|
6370
|
+
subs_ptrs[i] = UPB_PRIVATE(_upb_MiniTable_Empty)();
|
6371
|
+
subs[i].UPB_PRIVATE(submsg) = &subs_ptrs[i];
|
6256
6372
|
}
|
6257
6373
|
if (sub_counts.subenum_count) {
|
6258
6374
|
upb_MiniTableField* f = d->fields;
|
@@ -6744,6 +6860,7 @@ upb_MiniTable* _upb_MiniTable_Build(const char* data, size_t len,
|
|
6744
6860
|
|
6745
6861
|
#include <stddef.h>
|
6746
6862
|
#include <stdint.h>
|
6863
|
+
#include <string.h>
|
6747
6864
|
|
6748
6865
|
|
6749
6866
|
// Must be last.
|
@@ -6779,12 +6896,12 @@ bool upb_MiniTable_SetSubMessage(upb_MiniTable* table,
|
|
6779
6896
|
return false;
|
6780
6897
|
}
|
6781
6898
|
|
6782
|
-
|
6783
|
-
|
6899
|
+
int idx = field->UPB_PRIVATE(submsg_index);
|
6900
|
+
upb_MiniTableSubInternal* table_subs = (void*)table->UPB_PRIVATE(subs);
|
6784
6901
|
// TODO: Add this assert back once YouTube is updated to not call
|
6785
6902
|
// this function repeatedly.
|
6786
6903
|
// UPB_ASSERT(UPB_PRIVATE(_upb_MiniTable_IsEmpty)(table_sub->submsg));
|
6787
|
-
*
|
6904
|
+
memcpy((void*)table_subs[idx].UPB_PRIVATE(submsg), &sub, sizeof(void*));
|
6788
6905
|
return true;
|
6789
6906
|
}
|
6790
6907
|
|
@@ -6919,6 +7036,24 @@ failure:
|
|
6919
7036
|
return false;
|
6920
7037
|
}
|
6921
7038
|
|
7039
|
+
#ifdef UPB_LINKARR_DECLARE
|
7040
|
+
|
7041
|
+
UPB_LINKARR_DECLARE(upb_AllExts, upb_MiniTableExtension);
|
7042
|
+
|
7043
|
+
bool upb_ExtensionRegistry_AddAllLinkedExtensions(upb_ExtensionRegistry* r) {
|
7044
|
+
const upb_MiniTableExtension* start = UPB_LINKARR_START(upb_AllExts);
|
7045
|
+
const upb_MiniTableExtension* stop = UPB_LINKARR_STOP(upb_AllExts);
|
7046
|
+
for (const upb_MiniTableExtension* p = start; p < stop; p++) {
|
7047
|
+
// Windows can introduce zero padding, so we have to skip zeroes.
|
7048
|
+
if (upb_MiniTableExtension_Number(p) != 0) {
|
7049
|
+
if (!upb_ExtensionRegistry_Add(r, p)) return false;
|
7050
|
+
}
|
7051
|
+
}
|
7052
|
+
return true;
|
7053
|
+
}
|
7054
|
+
|
7055
|
+
#endif // UPB_LINKARR_DECLARE
|
7056
|
+
|
6922
7057
|
const upb_MiniTableExtension* upb_ExtensionRegistry_Lookup(
|
6923
7058
|
const upb_ExtensionRegistry* r, const upb_MiniTable* t, uint32_t num) {
|
6924
7059
|
char buf[EXTREG_KEY_SIZE];
|
@@ -7157,15 +7292,15 @@ typedef union {
|
|
7157
7292
|
// Returns the MiniTable corresponding to a given MiniTableField
|
7158
7293
|
// from an array of MiniTableSubs.
|
7159
7294
|
static const upb_MiniTable* _upb_MiniTableSubs_MessageByField(
|
7160
|
-
const
|
7161
|
-
return
|
7295
|
+
const upb_MiniTableSubInternal* subs, const upb_MiniTableField* field) {
|
7296
|
+
return *subs[field->UPB_PRIVATE(submsg_index)].UPB_PRIVATE(submsg);
|
7162
7297
|
}
|
7163
7298
|
|
7164
7299
|
// Returns the MiniTableEnum corresponding to a given MiniTableField
|
7165
7300
|
// from an array of MiniTableSub.
|
7166
7301
|
static const upb_MiniTableEnum* _upb_MiniTableSubs_EnumByField(
|
7167
|
-
const
|
7168
|
-
return
|
7302
|
+
const upb_MiniTableSubInternal* subs, const upb_MiniTableField* field) {
|
7303
|
+
return subs[field->UPB_PRIVATE(submsg_index)].UPB_PRIVATE(subenum);
|
7169
7304
|
}
|
7170
7305
|
|
7171
7306
|
static const char* _upb_Decoder_DecodeMessage(upb_Decoder* d, const char* ptr,
|
@@ -7300,11 +7435,10 @@ static void _upb_Decoder_Munge(int type, wireval* val) {
|
|
7300
7435
|
}
|
7301
7436
|
}
|
7302
7437
|
|
7303
|
-
static upb_Message*
|
7304
|
-
|
7305
|
-
|
7306
|
-
|
7307
|
-
const upb_MiniTable* subl = _upb_MiniTableSubs_MessageByField(subs, field);
|
7438
|
+
static upb_Message* _upb_Decoder_NewSubMessage2(upb_Decoder* d,
|
7439
|
+
const upb_MiniTable* subl,
|
7440
|
+
const upb_MiniTableField* field,
|
7441
|
+
upb_TaggedMessagePtr* target) {
|
7308
7442
|
UPB_ASSERT(subl);
|
7309
7443
|
upb_Message* msg = _upb_Message_New(subl, &d->arena);
|
7310
7444
|
if (!msg) _upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory);
|
@@ -7325,8 +7459,15 @@ static upb_Message* _upb_Decoder_NewSubMessage(upb_Decoder* d,
|
|
7325
7459
|
return msg;
|
7326
7460
|
}
|
7327
7461
|
|
7462
|
+
static upb_Message* _upb_Decoder_NewSubMessage(
|
7463
|
+
upb_Decoder* d, const upb_MiniTableSubInternal* subs,
|
7464
|
+
const upb_MiniTableField* field, upb_TaggedMessagePtr* target) {
|
7465
|
+
const upb_MiniTable* subl = _upb_MiniTableSubs_MessageByField(subs, field);
|
7466
|
+
return _upb_Decoder_NewSubMessage2(d, subl, field, target);
|
7467
|
+
}
|
7468
|
+
|
7328
7469
|
static upb_Message* _upb_Decoder_ReuseSubMessage(
|
7329
|
-
upb_Decoder* d, const
|
7470
|
+
upb_Decoder* d, const upb_MiniTableSubInternal* subs,
|
7330
7471
|
const upb_MiniTableField* field, upb_TaggedMessagePtr* target) {
|
7331
7472
|
upb_TaggedMessagePtr tagged = *target;
|
7332
7473
|
const upb_MiniTable* subl = _upb_MiniTableSubs_MessageByField(subs, field);
|
@@ -7379,7 +7520,7 @@ const char* _upb_Decoder_RecurseSubMessage(upb_Decoder* d, const char* ptr,
|
|
7379
7520
|
UPB_FORCEINLINE
|
7380
7521
|
const char* _upb_Decoder_DecodeSubMessage(upb_Decoder* d, const char* ptr,
|
7381
7522
|
upb_Message* submsg,
|
7382
|
-
const
|
7523
|
+
const upb_MiniTableSubInternal* subs,
|
7383
7524
|
const upb_MiniTableField* field,
|
7384
7525
|
int size) {
|
7385
7526
|
int saved_delta = upb_EpsCopyInputStream_PushLimit(&d->input, ptr, size);
|
@@ -7412,7 +7553,7 @@ const char* _upb_Decoder_DecodeUnknownGroup(upb_Decoder* d, const char* ptr,
|
|
7412
7553
|
UPB_FORCEINLINE
|
7413
7554
|
const char* _upb_Decoder_DecodeKnownGroup(upb_Decoder* d, const char* ptr,
|
7414
7555
|
upb_Message* submsg,
|
7415
|
-
const
|
7556
|
+
const upb_MiniTableSubInternal* subs,
|
7416
7557
|
const upb_MiniTableField* field) {
|
7417
7558
|
const upb_MiniTable* subl = _upb_MiniTableSubs_MessageByField(subs, field);
|
7418
7559
|
UPB_ASSERT(subl);
|
@@ -7463,12 +7604,10 @@ bool _upb_Decoder_CheckEnum(upb_Decoder* d, const char* ptr, upb_Message* msg,
|
|
7463
7604
|
}
|
7464
7605
|
|
7465
7606
|
UPB_NOINLINE
|
7466
|
-
static const char* _upb_Decoder_DecodeEnumArray(
|
7467
|
-
|
7468
|
-
|
7469
|
-
|
7470
|
-
const upb_MiniTableField* field,
|
7471
|
-
wireval* val) {
|
7607
|
+
static const char* _upb_Decoder_DecodeEnumArray(
|
7608
|
+
upb_Decoder* d, const char* ptr, upb_Message* msg, upb_Array* arr,
|
7609
|
+
const upb_MiniTableSubInternal* subs, const upb_MiniTableField* field,
|
7610
|
+
wireval* val) {
|
7472
7611
|
const upb_MiniTableEnum* e = _upb_MiniTableSubs_EnumByField(subs, field);
|
7473
7612
|
if (!_upb_Decoder_CheckEnum(d, ptr, msg, e, field, val)) return ptr;
|
7474
7613
|
void* mem = UPB_PTR_AT(upb_Array_MutableDataPtr(arr),
|
@@ -7544,7 +7683,7 @@ const char* _upb_Decoder_DecodeVarintPacked(upb_Decoder* d, const char* ptr,
|
|
7544
7683
|
UPB_NOINLINE
|
7545
7684
|
static const char* _upb_Decoder_DecodeEnumPacked(
|
7546
7685
|
upb_Decoder* d, const char* ptr, upb_Message* msg, upb_Array* arr,
|
7547
|
-
const
|
7686
|
+
const upb_MiniTableSubInternal* subs, const upb_MiniTableField* field,
|
7548
7687
|
wireval* val) {
|
7549
7688
|
const upb_MiniTableEnum* e = _upb_MiniTableSubs_EnumByField(subs, field);
|
7550
7689
|
int saved_limit = upb_EpsCopyInputStream_PushLimit(&d->input, ptr, val->size);
|
@@ -7578,11 +7717,10 @@ static upb_Array* _upb_Decoder_CreateArray(upb_Decoder* d,
|
|
7578
7717
|
return ret;
|
7579
7718
|
}
|
7580
7719
|
|
7581
|
-
static const char* _upb_Decoder_DecodeToArray(
|
7582
|
-
|
7583
|
-
|
7584
|
-
|
7585
|
-
wireval* val, int op) {
|
7720
|
+
static const char* _upb_Decoder_DecodeToArray(
|
7721
|
+
upb_Decoder* d, const char* ptr, upb_Message* msg,
|
7722
|
+
const upb_MiniTableSubInternal* subs, const upb_MiniTableField* field,
|
7723
|
+
wireval* val, int op) {
|
7586
7724
|
upb_Array** arrp = UPB_PTR_AT(msg, field->UPB_PRIVATE(offset), void);
|
7587
7725
|
upb_Array* arr = *arrp;
|
7588
7726
|
void* mem;
|
@@ -7683,11 +7821,10 @@ static upb_Map* _upb_Decoder_CreateMap(upb_Decoder* d,
|
|
7683
7821
|
return ret;
|
7684
7822
|
}
|
7685
7823
|
|
7686
|
-
static const char* _upb_Decoder_DecodeToMap(
|
7687
|
-
|
7688
|
-
|
7689
|
-
|
7690
|
-
wireval* val) {
|
7824
|
+
static const char* _upb_Decoder_DecodeToMap(
|
7825
|
+
upb_Decoder* d, const char* ptr, upb_Message* msg,
|
7826
|
+
const upb_MiniTableSubInternal* subs, const upb_MiniTableField* field,
|
7827
|
+
wireval* val) {
|
7691
7828
|
upb_Map** map_p = UPB_PTR_AT(msg, field->UPB_PRIVATE(offset), upb_Map*);
|
7692
7829
|
upb_Map* map = *map_p;
|
7693
7830
|
upb_MapEntry ent;
|
@@ -7748,8 +7885,8 @@ static const char* _upb_Decoder_DecodeToMap(upb_Decoder* d, const char* ptr,
|
|
7748
7885
|
|
7749
7886
|
static const char* _upb_Decoder_DecodeToSubMessage(
|
7750
7887
|
upb_Decoder* d, const char* ptr, upb_Message* msg,
|
7751
|
-
const
|
7752
|
-
int op) {
|
7888
|
+
const upb_MiniTableSubInternal* subs, const upb_MiniTableField* field,
|
7889
|
+
wireval* val, int op) {
|
7753
7890
|
void* mem = UPB_PTR_AT(msg, field->UPB_PRIVATE(offset), void);
|
7754
7891
|
int type = field->UPB_PRIVATE(descriptortype);
|
7755
7892
|
|
@@ -7879,9 +8016,9 @@ static void upb_Decoder_AddKnownMessageSetItem(
|
|
7879
8016
|
if (UPB_UNLIKELY(!ext)) {
|
7880
8017
|
_upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory);
|
7881
8018
|
}
|
7882
|
-
upb_Message* submsg =
|
7883
|
-
d,
|
7884
|
-
(upb_TaggedMessagePtr*)&ext->data);
|
8019
|
+
upb_Message* submsg = _upb_Decoder_NewSubMessage2(
|
8020
|
+
d, ext->ext->UPB_PRIVATE(sub).UPB_PRIVATE(submsg),
|
8021
|
+
&ext->ext->UPB_PRIVATE(field), (upb_TaggedMessagePtr*)&ext->data);
|
7885
8022
|
upb_DecodeStatus status = upb_Decode(
|
7886
8023
|
data, size, submsg, upb_MiniTableExtension_GetSubMessage(item_mt),
|
7887
8024
|
d->extreg, d->options, &d->arena);
|
@@ -8082,8 +8219,9 @@ void _upb_Decoder_CheckUnlinked(upb_Decoder* d, const upb_MiniTable* mt,
|
|
8082
8219
|
// unlinked.
|
8083
8220
|
do {
|
8084
8221
|
UPB_ASSERT(upb_MiniTableField_CType(oneof) == kUpb_CType_Message);
|
8085
|
-
const
|
8086
|
-
|
8222
|
+
const upb_MiniTable* oneof_sub =
|
8223
|
+
*mt->UPB_PRIVATE(subs)[oneof->UPB_PRIVATE(submsg_index)].UPB_PRIVATE(
|
8224
|
+
submsg);
|
8087
8225
|
UPB_ASSERT(!oneof_sub);
|
8088
8226
|
} while (upb_MiniTable_NextOneofField(mt, &oneof));
|
8089
8227
|
}
|
@@ -8221,8 +8359,9 @@ const char* _upb_Decoder_DecodeKnownField(upb_Decoder* d, const char* ptr,
|
|
8221
8359
|
const upb_MiniTable* layout,
|
8222
8360
|
const upb_MiniTableField* field,
|
8223
8361
|
int op, wireval* val) {
|
8224
|
-
const
|
8362
|
+
const upb_MiniTableSubInternal* subs = layout->UPB_PRIVATE(subs);
|
8225
8363
|
uint8_t mode = field->UPB_PRIVATE(mode);
|
8364
|
+
upb_MiniTableSubInternal ext_sub;
|
8226
8365
|
|
8227
8366
|
if (UPB_UNLIKELY(mode & kUpb_LabelFlags_IsExtension)) {
|
8228
8367
|
const upb_MiniTableExtension* ext_layout =
|
@@ -8234,7 +8373,14 @@ const char* _upb_Decoder_DecodeKnownField(upb_Decoder* d, const char* ptr,
|
|
8234
8373
|
}
|
8235
8374
|
d->unknown_msg = msg;
|
8236
8375
|
msg = (upb_Message*)&ext->data;
|
8237
|
-
|
8376
|
+
if (upb_MiniTableField_IsSubMessage(&ext->ext->UPB_PRIVATE(field))) {
|
8377
|
+
ext_sub.UPB_PRIVATE(submsg) =
|
8378
|
+
&ext->ext->UPB_PRIVATE(sub).UPB_PRIVATE(submsg);
|
8379
|
+
} else {
|
8380
|
+
ext_sub.UPB_PRIVATE(subenum) =
|
8381
|
+
ext->ext->UPB_PRIVATE(sub).UPB_PRIVATE(subenum);
|
8382
|
+
}
|
8383
|
+
subs = &ext_sub;
|
8238
8384
|
}
|
8239
8385
|
|
8240
8386
|
switch (mode & kUpb_FieldMode_Mask) {
|
@@ -8489,6 +8635,27 @@ upb_DecodeStatus upb_DecodeLengthPrefixed(const char* buf, size_t size,
|
|
8489
8635
|
return upb_Decode(buf, msg_len, msg, mt, extreg, options, arena);
|
8490
8636
|
}
|
8491
8637
|
|
8638
|
+
const char* upb_DecodeStatus_String(upb_DecodeStatus status) {
|
8639
|
+
switch (status) {
|
8640
|
+
case kUpb_DecodeStatus_Ok:
|
8641
|
+
return "Ok";
|
8642
|
+
case kUpb_DecodeStatus_Malformed:
|
8643
|
+
return "Wire format was corrupt";
|
8644
|
+
case kUpb_DecodeStatus_OutOfMemory:
|
8645
|
+
return "Arena alloc failed";
|
8646
|
+
case kUpb_DecodeStatus_BadUtf8:
|
8647
|
+
return "String field had bad UTF-8";
|
8648
|
+
case kUpb_DecodeStatus_MaxDepthExceeded:
|
8649
|
+
return "Exceeded upb_DecodeOptions_MaxDepth";
|
8650
|
+
case kUpb_DecodeStatus_MissingRequired:
|
8651
|
+
return "Missing required field";
|
8652
|
+
case kUpb_DecodeStatus_UnlinkedSubMessage:
|
8653
|
+
return "Unlinked sub-message field was present";
|
8654
|
+
default:
|
8655
|
+
return "Unknown decode status";
|
8656
|
+
}
|
8657
|
+
}
|
8658
|
+
|
8492
8659
|
#undef OP_FIXPCK_LG2
|
8493
8660
|
#undef OP_VARPCK_LG2
|
8494
8661
|
|
@@ -8503,6 +8670,13 @@ upb_DecodeStatus upb_DecodeLengthPrefixed(const char* buf, size_t size,
|
|
8503
8670
|
|
8504
8671
|
// Must be last.
|
8505
8672
|
|
8673
|
+
// Returns the MiniTable corresponding to a given MiniTableField
|
8674
|
+
// from an array of MiniTableSubs.
|
8675
|
+
static const upb_MiniTable* _upb_Encoder_GetSubMiniTable(
|
8676
|
+
const upb_MiniTableSubInternal* subs, const upb_MiniTableField* field) {
|
8677
|
+
return *subs[field->UPB_PRIVATE(submsg_index)].UPB_PRIVATE(submsg);
|
8678
|
+
}
|
8679
|
+
|
8506
8680
|
#define UPB_PB_VARINT_MAX_LEN 10
|
8507
8681
|
|
8508
8682
|
UPB_NOINLINE
|
@@ -8684,7 +8858,7 @@ static void encode_TaggedMessagePtr(upb_encstate* e,
|
|
8684
8858
|
}
|
8685
8859
|
|
8686
8860
|
static void encode_scalar(upb_encstate* e, const void* _field_mem,
|
8687
|
-
const
|
8861
|
+
const upb_MiniTableSubInternal* subs,
|
8688
8862
|
const upb_MiniTableField* f) {
|
8689
8863
|
const char* field_mem = _field_mem;
|
8690
8864
|
int wire_type;
|
@@ -8733,8 +8907,7 @@ static void encode_scalar(upb_encstate* e, const void* _field_mem,
|
|
8733
8907
|
case kUpb_FieldType_Group: {
|
8734
8908
|
size_t size;
|
8735
8909
|
upb_TaggedMessagePtr submsg = *(upb_TaggedMessagePtr*)field_mem;
|
8736
|
-
const upb_MiniTable* subm =
|
8737
|
-
upb_MiniTableSub_Message(subs[f->UPB_PRIVATE(submsg_index)]);
|
8910
|
+
const upb_MiniTable* subm = _upb_Encoder_GetSubMiniTable(subs, f);
|
8738
8911
|
if (submsg == 0) {
|
8739
8912
|
return;
|
8740
8913
|
}
|
@@ -8748,8 +8921,7 @@ static void encode_scalar(upb_encstate* e, const void* _field_mem,
|
|
8748
8921
|
case kUpb_FieldType_Message: {
|
8749
8922
|
size_t size;
|
8750
8923
|
upb_TaggedMessagePtr submsg = *(upb_TaggedMessagePtr*)field_mem;
|
8751
|
-
const upb_MiniTable* subm =
|
8752
|
-
upb_MiniTableSub_Message(subs[f->UPB_PRIVATE(submsg_index)]);
|
8924
|
+
const upb_MiniTable* subm = _upb_Encoder_GetSubMiniTable(subs, f);
|
8753
8925
|
if (submsg == 0) {
|
8754
8926
|
return;
|
8755
8927
|
}
|
@@ -8769,7 +8941,7 @@ static void encode_scalar(upb_encstate* e, const void* _field_mem,
|
|
8769
8941
|
}
|
8770
8942
|
|
8771
8943
|
static void encode_array(upb_encstate* e, const upb_Message* msg,
|
8772
|
-
const
|
8944
|
+
const upb_MiniTableSubInternal* subs,
|
8773
8945
|
const upb_MiniTableField* f) {
|
8774
8946
|
const upb_Array* arr = *UPB_PTR_AT(msg, f->UPB_PRIVATE(offset), upb_Array*);
|
8775
8947
|
bool packed = upb_MiniTableField_IsPacked(f);
|
@@ -8839,8 +9011,7 @@ static void encode_array(upb_encstate* e, const upb_Message* msg,
|
|
8839
9011
|
case kUpb_FieldType_Group: {
|
8840
9012
|
const upb_TaggedMessagePtr* start = upb_Array_DataPtr(arr);
|
8841
9013
|
const upb_TaggedMessagePtr* ptr = start + upb_Array_Size(arr);
|
8842
|
-
const upb_MiniTable* subm =
|
8843
|
-
upb_MiniTableSub_Message(subs[f->UPB_PRIVATE(submsg_index)]);
|
9014
|
+
const upb_MiniTable* subm = _upb_Encoder_GetSubMiniTable(subs, f);
|
8844
9015
|
if (--e->depth == 0) encode_err(e, kUpb_EncodeStatus_MaxDepthExceeded);
|
8845
9016
|
do {
|
8846
9017
|
size_t size;
|
@@ -8855,8 +9026,7 @@ static void encode_array(upb_encstate* e, const upb_Message* msg,
|
|
8855
9026
|
case kUpb_FieldType_Message: {
|
8856
9027
|
const upb_TaggedMessagePtr* start = upb_Array_DataPtr(arr);
|
8857
9028
|
const upb_TaggedMessagePtr* ptr = start + upb_Array_Size(arr);
|
8858
|
-
const upb_MiniTable* subm =
|
8859
|
-
upb_MiniTableSub_Message(subs[f->UPB_PRIVATE(submsg_index)]);
|
9029
|
+
const upb_MiniTable* subm = _upb_Encoder_GetSubMiniTable(subs, f);
|
8860
9030
|
if (--e->depth == 0) encode_err(e, kUpb_EncodeStatus_MaxDepthExceeded);
|
8861
9031
|
do {
|
8862
9032
|
size_t size;
|
@@ -8892,11 +9062,10 @@ static void encode_mapentry(upb_encstate* e, uint32_t number,
|
|
8892
9062
|
}
|
8893
9063
|
|
8894
9064
|
static void encode_map(upb_encstate* e, const upb_Message* msg,
|
8895
|
-
const
|
9065
|
+
const upb_MiniTableSubInternal* subs,
|
8896
9066
|
const upb_MiniTableField* f) {
|
8897
9067
|
const upb_Map* map = *UPB_PTR_AT(msg, f->UPB_PRIVATE(offset), const upb_Map*);
|
8898
|
-
const upb_MiniTable* layout =
|
8899
|
-
upb_MiniTableSub_Message(subs[f->UPB_PRIVATE(submsg_index)]);
|
9068
|
+
const upb_MiniTable* layout = _upb_Encoder_GetSubMiniTable(subs, f);
|
8900
9069
|
UPB_ASSERT(upb_MiniTable_FieldCount(layout) == 2);
|
8901
9070
|
|
8902
9071
|
if (!map || !upb_Map_Size(map)) return;
|
@@ -8925,7 +9094,6 @@ static void encode_map(upb_encstate* e, const upb_Message* msg,
|
|
8925
9094
|
}
|
8926
9095
|
|
8927
9096
|
static bool encode_shouldencode(upb_encstate* e, const upb_Message* msg,
|
8928
|
-
const upb_MiniTableSub* subs,
|
8929
9097
|
const upb_MiniTableField* f) {
|
8930
9098
|
if (f->presence == 0) {
|
8931
9099
|
// Proto3 presence or map/array.
|
@@ -8964,7 +9132,7 @@ static bool encode_shouldencode(upb_encstate* e, const upb_Message* msg,
|
|
8964
9132
|
}
|
8965
9133
|
|
8966
9134
|
static void encode_field(upb_encstate* e, const upb_Message* msg,
|
8967
|
-
const
|
9135
|
+
const upb_MiniTableSubInternal* subs,
|
8968
9136
|
const upb_MiniTableField* field) {
|
8969
9137
|
switch (UPB_PRIVATE(_upb_MiniTableField_Mode)(field)) {
|
8970
9138
|
case kUpb_FieldMode_Array:
|
@@ -8999,7 +9167,14 @@ static void encode_ext(upb_encstate* e, const upb_Extension* ext,
|
|
8999
9167
|
if (UPB_UNLIKELY(is_message_set)) {
|
9000
9168
|
encode_msgset_item(e, ext);
|
9001
9169
|
} else {
|
9002
|
-
|
9170
|
+
upb_MiniTableSubInternal sub;
|
9171
|
+
if (upb_MiniTableField_IsSubMessage(&ext->ext->UPB_PRIVATE(field))) {
|
9172
|
+
sub.UPB_PRIVATE(submsg) = &ext->ext->UPB_PRIVATE(sub).UPB_PRIVATE(submsg);
|
9173
|
+
} else {
|
9174
|
+
sub.UPB_PRIVATE(subenum) =
|
9175
|
+
ext->ext->UPB_PRIVATE(sub).UPB_PRIVATE(subenum);
|
9176
|
+
}
|
9177
|
+
encode_field(e, (upb_Message*)&ext->data, &sub,
|
9003
9178
|
&ext->ext->UPB_PRIVATE(field));
|
9004
9179
|
}
|
9005
9180
|
}
|
@@ -9055,7 +9230,7 @@ static void encode_message(upb_encstate* e, const upb_Message* msg,
|
|
9055
9230
|
const upb_MiniTableField* first = &m->UPB_PRIVATE(fields)[0];
|
9056
9231
|
while (f != first) {
|
9057
9232
|
f--;
|
9058
|
-
if (encode_shouldencode(e, msg,
|
9233
|
+
if (encode_shouldencode(e, msg, f)) {
|
9059
9234
|
encode_field(e, msg, m->UPB_PRIVATE(subs), f);
|
9060
9235
|
}
|
9061
9236
|
}
|
@@ -9129,6 +9304,21 @@ upb_EncodeStatus upb_EncodeLengthPrefixed(const upb_Message* msg,
|
|
9129
9304
|
return _upb_Encode(msg, l, options, arena, buf, size, true);
|
9130
9305
|
}
|
9131
9306
|
|
9307
|
+
const char* upb_EncodeStatus_String(upb_EncodeStatus status) {
|
9308
|
+
switch (status) {
|
9309
|
+
case kUpb_EncodeStatus_Ok:
|
9310
|
+
return "Ok";
|
9311
|
+
case kUpb_EncodeStatus_MissingRequired:
|
9312
|
+
return "Missing required field";
|
9313
|
+
case kUpb_EncodeStatus_MaxDepthExceeded:
|
9314
|
+
return "Max depth exceeded";
|
9315
|
+
case kUpb_EncodeStatus_OutOfMemory:
|
9316
|
+
return "Arena alloc failed";
|
9317
|
+
default:
|
9318
|
+
return "Unknown encode status";
|
9319
|
+
}
|
9320
|
+
}
|
9321
|
+
|
9132
9322
|
// Fast decoder: ~3x the speed of decode.c, but requires x86-64/ARM64.
|
9133
9323
|
// Also the table size grows by 2x.
|
9134
9324
|
//
|
@@ -9349,6 +9539,7 @@ UPB_FORCEINLINE
|
|
9349
9539
|
void* fastdecode_getfield(upb_Decoder* d, const char* ptr, upb_Message* msg,
|
9350
9540
|
uint64_t* data, uint64_t* hasbits,
|
9351
9541
|
fastdecode_arr* farr, int valbytes, upb_card card) {
|
9542
|
+
UPB_ASSERT(!upb_Message_IsFrozen(msg));
|
9352
9543
|
switch (card) {
|
9353
9544
|
case CARD_s: {
|
9354
9545
|
uint8_t hasbit_index = *data >> 24;
|
@@ -9724,6 +9915,7 @@ UPB_NOINLINE
|
|
9724
9915
|
static const char* fastdecode_verifyutf8(upb_Decoder* d, const char* ptr,
|
9725
9916
|
upb_Message* msg, intptr_t table,
|
9726
9917
|
uint64_t hasbits, uint64_t data) {
|
9918
|
+
UPB_ASSERT(!upb_Message_IsFrozen(msg));
|
9727
9919
|
upb_StringView* dst = (upb_StringView*)data;
|
9728
9920
|
if (!_upb_Decoder_VerifyUtf8Inline(dst->data, dst->size)) {
|
9729
9921
|
_upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_BadUtf8);
|
@@ -9769,6 +9961,7 @@ UPB_NOINLINE
|
|
9769
9961
|
static const char* fastdecode_longstring_noutf8(
|
9770
9962
|
struct upb_Decoder* d, const char* ptr, upb_Message* msg, intptr_t table,
|
9771
9963
|
uint64_t hasbits, uint64_t data) {
|
9964
|
+
UPB_ASSERT(!upb_Message_IsFrozen(msg));
|
9772
9965
|
upb_StringView* dst = (upb_StringView*)data;
|
9773
9966
|
FASTDECODE_LONGSTRING(d, ptr, msg, table, hasbits, dst, false);
|
9774
9967
|
}
|
@@ -11021,6 +11214,8 @@ const char* upb_BufToInt64(const char* ptr, const char* end, int64_t* val,
|
|
11021
11214
|
|
11022
11215
|
|
11023
11216
|
#include <float.h>
|
11217
|
+
#include <math.h>
|
11218
|
+
#include <stdio.h>
|
11024
11219
|
#include <stdlib.h>
|
11025
11220
|
|
11026
11221
|
// Must be last.
|
@@ -11040,6 +11235,10 @@ static void upb_FixLocale(char* p) {
|
|
11040
11235
|
|
11041
11236
|
void _upb_EncodeRoundTripDouble(double val, char* buf, size_t size) {
|
11042
11237
|
assert(size >= kUpb_RoundTripBufferSize);
|
11238
|
+
if (isnan(val)) {
|
11239
|
+
snprintf(buf, size, "%s", "nan");
|
11240
|
+
return;
|
11241
|
+
}
|
11043
11242
|
snprintf(buf, size, "%.*g", DBL_DIG, val);
|
11044
11243
|
if (strtod(buf, NULL) != val) {
|
11045
11244
|
snprintf(buf, size, "%.*g", DBL_DIG + 2, val);
|
@@ -11050,6 +11249,10 @@ void _upb_EncodeRoundTripDouble(double val, char* buf, size_t size) {
|
|
11050
11249
|
|
11051
11250
|
void _upb_EncodeRoundTripFloat(float val, char* buf, size_t size) {
|
11052
11251
|
assert(size >= kUpb_RoundTripBufferSize);
|
11252
|
+
if (isnan(val)) {
|
11253
|
+
snprintf(buf, size, "%s", "nan");
|
11254
|
+
return;
|
11255
|
+
}
|
11053
11256
|
snprintf(buf, size, "%.*g", FLT_DIG, val);
|
11054
11257
|
if (strtof(buf, NULL) != val) {
|
11055
11258
|
snprintf(buf, size, "%.*g", FLT_DIG + 3, val);
|
@@ -11469,6 +11672,7 @@ const upb_Extension* UPB_PRIVATE(_upb_Message_Getexts)(
|
|
11469
11672
|
|
11470
11673
|
upb_Extension* UPB_PRIVATE(_upb_Message_GetOrCreateExtension)(
|
11471
11674
|
struct upb_Message* msg, const upb_MiniTableExtension* e, upb_Arena* a) {
|
11675
|
+
UPB_ASSERT(!upb_Message_IsFrozen(msg));
|
11472
11676
|
upb_Extension* ext = (upb_Extension*)UPB_PRIVATE(_upb_Message_Getext)(msg, e);
|
11473
11677
|
if (ext) return ext;
|
11474
11678
|
if (!UPB_PRIVATE(_upb_Message_Realloc)(msg, sizeof(upb_Extension), a))
|
@@ -11494,6 +11698,7 @@ const double kUpb_NaN = NAN;
|
|
11494
11698
|
|
11495
11699
|
bool UPB_PRIVATE(_upb_Message_Realloc)(struct upb_Message* msg, size_t need,
|
11496
11700
|
upb_Arena* a) {
|
11701
|
+
UPB_ASSERT(!upb_Message_IsFrozen(msg));
|
11497
11702
|
const size_t overhead = sizeof(upb_Message_Internal);
|
11498
11703
|
|
11499
11704
|
upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg);
|
@@ -11530,22 +11735,80 @@ bool UPB_PRIVATE(_upb_Message_Realloc)(struct upb_Message* msg, size_t need,
|
|
11530
11735
|
}
|
11531
11736
|
|
11532
11737
|
#if UPB_TRACING_ENABLED
|
11533
|
-
static void (*
|
11534
|
-
|
11738
|
+
static void (*_message_trace_handler)(const upb_MiniTable*, const upb_Arena*);
|
11739
|
+
|
11740
|
+
void upb_Message_LogNewMessage(const upb_MiniTable* m, const upb_Arena* arena) {
|
11741
|
+
if (_message_trace_handler) {
|
11742
|
+
_message_trace_handler(m, arena);
|
11743
|
+
}
|
11744
|
+
}
|
11535
11745
|
|
11536
|
-
void
|
11537
|
-
|
11538
|
-
|
11746
|
+
void upb_Message_SetNewMessageTraceHandler(void (*handler)(const upb_MiniTable*,
|
11747
|
+
const upb_Arena*)) {
|
11748
|
+
_message_trace_handler = handler;
|
11539
11749
|
}
|
11750
|
+
#endif // UPB_TRACING_ENABLED
|
11751
|
+
|
11752
|
+
|
11753
|
+
#include <stddef.h>
|
11540
11754
|
|
11541
|
-
|
11542
|
-
|
11543
|
-
|
11544
|
-
|
11755
|
+
|
11756
|
+
// Must be last.
|
11757
|
+
|
11758
|
+
bool UPB_PRIVATE(_upb_Message_NextBaseField)(const upb_Message* msg,
|
11759
|
+
const upb_MiniTable* m,
|
11760
|
+
const upb_MiniTableField** out_f,
|
11761
|
+
upb_MessageValue* out_v,
|
11762
|
+
size_t* iter) {
|
11763
|
+
const size_t count = upb_MiniTable_FieldCount(m);
|
11764
|
+
size_t i = *iter;
|
11765
|
+
|
11766
|
+
while (++i < count) {
|
11767
|
+
const upb_MiniTableField* f = upb_MiniTable_GetFieldByIndex(m, i);
|
11768
|
+
const void* src = UPB_PRIVATE(_upb_Message_DataPtr)(msg, f);
|
11769
|
+
|
11770
|
+
upb_MessageValue val;
|
11771
|
+
UPB_PRIVATE(_upb_MiniTableField_DataCopy)(f, &val, src);
|
11772
|
+
|
11773
|
+
// Skip field if unset or empty.
|
11774
|
+
if (upb_MiniTableField_HasPresence(f)) {
|
11775
|
+
if (!upb_Message_HasBaseField(msg, f)) continue;
|
11776
|
+
} else {
|
11777
|
+
if (UPB_PRIVATE(_upb_MiniTableField_DataIsZero)(f, src)) continue;
|
11778
|
+
|
11779
|
+
if (upb_MiniTableField_IsArray(f)) {
|
11780
|
+
if (upb_Array_Size(val.array_val) == 0) continue;
|
11781
|
+
} else if (upb_MiniTableField_IsMap(f)) {
|
11782
|
+
if (upb_Map_Size(val.map_val) == 0) continue;
|
11783
|
+
}
|
11784
|
+
}
|
11785
|
+
|
11786
|
+
*out_f = f;
|
11787
|
+
*out_v = val;
|
11788
|
+
*iter = i;
|
11789
|
+
return true;
|
11545
11790
|
}
|
11791
|
+
|
11792
|
+
return false;
|
11546
11793
|
}
|
11547
|
-
#endif
|
11548
11794
|
|
11795
|
+
bool UPB_PRIVATE(_upb_Message_NextExtension)(
|
11796
|
+
const upb_Message* msg, const upb_MiniTable* m,
|
11797
|
+
const upb_MiniTableExtension** out_e, upb_MessageValue* out_v,
|
11798
|
+
size_t* iter) {
|
11799
|
+
size_t count;
|
11800
|
+
const upb_Extension* exts = UPB_PRIVATE(_upb_Message_Getexts)(msg, &count);
|
11801
|
+
size_t i = *iter;
|
11802
|
+
|
11803
|
+
if (++i < count) {
|
11804
|
+
*out_e = exts[i].ext;
|
11805
|
+
*out_v = exts[i].data;
|
11806
|
+
*iter = i;
|
11807
|
+
return true;
|
11808
|
+
}
|
11809
|
+
|
11810
|
+
return false;
|
11811
|
+
}
|
11549
11812
|
|
11550
11813
|
const char _kUpb_ToBase92[] = {
|
11551
11814
|
' ', '!', '#', '$', '%', '&', '(', ')', '*', '+', ',', '-', '.', '/',
|
@@ -11882,7 +12145,12 @@ char* upb_MtDataEncoder_EndEnum(upb_MtDataEncoder* e, char* ptr) {
|
|
11882
12145
|
|
11883
12146
|
// Must be last.
|
11884
12147
|
|
11885
|
-
// A MiniTable for an empty message, used for unlinked sub-messages
|
12148
|
+
// A MiniTable for an empty message, used for unlinked sub-messages that are
|
12149
|
+
// built via MiniDescriptors. Messages that use this MiniTable may possibly
|
12150
|
+
// be linked later, in which case this MiniTable will be replaced with a real
|
12151
|
+
// one. This pattern is known as "dynamic tree shaking", and it introduces
|
12152
|
+
// complication because sub-messages may either be the "empty" type or the
|
12153
|
+
// "real" type. A tagged bit indicates the difference.
|
11886
12154
|
const struct upb_MiniTable UPB_PRIVATE(_kUpb_MiniTable_Empty) = {
|
11887
12155
|
.UPB_PRIVATE(subs) = NULL,
|
11888
12156
|
.UPB_PRIVATE(fields) = NULL,
|
@@ -11894,6 +12162,21 @@ const struct upb_MiniTable UPB_PRIVATE(_kUpb_MiniTable_Empty) = {
|
|
11894
12162
|
.UPB_PRIVATE(required_count) = 0,
|
11895
12163
|
};
|
11896
12164
|
|
12165
|
+
// A MiniTable for a statically tree shaken message. Messages that use this
|
12166
|
+
// MiniTable are guaranteed to remain unlinked; unlike the empty message, this
|
12167
|
+
// MiniTable is never replaced, which greatly simplifies everything, because the
|
12168
|
+
// type of a sub-message is always known, without consulting a tagged bit.
|
12169
|
+
const struct upb_MiniTable UPB_PRIVATE(_kUpb_MiniTable_StaticallyTreeShaken) = {
|
12170
|
+
.UPB_PRIVATE(subs) = NULL,
|
12171
|
+
.UPB_PRIVATE(fields) = NULL,
|
12172
|
+
.UPB_PRIVATE(size) = sizeof(struct upb_Message),
|
12173
|
+
.UPB_PRIVATE(field_count) = 0,
|
12174
|
+
.UPB_PRIVATE(ext) = kUpb_ExtMode_NonExtendable,
|
12175
|
+
.UPB_PRIVATE(dense_below) = 0,
|
12176
|
+
.UPB_PRIVATE(table_mask) = -1,
|
12177
|
+
.UPB_PRIVATE(required_count) = 0,
|
12178
|
+
};
|
12179
|
+
|
11897
12180
|
|
11898
12181
|
|
11899
12182
|
// Must be last.
|
@@ -13168,11 +13451,11 @@ upb_MessageValue upb_FieldDef_Default(const upb_FieldDef* f) {
|
|
13168
13451
|
}
|
13169
13452
|
|
13170
13453
|
const upb_MessageDef* upb_FieldDef_MessageSubDef(const upb_FieldDef* f) {
|
13171
|
-
return
|
13454
|
+
return upb_FieldDef_IsSubMessage(f) ? f->sub.msgdef : NULL;
|
13172
13455
|
}
|
13173
13456
|
|
13174
13457
|
const upb_EnumDef* upb_FieldDef_EnumSubDef(const upb_FieldDef* f) {
|
13175
|
-
return
|
13458
|
+
return upb_FieldDef_IsEnum(f) ? f->sub.enumdef : NULL;
|
13176
13459
|
}
|
13177
13460
|
|
13178
13461
|
const upb_MiniTableField* upb_FieldDef_MiniTable(const upb_FieldDef* f) {
|
@@ -13269,8 +13552,11 @@ bool upb_FieldDef_HasDefault(const upb_FieldDef* f) { return f->has_default; }
|
|
13269
13552
|
bool upb_FieldDef_HasPresence(const upb_FieldDef* f) { return f->has_presence; }
|
13270
13553
|
|
13271
13554
|
bool upb_FieldDef_HasSubDef(const upb_FieldDef* f) {
|
13272
|
-
return upb_FieldDef_IsSubMessage(f) ||
|
13273
|
-
|
13555
|
+
return upb_FieldDef_IsSubMessage(f) || upb_FieldDef_IsEnum(f);
|
13556
|
+
}
|
13557
|
+
|
13558
|
+
bool upb_FieldDef_IsEnum(const upb_FieldDef* f) {
|
13559
|
+
return upb_FieldDef_CType(f) == kUpb_CType_Enum;
|
13274
13560
|
}
|
13275
13561
|
|
13276
13562
|
bool upb_FieldDef_IsMap(const upb_FieldDef* f) {
|
@@ -13605,7 +13891,7 @@ static void _upb_FieldDef_Create(upb_DefBuilder* ctx, const char* prefix,
|
|
13605
13891
|
f->full_name);
|
13606
13892
|
}
|
13607
13893
|
|
13608
|
-
if (oneof_index >= upb_MessageDef_OneofCount(m)) {
|
13894
|
+
if (oneof_index < 0 || oneof_index >= upb_MessageDef_OneofCount(m)) {
|
13609
13895
|
_upb_DefBuilder_Errf(ctx, "oneof_index out of range (%s)", f->full_name);
|
13610
13896
|
}
|
13611
13897
|
|
@@ -14872,8 +15158,8 @@ bool upb_Message_HasFieldByDef(const upb_Message* msg, const upb_FieldDef* f) {
|
|
14872
15158
|
}
|
14873
15159
|
}
|
14874
15160
|
|
14875
|
-
const upb_FieldDef*
|
14876
|
-
|
15161
|
+
const upb_FieldDef* upb_Message_WhichOneofByDef(const upb_Message* msg,
|
15162
|
+
const upb_OneofDef* o) {
|
14877
15163
|
const upb_FieldDef* f = upb_OneofDef_Field(o, 0);
|
14878
15164
|
if (upb_OneofDef_IsSynthetic(o)) {
|
14879
15165
|
UPB_ASSERT(upb_OneofDef_FieldCount(o) == 1);
|
@@ -14896,6 +15182,7 @@ upb_MessageValue upb_Message_GetFieldByDef(const upb_Message* msg,
|
|
14896
15182
|
upb_MutableMessageValue upb_Message_Mutable(upb_Message* msg,
|
14897
15183
|
const upb_FieldDef* f,
|
14898
15184
|
upb_Arena* a) {
|
15185
|
+
UPB_ASSERT(!upb_Message_IsFrozen(msg));
|
14899
15186
|
UPB_ASSERT(upb_FieldDef_IsSubMessage(f) || upb_FieldDef_IsRepeated(f));
|
14900
15187
|
if (upb_FieldDef_HasPresence(f) && !upb_Message_HasFieldByDef(msg, f)) {
|
14901
15188
|
// We need to skip the upb_Message_GetFieldByDef() call in this case.
|
@@ -14934,6 +15221,7 @@ make:
|
|
14934
15221
|
|
14935
15222
|
bool upb_Message_SetFieldByDef(upb_Message* msg, const upb_FieldDef* f,
|
14936
15223
|
upb_MessageValue val, upb_Arena* a) {
|
15224
|
+
UPB_ASSERT(!upb_Message_IsFrozen(msg));
|
14937
15225
|
const upb_MiniTableField* m_f = upb_FieldDef_MiniTable(f);
|
14938
15226
|
|
14939
15227
|
if (upb_MiniTableField_IsExtension(m_f)) {
|
@@ -14946,6 +15234,7 @@ bool upb_Message_SetFieldByDef(upb_Message* msg, const upb_FieldDef* f,
|
|
14946
15234
|
}
|
14947
15235
|
|
14948
15236
|
void upb_Message_ClearFieldByDef(upb_Message* msg, const upb_FieldDef* f) {
|
15237
|
+
UPB_ASSERT(!upb_Message_IsFrozen(msg));
|
14949
15238
|
const upb_MiniTableField* m_f = upb_FieldDef_MiniTable(f);
|
14950
15239
|
|
14951
15240
|
if (upb_MiniTableField_IsExtension(m_f)) {
|
@@ -14956,6 +15245,7 @@ void upb_Message_ClearFieldByDef(upb_Message* msg, const upb_FieldDef* f) {
|
|
14956
15245
|
}
|
14957
15246
|
|
14958
15247
|
void upb_Message_ClearByDef(upb_Message* msg, const upb_MessageDef* m) {
|
15248
|
+
UPB_ASSERT(!upb_Message_IsFrozen(msg));
|
14959
15249
|
upb_Message_Clear(msg, upb_MessageDef_MiniTable(m));
|
14960
15250
|
}
|
14961
15251
|
|
@@ -15017,6 +15307,7 @@ bool upb_Message_Next(const upb_Message* msg, const upb_MessageDef* m,
|
|
15017
15307
|
|
15018
15308
|
bool _upb_Message_DiscardUnknown(upb_Message* msg, const upb_MessageDef* m,
|
15019
15309
|
int depth) {
|
15310
|
+
UPB_ASSERT(!upb_Message_IsFrozen(msg));
|
15020
15311
|
size_t iter = kUpb_Message_Begin;
|
15021
15312
|
const upb_FieldDef* f;
|
15022
15313
|
upb_MessageValue val;
|
@@ -16328,3 +16619,7 @@ upb_ServiceDef* _upb_ServiceDefs_New(upb_DefBuilder* ctx, int n,
|
|
16328
16619
|
#undef UPB_USE_C11_ATOMICS
|
16329
16620
|
#undef UPB_PRIVATE
|
16330
16621
|
#undef UPB_ONLYBITS
|
16622
|
+
#undef UPB_LINKARR_DECLARE
|
16623
|
+
#undef UPB_LINKARR_APPEND
|
16624
|
+
#undef UPB_LINKARR_START
|
16625
|
+
#undef UPB_LINKARR_STOP
|