google-protobuf 3.20.0.rc.1-x86_64-darwin → 3.20.0.rc.2-x86_64-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: 39735426964a2c7a74a15f5ba4925ae3fa15df4576031748c7f03a12b7903fc4
4
- data.tar.gz: efd5b51a7611bd808714e277084e3690dc10e49024774251a6d0a598ed97de39
3
+ metadata.gz: 36da9c21d2578890976dbc4297e975cd1538343ac09393b9bc97400806744e0e
4
+ data.tar.gz: 4873cacdc9373dba8ab89e03e041bec260ba5065539fe753c0195373ce49a69f
5
5
  SHA512:
6
- metadata.gz: 2ba8a5144768d5cdcd8e4b81d22c5cbdf6df2e9c8e0674fca114d5df0c7167c4c5b6c348faf76d1d9fd653e7fe7db200f99196944c939d0fdd364c93fa3f875e
7
- data.tar.gz: eb1c0b4c0db116370559fe40e4e4395afc9ce5e1dd0f390161df83471261da025dc0778348594a4e22c68e6110b1ad21409839839bc22d9754b264836527b017
6
+ metadata.gz: 8be55dc2a7d1e42637801f3497b2538ccc066a6379112851cdb5bb7a32922a68e27367cdeb0f0810783e1015301174ed5e678558aa2b6a0f649857dd2e8d0a52
7
+ data.tar.gz: cd111d6df8d95ddfaa1d6de178a07a07eeaaa97c6057ea066e55ad588bf7e6208f28ac7f9c3f7547249267375d9541df88855ee2bf551a601fb0c727145efe2c
@@ -340,19 +340,19 @@ uint64_t Msgval_GetHash(upb_MessageValue val, TypeInfo type_info,
340
340
  uint64_t seed) {
341
341
  switch (type_info.type) {
342
342
  case kUpb_CType_Bool:
343
- return Wyhash(&val, 1, seed, kWyhashSalt);
343
+ return _upb_Hash(&val, 1, seed);
344
344
  case kUpb_CType_Float:
345
345
  case kUpb_CType_Int32:
346
346
  case kUpb_CType_UInt32:
347
347
  case kUpb_CType_Enum:
348
- return Wyhash(&val, 4, seed, kWyhashSalt);
348
+ return _upb_Hash(&val, 4, seed);
349
349
  case kUpb_CType_Double:
350
350
  case kUpb_CType_Int64:
351
351
  case kUpb_CType_UInt64:
352
- return Wyhash(&val, 8, seed, kWyhashSalt);
352
+ return _upb_Hash(&val, 8, seed);
353
353
  case kUpb_CType_String:
354
354
  case kUpb_CType_Bytes:
355
- return Wyhash(val.str_val.data, val.str_val.size, seed, kWyhashSalt);
355
+ return _upb_Hash(val.str_val.data, val.str_val.size, seed);
356
356
  case kUpb_CType_Message:
357
357
  return Message_Hash(val.msg_val, type_info.def.msgdef, seed);
358
358
  default:
@@ -159,6 +159,7 @@ VALUE DescriptorPool_add_serialized_file(VALUE _self,
159
159
  rb_raise(cTypeError, "Unable to build file to DescriptorPool: %s",
160
160
  upb_Status_ErrorMessage(&status));
161
161
  }
162
+ RB_GC_GUARD(arena_rb);
162
163
  return get_filedef_obj(_self, filedef);
163
164
  }
164
165
 
@@ -23,6 +23,6 @@ $INCFLAGS << "$(srcdir)/third_party/utf8_range"
23
23
 
24
24
  $srcs = ["protobuf.c", "convert.c", "defs.c", "message.c",
25
25
  "repeated_field.c", "map.c", "ruby-upb.c", "wrap_memcpy.c",
26
- "utf8_range.c"]
26
+ "naive.c", "range2-neon.c", "range2-sse.c"]
27
27
 
28
28
  create_makefile(ext_name)
