google-protobuf 3.15.8-x86-linux → 3.17.0.rc.2-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: f3fd3973c0a9981c2b563b4570fd3811bfed24f8bbd9c9ef8c7e970eb05e71b9
4
- data.tar.gz: '08b3a332679e002c2556f31929c69b74fcbbcefae427d44d2c6f3c2b282fde50'
3
+ metadata.gz: 023c0ef50832fbf79be0e1bd46ee267970f33d7940151ab769e49a0943cd30ec
4
+ data.tar.gz: dbb3c231ac68a1513f093687287a1a36a19e30dfc4746b637e79ef9d632fa23c
5
5
  SHA512:
6
- metadata.gz: b3979160a19520ef46451f071b00b7c2923e491d1bac9e04c5115592d88e84cb1c6a7141d71d967bfb1137fd7b89c5b0787584c1602516f33946306de6c9d986
7
- data.tar.gz: 9888d6e87b4cfa31774c199b863c47a972efc0ef03fa9aff0b4d607da31c52d3775a52252973954a5f2d6ae567193e5e45b22132ed30df039cc8bb66be78d328
6
+ metadata.gz: 57bd0d899649ccfa7c413451aaa3bf30b2b8798a3845123d68a04db62dde4fca8bc10a13354ce71931283d92aeaea315dc1fdd8ea08827b6a52ae2f15d9bd0b2
7
+ data.tar.gz: 91e9405b9a7ce013073ee79e893ee9b08a77134945d326083bbfe32d8991860f44d147bdbedd0fa6d69bb6fa6be45bf60b4b8393d53e4f5f6f3d21deefe01471
@@ -868,6 +868,20 @@ static VALUE FieldDescriptor_default(VALUE _self) {
868
868
  return Convert_UpbToRuby(default_val, TypeInfo_get(self->fielddef), Qnil);
869
869
  }
870
870
 
871
+
872
+ /*
873
+ * call-seq:
874
+ * FieldDescriptor.json_name => json_name
875
+ *
876
+ * Returns this field's json_name, as a Ruby string, or nil if not yet set.
877
+ */
878
+ static VALUE FieldDescriptor_json_name(VALUE _self) {
879
+ FieldDescriptor* self = ruby_to_FieldDescriptor(_self);
880
+ const upb_fielddef *f = self->fielddef;
881
+ const char *json_name = upb_fielddef_jsonname(f);
882
+ return rb_str_new2(json_name);
883
+ }
884
+
871
885
  /*
872
886
  * call-seq:
873
887
  * FieldDescriptor.label => label
@@ -1043,6 +1057,7 @@ static void FieldDescriptor_register(VALUE module) {
1043
1057
  rb_define_method(klass, "name", FieldDescriptor_name, 0);
1044
1058
  rb_define_method(klass, "type", FieldDescriptor__type, 0);
1045
1059
  rb_define_method(klass, "default", FieldDescriptor_default, 0);
1060
+ rb_define_method(klass, "json_name", FieldDescriptor_json_name, 0);
1046
1061
  rb_define_method(klass, "label", FieldDescriptor_label, 0);
1047
1062
  rb_define_method(klass, "number", FieldDescriptor_number, 0);
1048
1063
  rb_define_method(klass, "submsg_name", FieldDescriptor_submsg_name, 0);
@@ -1750,6 +1765,16 @@ static void msgdef_add_field(VALUE msgbuilder_rb, upb_label_t label, VALUE name,
1750
1765
  field_proto,
1751
1766
  FileBuilderContext_strdup(self->file_builder, default_value));
1752
1767
  }
1768
+
1769
+ if (rb_funcall(options, rb_intern("key?"), 1,
1770
+ ID2SYM(rb_intern("json_name"))) == Qtrue) {
1771
+ VALUE json_name =
1772
+ rb_hash_lookup(options, ID2SYM(rb_intern("json_name")));
1773
+
1774
+ google_protobuf_FieldDescriptorProto_set_json_name(
1775
+ field_proto,
1776
+ FileBuilderContext_strdup(self->file_builder, json_name));
1777
+ }
1753
1778
  }
1754
1779
 
1755
1780
  if (oneof_index >= 0) {
@@ -1899,18 +1924,20 @@ static VALUE MessageBuilderContext_required(int argc, VALUE* argv,
1899
1924
  */
1900
1925
  static VALUE MessageBuilderContext_repeated(int argc, VALUE* argv,
1901
1926
  VALUE _self) {
1902
- VALUE name, type, number, type_class;
1927
+ VALUE name, type, number;
1928
+ VALUE type_class, options = Qnil;
1903
1929
 
1904
- if (argc < 3) {
1905
- rb_raise(rb_eArgError, "Expected at least 3 arguments.");
1930
+ rb_scan_args(argc, argv, "32", &name, &type, &number, &type_class, &options);
1931
+
1932
+ // Allow passing (name, type, number, options) or
1933
+ // (name, type, number, type_class, options)
1934
+ if (argc == 4 && RB_TYPE_P(type_class, T_HASH)) {
1935
+ options = type_class;
1936
+ type_class = Qnil;
1906
1937
  }
1907
- name = argv[0];
1908
- type = argv[1];
1909
- number = argv[2];
1910
- type_class = (argc > 3) ? argv[3] : Qnil;
1911
1938
 
1912
1939
  msgdef_add_field(_self, UPB_LABEL_REPEATED, name, type, number, type_class,
1913
- Qnil, -1, false);
1940
+ options, -1, false);
1914
1941
 
1915
1942
  return Qnil;
1916
1943
  }
@@ -17,4 +17,5 @@ end
17
17
  $objs = ["protobuf.o", "convert.o", "defs.o", "message.o",
18
18
  "repeated_field.o", "map.o", "ruby-upb.o", "wrap_memcpy.o"]
