google-protobuf 3.5.0-x86-mingw32 → 3.5.1-x86-mingw32
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/defs.c +11 -11
- data/ext/google/protobuf_c/encode_decode.c +88 -0
- data/ext/google/protobuf_c/map.c +1 -1
- data/ext/google/protobuf_c/protobuf.c +2 -0
- data/ext/google/protobuf_c/protobuf.h +1 -0
- data/ext/google/protobuf_c/repeated_field.c +1 -1
- data/lib/google/2.0/protobuf_c.so +0 -0
- data/lib/google/2.1/protobuf_c.so +0 -0
- data/lib/google/2.2/protobuf_c.so +0 -0
- data/lib/google/2.3/protobuf_c.so +0 -0
- data/lib/google/2.4/protobuf_c.so +0 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d429d95ce5928edfafe56c9dffb4d1d57c46ecb
|
4
|
+
data.tar.gz: e4ca3d436d4b5f92f3ca5175e8319ddf60526ec7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 849ef19d7d559a3ebf27e9129e39b09dbdfbe86a4b7c67b44de178d67e5702268b9f303b4f4996ef69b8ea037d37278bf87c78d0fcf864dc3c7b179a3982982c
|
7
|
+
data.tar.gz: eb230f12929f7a64079000354c8fbed2f225492328d7e02edd15a06a63efcce25bcde34eb4dddb8cc50fa7d86cc61533224052067bc3639776e3cd77f0bc59bd
|
@@ -76,7 +76,7 @@ static upb_enumdef* check_enum_notfrozen(const upb_enumdef* def) {
|
|
76
76
|
// -----------------------------------------------------------------------------
|
77
77
|
|
78
78
|
#define DEFINE_CLASS(name, string_name) \
|
79
|
-
VALUE c ## name;
|
79
|
+
VALUE c ## name = Qnil; \
|
80
80
|
const rb_data_type_t _ ## name ## _type = { \
|
81
81
|
string_name, \
|
82
82
|
{ name ## _mark, name ## _free, NULL }, \
|
@@ -126,11 +126,11 @@ void DescriptorPool_register(VALUE module) {
|
|
126
126
|
rb_define_method(klass, "lookup", DescriptorPool_lookup, 1);
|
127
127
|
rb_define_singleton_method(klass, "generated_pool",
|
128
128
|
DescriptorPool_generated_pool, 0);
|
129
|
-
cDescriptorPool = klass;
|
130
129
|
rb_gc_register_address(&cDescriptorPool);
|
130
|
+
cDescriptorPool = klass;
|
131
131
|
|
132
|
-
generated_pool = rb_class_new_instance(0, NULL, klass);
|
133
132
|
rb_gc_register_address(&generated_pool);
|
133
|
+
generated_pool = rb_class_new_instance(0, NULL, klass);
|
134
134
|
}
|
135
135
|
|
136
136
|
static void add_descriptor_to_pool(DescriptorPool* self,
|
@@ -299,8 +299,8 @@ void Descriptor_register(VALUE module) {
|
|
299
299
|
rb_define_method(klass, "name", Descriptor_name, 0);
|
300
300
|
rb_define_method(klass, "name=", Descriptor_name_set, 1);
|
301
301
|
rb_include_module(klass, rb_mEnumerable);
|
302
|
-
cDescriptor = klass;
|
303
302
|
rb_gc_register_address(&cDescriptor);
|
303
|
+
cDescriptor = klass;
|
304
304
|
}
|
305
305
|
|
306
306
|
/*
|
@@ -518,8 +518,8 @@ void FieldDescriptor_register(VALUE module) {
|
|
518
518
|
rb_define_method(klass, "subtype", FieldDescriptor_subtype, 0);
|
519
519
|
rb_define_method(klass, "get", FieldDescriptor_get, 1);
|
520
520
|
rb_define_method(klass, "set", FieldDescriptor_set, 2);
|
521
|
-
cFieldDescriptor = klass;
|
522
521
|
rb_gc_register_address(&cFieldDescriptor);
|
522
|
+
cFieldDescriptor = klass;
|
523
523
|
}
|
524
524
|
|
525
525
|
/*
|
@@ -916,8 +916,8 @@ void OneofDescriptor_register(VALUE module) {
|
|
916
916
|
rb_define_method(klass, "add_field", OneofDescriptor_add_field, 1);
|
917
917
|
rb_define_method(klass, "each", OneofDescriptor_each, 0);
|
918
918
|
rb_include_module(klass, rb_mEnumerable);
|
919
|
-
cOneofDescriptor = klass;
|
920
919
|
rb_gc_register_address(&cOneofDescriptor);
|
920
|
+
cOneofDescriptor = klass;
|
921
921
|
}
|
922
922
|
|
923
923
|
/*
|
@@ -1037,8 +1037,8 @@ void EnumDescriptor_register(VALUE module) {
|
|
1037
1037
|
rb_define_method(klass, "each", EnumDescriptor_each, 0);
|
1038
1038
|
rb_define_method(klass, "enummodule", EnumDescriptor_enummodule, 0);
|
1039
1039
|
rb_include_module(klass, rb_mEnumerable);
|
1040
|
-
cEnumDescriptor = klass;
|
1041
1040
|
rb_gc_register_address(&cEnumDescriptor);
|
1041
|
+
cEnumDescriptor = klass;
|
1042
1042
|
}
|
1043
1043
|
|
1044
1044
|
/*
|
@@ -1202,8 +1202,8 @@ void MessageBuilderContext_register(VALUE module) {
|
|
1202
1202
|
rb_define_method(klass, "repeated", MessageBuilderContext_repeated, -1);
|
1203
1203
|
rb_define_method(klass, "map", MessageBuilderContext_map, -1);
|
1204
1204
|
rb_define_method(klass, "oneof", MessageBuilderContext_oneof, 1);
|
1205
|
-
cMessageBuilderContext = klass;
|
1206
1205
|
rb_gc_register_address(&cMessageBuilderContext);
|
1206
|
+
cMessageBuilderContext = klass;
|
1207
1207
|
}
|
1208
1208
|
|
1209
1209
|
/*
|
@@ -1491,8 +1491,8 @@ void OneofBuilderContext_register(VALUE module) {
|
|
1491
1491
|
rb_define_method(klass, "initialize",
|
1492
1492
|
OneofBuilderContext_initialize, 2);
|
1493
1493
|
rb_define_method(klass, "optional", OneofBuilderContext_optional, -1);
|
1494
|
-
cOneofBuilderContext = klass;
|
1495
1494
|
rb_gc_register_address(&cOneofBuilderContext);
|
1495
|
+
cOneofBuilderContext = klass;
|
1496
1496
|
}
|
1497
1497
|
|
1498
1498
|
/*
|
@@ -1569,8 +1569,8 @@ void EnumBuilderContext_register(VALUE module) {
|
|
1569
1569
|
rb_define_method(klass, "initialize",
|
1570
1570
|
EnumBuilderContext_initialize, 1);
|
1571
1571
|
rb_define_method(klass, "value", EnumBuilderContext_value, 2);
|
1572
|
-
cEnumBuilderContext = klass;
|
1573
1572
|
rb_gc_register_address(&cEnumBuilderContext);
|
1573
|
+
cEnumBuilderContext = klass;
|
1574
1574
|
}
|
1575
1575
|
|
1576
1576
|
/*
|
@@ -1645,8 +1645,8 @@ void Builder_register(VALUE module) {
|
|
1645
1645
|
rb_define_method(klass, "add_enum", Builder_add_enum, 1);
|
1646
1646
|
rb_define_method(klass, "initialize", Builder_initialize, 0);
|
1647
1647
|
rb_define_method(klass, "finalize_to_pool", Builder_finalize_to_pool, 1);
|
1648
|
-
cBuilder = klass;
|
1649
1648
|
rb_gc_register_address(&cBuilder);
|
1649
|
+
cBuilder = klass;
|
1650
1650
|
}
|
1651
1651
|
|
1652
1652
|
/*
|
@@ -1305,3 +1305,91 @@ VALUE Message_encode_json(int argc, VALUE* argv, VALUE klass) {
|
|
1305
1305
|
}
|
1306
1306
|
}
|
1307
1307
|
|
1308
|
+
static void discard_unknown(VALUE msg_rb, const Descriptor* desc) {
|
1309
|
+
MessageHeader* msg;
|
1310
|
+
upb_msg_field_iter it;
|
1311
|
+
|
1312
|
+
TypedData_Get_Struct(msg_rb, MessageHeader, &Message_type, msg);
|
1313
|
+
|
1314
|
+
stringsink* unknown = msg->unknown_fields;
|
1315
|
+
if (unknown != NULL) {
|
1316
|
+
stringsink_uninit(unknown);
|
1317
|
+
msg->unknown_fields = NULL;
|
1318
|
+
}
|
1319
|
+
|
1320
|
+
for (upb_msg_field_begin(&it, desc->msgdef);
|
1321
|
+
!upb_msg_field_done(&it);
|
1322
|
+
upb_msg_field_next(&it)) {
|
1323
|
+
upb_fielddef *f = upb_msg_iter_field(&it);
|
1324
|
+
uint32_t offset =
|
1325
|
+
desc->layout->fields[upb_fielddef_index(f)].offset +
|
1326
|
+
sizeof(MessageHeader);
|
1327
|
+
|
1328
|
+
if (upb_fielddef_containingoneof(f)) {
|
1329
|
+
uint32_t oneof_case_offset =
|
1330
|
+
desc->layout->fields[upb_fielddef_index(f)].case_offset +
|
1331
|
+
sizeof(MessageHeader);
|
1332
|
+
// For a oneof, check that this field is actually present -- skip all the
|
1333
|
+
// below if not.
|
1334
|
+
if (DEREF(msg, oneof_case_offset, uint32_t) !=
|
1335
|
+
upb_fielddef_number(f)) {
|
1336
|
+
continue;
|
1337
|
+
}
|
1338
|
+
// Otherwise, fall through to the appropriate singular-field handler
|
1339
|
+
// below.
|
1340
|
+
}
|
1341
|
+
|
1342
|
+
if (!upb_fielddef_issubmsg(f)) {
|
1343
|
+
continue;
|
1344
|
+
}
|
1345
|
+
|
1346
|
+
if (is_map_field(f)) {
|
1347
|
+
if (!upb_fielddef_issubmsg(map_field_value(f))) continue;
|
1348
|
+
VALUE map = DEREF(msg, offset, VALUE);
|
1349
|
+
if (map == Qnil) continue;
|
1350
|
+
Map_iter map_it;
|
1351
|
+
for (Map_begin(map, &map_it); !Map_done(&map_it); Map_next(&map_it)) {
|
1352
|
+
VALUE submsg = Map_iter_value(&map_it);
|
1353
|
+
VALUE descriptor = rb_ivar_get(submsg, descriptor_instancevar_interned);
|
1354
|
+
const Descriptor* subdesc = ruby_to_Descriptor(descriptor);
|
1355
|
+
discard_unknown(submsg, subdesc);
|
1356
|
+
}
|
1357
|
+
} else if (upb_fielddef_isseq(f)) {
|
1358
|
+
VALUE ary = DEREF(msg, offset, VALUE);
|
1359
|
+
if (ary == Qnil) continue;
|
1360
|
+
int size = NUM2INT(RepeatedField_length(ary));
|
1361
|
+
for (int i = 0; i < size; i++) {
|
1362
|
+
void* memory = RepeatedField_index_native(ary, i);
|
1363
|
+
VALUE submsg = *((VALUE *)memory);
|
1364
|
+
VALUE descriptor = rb_ivar_get(submsg, descriptor_instancevar_interned);
|
1365
|
+
const Descriptor* subdesc = ruby_to_Descriptor(descriptor);
|
1366
|
+
discard_unknown(submsg, subdesc);
|
1367
|
+
}
|
1368
|
+
} else {
|
1369
|
+
VALUE submsg = DEREF(msg, offset, VALUE);
|
1370
|
+
if (submsg == Qnil) continue;
|
1371
|
+
VALUE descriptor = rb_ivar_get(submsg, descriptor_instancevar_interned);
|
1372
|
+
const Descriptor* subdesc = ruby_to_Descriptor(descriptor);
|
1373
|
+
discard_unknown(submsg, subdesc);
|
1374
|
+
}
|
1375
|
+
}
|
1376
|
+
}
|
1377
|
+
|
1378
|
+
/*
|
1379
|
+
* call-seq:
|
1380
|
+
* Google::Protobuf.discard_unknown(msg)
|
1381
|
+
*
|
1382
|
+
* Discard unknown fields in the given message object and recursively discard
|
1383
|
+
* unknown fields in submessages.
|
1384
|
+
*/
|
1385
|
+
VALUE Google_Protobuf_discard_unknown(VALUE self, VALUE msg_rb) {
|
1386
|
+
VALUE klass = CLASS_OF(msg_rb);
|
1387
|
+
VALUE descriptor = rb_ivar_get(klass, descriptor_instancevar_interned);
|
1388
|
+
Descriptor* desc = ruby_to_Descriptor(descriptor);
|
1389
|
+
if (klass == cRepeatedField || klass == cMap) {
|
1390
|
+
rb_raise(rb_eArgError, "Expected proto msg for discard unknown.");
|
1391
|
+
} else {
|
1392
|
+
discard_unknown(msg_rb, desc);
|
1393
|
+
}
|
1394
|
+
return Qnil;
|
1395
|
+
}
|
data/ext/google/protobuf_c/map.c
CHANGED
@@ -825,8 +825,8 @@ VALUE Map_iter_value(Map_iter* iter) {
|
|
825
825
|
void Map_register(VALUE module) {
|
826
826
|
VALUE klass = rb_define_class_under(module, "Map", rb_cObject);
|
827
827
|
rb_define_alloc_func(klass, Map_alloc);
|
828
|
-
cMap = klass;
|
829
828
|
rb_gc_register_address(&cMap);
|
829
|
+
cMap = klass;
|
830
830
|
|
831
831
|
rb_define_method(klass, "initialize", Map_init, -1);
|
832
832
|
rb_define_method(klass, "each", Map_each, 0);
|
@@ -103,6 +103,8 @@ void Init_protobuf_c() {
|
|
103
103
|
cError = rb_const_get(protobuf, rb_intern("Error"));
|
104
104
|
cParseError = rb_const_get(protobuf, rb_intern("ParseError"));
|
105
105
|
|
106
|
+
rb_define_singleton_method(protobuf, "discard_unknown",
|
107
|
+
Google_Protobuf_discard_unknown, 1);
|
106
108
|
rb_define_singleton_method(protobuf, "deep_copy",
|
107
109
|
Google_Protobuf_deep_copy, 1);
|
108
110
|
|
@@ -515,6 +515,7 @@ VALUE Message_encode(VALUE klass, VALUE msg_rb);
|
|
515
515
|
VALUE Message_decode_json(VALUE klass, VALUE data);
|
516
516
|
VALUE Message_encode_json(int argc, VALUE* argv, VALUE klass);
|
517
517
|
|
518
|
+
VALUE Google_Protobuf_discard_unknown(VALUE self, VALUE msg_rb);
|
518
519
|
VALUE Google_Protobuf_deep_copy(VALUE self, VALUE obj);
|
519
520
|
|
520
521
|
VALUE build_module_from_enumdesc(EnumDescriptor* enumdef);
|
@@ -626,8 +626,8 @@ void RepeatedField_register(VALUE module) {
|
|
626
626
|
VALUE klass = rb_define_class_under(
|
627
627
|
module, "RepeatedField", rb_cObject);
|
628
628
|
rb_define_alloc_func(klass, RepeatedField_alloc);
|
629
|
-
cRepeatedField = klass;
|
630
629
|
rb_gc_register_address(&cRepeatedField);
|
630
|
+
cRepeatedField = klass;
|
631
631
|
|
632
632
|
rb_define_method(klass, "initialize",
|
633
633
|
RepeatedField_init, -1);
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-protobuf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.5.
|
4
|
+
version: 3.5.1
|
5
5
|
platform: x86-mingw32
|
6
6
|
authors:
|
7
7
|
- Protobuf Authors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler-dock
|