@@ -161,10 +161,8 @@ void Message_PrintMessage(StringBuilder* b, const upb_Message* msg,
161
161
 
162
162
  if (upb_FieldDef_IsMap(field)) {
163
163
  const upb_MessageDef* entry_m = upb_FieldDef_MessageSubDef(field);
164
- const upb_FieldDef* key_f =
165
- upb_MessageDef_FindFieldByNumberWithSize(entry_m, 1);
166
- const upb_FieldDef* val_f =
167
- upb_MessageDef_FindFieldByNumberWithSize(entry_m, 2);
164
+ const upb_FieldDef* key_f = upb_MessageDef_FindFieldByNumber(entry_m, 1);
165
+ const upb_FieldDef* val_f = upb_MessageDef_FindFieldByNumber(entry_m, 2);
168
166
  TypeInfo val_info = TypeInfo_get(val_f);
169
167
  Map_Inspect(b, msgval.map_val, upb_FieldDef_CType(key_f), val_info);
170
168
  } else if (upb_FieldDef_IsRepeated(field)) {
@@ -365,7 +363,7 @@ static VALUE Message_field_accessor(VALUE _self, const upb_FieldDef* f,
365
363
  upb_MessageValue wrapper = upb_Message_Get(self->msg, f);
366
364
  const upb_MessageDef* wrapper_m = upb_FieldDef_MessageSubDef(f);
367
365
  const upb_FieldDef* value_f =
368
- upb_MessageDef_FindFieldByNumberWithSize(wrapper_m, 1);
366
+ upb_MessageDef_FindFieldByNumber(wrapper_m, 1);
369
367
  upb_MessageValue value = upb_Message_Get(wrapper.msg_val, value_f);
370
368
  return Convert_UpbToRuby(value, TypeInfo_get(value_f), self->arena);
371
369
  } else {
@@ -377,8 +375,8 @@ static VALUE Message_field_accessor(VALUE _self, const upb_FieldDef* f,
377
375
  if (argv[1] == Qnil) {
378
376
  upb_Message_ClearField(msg, f);
379
377
  } else {
380
- const upb_FieldDef* val_f = upb_MessageDef_FindFieldByNumberWithSize(
381
- upb_FieldDef_MessageSubDef(f), 1);
378
+ const upb_FieldDef* val_f =
379
+ upb_MessageDef_FindFieldByNumber(upb_FieldDef_MessageSubDef(f), 1);
382
380
  upb_MessageValue msgval = Convert_RubyToUpb(
383
381
  argv[1], upb_FieldDef_Name(f), TypeInfo_get(val_f), arena);
384
382
  upb_Message* wrapper = upb_Message_Mutable(msg, f, arena).msg;
@@ -527,10 +525,8 @@ static int Map_initialize_kwarg(VALUE key, VALUE val, VALUE _self) {
527
525
  static void Map_InitFromValue(upb_Map* map, const upb_FieldDef* f, VALUE val,
528
526
  upb_Arena* arena) {
529
527
  const upb_MessageDef* entry_m = upb_FieldDef_MessageSubDef(f);
530
- const upb_FieldDef* key_f =
531
- upb_MessageDef_FindFieldByNumberWithSize(entry_m, 1);
532
- const upb_FieldDef* val_f =
533
- upb_MessageDef_FindFieldByNumberWithSize(entry_m, 2);
528
+ const upb_FieldDef* key_f = upb_MessageDef_FindFieldByNumber(entry_m, 1);
529
+ const upb_FieldDef* val_f = upb_MessageDef_FindFieldByNumber(entry_m, 2);
534
530
  if (TYPE(val) != T_HASH) {
535
531
  rb_raise(rb_eArgError,
536
532
  "Expected Hash object as initializer value for map field '%s' "
@@ -748,7 +744,7 @@ uint64_t Message_Hash(const upb_Message* msg, const upb_MessageDef* m,
748
744
  &size);
749
745
 
750
746
  if (data) {
751
- uint64_t ret = Wyhash(data, size, seed, kWyhashSalt);
747
+ uint64_t ret = _upb_Hash(data, size, seed);
752
748
  upb_Arena_Free(arena);
753
749
  return ret;
754
750
  } else {
@@ -847,10 +843,8 @@ static VALUE Message_CreateHash(const upb_Message* msg,
847
843
 
848
844
  if (upb_FieldDef_IsMap(field)) {
849
845
  const upb_MessageDef* entry_m = upb_FieldDef_MessageSubDef(field);
850
- const upb_FieldDef* key_f =
851
- upb_MessageDef_FindFieldByNumberWithSize(entry_m, 1);
852
- const upb_FieldDef* val_f =
853
- upb_MessageDef_FindFieldByNumberWithSize(entry_m, 2);
846
+ const upb_FieldDef* key_f = upb_MessageDef_FindFieldByNumber(entry_m, 1);
847
+ const upb_FieldDef* val_f = upb_MessageDef_FindFieldByNumber(entry_m, 2);
854
848
  upb_CType key_type = upb_FieldDef_CType(key_f);
855
849
  msg_value = Map_CreateHash(msgval.map_val, key_type, TypeInfo_get(val_f));
856
850
  } else if (upb_FieldDef_IsRepeated(field)) {
@@ -1141,7 +1135,11 @@ static VALUE Message_encode_json(int argc, VALUE* argv, VALUE klass) {
1141
1135
  if (argc == 2) {
1142
1136
  VALUE hash_args = argv[1];
1143
1137
  if (TYPE(hash_args) != T_HASH) {
1144
- rb_raise(rb_eArgError, "Expected hash arguments.");
1138
+ if (RTEST(rb_funcall(hash_args, rb_intern("respond_to?"), 1, rb_str_new2("to_h")))) {
1139
+ hash_args = rb_funcall(hash_args, rb_intern("to_h"), 0);
1140
+ } else {
1141
+ rb_raise(rb_eArgError, "Expected hash arguments.");
1142
+ }
1145
1143
  }
1146
1144
 
1147
1145
  if (RTEST(rb_hash_lookup2(hash_args,
@@ -1353,10 +1351,8 @@ const upb_Message* Message_GetUpbMessage(VALUE value, const upb_MessageDef* m,
1353
1351
  upb_Message* msg = upb_Message_New(m, arena);
1354
1352
  upb_MessageValue sec, nsec;
1355
1353
  struct timespec time;
1356
- const upb_FieldDef* sec_f =
1357
- upb_MessageDef_FindFieldByNumberWithSize(m, 1);
1358
- const upb_FieldDef* nsec_f =
1359
- upb_MessageDef_FindFieldByNumberWithSize(m, 2);
1354
+ const upb_FieldDef* sec_f = upb_MessageDef_FindFieldByNumber(m, 1);
1355
+ const upb_FieldDef* nsec_f = upb_MessageDef_FindFieldByNumber(m, 2);
1360
1356
 
1361
1357
  if (!rb_obj_is_kind_of(value, rb_cTime)) goto badtype;
1362
1358
 
@@ -1371,10 +1367,8 @@ const upb_Message* Message_GetUpbMessage(VALUE value, const upb_MessageDef* m,
1371
1367
  // Numeric -> Google::Protobuf::Duration
1372
1368
  upb_Message* msg = upb_Message_New(m, arena);
1373
1369
  upb_MessageValue sec, nsec;
1374
- const upb_FieldDef* sec_f =
1375
- upb_MessageDef_FindFieldByNumberWithSize(m, 1);
1376
- const upb_FieldDef* nsec_f =
1377
- upb_MessageDef_FindFieldByNumberWithSize(m, 2);
1370
+ const upb_FieldDef* sec_f = upb_MessageDef_FindFieldByNumber(m, 1);
1371
+ const upb_FieldDef* nsec_f = upb_MessageDef_FindFieldByNumber(m, 2);
1378
1372
 
1379
1373
  if (!rb_obj_is_kind_of(value, rb_cNumeric)) goto badtype;
1380
1374
 
@@ -42,12 +42,12 @@ VALUE cTypeError;
42
42
 
43
43
  const upb_FieldDef *map_field_key(const upb_FieldDef *field) {
44
44
  const upb_MessageDef *entry = upb_FieldDef_MessageSubDef(field);
45
- return upb_MessageDef_FindFieldByNumberWithSize(entry, 1);
45
+ return upb_MessageDef_FindFieldByNumber(entry, 1);
46
46
  }
47
47
 
48
48
  const upb_FieldDef *map_field_value(const upb_FieldDef *field) {
49
49
  const upb_MessageDef *entry = upb_FieldDef_MessageSubDef(field);
50
- return upb_MessageDef_FindFieldByNumberWithSize(entry, 2);
50
+ return upb_MessageDef_FindFieldByNumber(entry, 2);
51
51
  }
52
52
 
53
53
  // -----------------------------------------------------------------------------
@@ -193,9 +193,20 @@ const rb_data_type_t Arena_type = {
193
193
  .flags = RUBY_TYPED_FREE_IMMEDIATELY,
194
194
  };
195
195
 
196
+ static void* ruby_upb_allocfunc(upb_alloc* alloc, void* ptr, size_t oldsize, size_t size) {
197
+ if (size == 0) {
198
+ xfree(ptr);
199
+ return NULL;
200
+ } else {
201
+ return xrealloc(ptr, size);
202
+ }
203
+ }
204
+
205
+ upb_alloc ruby_upb_alloc = {&ruby_upb_allocfunc};
206
+
196
207
  static VALUE Arena_alloc(VALUE klass) {
197
208
  Arena *arena = ALLOC(Arena);
198
- arena->arena = upb_Arena_New();
209
+ arena->arena = upb_Arena_Init(NULL, 0, &ruby_upb_alloc);
199
210
  arena->pinned_objs = Qnil;
200
211
  return TypedData_Wrap_Struct(klass, &Arena_type, arena);
201
212
  }