google-protobuf 4.30.2 → 4.31.0.rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/google/protobuf_c/defs.c +32 -0
- data/ext/google/protobuf_c/extconf.rb +6 -2
- data/ext/google/protobuf_c/map.c +2 -2
- data/ext/google/protobuf_c/message.c +2 -2
- data/ext/google/protobuf_c/protobuf.h +0 -6
- data/ext/google/protobuf_c/ruby-upb.c +1013 -478
- data/ext/google/protobuf_c/ruby-upb.h +787 -385
- data/lib/google/protobuf/any_pb.rb +1 -1
- data/lib/google/protobuf/api_pb.rb +1 -1
- data/lib/google/protobuf/descriptor_pb.rb +5 -2
- data/lib/google/protobuf/duration_pb.rb +1 -1
- data/lib/google/protobuf/empty_pb.rb +1 -1
- data/lib/google/protobuf/ffi/descriptor_pool.rb +3 -1
- data/lib/google/protobuf/ffi/field_descriptor.rb +6 -0
- data/lib/google/protobuf/ffi/file_descriptor.rb +26 -0
- data/lib/google/protobuf/ffi/internal/pointer_helper.rb +2 -1
- data/lib/google/protobuf/ffi/map.rb +2 -2
- data/lib/google/protobuf/field_mask_pb.rb +1 -1
- data/lib/google/protobuf/message_exts.rb +4 -0
- data/lib/google/protobuf/plugin_pb.rb +1 -1
- data/lib/google/protobuf/source_context_pb.rb +1 -1
- data/lib/google/protobuf/struct_pb.rb +1 -1
- data/lib/google/protobuf/timestamp_pb.rb +1 -1
- data/lib/google/protobuf/type_pb.rb +1 -1
- data/lib/google/protobuf/wrappers_pb.rb +1 -1
- data/lib/google/protobuf_ffi.rb +1 -1
- metadata +20 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c728a95a5054361b417600c7447dfede237cc5bf78e35534f38d7468d080a4f
|
4
|
+
data.tar.gz: '099be6e67378db1cd5e30f201f4e31baca66a95fa009c64ebecbff259db829c8'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b852417b182818d483ee2e45338a9f03a5dca07cefe4ad0d3c0d707ce1c4d517f7875cf06c20e554fb11d1e8d118973d2946d0f1cf53a9bf151f890b8b2f90c
|
7
|
+
data.tar.gz: b2105d206dcdb3d3c5e857da99e643ec6f57759310a519051be1be48ebcf739a3e24b429298fd415199a31eb4c0fa54367f7391333489ad31dab9b8e710e0107
|
@@ -156,6 +156,7 @@ static VALUE DescriptorPool_lookup(VALUE _self, VALUE name) {
|
|
156
156
|
const upb_EnumDef* enumdef;
|
157
157
|
const upb_FieldDef* fielddef;
|
158
158
|
const upb_ServiceDef* servicedef;
|
159
|
+
const upb_FileDef* filedef;
|
159
160
|
|
160
161
|
msgdef = upb_DefPool_FindMessageByName(self->symtab, name_str);
|
161
162
|
if (msgdef) {
|
@@ -177,6 +178,11 @@ static VALUE DescriptorPool_lookup(VALUE _self, VALUE name) {
|
|
177
178
|
return get_servicedef_obj(_self, servicedef);
|
178
179
|
}
|
179
180
|
|
181
|
+
filedef = upb_DefPool_FindFileByName(self->symtab, name_str);
|
182
|
+
if (filedef) {
|
183
|
+
return get_filedef_obj(_self, filedef);
|
184
|
+
}
|
185
|
+
|
180
186
|
return Qnil;
|
181
187
|
}
|
182
188
|
|
@@ -792,6 +798,28 @@ static VALUE FieldDescriptor_has_presence(VALUE _self) {
|
|
792
798
|
return upb_FieldDef_HasPresence(self->fielddef) ? Qtrue : Qfalse;
|
793
799
|
}
|
794
800
|
|
801
|
+
/*
|
802
|
+
* call-seq:
|
803
|
+
* FieldDescriptor.required? => bool
|
804
|
+
*
|
805
|
+
* Returns whether this is a required field.
|
806
|
+
*/
|
807
|
+
static VALUE FieldDescriptor_is_required(VALUE _self) {
|
808
|
+
FieldDescriptor* self = ruby_to_FieldDescriptor(_self);
|
809
|
+
return upb_FieldDef_IsRequired(self->fielddef) ? Qtrue : Qfalse;
|
810
|
+
}
|
811
|
+
|
812
|
+
/*
|
813
|
+
* call-seq:
|
814
|
+
* FieldDescriptor.repeated? => bool
|
815
|
+
*
|
816
|
+
* Returns whether this is a repeated field.
|
817
|
+
*/
|
818
|
+
static VALUE FieldDescriptor_is_repeated(VALUE _self) {
|
819
|
+
FieldDescriptor* self = ruby_to_FieldDescriptor(_self);
|
820
|
+
return upb_FieldDef_IsRepeated(self->fielddef) ? Qtrue : Qfalse;
|
821
|
+
}
|
822
|
+
|
795
823
|
/*
|
796
824
|
* call-seq:
|
797
825
|
* FieldDescriptor.is_packed? => bool
|
@@ -817,6 +845,8 @@ static VALUE FieldDescriptor_json_name(VALUE _self) {
|
|
817
845
|
}
|
818
846
|
|
819
847
|
/*
|
848
|
+
* DEPRECATED: Use repeated? or required? instead.
|
849
|
+
*
|
820
850
|
* call-seq:
|
821
851
|
* FieldDescriptor.label => label
|
822
852
|
*
|
@@ -1032,6 +1062,8 @@ static void FieldDescriptor_register(VALUE module) {
|
|
1032
1062
|
rb_define_method(klass, "type", FieldDescriptor__type, 0);
|
1033
1063
|
rb_define_method(klass, "default", FieldDescriptor_default, 0);
|
1034
1064
|
rb_define_method(klass, "has_presence?", FieldDescriptor_has_presence, 0);
|
1065
|
+
rb_define_method(klass, "required?", FieldDescriptor_is_required, 0);
|
1066
|
+
rb_define_method(klass, "repeated?", FieldDescriptor_is_repeated, 0);
|
1035
1067
|
rb_define_method(klass, "is_packed?", FieldDescriptor_is_packed, 0);
|
1036
1068
|
rb_define_method(klass, "json_name", FieldDescriptor_json_name, 0);
|
1037
1069
|
rb_define_method(klass, "label", FieldDescriptor_label, 0);
|
@@ -18,10 +18,14 @@ if ENV["LD"]
|
|
18
18
|
RbConfig::CONFIG["LD"] = RbConfig::MAKEFILE_CONFIG["LD"] = ENV["LD"]
|
19
19
|
end
|
20
20
|
|
21
|
+
debug_enabled = ENV["PROTOBUF_CONFIG"] == "dbg"
|
22
|
+
|
23
|
+
additional_c_flags = debug_enabled ? "-O0 -fno-omit-frame-pointer -fvisibility=default -g" : "-O3 -DNDEBUG -fvisibility=hidden"
|
24
|
+
|
21
25
|
if RUBY_PLATFORM =~ /darwin/ || RUBY_PLATFORM =~ /linux/ || RUBY_PLATFORM =~ /freebsd/
|
22
|
-
$CFLAGS += " -std=gnu99 -
|
26
|
+
$CFLAGS += " -std=gnu99 -Wall -Wsign-compare -Wno-declaration-after-statement #{additional_c_flags}"
|
23
27
|
else
|
24
|
-
$CFLAGS += " -std=gnu99
|
28
|
+
$CFLAGS += " -std=gnu99 #{additional_c_flags}"
|
25
29
|
end
|
26
30
|
|
27
31
|
if RUBY_PLATFORM =~ /linux/
|
data/ext/google/protobuf_c/map.c
CHANGED
@@ -650,8 +650,8 @@ VALUE Map_hash(VALUE _self) {
|
|
650
650
|
TypeInfo key_info = {self->key_type};
|
651
651
|
upb_MessageValue key, val;
|
652
652
|
while (upb_Map_Next(self->map, &key, &val, &iter)) {
|
653
|
-
hash
|
654
|
-
hash
|
653
|
+
hash += Msgval_GetHash(key, key_info, 0);
|
654
|
+
hash += Msgval_GetHash(val, self->value_type_info, 0);
|
655
655
|
}
|
656
656
|
|
657
657
|
return LL2NUM(hash);
|
@@ -398,7 +398,7 @@ static VALUE Message_field_accessor(VALUE _self, const upb_FieldDef* f,
|
|
398
398
|
upb_MessageValue msgval =
|
399
399
|
upb_Message_GetFieldByDef(Message_Get(_self, NULL), f);
|
400
400
|
|
401
|
-
if (
|
401
|
+
if (upb_FieldDef_IsRepeated(f)) {
|
402
402
|
// Map repeated fields to a new type with ints
|
403
403
|
VALUE arr = rb_ary_new();
|
404
404
|
size_t i, n = upb_Array_Size(msgval.array_val);
|
@@ -592,7 +592,7 @@ static void Message_InitFieldFromValue(upb_Message* msg, const upb_FieldDef* f,
|
|
592
592
|
if (upb_FieldDef_IsMap(f)) {
|
593
593
|
upb_Map* map = upb_Message_Mutable(msg, f, arena).map;
|
594
594
|
Map_InitFromValue(map, f, val, arena);
|
595
|
-
} else if (
|
595
|
+
} else if (upb_FieldDef_IsRepeated(f)) {
|
596
596
|
upb_Array* arr = upb_Message_Mutable(msg, f, arena).array;
|
597
597
|
RepeatedField_InitFromValue(arr, f, val, arena);
|
598
598
|
} else if (upb_FieldDef_IsSubMessage(f)) {
|
@@ -16,12 +16,6 @@
|
|
16
16
|
#undef NDEBUG
|
17
17
|
#endif
|
18
18
|
|
19
|
-
#include <ruby/version.h>
|
20
|
-
|
21
|
-
#if RUBY_API_VERSION_CODE < 20700
|
22
|
-
#error Protobuf requires Ruby >= 2.7
|
23
|
-
#endif
|
24
|
-
|
25
19
|
#include <assert.h> // Must be included after the NDEBUG logic above.
|
26
20
|
#include <ruby/encoding.h>
|
27
21
|
#include <ruby/vm.h>
|