google-protobuf 3.21.12 → 3.22.0.rc.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/ext/google/protobuf_c/convert.c +0 -0
  3. data/ext/google/protobuf_c/convert.h +0 -0
  4. data/ext/google/protobuf_c/defs.c +3 -3
  5. data/ext/google/protobuf_c/defs.h +0 -0
  6. data/ext/google/protobuf_c/extconf.rb +2 -2
  7. data/ext/google/protobuf_c/map.c +27 -42
  8. data/ext/google/protobuf_c/map.h +0 -0
  9. data/ext/google/protobuf_c/message.c +112 -86
  10. data/ext/google/protobuf_c/message.h +0 -0
  11. data/ext/google/protobuf_c/protobuf.c +0 -0
  12. data/ext/google/protobuf_c/protobuf.h +0 -0
  13. data/ext/google/protobuf_c/repeated_field.c +0 -0
  14. data/ext/google/protobuf_c/repeated_field.h +0 -0
  15. data/ext/google/protobuf_c/ruby-upb.c +11144 -9889
  16. data/ext/google/protobuf_c/ruby-upb.h +9285 -4982
  17. data/ext/google/protobuf_c/third_party/utf8_range/LICENSE +1 -0
  18. data/ext/google/protobuf_c/third_party/utf8_range/naive.c +0 -0
  19. data/ext/google/protobuf_c/third_party/utf8_range/range2-neon.c +1 -1
  20. data/ext/google/protobuf_c/third_party/utf8_range/range2-sse.c +0 -0
  21. data/ext/google/protobuf_c/third_party/utf8_range/utf8_range.h +13 -1
  22. data/ext/google/protobuf_c/wrap_memcpy.c +0 -0
  23. data/lib/google/protobuf/any_pb.rb +0 -0
  24. data/lib/google/protobuf/api_pb.rb +0 -0
  25. data/lib/google/protobuf/descriptor_dsl.rb +0 -0
  26. data/lib/google/protobuf/descriptor_pb.rb +41 -12
  27. data/lib/google/protobuf/duration_pb.rb +0 -0
  28. data/lib/google/protobuf/empty_pb.rb +0 -0
  29. data/lib/google/protobuf/field_mask_pb.rb +0 -0
  30. data/lib/google/protobuf/message_exts.rb +5 -0
  31. data/lib/google/protobuf/plugin_pb.rb +50 -0
  32. data/lib/google/protobuf/repeated_field.rb +0 -0
  33. data/lib/google/protobuf/source_context_pb.rb +0 -0
  34. data/lib/google/protobuf/struct_pb.rb +0 -0
  35. data/lib/google/protobuf/timestamp_pb.rb +0 -0
  36. data/lib/google/protobuf/type_pb.rb +0 -0
  37. data/lib/google/protobuf/wrappers_pb.rb +0 -0
  38. data/lib/google/protobuf.rb +0 -0
  39. metadata +8 -13
  40. data/tests/basic.rb +0 -739
  41. data/tests/generated_code_test.rb +0 -23
  42. data/tests/stress.rb +0 -38
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0b23be5be98bd61dc232a5ffb1eb6d7b11d38e21bf088140e79af252ad06fa4
4
- data.tar.gz: 88fd35d071aa35107fe11dc3c4acbd07e437fdfa57bca40990c5c4961df58374
3
+ metadata.gz: ac38bcf7bc64e0fde46bfba2380e62f02ea262ea7ff2102e76ddce083385e1e4
4
+ data.tar.gz: a20bf4b6e63e0b96a1a1c079584eb665ffcdd75b3226a342a7010a59530ffeff
5
5
  SHA512:
