google-protobuf 3.4.0.2-x64-mingw32 → 3.4.1.1-x64-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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 553dc467fb7af17cc18258c672d2e0ab696fc14c
4
- data.tar.gz: 9170934b32ff4c7027a96be97a20d16c12232718
3
+ metadata.gz: 0f96f194b39c6275eca8a8adadedcae5d92d23ca
4
+ data.tar.gz: 00f8ea942ba8ec53f62a24b7ff0c020af94a047d
5
5
  SHA512:
6
- metadata.gz: dff355a445bf921ff88ab03c68b8807cf3f0305cc6ba4ec2cb8e6c8a3196a96c8378d5a01b014072f7b4e0e11eeb03cdf898b2c0f2b233be086ad74a22959f2e
7
- data.tar.gz: 5b8eb3bb28c3b35f5244188d8e5c771e8e05ec21bc27979b2c2f5e94e54072852b728715274071748e9f2d0ede7faefde366d6059e4dcb120888166adb51f581
6
+ metadata.gz: 0355513a7fbd16816e6c7ec35dfd47218aba0d7c9c5a6b673ec005077974dc6ea291af1864dc4b548160c68a222e20b2c9159b7bb066a0fe797e5374eee30889
7
+ data.tar.gz: 428eae023468bf650b71520631293655c596db0dadbd4aaab0fb951f1de7a254daf61fe8c6278da79041490d480189867a05ac33d3078a32fe634ae491f99fb0
@@ -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
- rb_ary_push(map_parse_frames,
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
- map_pop_frame();
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;
@@ -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) {
@@ -112,6 +112,4 @@ void Init_protobuf_c() {
112
112
 
113
113
  upb_def_to_ruby_obj_map = rb_hash_new();
114
114
  rb_gc_register_address(&upb_def_to_ruby_obj_map);
115
- map_parse_frames = rb_ary_new();
116
- rb_gc_register_address(&map_parse_frames);
117
115
  }
@@ -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.0.2
4
+ version: 3.4.1.1
5
5
  platform: x64-mingw32
6
6
  authors:
7
7
  - Protobuf Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-17 00:00:00.000000000 Z
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: '2.0'
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
  - - ">="