google-protobuf 3.8.0 → 3.9.0.rc.1

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: acc61dfa5ec7487b0b62edbf098aca5a5d0ce33145cbab091a892f1ed9f240cf
4
- data.tar.gz: f7666d31441737c415008dfa0077657b8afb3c23fd0966f972b305163ffd2a02
3
+ metadata.gz: 6674a08fc038c1252f03ae0255facbd23ee6626b98cdf52925c2dc696e9caffa
4
+ data.tar.gz: 7c0055b1e31c8721b70836623bf0ef69d58f5bd7c628305bbc216ed0f530775a
5
5
  SHA512:
6
- metadata.gz: 481d523e6d2dc363c73695025811bcc181358513a9a7931d4f19d6c9aab40a085a2e02e97d5370069f339897b8170fd3ddca906952717233e582cd10a9dcfd4c
7
- data.tar.gz: 9cf2022047f865793c3edc480147e1e2c27f1d1d676239090c32f3356a8c4f6f6405bde3b8a879aeb9200725d7e340f9fec8d1457ed37411feb3b4d0546dd96c
6
+ metadata.gz: 47e460d54b1444237a7381e7626c6cf67248abb88395af3d7a0640b3fa266fed8a4b18135ec90d4de72853f14ac5b0d49fd3376bc397979ac894dfe6534028db
7
+ data.tar.gz: d2fb9569e807153a8e09dd824396e8a9fbb9129a67574f3fbac64a8fe9721b4bd39b82767b58882f77c3936542176446d3ded2612c9b057abdb4e1552a0f8439
@@ -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
@@ -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: ruby
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
@@ -123,11 +123,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
123
123
  version: '2.3'
124
124
  required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  requirements:
126
- - - ">="
126
+ - - ">"
127
127
  - !ruby/object:Gem::Version
128
- version: '0'
128
+ version: 1.3.1
129
129
  requirements: []
130
- rubygems_version: 3.0.3
130
+ rubygems_version: 3.0.4
131
131
  signing_key:
132
132
  specification_version: 4
133
133
  summary: Protocol Buffers