6
- metadata.gz: fb39de679d089a3ca3ce3b7bb4cb2bbb9085431f2530d6128e10b3d4b1153e6cb51ad4632449b9d458d0f4c9a71435f76f009ce6cbc3341bc22be8d28bb3f8fc
7
- data.tar.gz: 154463a7fdc6fc8e0977253b2a6ed8493f515e014c4fd2ba60d5bf22f6711f0b6f6dd3bb816710c1ef2c66e212fd29edd8b90f6a98b0bd584b265d14a7ef72e4
6
+ metadata.gz: f72368247b7e3d2ae9ceb0172ea43f79659562ac32dc205aef156e60addda1ce07898df2b9c5aa9ac15bbdceaf692e7fde2bc570c40f0e0bf285bb60cb1f127a
7
+ data.tar.gz: '04359f464dc8570a9c1b9d36f13b9b8e65fcb4cce295844500d094ee13a87a0d18bd7a32bb7477cda98563de24890f15d47bccab38818a53b736a9a5ade0071b'
File without changes
File without changes
@@ -811,7 +811,7 @@ static VALUE FieldDescriptor_has(VALUE _self, VALUE msg_rb) {
811
811
  rb_raise(rb_eArgError, "does not track presence");
812
812
  }
813
813
 
814
- return upb_Message_Has(msg, self->fielddef) ? Qtrue : Qfalse;
814
+ return upb_Message_HasFieldByDef(msg, self->fielddef) ? Qtrue : Qfalse;
815
815
  }
816
816
 
