google-protobuf 3.0.0-universal-darwin → 3.0.2-universal-darwin

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: 23958eac76a7e456b39c6b73917cb142c9c31c2c
4
- data.tar.gz: 1927275c1ffe0de74b450c7bec9fb8181332f545
3
+ metadata.gz: a80e6fe807daf674f4e4ea399492caae4954b762
4
+ data.tar.gz: 9f2865beef368daab0d238fcba2abe83311e0584
5
5
  SHA512:
6
- metadata.gz: f59af85b4aa28fe5f867e28ea3c36a388ecb07bf9d38830432426862d1803b80d3d01caa9679d07a1d1bc61c1d5eb16f9c444dbba4b6cc7ea0c86fd23438a980
7
- data.tar.gz: 0b4a4719f8e1cc8d33d2fd13f30ba217ce6f8fb46516d0d346da01ee37134b5bfbf58ddce760fdeee713576983bc98c0d963750c69b902fd97364e17ed067a96
6
+ metadata.gz: 9e657a0811eff1485f75a02ce53aea0d7fff6fb143de781ad3fba54a38ab2e4b62bc7b8310e94af0a0423df948360eba639805a83e10416b546fbc8cbb72c6f8
7
+ data.tar.gz: eb00c45f543dac0c2bab249d94085677f6425ce2ffb134c0657ca206a454d146c60f99f44376fa8ebd9b69317d69f0f60dc658b0a7ff60faed45f312868a7141
@@ -255,10 +255,54 @@ typedef struct {
255
255
  // value into the map.
256
256
  typedef struct {
257
257
  VALUE map;
258
+ const map_handlerdata_t* handlerdata;
258
259
  char key_storage[NATIVE_SLOT_MAX_SIZE];
259
260
  char value_storage[NATIVE_SLOT_MAX_SIZE];
260
261
  } map_parse_frame_t;
261
262
 
263
+ static void MapParseFrame_mark(void* _self) {
264
+ map_parse_frame_t* frame = _self;
265
+
266
+ // This shouldn't strictly be necessary since this should be rooted by the
267
+ // message itself, but it can't hurt.
268
+ rb_gc_mark(frame->map);
269
+
270
+ native_slot_mark(frame->handlerdata->key_field_type, &frame->key_storage);
271
+ native_slot_mark(frame->handlerdata->value_field_type, &frame->value_storage);
272
+ }
273
+
274
+ void MapParseFrame_free(void* self) {
275
+ xfree(self);
276
+ }
277
+
278
+ rb_data_type_t MapParseFrame_type = {
279
+ "MapParseFrame",
280
+ { MapParseFrame_mark, MapParseFrame_free, NULL },
281
+ };
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
+ static map_parse_frame_t* map_push_frame(VALUE map,
289
+ const map_handlerdata_t* handlerdata) {
290
+ map_parse_frame_t* frame = ALLOC(map_parse_frame_t);
291
+ frame->handlerdata = handlerdata;
292
+ frame->map = map;
293
+ native_slot_init(handlerdata->key_field_type, &frame->key_storage);
294
+ native_slot_init(handlerdata->value_field_type, &frame->value_storage);
295
+
296
+ rb_ary_push(map_parse_frames,
297
+ TypedData_Wrap_Struct(rb_cObject, &MapParseFrame_type, frame));
298
+
299
+ return frame;
300
+ }
301
+
302
+ static void map_pop_frame() {
303
+ rb_ary_pop(map_parse_frames);
304
+ }
305
+
262
306
  // Handler to begin a map entry: allocates a temporary frame. This is the
263
307
  // 'startsubmsg' handler on the msgdef that contains the map field.
264
308
  static void *startmapentry_handler(void *closure, const void *hd) {
@@ -266,13 +310,7 @@ static void *startmapentry_handler(void *closure, const void *hd) {
266
310
  const map_handlerdata_t* mapdata = hd;
267
311
  VALUE map_rb = DEREF(msg, mapdata->ofs, VALUE);
268
312
 
269
- map_parse_frame_t* frame = ALLOC(map_parse_frame_t);
270
- frame->map = map_rb;
271
-
272
- native_slot_init(mapdata->key_field_type, &frame->key_storage);
273
- native_slot_init(mapdata->value_field_type, &frame->value_storage);
274
-
275
- return frame;
313
+ return map_push_frame(map_rb, mapdata);
276
314
  }
277
315
 
278
316
  // Handler to end a map entry: inserts the value defined during the message into
@@ -298,7 +336,7 @@ static bool endmap_handler(void *closure, const void *hd, upb_status* s) {
298
336
  &frame->value_storage);
299
337
 
300
338
  Map_index_set(frame->map, key, value);
301
- xfree(frame);
339
+ map_pop_frame();
302
340
 
303
341
  return true;
304
342
  }
@@ -737,6 +775,10 @@ VALUE Message_decode(VALUE klass, VALUE data) {
737
775
  msg_rb = rb_class_new_instance(0, NULL, msgklass);
738
776
  TypedData_Get_Struct(msg_rb, MessageHeader, &Message_type, msg);
739
777
 
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
+
740
782
  {
741
783
  const upb_pbdecodermethod* method = msgdef_decodermethod(desc);
742
784
  const upb_handlers* h = upb_pbdecodermethod_desthandlers(method);
@@ -781,6 +823,10 @@ VALUE Message_decode_json(VALUE klass, VALUE data) {
781
823
  msg_rb = rb_class_new_instance(0, NULL, msgklass);
782
824
  TypedData_Get_Struct(msg_rb, MessageHeader, &Message_type, msg);
783
825
 
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
+
784
830
  {
785
831
  const upb_json_parsermethod* method = msgdef_jsonparsermethod(desc);
786
832
  stackenv se;
@@ -112,4 +112,6 @@ 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);
115
117
  }
@@ -166,6 +166,8 @@ extern VALUE cBuilder;
166
166
  extern VALUE cError;
167
167
  extern VALUE cParseError;
168
168
 
169
+ extern VALUE map_parse_frames;
170
+
169
171
  // We forward-declare all of the Ruby method implementations here because we
170
172
  // sometimes call the methods directly across .c files, rather than going
171
173
  // through Ruby's method dispatching (e.g. during message parse). It's cleaner
@@ -11175,7 +11175,7 @@ static bool parse_mapentry_key(upb_json_parser *p) {
11175
11175
  sel = getsel_for_handlertype(p, UPB_HANDLER_STRING);
11176
11176
  upb_sink_putstring(&subsink, sel, buf, len, NULL);
11177
11177
  sel = getsel_for_handlertype(p, UPB_HANDLER_ENDSTR);
11178
- upb_sink_endstr(&subsink, sel);
11178
+ upb_sink_endstr(&p->top->sink, sel);
11179
11179
  multipart_end(p);
11180
11180
  break;
11181
11181
  }
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.0.0
4
+ version: 3.0.2
5
5
  platform: universal-darwin
6
6
  authors:
7
7
  - Protobuf Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-29 00:00:00.000000000 Z
11
+ date: 2016-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler-dock