google-protobuf 3.20.0.rc.1-x64-mingw32 → 3.20.0.rc.2-x64-mingw32

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: 689f21c96a87f151f843b042c0db37283207fdd4d0a6f356f1bf796177b49020
4
- data.tar.gz: 8e6ad5cfe94b2c89178a548532f46389f3b6198512ab20493b35570739acc0de
3
+ metadata.gz: b26b835b0ebf80807bcb1fbbbcb0d425406075abdf3afd8cfe6b0c92cb6c06fa
4
+ data.tar.gz: bc31c19fd7892d4d91c392ef8b98afd9d926c46d1f75a1af42724f978370cbb4
5
5
  SHA512:
6
- metadata.gz: 93d9da89a599abb37e667f0132d0b769194dbd4712e1678910aa0acc459e7ace75601e0723798184d91f737f3f63315dc2096141e015edc4746069eff0134b36
7
- data.tar.gz: edf95d043ddaff794f1bff2c97eb7f0ad8124a9f456084d097963915524c38c39f5e1d3ce4a4be7e1bdd3b6d9fa72a5b00cac51c12f3b87d928d8e257b47683f
6
+ metadata.gz: cc34a6deb3a05641baac0f2969cbce4409e19e1980ef9a1b840b65418a1c7e23af4920254f9a97d2832966c4059e0df7c6062fe86e5970b8acb8574e6c9bd75c
7
+ data.tar.gz: 9df2b241de92ed9e63bc8a7a404b55f664e0ecb7abc65b3dbc16950fe586a196be1fc816385d09076bc9604d4a255e31bee933c129f6c053ef3d5a19e93cf904
@@ -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
  }