817
817
  /*
@@ -829,7 +829,7 @@ static VALUE FieldDescriptor_clear(VALUE _self, VALUE msg_rb) {
829
829
  rb_raise(cTypeError, "has method called on wrong message type");
830
830
  }
831
831
 
832
- upb_Message_ClearField(msg, self->fielddef);
832
+ upb_Message_ClearFieldByDef(msg, self->fielddef);
833
833
  return Qnil;
834
834
  }
835
835
 
@@ -854,7 +854,7 @@ static VALUE FieldDescriptor_set(VALUE _self, VALUE msg_rb, VALUE value) {
854
854
 
855
855
  msgval = Convert_RubyToUpb(value, upb_FieldDef_Name(self->fielddef),
856
856
  TypeInfo_get(self->fielddef), arena);
857
- upb_Message_Set(msg, self->fielddef, msgval, arena);
857
+ upb_Message_SetFieldByDef(msg, self->fielddef, msgval, arena);
858
858
  return Qnil;
859
859
  }
860
860
 
File without changes
@@ -6,8 +6,8 @@ ext_name = "google/protobuf_c"
6
6
 
7
7
  dir_config(ext_name)
8
8
 
9
- if RUBY_PLATFORM =~ /darwin/ || RUBY_PLATFORM =~ /linux/
10
- $CFLAGS += " -std=gnu99 -O3 -DNDEBUG -fvisibility=hidden -Wall -Wsign-compare -Wno-declaration-after-statement"
9
+ if RUBY_PLATFORM =~ /darwin/ || RUBY_PLATFORM =~ /linux/ || RUBY_PLATFORM =~ /freebsd/
10
+ $CFLAGS += " -std=gnu99 -O3 -DNDEBUG -fvisibility=hidden -Wall -Wsign-compare -Wno-declaration-after-statement -I$(srcdir)/third_party/utf8_range"
11
11
  else
12
12
  $CFLAGS += " -std=gnu99 -O3 -DNDEBUG"
13
13
  end
@@ -133,14 +133,13 @@ static upb_Map* Map_GetMutable(VALUE _self) {
133
133
  VALUE Map_CreateHash(const upb_Map* map, upb_CType key_type,
134
134
  TypeInfo val_info) {
135
135
  VALUE hash = rb_hash_new();
136
- size_t iter = kUpb_Map_Begin;
137
136
  TypeInfo key_info = TypeInfo_from_type(key_type);
138
137
 
139
138
  if (!map) return hash;
140
139
 
141
- while (upb_MapIterator_Next(map, &iter)) {
142
- upb_MessageValue key = upb_MapIterator_Key(map, iter);
143
- upb_MessageValue val = upb_MapIterator_Value(map, iter);
140
+ size_t iter = kUpb_Map_Begin;
141
+ upb_MessageValue key, val;
142
+ while (upb_Map_Next(map, &key, &val, &iter)) {
144
143
  VALUE key_val = Convert_UpbToRuby(key, key_info, Qnil);
145
144
  VALUE val_val = Scalar_CreateHash(val, val_info);
146
145
  rb_hash_aset(hash, key_val, val_val);
@@ -156,9 +155,8 @@ VALUE Map_deep_copy(VALUE obj) {
156
155
  upb_Map* new_map =
157
156
  upb_Map_New(arena, self->key_type, self->value_type_info.type);
158
157
  size_t iter = kUpb_Map_Begin;
159
- while (upb_MapIterator_Next(self->map, &iter)) {
160
- upb_MessageValue key = upb_MapIterator_Key(self->map, iter);
161
- upb_MessageValue val = upb_MapIterator_Value(self->map, iter);
158
+ upb_MessageValue key, val;
159
+ while (upb_Map_Next(self->map, &key, &val, &iter)) {
162
160
  upb_MessageValue val_copy =
163
161
  Msgval_DeepCopy(val, self->value_type_info, arena);
164
162
  upb_Map_Set(new_map, key, val_copy, arena);
@@ -202,9 +200,8 @@ void Map_Inspect(StringBuilder* b, const upb_Map* map, upb_CType key_type,
202
200
  StringBuilder_Printf(b, "{");
203
201
  if (map) {
204
202
  size_t iter = kUpb_Map_Begin;
205
- while (upb_MapIterator_Next(map, &iter)) {
206
- upb_MessageValue key = upb_MapIterator_Key(map, iter);
207
- upb_MessageValue val = upb_MapIterator_Value(map, iter);
203
+ upb_MessageValue key, val;
204
+ while (upb_Map_Next(map, &key, &val, &iter)) {
208
205
  if (first) {
209
206
  first = false;
210
207
  } else {
@@ -239,7 +236,6 @@ static VALUE Map_merge_into_self(VALUE _self, VALUE hashmap) {
239
236
  Map* other = ruby_to_Map(hashmap);
240
237
  upb_Arena* arena = Arena_get(self->arena);
241
238
  upb_Message* self_msg = Map_GetMutable(_self);
242
- size_t iter = kUpb_Map_Begin;
243
239
 
244
240
  Arena_fuse(other->arena, arena);
245
241
 
@@ -249,9 +245,9 @@ static VALUE Map_merge_into_self(VALUE _self, VALUE hashmap) {
249
245
  rb_raise(rb_eArgError, "Attempt to merge Map with mismatching types");
250
246
  }
251
247
 
252
- while (upb_MapIterator_Next(other->map, &iter)) {
253
- upb_MessageValue key = upb_MapIterator_Key(other->map, iter);
254
- upb_MessageValue val = upb_MapIterator_Value(other->map, iter);
248
+ size_t iter = kUpb_Map_Begin;
249
+ upb_MessageValue key, val;
250
+ while (upb_Map_Next(other->map, &key, &val, &iter)) {
255
251
  upb_Map_Set(self_msg, key, val, arena);
256
252
  }
257
253
  } else {
@@ -343,10 +339,9 @@ static VALUE Map_init(int argc, VALUE* argv, VALUE _self) {
343
339
  static VALUE Map_each(VALUE _self) {
344
340
  Map* self = ruby_to_Map(_self);
345
341
  size_t iter = kUpb_Map_Begin;
342
+ upb_MessageValue key, val;
346
343
 
347
- while (upb_MapIterator_Next(self->map, &iter)) {
348
- upb_MessageValue key = upb_MapIterator_Key(self->map, iter);
349
- upb_MessageValue val = upb_MapIterator_Value(self->map, iter);
344
+ while (upb_Map_Next(self->map, &key, &val, &iter)) {
350
345
  VALUE key_val = Convert_UpbToRuby(key, Map_keyinfo(self), self->arena);
351
346
  VALUE val_val = Convert_UpbToRuby(val, self->value_type_info, self->arena);
352
347
  rb_yield_values(2, key_val, val_val);
@@ -365,9 +360,9 @@ static VALUE Map_keys(VALUE _self) {
365
360
  Map* self = ruby_to_Map(_self);
366
361
  size_t iter = kUpb_Map_Begin;
367
362
  VALUE ret = rb_ary_new();
363
+ upb_MessageValue key, val;
368
364
 
369
- while (upb_MapIterator_Next(self->map, &iter)) {
370
- upb_MessageValue key = upb_MapIterator_Key(self->map, iter);
365
+ while (upb_Map_Next(self->map, &key, &val, &iter)) {
371
366
  VALUE key_val = Convert_UpbToRuby(key, Map_keyinfo(self), self->arena);
372
367
  rb_ary_push(ret, key_val);
373
368
  }
@@ -385,9 +380,9 @@ static VALUE Map_values(VALUE _self) {
385
380
  Map* self = ruby_to_Map(_self);
386
381
  size_t iter = kUpb_Map_Begin;
387
382
  VALUE ret = rb_ary_new();
383
+ upb_MessageValue key, val;
388
384
 
389
- while (upb_MapIterator_Next(self->map, &iter)) {
390
- upb_MessageValue val = upb_MapIterator_Value(self->map, iter);
385
+ while (upb_Map_Next(self->map, &key, &val, &iter)) {
391
386
  VALUE val_val = Convert_UpbToRuby(val, self->value_type_info, self->arena);
392
387
  rb_ary_push(ret, val_val);
393
388
  }
@@ -464,24 +459,17 @@ static VALUE Map_has_key(VALUE _self, VALUE key) {
464
459
  */