19
19
 
20
+ find_header('third_party/wyhash/wyhash.h', '../../../..')
20
21
  create_makefile("google/protobuf_c")
@@ -734,7 +734,10 @@ uint64_t Message_Hash(const upb_msg* msg, const upb_msgdef* m, uint64_t seed) {
734
734
  */
735
735
  static VALUE Message_hash(VALUE _self) {
736
736
  Message* self = ruby_to_Message(_self);
737
- return INT2FIX(Message_Hash(self->msg, self->msgdef, 0));
737
+ uint64_t hash_value = Message_Hash(self->msg, self->msgdef, 0);
738
+ // RUBY_FIXNUM_MAX should be one less than a power of 2.
739
+ assert((RUBY_FIXNUM_MAX & (RUBY_FIXNUM_MAX + 1)) == 0);
740
+ return INT2FIX(hash_value & RUBY_FIXNUM_MAX);
738
741
  }
739
742
 
740
743
  /*
@@ -37,7 +37,7 @@
37
37
  #include "message.h"
38
38
  #include "repeated_field.h"
39
39
 
40
- VALUE cError;
40
+ VALUE cParseError;
41
41
  VALUE cTypeError;
42
42
 
43
43
  const upb_fielddef* map_field_key(const upb_fielddef* field) {
@@ -238,8 +238,16 @@ void Arena_register(VALUE module) {
238
238
  // We use WeakMap for the cache. For Ruby <2.7 we also need a secondary Hash
239
239
  // to store WeakMap keys because Ruby <2.7 WeakMap doesn't allow non-finalizable
240
240
  // keys.
241
-
242
- #if RUBY_API_VERSION_CODE >= 20700
241
+ //
242
+ // We also need the secondary Hash if sizeof(long) < sizeof(VALUE), because this
243
+ // means it may not be possible to fit a pointer into a Fixnum. Keys are
244
+ // pointers, and if they fit into a Fixnum, Ruby doesn't collect them, but if
245
+ // they overflow and require allocating a Bignum, they could get collected
246
+ // prematurely, thus removing the cache entry. This happens on 64-bit Windows,
247
+ // on which pointers are 64 bits but longs are 32 bits. In this case, we enable
248
+ // the secondary Hash to hold the keys and prevent them from being collected.
249
+
250
+ #if RUBY_API_VERSION_CODE >= 20700 && SIZEOF_LONG >= SIZEOF_VALUE
243
251
  #define USE_SECONDARY_MAP 0
244
252
  #else
245
253
  #define USE_SECONDARY_MAP 1
@@ -326,7 +334,7 @@ static VALUE SecondaryMap_Get(VALUE key, bool create) {
326
334
  VALUE ret = rb_hash_lookup(secondary_map, key);
327
335
  if (ret == Qnil && create) {
328
336
  SecondaryMap_MaybeGC();
329
- ret = rb_eval_string("Object.new");
337
+ ret = rb_class_new_instance(0, NULL, rb_cObject);
330
338
  rb_hash_aset(secondary_map, key, ret);
331
339
  }
332
340
  return ret;
@@ -336,11 +344,9 @@ static VALUE SecondaryMap_Get(VALUE key, bool create) {
336
344
 
337
345
  // Requires: secondary_map_mutex is held by this thread iff create == true.
338
346
  static VALUE ObjectCache_GetKey(const void* key, bool create) {
339
- char buf[sizeof(key)];
340
- memcpy(&buf, &key, sizeof(key));
341
- intptr_t key_int = (intptr_t)key;
342
- PBRUBY_ASSERT((key_int & 3) == 0);
343
- VALUE ret = LL2NUM(key_int >> 2);
347
+ VALUE key_val = (VALUE)key;
348
+ PBRUBY_ASSERT((key_val & 3) == 0);
349
+ VALUE ret = LL2NUM(key_val >> 2);
344
350
  #if USE_SECONDARY_MAP
345
351
  ret = SecondaryMap_Get(ret, create);
346
352
  #endif
@@ -442,8 +448,10 @@ void Init_protobuf_c() {
442
448
  Map_register(protobuf);
443
449
  Message_register(protobuf);
444
450
 
445
- cError = rb_const_get(protobuf, rb_intern("Error"));
451
+ cParseError = rb_const_get(protobuf, rb_intern("ParseError"));
452
+ rb_gc_register_mark_object(cParseError);
446
453
  cTypeError = rb_const_get(protobuf, rb_intern("TypeError"));
454
+ rb_gc_register_mark_object(cTypeError);
447
455
 
448
456
  rb_define_singleton_method(protobuf, "discard_unknown",
449
457
  Google_Protobuf_discard_unknown, 1);
Binary file
Binary file
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.15.8
4
+ version: 3.17.0.rc.2
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: 2021-04-08 00:00:00.000000000 Z
11
+ date: 2021-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler-dock
@@ -128,7 +128,7 @@ homepage: https://developers.google.com/protocol-buffers
128
128
  licenses:
129
129
  - BSD-3-Clause
130
130
  metadata:
131
- source_code_uri: https://github.com/protocolbuffers/protobuf/tree/v3.15.8/ruby
131
+ source_code_uri: https://github.com/protocolbuffers/protobuf/tree/v3.17.0-rc2/ruby
132
132
  post_install_message:
133
133
  rdoc_options: []
134
134
  require_paths:
@@ -143,9 +143,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
143
143
  version: 3.1.dev
144
144
  required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  requirements:
146
- - - ">="
146
+ - - ">"
147
147
  - !ruby/object:Gem::Version
148
- version: '0'
148
+ version: 1.3.1
149
149
  requirements: []
150
150
  rubygems_version: 3.2.3
151
151
  signing_key: