google-protobuf 3.4.0.2-x86-linux → 3.4.1.1-x86-linux
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.
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/encode_decode.c +2 -19
- data/ext/google/protobuf_c/map.c +8 -0
- data/ext/google/protobuf_c/protobuf.c +0 -2
- data/ext/google/protobuf_c/protobuf.h +2 -2
- 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
- data/tests/basic.rb +25 -0
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39910983cda5c59a079924cd697f710987c7841e
|
4
|
+
data.tar.gz: 33cc6614e794c02193bbc117012397da64d0d398
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76939e7fe29e3bf3282fe2ea4d6e3010d90c534a3ff18ed6f54022024eb676696ecfb9afd66c15b28b39afa3e764726e0ad3887c292546fb26fe8a32cc5e4143
|
7
|
+
data.tar.gz: 59f9342c94eec0142d8bcbcd3cd061f74d665116f170e934c7f183e872796b6d11afb5751320e25f75421b4e88a4bb32c6127b8cb78fec241801c3cdd99ba54d
|
@@ -280,11 +280,6 @@ rb_data_type_t MapParseFrame_type = {
|
|
280
280
|
{ MapParseFrame_mark, MapParseFrame_free, NULL },
|
281
281
|
};
|
282
282
|
|
283
|
-
// Array of Ruby objects wrapping map_parse_frame_t.
|
284
|
-
// We don't allow multiple concurrent decodes, so we assume that this global
|
285
|
-
// variable is specific to the "current" decode.
|
286
|
-
VALUE map_parse_frames;
|
287
|
-
|
288
283
|
static map_parse_frame_t* map_push_frame(VALUE map,
|
289
284
|
const map_handlerdata_t* handlerdata) {
|
290
285
|
map_parse_frame_t* frame = ALLOC(map_parse_frame_t);
|
@@ -293,16 +288,12 @@ static map_parse_frame_t* map_push_frame(VALUE map,
|
|
293
288
|
native_slot_init(handlerdata->key_field_type, &frame->key_storage);
|
294
289
|
native_slot_init(handlerdata->value_field_type, &frame->value_storage);
|
295
290
|
|
296
|
-
|
291
|
+
Map_set_frame(map,
|
297
292
|
TypedData_Wrap_Struct(rb_cObject, &MapParseFrame_type, frame));
|
298
293
|
|
299
294
|
return frame;
|
300
295
|
}
|
301
296
|
|
302
|
-
static void map_pop_frame() {
|
303
|
-
rb_ary_pop(map_parse_frames);
|
304
|
-
}
|
305
|
-
|
306
297
|
// Handler to begin a map entry: allocates a temporary frame. This is the
|
307
298
|
// 'startsubmsg' handler on the msgdef that contains the map field.
|
308
299
|
static void *startmapentry_handler(void *closure, const void *hd) {
|
@@ -336,7 +327,7 @@ static bool endmap_handler(void *closure, const void *hd, upb_status* s) {
|
|
336
327
|
&frame->value_storage);
|
337
328
|
|
338
329
|
Map_index_set(frame->map, key, value);
|
339
|
-
|
330
|
+
Map_set_frame(frame->map, Qnil);
|
340
331
|
|
341
332
|
return true;
|
342
333
|
}
|
@@ -775,10 +766,6 @@ VALUE Message_decode(VALUE klass, VALUE data) {
|
|
775
766
|
msg_rb = rb_class_new_instance(0, NULL, msgklass);
|
776
767
|
TypedData_Get_Struct(msg_rb, MessageHeader, &Message_type, msg);
|
777
768
|
|
778
|
-
// We generally expect this to be clear already, but clear it in case parsing
|
779
|
-
// previously got interrupted somehow.
|
780
|
-
rb_ary_clear(map_parse_frames);
|
781
|
-
|
782
769
|
{
|
783
770
|
const upb_pbdecodermethod* method = msgdef_decodermethod(desc);
|
784
771
|
const upb_handlers* h = upb_pbdecodermethod_desthandlers(method);
|
@@ -823,10 +810,6 @@ VALUE Message_decode_json(VALUE klass, VALUE data) {
|
|
823
810
|
msg_rb = rb_class_new_instance(0, NULL, msgklass);
|
824
811
|
TypedData_Get_Struct(msg_rb, MessageHeader, &Message_type, msg);
|
825
812
|
|
826
|
-
// We generally expect this to be clear already, but clear it in case parsing
|
827
|
-
// previously got interrupted somehow.
|
828
|
-
rb_ary_clear(map_parse_frames);
|
829
|
-
|
830
813
|
{
|
831
814
|
const upb_json_parsermethod* method = msgdef_jsonparsermethod(desc);
|
832
815
|
stackenv se;
|
data/ext/google/protobuf_c/map.c
CHANGED
@@ -146,6 +146,7 @@ void Map_mark(void* _self) {
|
|
146
146
|
Map* self = _self;
|
147
147
|
|
148
148
|
rb_gc_mark(self->value_type_class);
|
149
|
+
rb_gc_mark(self->parse_frame);
|
149
150
|
|
150
151
|
if (self->value_type == UPB_TYPE_STRING ||
|
151
152
|
self->value_type == UPB_TYPE_BYTES ||
|
@@ -174,6 +175,12 @@ VALUE Map_alloc(VALUE klass) {
|
|
174
175
|
return TypedData_Wrap_Struct(klass, &Map_type, self);
|
175
176
|
}
|
176
177
|
|
178
|
+
VALUE Map_set_frame(VALUE map, VALUE val) {
|
179
|
+
Map* self = ruby_to_Map(map);
|
180
|
+
self->parse_frame = val;
|
181
|
+
return val;
|
182
|
+
}
|
183
|
+
|
177
184
|
static bool needs_typeclass(upb_fieldtype_t type) {
|
178
185
|
switch (type) {
|
179
186
|
case UPB_TYPE_MESSAGE:
|
@@ -227,6 +234,7 @@ VALUE Map_init(int argc, VALUE* argv, VALUE _self) {
|
|
227
234
|
|
228
235
|
self->key_type = ruby_to_fieldtype(argv[0]);
|
229
236
|
self->value_type = ruby_to_fieldtype(argv[1]);
|
237
|
+
self->parse_frame = Qnil;
|
230
238
|
|
231
239
|
// Check that the key type is an allowed type.
|
232
240
|
switch (self->key_type) {
|
@@ -166,8 +166,6 @@ extern VALUE cBuilder;
|
|
166
166
|
extern VALUE cError;
|
167
167
|
extern VALUE cParseError;
|
168
168
|
|
169
|
-
extern VALUE map_parse_frames;
|
170
|
-
|
171
169
|
// We forward-declare all of the Ruby method implementations here because we
|
172
170
|
// sometimes call the methods directly across .c files, rather than going
|
173
171
|
// through Ruby's method dispatching (e.g. during message parse). It's cleaner
|
@@ -397,6 +395,7 @@ typedef struct {
|
|
397
395
|
upb_fieldtype_t key_type;
|
398
396
|
upb_fieldtype_t value_type;
|
399
397
|
VALUE value_type_class;
|
398
|
+
VALUE parse_frame;
|
400
399
|
upb_strtable table;
|
401
400
|
} Map;
|
402
401
|
|
@@ -405,6 +404,7 @@ void Map_free(void* self);
|
|
405
404
|
VALUE Map_alloc(VALUE klass);
|
406
405
|
VALUE Map_init(int argc, VALUE* argv, VALUE self);
|
407
406
|
void Map_register(VALUE module);
|
407
|
+
VALUE Map_set_frame(VALUE self, VALUE val);
|
408
408
|
|
409
409
|
extern const rb_data_type_t Map_type;
|
410
410
|
extern VALUE cMap;
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/tests/basic.rb
CHANGED
@@ -96,8 +96,18 @@ module BasicTest
|
|
96
96
|
optional :d, :enum, 4, "TestEnum"
|
97
97
|
end
|
98
98
|
end
|
99
|
+
|
100
|
+
add_message "repro.Outer" do
|
101
|
+
map :items, :int32, :message, 1, "repro.Inner"
|
102
|
+
end
|
103
|
+
|
104
|
+
add_message "repro.Inner" do
|
105
|
+
end
|
99
106
|
end
|
100
107
|
|
108
|
+
|
109
|
+
Outer = pool.lookup("repro.Outer").msgclass
|
110
|
+
Inner = pool.lookup("repro.Inner").msgclass
|
101
111
|
Foo = pool.lookup("Foo").msgclass
|
102
112
|
Bar = pool.lookup("Bar").msgclass
|
103
113
|
Baz = pool.lookup("Baz").msgclass
|
@@ -675,6 +685,21 @@ module BasicTest
|
|
675
685
|
m.map_string_int32['aaa'] = 3
|
676
686
|
end
|
677
687
|
|
688
|
+
def test_concurrent_decoding
|
689
|
+
o = Outer.new
|
690
|
+
o.items[0] = Inner.new
|
691
|
+
raw = Outer.encode(o)
|
692
|
+
|
693
|
+
thds = 2.times.map do
|
694
|
+
Thread.new do
|
695
|
+
100000.times do
|
696
|
+
assert_equal o, Outer.decode(raw)
|
697
|
+
end
|
698
|
+
end
|
699
|
+
end
|
700
|
+
thds.map(&:join)
|
701
|
+
end
|
702
|
+
|
678
703
|
def test_map_encode_decode
|
679
704
|
m = MapMessage.new(
|
680
705
|
:map_string_int32 => {"a" => 1, "b" => 2},
|
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.4.
|
4
|
+
version: 3.4.1.1
|
5
5
|
platform: x86-linux
|
6
6
|
authors:
|
7
7
|
- Protobuf Authors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler-dock
|
@@ -124,10 +124,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
124
124
|
requirements:
|
125
125
|
- - ">="
|
126
126
|
- !ruby/object:Gem::Version
|
127
|
-
version: '
|
128
|
-
- - "<"
|
129
|
-
- !ruby/object:Gem::Version
|
130
|
-
version: '2.5'
|
127
|
+
version: '0'
|
131
128
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
129
|
requirements:
|
133
130
|
- - ">="
|