google-protobuf 3.8.0-universal-darwin → 3.9.0.rc.1-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
  SHA256:
3
- metadata.gz: 35cab6929ca13cb72488a8c35deacf68b498a043030e1bb1d26ba481dcaa87e8
4
- data.tar.gz: daa6ea023c7b585bcbb866cdc8b97d47d2a7f5cef777fc8cd26baf58e1d5d07e
3
+ metadata.gz: 29cedddf3dd74476f336488974cee16a1eaa224f15be3b831eaeafcdb44e41bb
4
+ data.tar.gz: e6fa849e53192436d407e15b350557290cb6fd9b7d542d064f7c8a45f2d31644
5
5
  SHA512:
6
- metadata.gz: 1671f07a1a790961d08c691027910604e6c5e9db39a6bd9ce36257c9301a3988247fb65e7630902ee36c29aafbb3f00fe0ead2abc6de1e70f190e22a65cd3b31
7
- data.tar.gz: 6ad4a34670908116662b7597b062d2777a1574f4f27216d05279198362eb459ebf1560d28c4ae7c160565c98b45746e3732236ac1c8a56024751d2b3d250c146
6
+ metadata.gz: 781ab50e249e19f8677787b6e48775afc2a15c019d524e11d516f65ebbf8eeb7b2673aaf6377f3d2db352c053f6197d067841dc072c06dbf30757e7615ce4610
7
+ data.tar.gz: 5271b402ab08109b2219ff1f554057d8a45953bf2fef2875d7467f5a5db319d76de521ff875e702a2bb17d0e812998bcafc8898ae976eeeac1c93e2d8ecb94cd
@@ -389,6 +389,9 @@ static bool endmap_handler(void *closure, const void *hd, upb_status* s) {
389
389
  if (mapdata->value_field_type == UPB_TYPE_MESSAGE ||
390
390
  mapdata->value_field_type == UPB_TYPE_ENUM) {
391
391
  value_field_typeclass = get_def_obj(mapdata->value_field_subdef);
392
+ if (mapdata->value_field_type == UPB_TYPE_ENUM) {
393
+ value_field_typeclass = EnumDescriptor_enummodule(value_field_typeclass);
394
+ }
392
395
  }
393
396
 
394
397
  value = native_slot_get(
@@ -847,7 +847,6 @@ void Map_register(VALUE module) {
847
847
  rb_define_method(klass, "dup", Map_dup, 0);
848
848
  rb_define_method(klass, "==", Map_eq, 1);
849
849
  rb_define_method(klass, "hash", Map_hash, 0);
850
- rb_define_method(klass, "to_hash", Map_to_h, 0);
851
850
  rb_define_method(klass, "to_h", Map_to_h, 0);
852
851
  rb_define_method(klass, "inspect", Map_inspect, 0);
853
852
  rb_define_method(klass, "merge", Map_merge, 1);
@@ -737,7 +737,6 @@ VALUE build_class_from_descriptor(Descriptor* desc) {
737
737
  rb_define_method(klass, "eql?", Message_eq, 1);
738
738
  rb_define_method(klass, "hash", Message_hash, 0);
739
739
  rb_define_method(klass, "to_h", Message_to_h, 0);
740
- rb_define_method(klass, "to_hash", Message_to_h, 0);
741
740
  rb_define_method(klass, "inspect", Message_inspect, 0);
742
741
  rb_define_method(klass, "to_s", Message_inspect, 0);
743
742
  rb_define_method(klass, "[]", Message_index, 1);
@@ -16289,18 +16289,32 @@ static size_t fmt_bool(bool val, char* buf, size_t length) {
16289
16289
  return n;
16290
16290
  }
16291
16291
 
16292
- static size_t fmt_int64(long val, char* buf, size_t length) {
16293
- size_t n = _upb_snprintf(buf, length, "%ld", val);
16292
+ static size_t fmt_int64_as_number(long long val, char* buf, size_t length) {
16293
+ size_t n = _upb_snprintf(buf, length, "%lld", val);
16294
16294
  CHKLENGTH(n > 0 && n < length);
16295
16295
  return n;
16296
16296
  }
16297
16297
 
16298
- static size_t fmt_uint64(unsigned long long val, char* buf, size_t length) {
16298
+ static size_t fmt_uint64_as_number(
16299
+ unsigned long long val, char* buf, size_t length) {
16299
16300
  size_t n = _upb_snprintf(buf, length, "%llu", val);
16300
16301
  CHKLENGTH(n > 0 && n < length);
16301
16302
  return n;
16302
16303
  }
16303
16304
 
16305
+ static size_t fmt_int64_as_string(long long val, char* buf, size_t length) {
16306
+ size_t n = _upb_snprintf(buf, length, "\"%lld\"", val);
16307
+ CHKLENGTH(n > 0 && n < length);
16308
+ return n;
16309
+ }
16310
+
16311
+ static size_t fmt_uint64_as_string(
16312
+ unsigned long long val, char* buf, size_t length) {
16313
+ size_t n = _upb_snprintf(buf, length, "\"%llu\"", val);
16314
+ CHKLENGTH(n > 0 && n < length);
16315
+ return n;
16316
+ }
16317
+
16304
16318
  /* Print a map key given a field name. Called by scalar field handlers and by
16305
16319
  * startseq for repeated fields. */
16306
16320
  static bool putkey(void *closure, const void *handler_data) {
@@ -16344,8 +16358,11 @@ static bool putkey(void *closure, const void *handler_data) {
16344
16358
  static bool putmapkey_##type(void *closure, const void *handler_data, \
16345
16359
  type val) { \
16346
16360
  upb_json_printer *p = closure; \
16361
+ char data[64]; \
16362
+ size_t length = fmt_func(val, data, sizeof(data)); \
16363
+ UPB_UNUSED(handler_data); \
16347
16364
  print_data(p, "\"", 1); \
16348
- CHK(put##type(closure, handler_data, val)); \
16365
+ print_data(p, data, length); \
16349
16366
  print_data(p, "\":", 2); \
16350
16367
  return true; \
16351
16368
  }
@@ -16353,17 +16370,17 @@ static bool putkey(void *closure, const void *handler_data) {
16353
16370
  TYPE_HANDLERS(double, fmt_double)
16354
16371
  TYPE_HANDLERS(float, fmt_float)
16355
16372
  TYPE_HANDLERS(bool, fmt_bool)
16356
- TYPE_HANDLERS(int32_t, fmt_int64)
16357
- TYPE_HANDLERS(uint32_t, fmt_int64)
16358
- TYPE_HANDLERS(int64_t, fmt_int64)
16359
- TYPE_HANDLERS(uint64_t, fmt_uint64)
16373
+ TYPE_HANDLERS(int32_t, fmt_int64_as_number)
16374
+ TYPE_HANDLERS(uint32_t, fmt_int64_as_number)
16375
+ TYPE_HANDLERS(int64_t, fmt_int64_as_string)
16376
+ TYPE_HANDLERS(uint64_t, fmt_uint64_as_string)
16360
16377
 
16361
16378
  /* double and float are not allowed to be map keys. */
16362
16379
  TYPE_HANDLERS_MAPKEY(bool, fmt_bool)
16363
- TYPE_HANDLERS_MAPKEY(int32_t, fmt_int64)
16364
- TYPE_HANDLERS_MAPKEY(uint32_t, fmt_int64)
16365
- TYPE_HANDLERS_MAPKEY(int64_t, fmt_int64)
16366
- TYPE_HANDLERS_MAPKEY(uint64_t, fmt_uint64)
16380
+ TYPE_HANDLERS_MAPKEY(int32_t, fmt_int64_as_number)
16381
+ TYPE_HANDLERS_MAPKEY(uint32_t, fmt_int64_as_number)
16382
+ TYPE_HANDLERS_MAPKEY(int64_t, fmt_int64_as_number)
16383
+ TYPE_HANDLERS_MAPKEY(uint64_t, fmt_uint64_as_number)
16367
16384
 
16368
16385
  #undef TYPE_HANDLERS
16369
16386
  #undef TYPE_HANDLERS_MAPKEY
Binary file
Binary file
Binary file
Binary file
data/tests/basic.rb CHANGED
@@ -170,10 +170,12 @@ module BasicTest
170
170
  m = MapMessage.new(
171
171
  :map_string_int32 => {"a" => 1, "b" => 2},
172
172
  :map_string_msg => {"a" => TestMessage2.new(:foo => 1),
173
- "b" => TestMessage2.new(:foo => 2)})
173
+ "b" => TestMessage2.new(:foo => 2)},
174
+ :map_string_enum => {"a" => :A, "b" => :B})
174
175
  assert m.map_string_int32.keys.sort == ["a", "b"]
175
176
  assert m.map_string_int32["a"] == 1
176
177
  assert m.map_string_msg["b"].foo == 2
178
+ assert m.map_string_enum["a"] == :A
177
179
 
178
180
  m.map_string_int32["c"] = 3
179
181
  assert m.map_string_int32["c"] == 3
@@ -206,8 +208,9 @@ module BasicTest
206
208
  m = MapMessage.new(
207
209
  :map_string_int32 => {"a" => 1, "b" => 2},
208
210
  :map_string_msg => {"a" => TestMessage2.new(:foo => 1),
209
- "b" => TestMessage2.new(:foo => 2)})
210
- expected = "<BasicTest::MapMessage: map_string_int32: {\"b\"=>2, \"a\"=>1}, map_string_msg: {\"b\"=><BasicTest::TestMessage2: foo: 2>, \"a\"=><BasicTest::TestMessage2: foo: 1>}>"
211
+ "b" => TestMessage2.new(:foo => 2)},
212
+ :map_string_enum => {"a" => :A, "b" => :B})
213
+ expected = "<BasicTest::MapMessage: map_string_int32: {\"b\"=>2, \"a\"=>1}, map_string_msg: {\"b\"=><BasicTest::TestMessage2: foo: 2>, \"a\"=><BasicTest::TestMessage2: foo: 1>}, map_string_enum: {\"b\"=>:B, \"a\"=>:A}>"
211
214
  assert_equal expected, m.inspect
212
215
  end
213
216
 
@@ -237,7 +240,8 @@ module BasicTest
237
240
  m = MapMessage.new(
238
241
  :map_string_int32 => {"a" => 1, "b" => 2},
239
242
  :map_string_msg => {"a" => TestMessage2.new(:foo => 1),
240
- "b" => TestMessage2.new(:foo => 2)})
243
+ "b" => TestMessage2.new(:foo => 2)},
244
+ :map_string_enum => {"a" => :A, "b" => :B})
241
245
  m2 = MapMessage.decode(MapMessage.encode(m))
242
246
  assert m == m2
243
247
 
@@ -298,10 +302,12 @@ module BasicTest
298
302
  m = MapMessage.new(
299
303
  :map_string_int32 => {"a" => 1, "b" => 2},
300
304
  :map_string_msg => {"a" => TestMessage2.new(:foo => 1),
301
- "b" => TestMessage2.new(:foo => 2)})
305
+ "b" => TestMessage2.new(:foo => 2)},
306
+ :map_string_enum => {"a" => :A, "b" => :B})
302
307
  expected_result = {
303
308
  :map_string_int32 => {"a" => 1, "b" => 2},
304
- :map_string_msg => {"a" => {:foo => 1}, "b" => {:foo => 2}}
309
+ :map_string_msg => {"a" => {:foo => 1}, "b" => {:foo => 2}},
310
+ :map_string_enum => {"a" => :A, "b" => :B}
305
311
  }
306
312
  assert_equal expected_result, m.to_h
307
313
  end
@@ -311,26 +317,26 @@ module BasicTest
311
317
  # TODO: Fix JSON in JRuby version.
312
318
  return if RUBY_PLATFORM == "java"
313
319
  m = MapMessage.new(:map_string_int32 => {"a" => 1})
314
- expected = {mapStringInt32: {a: 1}, mapStringMsg: {}}
315
- expected_preserve = {map_string_int32: {a: 1}, map_string_msg: {}}
316
- assert JSON.parse(MapMessage.encode_json(m), :symbolize_names => true) == expected
320
+ expected = {mapStringInt32: {a: 1}, mapStringMsg: {}, mapStringEnum: {}}
321
+ expected_preserve = {map_string_int32: {a: 1}, map_string_msg: {}, map_string_enum: {}}
322
+ assert_equal JSON.parse(MapMessage.encode_json(m), :symbolize_names => true), expected
317
323
 
318
324
  json = MapMessage.encode_json(m, :preserve_proto_fieldnames => true)
319
- assert JSON.parse(json, :symbolize_names => true) == expected_preserve
325
+ assert_equal JSON.parse(json, :symbolize_names => true), expected_preserve
320
326
 
321
327
  m2 = MapMessage.decode_json(MapMessage.encode_json(m))
322
- assert m == m2
328
+ assert_equal m, m2
323
329
  end
324
330
 
325
331
  def test_json_maps_emit_defaults_submsg
326
332
  # TODO: Fix JSON in JRuby version.
327
333
  return if RUBY_PLATFORM == "java"
328
334
  m = MapMessage.new(:map_string_msg => {"a" => TestMessage2.new})
329
- expected = {mapStringInt32: {}, mapStringMsg: {a: {foo: 0}}}
335
+ expected = {mapStringInt32: {}, mapStringMsg: {a: {foo: 0}}, mapStringEnum: {}}
330
336
 
331
337
  actual = MapMessage.encode_json(m, :emit_defaults => true)
332
338
 
333
- assert JSON.parse(actual, :symbolize_names => true) == expected
339
+ assert_equal JSON.parse(actual, :symbolize_names => true), expected
334
340
  end
335
341
 
336
342
  def test_respond_to
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.8.0
4
+ version: 3.9.0.rc.1
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: 2019-05-28 00:00:00.000000000 Z
11
+ date: 2019-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler-dock
@@ -126,11 +126,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
126
126
  version: '2.3'
127
127
  required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ">="
129
+ - - ">"
130
130
  - !ruby/object:Gem::Version
131
- version: '0'
131
+ version: 1.3.1
132
132
  requirements: []
133
- rubygems_version: 3.0.3
133
+ rubygems_version: 3.0.4
134
134
  signing_key:
135
135
  specification_version: 4
136
136
  summary: Protocol Buffers