465
460
  static VALUE Map_delete(VALUE _self, VALUE key) {
466
461
  Map* self = ruby_to_Map(_self);
462
+ rb_check_frozen(_self);
463
+
467
464
  upb_MessageValue key_upb =
468
465
  Convert_RubyToUpb(key, "", Map_keyinfo(self), NULL);
469
466
  upb_MessageValue val_upb;
470
- VALUE ret;
471
467
 
472
- rb_check_frozen(_self);
473
-
474
- // TODO(haberman): make upb_Map_Delete() also capable of returning the deleted
475
- // value.
476
- if (upb_Map_Get(self->map, key_upb, &val_upb)) {
477
- ret = Convert_UpbToRuby(val_upb, self->value_type_info, self->arena);
468
+ if (upb_Map_Delete(self->map, key_upb, &val_upb)) {
469
+ return Convert_UpbToRuby(val_upb, self->value_type_info, self->arena);
478
470
  } else {
479
- ret = Qnil;
471
+ return Qnil;
480
472
  }
481
-
482
- upb_Map_Delete(Map_GetMutable(_self), key_upb);
483
-
484
- return ret;
485
473
  }
486
474
 
487
475
  /*
@@ -523,9 +511,8 @@ static VALUE Map_dup(VALUE _self) {
523
511
 
524
512
  Arena_fuse(self->arena, arena);
525
513
 
526
- while (upb_MapIterator_Next(self->map, &iter)) {
527
- upb_MessageValue key = upb_MapIterator_Key(self->map, iter);
528
- upb_MessageValue val = upb_MapIterator_Value(self->map, iter);
514
+ upb_MessageValue key, val;
515
+ while (upb_Map_Next(self->map, &key, &val, &iter)) {
529
516
  upb_Map_Set(new_map, key, val, arena);
530
517
  }
531
518
 
@@ -574,9 +561,8 @@ VALUE Map_eq(VALUE _self, VALUE _other) {
574
561
  // For each member of self, check that an equal member exists at the same key
575
562
  // in other.
576
563
  size_t iter = kUpb_Map_Begin;
577
- while (upb_MapIterator_Next(self->map, &iter)) {
578
- upb_MessageValue key = upb_MapIterator_Key(self->map, iter);
579
- upb_MessageValue val = upb_MapIterator_Value(self->map, iter);
564
+ upb_MessageValue key, val;
565
+ while (upb_Map_Next(self->map, &key, &val, &iter)) {
580
566
  upb_MessageValue other_val;
581
567
  if (!upb_Map_Get(other->map, key, &other_val)) {
582
568
  // Not present in other map.
@@ -619,9 +605,8 @@ VALUE Map_hash(VALUE _self) {
619
605
 
620
606
  size_t iter = kUpb_Map_Begin;
621
607
  TypeInfo key_info = {self->key_type};
622
- while (upb_MapIterator_Next(self->map, &iter)) {
623
- upb_MessageValue key = upb_MapIterator_Key(self->map, iter);
624
- upb_MessageValue val = upb_MapIterator_Value(self->map, iter);
608
+ upb_MessageValue key, val;
609
+ while (upb_Map_Next(self->map, &key, &val, &iter)) {
625
610
  hash = Msgval_GetHash(key, key_info, hash);
626
611
  hash = Msgval_GetHash(val, self->value_type_info, hash);
627
612
  }
File without changes