google-protobuf 4.27.2-aarch64-linux → 4.28.0.rc.1-aarch64-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.

@@ -24,12 +24,14 @@ module Google
24
24
  module Protobuf
25
25
  class FFI
26
26
  # Array
27
- attach_function :append_array, :upb_Array_Append, [:Array, MessageValue.by_value, Internal::Arena], :bool
28
- attach_function :get_msgval_at,:upb_Array_Get, [:Array, :size_t], MessageValue.by_value
29
- attach_function :create_array, :upb_Array_New, [Internal::Arena, CType], :Array
30
- attach_function :array_resize, :upb_Array_Resize, [:Array, :size_t, Internal::Arena], :bool
31
- attach_function :array_set, :upb_Array_Set, [:Array, :size_t, MessageValue.by_value], :void
32
- attach_function :array_size, :upb_Array_Size, [:Array], :size_t
27
+ attach_function :append_array, :upb_Array_Append, [:Array, MessageValue.by_value, Internal::Arena], :bool
28
+ attach_function :get_msgval_at, :upb_Array_Get, [:Array, :size_t], MessageValue.by_value
29
+ attach_function :create_array, :upb_Array_New, [Internal::Arena, CType], :Array
30
+ attach_function :array_resize, :upb_Array_Resize, [:Array, :size_t, Internal::Arena], :bool
31
+ attach_function :array_set, :upb_Array_Set, [:Array, :size_t, MessageValue.by_value], :void
32
+ attach_function :array_size, :upb_Array_Size, [:Array], :size_t
33
+ attach_function :array_freeze, :upb_Array_Freeze, [:Array, MiniTable.by_ref], :void
34
+ attach_function :array_frozen?, :upb_Array_IsFrozen, [:Array], :bool
33
35
  end
34
36
 
35
37
  class RepeatedField
@@ -174,16 +176,36 @@ module Google
174
176
  end
175
177
  alias size :length
176
178
 
179
+ ##
180
+ # Is this object frozen?
181
+ # Returns true if either this Ruby wrapper or the underlying
182
+ # representation are frozen. Freezes the wrapper if the underlying
183
+ # representation is already frozen but this wrapper isn't.
184
+ def frozen?
185
+ unless Google::Protobuf::FFI.array_frozen? array
186
+ raise RuntimeError.new "Ruby frozen RepeatedField with mutable representation" if super
187
+ return false
188
+ end
189
+ method(:freeze).super_method.call unless super
190
+ true
191
+ end
192
+
193
+ ##
194
+ # Freezes the RepeatedField object. We have to intercept this so we can
195
+ # freeze the underlying representation, not just the Ruby wrapper. Returns
196
+ # self.
177
197
  def freeze
178
- return self if frozen?
179
- super
180
- @arena.pin self
181
- if type == :message
182
- each do |element|
183
- element.freeze
198
+ if method(:frozen?).super_method.call
199
+ unless Google::Protobuf::FFI.array_frozen? array
200
+ raise RuntimeError.new "Underlying representation of repeated field still mutable despite frozen wrapper"
184
201
  end
202
+ return self
185
203
  end
186
- self
204
+ unless Google::Protobuf::FFI.array_frozen? array
205
+ mini_table = (type == :message) ? Google::Protobuf::FFI.get_mini_table(@descriptor) : nil
206
+ Google::Protobuf::FFI.array_freeze(array, mini_table)
207
+ end
208
+ super
187
209
  end
188
210
 
189
211
  def dup
@@ -348,10 +370,14 @@ module Google
348
370
  OBJECT_CACHE.try_add(@array.address, self)
349
371
  end
350
372
 
351
- # @param field [FieldDescriptor] Descriptor of the field where the RepeatedField will be assigned
352
- # @param values [Enumerable] Initial values; may be nil or empty
373
+ ##
374
+ # Constructor that uses the type information from the given
375
+ # FieldDescriptor to configure the new RepeatedField instance.
376
+ # @param field [FieldDescriptor] Type information for the new RepeatedField
353
377
  # @param arena [Arena] Owning message's arena
354
- def self.construct_for_field(field, arena, values: nil, array: nil)
378
+ # @param values [Enumerable] Initial values
379
+ # @param array [::FFI::Pointer] Existing upb_Array
380
+ def self.construct_for_field(field, arena: nil, values: nil, array: nil)
355
381
  instance = allocate
356
382
  options = {initial_values: values, name: field.name, arena: arena, array: array}
357
383
  if [:enum, :message].include? field.type
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-protobuf
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.27.2
4
+ version: 4.28.0.rc.1
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - Protobuf Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-25 00:00:00.000000000 Z
11
+ date: 2024-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler-dock
@@ -190,7 +190,7 @@ homepage: https://developers.google.com/protocol-buffers
190
190
  licenses:
191
191
  - BSD-3-Clause
192
192
  metadata:
193
- source_code_uri: https://github.com/protocolbuffers/protobuf/tree/v4.27.2/ruby
193
+ source_code_uri: https://github.com/protocolbuffers/protobuf/tree/v4.28.0-rc1/ruby
194
194
  post_install_message:
195
195
  rdoc_options: []
196
196
  require_paths:
@@ -205,9 +205,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
205
205
  version: 3.4.dev
206
206
  required_rubygems_version: !ruby/object:Gem::Requirement
207
207
  requirements:
208
- - - ">="
208
+ - - ">"
209
209
  - !ruby/object:Gem::Version
210
- version: '0'
210
+ version: 1.3.1
211
211
  requirements: []
212
212
  rubygems_version: 3.3.26
213
213
  signing_key: