google-protobuf 3.8.0-x86-linux → 3.9.0.rc.1-x86-linux

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: 6807eea89a715b5e59b7bb92a48260adcac1cef0b7bf9ede69f7757266211482
4
- data.tar.gz: becdd0bb72159627b40e47d918f0b8199bfb32247e87f2c722aa3f7dadbcdcbe
3
+ metadata.gz: 0e07856a9e78bb24f6dbc8df2a2d9741d7344c5b75b87950b048ebc9fe1d44dc
4
+ data.tar.gz: 697034eb40b24f3985815acdbc5b1d434e60d60c8040052dceb379cced0636d0
5
5
  SHA512:
6
- metadata.gz: 0e09aee5290aa0589c356aba66317f6b107f3dad52dd12cf72d28b1015336fc5e21e92d56e55a9968ea2b02d49022537d25ce53aafdef260845a8c4ac4c2192c
7
- data.tar.gz: d00a34015c5c187790f7e7678dd415ba887d8561ced54063618eb70ba22c54f349a2cdbde9cf1c4dd0e9018a086fa19abb2bb4dcf417a6500e676a9b434b519e
6
+ metadata.gz: 6ac54106224dd7382b9392f05c077e6aea6e1b8dde04b45573c4e40cf8570feb302d23c6536af44abf7887c9d7ecc246370778c83d1d552a1cf7e14be4778d2e
7
+ data.tar.gz: ef6bed24bd66981e10ec901d7b16adf5f02246b258d356fc9cc202684de59ff9c3e094d09cde650539d362c533e3be4198c1c2db179095b37080762b9c818555
@@ -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
@@ -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: x86-linux
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,12 +126,12 @@ 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
133
  rubyforge_project:
134
- rubygems_version: 2.7.8
134
+ rubygems_version: 2.7.9
135
135
  signing_key:
136
136
  specification_version: 4
137
137
  summary: Protocol Buffers