google-protobuf 3.17.3 → 3.19.2

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.

@@ -17,5 +17,4 @@ 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', '../../../..')
21
20
  create_makefile("google/protobuf_c")
@@ -680,7 +680,10 @@ void Map_register(VALUE module) {
680
680
  rb_define_method(klass, "delete", Map_delete, 1);
681
681
  rb_define_method(klass, "clear", Map_clear, 0);
682
682
  rb_define_method(klass, "length", Map_length, 0);
683
+ rb_define_method(klass, "size", Map_length, 0);
683
684
  rb_define_method(klass, "dup", Map_dup, 0);
685
+ // Also define #clone so that we don't inherit Object#clone.
686
+ rb_define_method(klass, "clone", Map_dup, 0);
684
687
  rb_define_method(klass, "==", Map_eq, 1);
685
688
  rb_define_method(klass, "freeze", Map_freeze, 0);
686
689
  rb_define_method(klass, "hash", Map_hash, 0);
@@ -35,7 +35,6 @@
35
35
  #include "map.h"
36
36
  #include "protobuf.h"
37
37
  #include "repeated_field.h"
38
- #include "third_party/wyhash/wyhash.h"
39
38
 
40
39
  static VALUE cParseError = Qnil;
41
40
  static ID descriptor_instancevar_interned;
@@ -717,7 +716,7 @@ uint64_t Message_Hash(const upb_msg* msg, const upb_msgdef* m, uint64_t seed) {
717
716
  &size);
718
717
 
719
718
  if (data) {
720
- uint64_t ret = wyhash(data, size, seed, _wyp);
719
+ uint64_t ret = Wyhash(data, size, seed, kWyhashSalt);
721
720
  upb_arena_free(arena);
722
721
  return ret;
723
722
  } else {
@@ -1013,7 +1012,6 @@ static VALUE Message_decode_json(int argc, VALUE* argv, VALUE klass) {
1013
1012
  */
1014
1013
  static VALUE Message_encode(VALUE klass, VALUE msg_rb) {
1015
1014
  Message* msg = ruby_to_Message(msg_rb);
1016
- upb_arena *arena = upb_arena_new();
1017
1015
  const char *data;
1018
1016
  size_t size;
1019
1017
 
@@ -1021,6 +1019,8 @@ static VALUE Message_encode(VALUE klass, VALUE msg_rb) {
1021
1019
  rb_raise(rb_eArgError, "Message of wrong type.");
1022
1020
  }
1023
1021
 
1022
+ upb_arena *arena = upb_arena_new();
1023
+
1024
1024
  data = upb_encode(msg->msg, upb_msgdef_layout(msg->msgdef), arena,
1025
1025
  &size);
1026
1026
 
@@ -34,7 +34,6 @@
34
34
  #include "defs.h"
35
35
  #include "message.h"
36
36
  #include "protobuf.h"
37
- #include "third_party/wyhash/wyhash.h"
38
37
 
39
38
  // -----------------------------------------------------------------------------
40
39
  // Repeated field container type.
@@ -552,6 +551,7 @@ VALUE RepeatedField_plus(VALUE _self, VALUE list) {
552
551
  RepeatedField* dupped = ruby_to_RepeatedField(dupped_);
553
552
  upb_array *dupped_array = RepeatedField_GetMutable(dupped_);
554
553
  upb_arena* arena = Arena_get(dupped->arena);
554
+ Arena_fuse(list_rptfield->arena, arena);
555
555
  int size = upb_array_size(list_rptfield->array);
556
556
  int i;
557
557