google-protobuf 4.29.3 → 4.30.0.rc.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2956cfa1fcc75ab4faaa1884e4bf43f07a45ef03992806dd974f2e6dece6b5a0
4
- data.tar.gz: eb8281379f42531e5d86e1b92504f1ba5a00fbdbddf38b8d37c16c5d4b522352
3
+ metadata.gz: 0d27615524fb9805ff2948a71486e073e7321242324cdf0b334be254c6e554ba
4
+ data.tar.gz: ee3f8056259ffdd934b25f9e8be68a967726fa1cd7bd8ce503c3e10e60677307
5
5
  SHA512:
6
- metadata.gz: c13f8f6cc2117980c13dd30ce43708683120b016b4d6239fb97271cec82df15bdcf559415ea625302823b7f2e2b7b893070d2f35576e3d97e9e8895267f196d9
7
- data.tar.gz: 95d877eb2bca28b52c75611989fe2538a34c2ccb209011d6eaf033ab930742f0ba81fd3f39e824edd00a31de5062de8a8591fe6bb70290d94ce041e28b964fc3
6
+ metadata.gz: 7dc5fe7f219504925cf5450c31462b75a9fa47f1eada981667ab350165fab5856f95ce6bc3cb0da34fe918f37b824fce8bf12b9d6e7096e6f7cae0cf72d0e8b3
7
+ data.tar.gz: 3a160251ec1f64e73bb626cff2d2d234495c5cb9144f932c0b0f4f6cf2ca9d6faecc1942e442c753f1abbeae4d01efe739defbab08f465ad0d00e87a11cd623d
@@ -112,16 +112,9 @@ VALUE Convert_CheckStringUtf8(VALUE str) {
112
112
  // not mean that it is *valid* UTF-8. We have to check separately
113
113
  // whether it is valid.
114
114
  if (rb_enc_str_coderange(str) == ENC_CODERANGE_BROKEN) {
115
- // TODO: For now
116
- // we only warn for this case. We will remove the warning and throw an
117
- // exception below in the 30.x release
118
-
119
- rb_warn(
120
- "String is invalid UTF-8. This will be an error in a future "
121
- "version.");
122
- // VALUE exc = rb_const_get_at(
123
- // rb_cEncoding, rb_intern("InvalidByteSequenceError"));
124
- // rb_raise(exc, "String is invalid UTF-8");
115
+ VALUE exc = rb_const_get_at(
116
+ rb_cEncoding, rb_intern("InvalidByteSequenceError"));
117
+ rb_raise(exc, "String is invalid UTF-8");
125
118
  }
126
119
  } else {
127
120
  // Note: this will not duplicate underlying string data unless
@@ -146,8 +146,8 @@ VALUE DescriptorPool_add_serialized_file(VALUE _self,
146
146
  * call-seq:
147
147
  * DescriptorPool.lookup(name) => descriptor
148
148
  *
149
- * Finds a Descriptor, EnumDescriptor or FieldDescriptor by name and returns it,
150
- * or nil if none exists with the given name.
149
+ * Finds a Descriptor, EnumDescriptor, FieldDescriptor or ServiceDescriptor by
150
+ * name and returns it, or nil if none exists with the given name.
151
151
  */
152
152
  static VALUE DescriptorPool_lookup(VALUE _self, VALUE name) {
153
153
  DescriptorPool* self = ruby_to_DescriptorPool(_self);
@@ -451,6 +451,27 @@ static VALUE Descriptor_options(VALUE _self) {
451
451
  return message_options;
452
452
  }
453
453
 
454
+ /*
455
+ * call-seq:
456
+ * Descriptor.to_proto => DescriptorProto
457
+ *
458
+ * Returns the `DescriptorProto` of this `Descriptor`.
459
+ */
460
+ static VALUE Descriptor_to_proto(VALUE _self) {
461
+ Descriptor* self = ruby_to_Descriptor(_self);
462
+ upb_Arena* arena = upb_Arena_New();
463
+ google_protobuf_DescriptorProto* proto =
464
+ upb_MessageDef_ToProto(self->msgdef, arena);
465
+ size_t size;
466
+ const char* serialized =
467
+ google_protobuf_DescriptorProto_serialize(proto, arena, &size);
468
+ VALUE proto_class = rb_path2class("Google::Protobuf::DescriptorProto");
469
+ VALUE proto_rb =
470
+ Message_decode_bytes(size, serialized, 0, proto_class, false);
471
+ upb_Arena_Free(arena);
472
+ return proto_rb;
473
+ }
474
+
454
475
  static void Descriptor_register(VALUE module) {
455
476
  VALUE klass = rb_define_class_under(module, "Descriptor", rb_cObject);
456
477
  rb_define_alloc_func(klass, Descriptor_alloc);
@@ -463,6 +484,7 @@ static void Descriptor_register(VALUE module) {
463
484
  rb_define_method(klass, "name", Descriptor_name, 0);
464
485
  rb_define_method(klass, "file_descriptor", Descriptor_file_descriptor, 0);
465
486
  rb_define_method(klass, "options", Descriptor_options, 0);
487
+ rb_define_method(klass, "to_proto", Descriptor_to_proto, 0);
466
488
  rb_include_module(klass, rb_mEnumerable);
467
489
  rb_gc_register_address(&cDescriptor);
468
490
  cDescriptor = klass;
@@ -558,12 +580,37 @@ static VALUE FileDescriptor_options(VALUE _self) {
558
580
  return file_options;
559
581
  }
560
582
 
583
+ /*
584
+ * call-seq:
585
+ * FileDescriptor.to_proto => FileDescriptorProto
586
+ *
587
+ * Returns the `FileDescriptorProto` of this `FileDescriptor`.
588
+ */
589
+ static VALUE FileDescriptor_to_proto(VALUE _self) {
590
+ FileDescriptor* self = ruby_to_FileDescriptor(_self);
591
+ upb_Arena* arena = upb_Arena_New();
592
+ google_protobuf_FileDescriptorProto* file_proto =
593
+ upb_FileDef_ToProto(self->filedef, arena);
594
+
595
+ size_t size;
596
+ const char* serialized =
597
+ google_protobuf_FileDescriptorProto_serialize(file_proto, arena, &size);
598
+
599
+ VALUE file_proto_class =
600
+ rb_path2class("Google::Protobuf::FileDescriptorProto");
601
+ VALUE proto_rb =
602
+ Message_decode_bytes(size, serialized, 0, file_proto_class, false);
603
+ upb_Arena_Free(arena);
604
+ return proto_rb;
605
+ }
606
+
561
607
  static void FileDescriptor_register(VALUE module) {
562
608
  VALUE klass = rb_define_class_under(module, "FileDescriptor", rb_cObject);
563
609
  rb_define_alloc_func(klass, FileDescriptor_alloc);
564
610
  rb_define_method(klass, "initialize", FileDescriptor_initialize, 3);
565
611
  rb_define_method(klass, "name", FileDescriptor_name, 0);
566
612
  rb_define_method(klass, "options", FileDescriptor_options, 0);
613
+ rb_define_method(klass, "to_proto", FileDescriptor_to_proto, 0);
567
614
  rb_gc_register_address(&cFileDescriptor);
568
615
  cFileDescriptor = klass;
569
616
  }
@@ -956,6 +1003,27 @@ static VALUE FieldDescriptor_options(VALUE _self) {
956
1003
  return field_options;
957
1004
  }
958
1005
 
1006
+ /*
1007
+ * call-seq:
1008
+ * FieldDescriptor.to_proto => FieldDescriptorProto
1009
+ *
1010
+ * Returns the `FieldDescriptorProto` of this `FieldDescriptor`.
1011
+ */
1012
+ static VALUE FieldDescriptor_to_proto(VALUE _self) {
1013
+ FieldDescriptor* self = ruby_to_FieldDescriptor(_self);
1014
+ upb_Arena* arena = upb_Arena_New();
1015
+ google_protobuf_FieldDescriptorProto* proto =
1016
+ upb_FieldDef_ToProto(self->fielddef, arena);
1017
+ size_t size;
1018
+ const char* serialized =
1019
+ google_protobuf_FieldDescriptorProto_serialize(proto, arena, &size);
1020
+ VALUE proto_class = rb_path2class("Google::Protobuf::FieldDescriptorProto");
1021
+ VALUE proto_rb =
1022
+ Message_decode_bytes(size, serialized, 0, proto_class, false);
1023
+ upb_Arena_Free(arena);
1024
+ return proto_rb;
1025
+ }
1026
+
959
1027
  static void FieldDescriptor_register(VALUE module) {
960
1028
  VALUE klass = rb_define_class_under(module, "FieldDescriptor", rb_cObject);
961
1029
  rb_define_alloc_func(klass, FieldDescriptor_alloc);
@@ -975,6 +1043,7 @@ static void FieldDescriptor_register(VALUE module) {
975
1043
  rb_define_method(klass, "get", FieldDescriptor_get, 1);
976
1044
  rb_define_method(klass, "set", FieldDescriptor_set, 2);
977
1045
  rb_define_method(klass, "options", FieldDescriptor_options, 0);
1046
+ rb_define_method(klass, "to_proto", FieldDescriptor_to_proto, 0);
978
1047
  rb_gc_register_address(&cFieldDescriptor);
979
1048
  cFieldDescriptor = klass;
980
1049
  }
@@ -1093,6 +1162,27 @@ static VALUE OneOfDescriptor_options(VALUE _self) {
1093
1162
  return oneof_options;
1094
1163
  }
1095
1164
 
1165
+ /*
1166
+ * call-seq:
1167
+ * OneofDescriptor.to_proto => OneofDescriptorProto
1168
+ *
1169
+ * Returns the `OneofDescriptorProto` of this `OneofDescriptor`.
1170
+ */
1171
+ static VALUE OneOfDescriptor_to_proto(VALUE _self) {
1172
+ OneofDescriptor* self = ruby_to_OneofDescriptor(_self);
1173
+ upb_Arena* arena = upb_Arena_New();
1174
+ google_protobuf_OneofDescriptorProto* proto =
1175
+ upb_OneofDef_ToProto(self->oneofdef, arena);
1176
+ size_t size;
1177
+ const char* serialized =
1178
+ google_protobuf_OneofDescriptorProto_serialize(proto, arena, &size);
1179
+ VALUE proto_class = rb_path2class("Google::Protobuf::OneofDescriptorProto");
1180
+ VALUE proto_rb =
1181
+ Message_decode_bytes(size, serialized, 0, proto_class, false);
1182
+ upb_Arena_Free(arena);
1183
+ return proto_rb;
1184
+ }
1185
+
1096
1186
  static void OneofDescriptor_register(VALUE module) {
1097
1187
  VALUE klass = rb_define_class_under(module, "OneofDescriptor", rb_cObject);
1098
1188
  rb_define_alloc_func(klass, OneofDescriptor_alloc);
@@ -1100,6 +1190,7 @@ static void OneofDescriptor_register(VALUE module) {
1100
1190
  rb_define_method(klass, "name", OneofDescriptor_name, 0);
1101
1191
  rb_define_method(klass, "each", OneofDescriptor_each, 0);
1102
1192
  rb_define_method(klass, "options", OneOfDescriptor_options, 0);
1193
+ rb_define_method(klass, "to_proto", OneOfDescriptor_to_proto, 0);
1103
1194
  rb_include_module(klass, rb_mEnumerable);
1104
1195
  rb_gc_register_address(&cOneofDescriptor);
1105
1196
  cOneofDescriptor = klass;
@@ -1298,6 +1389,29 @@ static VALUE EnumDescriptor_options(VALUE _self) {
1298
1389
  return enum_options;
1299
1390
  }
1300
1391
 
1392
+ /*
1393
+ * call-seq:
1394
+ * EnumDescriptor.to_proto => EnumDescriptorProto
1395
+ *
1396
+ * Returns the `EnumDescriptorProto` of this `EnumDescriptor`.
1397
+ */
1398
+ static VALUE EnumDescriptor_to_proto(VALUE _self) {
1399
+ EnumDescriptor* self = ruby_to_EnumDescriptor(_self);
1400
+ upb_Arena* arena = upb_Arena_New();
1401
+ google_protobuf_EnumDescriptorProto* proto =
1402
+ upb_EnumDef_ToProto(self->enumdef, arena);
1403
+
1404
+ size_t size;
1405
+ const char* serialized =
1406
+ google_protobuf_EnumDescriptorProto_serialize(proto, arena, &size);
1407
+
1408
+ VALUE proto_class = rb_path2class("Google::Protobuf::EnumDescriptorProto");
1409
+ VALUE proto_rb =
1410
+ Message_decode_bytes(size, serialized, 0, proto_class, false);
1411
+ upb_Arena_Free(arena);
1412
+ return proto_rb;
1413
+ }
1414
+
1301
1415
  static void EnumDescriptor_register(VALUE module) {
1302
1416
  VALUE klass = rb_define_class_under(module, "EnumDescriptor", rb_cObject);
1303
1417
  rb_define_alloc_func(klass, EnumDescriptor_alloc);
@@ -1310,6 +1424,7 @@ static void EnumDescriptor_register(VALUE module) {
1310
1424
  rb_define_method(klass, "file_descriptor", EnumDescriptor_file_descriptor, 0);
1311
1425
  rb_define_method(klass, "is_closed?", EnumDescriptor_is_closed, 0);
1312
1426
  rb_define_method(klass, "options", EnumDescriptor_options, 0);
1427
+ rb_define_method(klass, "to_proto", EnumDescriptor_to_proto, 0);
1313
1428
  rb_include_module(klass, rb_mEnumerable);
1314
1429
  rb_gc_register_address(&cEnumDescriptor);
1315
1430
  cEnumDescriptor = klass;
@@ -1438,6 +1553,27 @@ static VALUE ServiceDescriptor_options(VALUE _self) {
1438
1553
  return service_options;
1439
1554
  }
1440
1555
 
1556
+ /*
1557
+ * call-seq:
1558
+ * ServiceDescriptor.to_proto => ServiceDescriptorProto
1559
+ *
1560
+ * Returns the `ServiceDescriptorProto` of this `ServiceDescriptor`.
1561
+ */
1562
+ static VALUE ServiceDescriptor_to_proto(VALUE _self) {
1563
+ ServiceDescriptor* self = ruby_to_ServiceDescriptor(_self);
1564
+ upb_Arena* arena = upb_Arena_New();
1565
+ google_protobuf_ServiceDescriptorProto* proto =
1566
+ upb_ServiceDef_ToProto(self->servicedef, arena);
1567
+ size_t size;
1568
+ const char* serialized =
1569
+ google_protobuf_ServiceDescriptorProto_serialize(proto, arena, &size);
1570
+ VALUE proto_class = rb_path2class("Google::Protobuf::ServiceDescriptorProto");
1571
+ VALUE proto_rb =
1572
+ Message_decode_bytes(size, serialized, 0, proto_class, false);
1573
+ upb_Arena_Free(arena);
1574
+ return proto_rb;
1575
+ }
1576
+
1441
1577
  static void ServiceDescriptor_register(VALUE module) {
1442
1578
  VALUE klass = rb_define_class_under(module, "ServiceDescriptor", rb_cObject);
1443
1579
  rb_define_alloc_func(klass, ServiceDescriptor_alloc);
@@ -1447,6 +1583,7 @@ static void ServiceDescriptor_register(VALUE module) {
1447
1583
  rb_define_method(klass, "file_descriptor", ServiceDescriptor_file_descriptor,
1448
1584
  0);
1449
1585
  rb_define_method(klass, "options", ServiceDescriptor_options, 0);
1586
+ rb_define_method(klass, "to_proto", ServiceDescriptor_to_proto, 0);
1450
1587
  rb_include_module(klass, rb_mEnumerable);
1451
1588
  rb_gc_register_address(&cServiceDescriptor);
1452
1589
  cServiceDescriptor = klass;
@@ -1580,6 +1717,27 @@ static VALUE MethodDescriptor_client_streaming(VALUE _self) {
1580
1717
  return upb_MethodDef_ClientStreaming(self->methoddef) ? Qtrue : Qfalse;
1581
1718
  }
1582
1719
 
1720
+ /*
1721
+ * call-seq:
1722
+ * MethodDescriptor.to_proto => MethodDescriptorProto
1723
+ *
1724
+ * Returns the `MethodDescriptorProto` of this `MethodDescriptor`.
1725
+ */
1726
+ static VALUE MethodDescriptor_to_proto(VALUE _self) {
1727
+ MethodDescriptor* self = ruby_to_MethodDescriptor(_self);
1728
+ upb_Arena* arena = upb_Arena_New();
1729
+ google_protobuf_MethodDescriptorProto* proto =
1730
+ upb_MethodDef_ToProto(self->methoddef, arena);
1731
+ size_t size;
1732
+ const char* serialized =
1733
+ google_protobuf_MethodDescriptorProto_serialize(proto, arena, &size);
1734
+ VALUE proto_class = rb_path2class("Google::Protobuf::MethodDescriptorProto");
1735
+ VALUE proto_rb =
1736
+ Message_decode_bytes(size, serialized, 0, proto_class, false);
1737
+ upb_Arena_Free(arena);
1738
+ return proto_rb;
1739
+ }
1740
+
1583
1741
  /*
1584
1742
  * call-seq:
1585
1743
  * MethodDescriptor.server_streaming => bool
@@ -1603,6 +1761,7 @@ static void MethodDescriptor_register(VALUE module) {
1603
1761
  0);
1604
1762
  rb_define_method(klass, "server_streaming", MethodDescriptor_server_streaming,
1605
1763
  0);
1764
+ rb_define_method(klass, "to_proto", MethodDescriptor_to_proto, 0);
1606
1765
  rb_gc_register_address(&cMethodDescriptor);
1607
1766
  cMethodDescriptor = klass;
1608
1767
  }
@@ -6,6 +6,18 @@ ext_name = "google/protobuf_c"
6
6
 
7
7
  dir_config(ext_name)
8
8
 
9
+ if ENV["CC"]
10
+ RbConfig::CONFIG["CC"] = RbConfig::MAKEFILE_CONFIG["CC"] = ENV["CC"]
11
+ end
12
+
13
+ if ENV["CXX"]
14
+ RbConfig::CONFIG["CXX"] = RbConfig::MAKEFILE_CONFIG["CXX"] = ENV["CXX"]
15
+ end
16
+
17
+ if ENV["LD"]
18
+ RbConfig::CONFIG["LD"] = RbConfig::MAKEFILE_CONFIG["LD"] = ENV["LD"]
19
+ end
20
+
9
21
  if RUBY_PLATFORM =~ /darwin/ || RUBY_PLATFORM =~ /linux/ || RUBY_PLATFORM =~ /freebsd/
10
22
  $CFLAGS += " -std=gnu99 -O3 -DNDEBUG -fvisibility=hidden -Wall -Wsign-compare -Wno-declaration-after-statement"
11
23
  else
@@ -26,6 +26,15 @@ char* EnumDescriptor_serialized_options(const upb_EnumDef* enumdef,
26
26
  return serialized;
27
27
  }
28
28
 
29
+ char* EnumDescriptor_serialized_to_proto(const upb_EnumDef* enumdef,
30
+ size_t* size, upb_Arena* arena) {
31
+ const google_protobuf_EnumDescriptorProto* file_proto =
32
+ upb_EnumDef_ToProto(enumdef, arena);
33
+ char* serialized =
34
+ google_protobuf_EnumDescriptorProto_serialize(file_proto, arena, size);
35
+ return serialized;
36
+ }
37
+
29
38
  char* FileDescriptor_serialized_options(const upb_FileDef* filedef,
30
39
  size_t* size, upb_Arena* arena) {
31
40
  const google_protobuf_FileOptions* opts = upb_FileDef_Options(filedef);
@@ -33,6 +42,15 @@ char* FileDescriptor_serialized_options(const upb_FileDef* filedef,
33
42
  return serialized;
34
43
  }
35
44
 
45
+ char* FileDescriptor_serialized_to_proto(const upb_FileDef* filedef,
46
+ size_t* size, upb_Arena* arena) {
47
+ const google_protobuf_FileDescriptorProto* file_proto =
48
+ upb_FileDef_ToProto(filedef, arena);
49
+ char* serialized =
50
+ google_protobuf_FileDescriptorProto_serialize(file_proto, arena, size);
51
+ return serialized;
52
+ }
53
+
36
54
  char* Descriptor_serialized_options(const upb_MessageDef* msgdef, size_t* size,
37
55
  upb_Arena* arena) {
38
56
  const google_protobuf_MessageOptions* opts = upb_MessageDef_Options(msgdef);
@@ -41,6 +59,15 @@ char* Descriptor_serialized_options(const upb_MessageDef* msgdef, size_t* size,
41
59
  return serialized;
42
60
  }
43
61
 
62
+ char* Descriptor_serialized_to_proto(const upb_MessageDef* msgdef, size_t* size,
63
+ upb_Arena* arena) {
64
+ const google_protobuf_DescriptorProto* proto =
65
+ upb_MessageDef_ToProto(msgdef, arena);
66
+ char* serialized =
67
+ google_protobuf_DescriptorProto_serialize(proto, arena, size);
68
+ return serialized;
69
+ }
70
+
44
71
  char* OneOfDescriptor_serialized_options(const upb_OneofDef* oneofdef,
45
72
  size_t* size, upb_Arena* arena) {
46
73
  const google_protobuf_OneofOptions* opts = upb_OneofDef_Options(oneofdef);
@@ -48,6 +75,15 @@ char* OneOfDescriptor_serialized_options(const upb_OneofDef* oneofdef,
48
75
  return serialized;
49
76
  }
50
77
 
78
+ char* OneOfDescriptor_serialized_to_proto(const upb_OneofDef* oneofdef,
79
+ size_t* size, upb_Arena* arena) {
80
+ const google_protobuf_OneofDescriptorProto* proto =
81
+ upb_OneofDef_ToProto(oneofdef, arena);
82
+ char* serialized =
83
+ google_protobuf_OneofDescriptorProto_serialize(proto, arena, size);
84
+ return serialized;
85
+ }
86
+
51
87
  char* FieldDescriptor_serialized_options(const upb_FieldDef* fielddef,
52
88
  size_t* size, upb_Arena* arena) {
53
89
  const google_protobuf_FieldOptions* opts = upb_FieldDef_Options(fielddef);
@@ -55,6 +91,15 @@ char* FieldDescriptor_serialized_options(const upb_FieldDef* fielddef,
55
91
  return serialized;
56
92
  }
57
93
 
94
+ char* FieldDescriptor_serialized_to_proto(const upb_FieldDef* fieldef,
95
+ size_t* size, upb_Arena* arena) {
96
+ const google_protobuf_FieldDescriptorProto* proto =
97
+ upb_FieldDef_ToProto(fieldef, arena);
98
+ char* serialized =
99
+ google_protobuf_FieldDescriptorProto_serialize(proto, arena, size);
100
+ return serialized;
101
+ }
102
+
58
103
  char* ServiceDescriptor_serialized_options(const upb_ServiceDef* servicedef,
59
104
  size_t* size, upb_Arena* arena) {
60
105
  const google_protobuf_ServiceOptions* opts =
@@ -64,9 +109,27 @@ char* ServiceDescriptor_serialized_options(const upb_ServiceDef* servicedef,
64
109
  return serialized;
65
110
  }
66
111
 
112
+ char* ServiceDescriptor_serialized_to_proto(const upb_ServiceDef* servicedef,
113
+ size_t* size, upb_Arena* arena) {
114
+ const google_protobuf_ServiceDescriptorProto* proto =
115
+ upb_ServiceDef_ToProto(servicedef, arena);
116
+ char* serialized =
117
+ google_protobuf_ServiceDescriptorProto_serialize(proto, arena, size);
118
+ return serialized;
119
+ }
120
+
67
121
  char* MethodDescriptor_serialized_options(const upb_MethodDef* methoddef,
68
122
  size_t* size, upb_Arena* arena) {
69
123
  const google_protobuf_MethodOptions* opts = upb_MethodDef_Options(methoddef);
70
124
  char* serialized = google_protobuf_MethodOptions_serialize(opts, arena, size);
71
125
  return serialized;
72
126
  }
127
+
128
+ char* MethodDescriptor_serialized_to_proto(const upb_MethodDef* methodef,
129
+ size_t* size, upb_Arena* arena) {
130
+ const google_protobuf_MethodDescriptorProto* proto =
131
+ upb_MethodDef_ToProto(methodef, arena);
132
+ char* serialized =
133
+ google_protobuf_MethodDescriptorProto_serialize(proto, arena, size);
134
+ return serialized;
135
+ }
@@ -362,7 +362,8 @@ static VALUE Message_field_accessor(VALUE _self, const upb_FieldDef* f,
362
362
  if (!upb_FieldDef_HasPresence(f)) {
363
363
  rb_raise(rb_eRuntimeError, "Field does not have presence.");
364
364
  }
365
- return upb_Message_HasFieldByDef(Message_Get(_self, NULL), f);
365
+ return upb_Message_HasFieldByDef(Message_Get(_self, NULL), f) ? Qtrue
366
+ : Qfalse;
366
367
  case METHOD_WRAPPER_GETTER: {
367
368
  Message* self = ruby_to_Message(_self);
368
369
  if (upb_Message_HasFieldByDef(self->msg, f)) {
@@ -1046,9 +1047,6 @@ static VALUE Message_decode_json(int argc, VALUE* argv, VALUE klass) {
1046
1047
  switch (result) {
1047
1048
  case kUpb_JsonDecodeResult_Ok:
1048
1049
  break;
1049
- case kUpb_JsonDecodeResult_OkWithEmptyStringNumerics:
1050
- rb_warn("%s", upb_Status_ErrorMessage(&status));
1051
- break;
1052
1050
  case kUpb_JsonDecodeResult_Error:
1053
1051
  rb_raise(cParseError, "Error occurred during parsing: %s",
1054
1052
  upb_Status_ErrorMessage(&status));
@@ -286,7 +286,8 @@ VALUE ObjectCache_Get(const void *key) {
286
286
  static VALUE Google_Protobuf_discard_unknown(VALUE self, VALUE msg_rb) {
287
287
  const upb_MessageDef *m;
288
288
  upb_Message *msg = Message_GetMutable(msg_rb, &m);
289
- if (!upb_Message_DiscardUnknown(msg, m, 128)) {
289
+ const upb_DefPool* ext_pool = upb_FileDef_Pool(upb_MessageDef_File(m));
290
+ if (!upb_Message_DiscardUnknown(msg, m, ext_pool, 128)) {
290
291
  rb_raise(rb_eRuntimeError, "Messages nested too deeply.");
291
292
  }
292
293