google-protobuf 3.20.0.rc.1-x86-linux → 3.20.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: 783a0db3f6474937675325eef150420039be17a0db4653047307bc4a3f28d857
4
- data.tar.gz: aca98c23e812a5fa04cadad3950cea3349da999fb7f8872e0decfc13d87984d6
3
+ metadata.gz: dde965f16bc82f78430adcc6f7dbfc90d46120a03cd0843cd863b998369828bc
4
+ data.tar.gz: 2cbb81bd7bc803b106240c0c411c9567f92e46c6fc40972cec4d79a2f2d162ac
5
5
  SHA512:
6
- metadata.gz: 8eff3b821754bca9e2bf69a77c4d30630f281094ce8773e71256fdaa64c271242dae0e9268d19a5bdd10de8c5103b22b879b08501c4eafe5b40d879c6e36fcca
7
- data.tar.gz: 2d495a91f7770d6a14e26a853cedfa49146e7723a4eb6a1819ced92fd601943dc7921dbb73ccf95e68c994732812a86a8082d07c5ad85259c61b27a891d12a45
6
+ metadata.gz: 663adb3599c9d75c92cc105cd348a65dc4e6a66c70c760e4e8376cbfe3523f1fe75f3990c7716e1f4418e3320136b1ad274f029ed0878dd01276227071ee598a
7
+ data.tar.gz: c98031e39a4d12233fd511dda0b3f5a8e2a98c54a4d297a2e93316747b18f0bdc505f603d51d49504ae4f2595e85dd5e7aeff6c8bc7db7fb41355858ffead44d
@@ -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
  }