google-protobuf 3.22.0 → 3.25.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/google/protobuf_c/Rakefile +3 -0
- data/ext/google/protobuf_c/convert.c +23 -70
- data/ext/google/protobuf_c/convert.h +3 -28
- data/ext/google/protobuf_c/defs.c +175 -52
- data/ext/google/protobuf_c/defs.h +3 -28
- data/ext/google/protobuf_c/extconf.rb +2 -1
- data/ext/google/protobuf_c/glue.c +56 -0
- data/ext/google/protobuf_c/map.c +27 -28
- data/ext/google/protobuf_c/map.h +6 -28
- data/ext/google/protobuf_c/message.c +83 -83
- data/ext/google/protobuf_c/message.h +10 -28
- data/ext/google/protobuf_c/protobuf.c +39 -176
- data/ext/google/protobuf_c/protobuf.h +24 -32
- data/ext/google/protobuf_c/repeated_field.c +28 -29
- data/ext/google/protobuf_c/repeated_field.h +6 -28
- data/ext/google/protobuf_c/ruby-upb.c +2982 -2494
- data/ext/google/protobuf_c/ruby-upb.h +5838 -3467
- data/ext/google/protobuf_c/shared_convert.c +64 -0
- data/ext/google/protobuf_c/shared_convert.h +26 -0
- data/ext/google/protobuf_c/shared_message.c +65 -0
- data/ext/google/protobuf_c/shared_message.h +25 -0
- data/ext/google/protobuf_c/wrap_memcpy.c +3 -26
- data/lib/google/protobuf/any_pb.rb +24 -5
- data/lib/google/protobuf/api_pb.rb +26 -23
- data/lib/google/protobuf/descriptor_pb.rb +40 -252
- data/lib/google/protobuf/duration_pb.rb +24 -5
- data/lib/google/protobuf/empty_pb.rb +24 -3
- data/lib/google/protobuf/ffi/descriptor.rb +165 -0
- data/lib/google/protobuf/ffi/descriptor_pool.rb +75 -0
- data/lib/google/protobuf/ffi/enum_descriptor.rb +171 -0
- data/lib/google/protobuf/ffi/ffi.rb +213 -0
- data/lib/google/protobuf/ffi/field_descriptor.rb +319 -0
- data/lib/google/protobuf/ffi/file_descriptor.rb +59 -0
- data/lib/google/protobuf/ffi/internal/arena.rb +66 -0
- data/lib/google/protobuf/ffi/internal/convert.rb +305 -0
- data/lib/google/protobuf/ffi/internal/pointer_helper.rb +35 -0
- data/lib/google/protobuf/ffi/internal/type_safety.rb +25 -0
- data/lib/google/protobuf/ffi/map.rb +407 -0
- data/lib/google/protobuf/ffi/message.rb +662 -0
- data/lib/google/protobuf/ffi/object_cache.rb +30 -0
- data/lib/google/protobuf/ffi/oneof_descriptor.rb +95 -0
- data/lib/google/protobuf/ffi/repeated_field.rb +383 -0
- data/lib/google/protobuf/field_mask_pb.rb +24 -4
- data/lib/google/protobuf/message_exts.rb +3 -26
- data/lib/google/protobuf/object_cache.rb +97 -0
- data/lib/google/protobuf/plugin_pb.rb +25 -28
- data/lib/google/protobuf/repeated_field.rb +3 -26
- data/lib/google/protobuf/source_context_pb.rb +24 -4
- data/lib/google/protobuf/struct_pb.rb +24 -20
- data/lib/google/protobuf/timestamp_pb.rb +24 -5
- data/lib/google/protobuf/type_pb.rb +26 -68
- data/lib/google/protobuf/well_known_types.rb +5 -34
- data/lib/google/protobuf/wrappers_pb.rb +24 -28
- data/lib/google/protobuf.rb +27 -45
- data/lib/google/protobuf_ffi.rb +50 -0
- data/lib/google/protobuf_native.rb +20 -0
- data/lib/google/tasks/ffi.rake +102 -0
- metadata +72 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 634d898bbe3be4cc53cdd85c2bb7774be145905c391514519b32ce409f1781d9
|
4
|
+
data.tar.gz: ee14834c2b11e87c437dbe005ac5518505770324b2202da40a732eaa2c9a5ff6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1baa4d20ce995a96ba0916a7d4ed0847e25645062d7b3e9ba655aae55f0224f9d7b6355b7a5f5d52a8f5100879cd46a21c077a5e4521ca3fd42f2751184a21e9
|
7
|
+
data.tar.gz: 2dc9e891af8d7c553476b9cfa29525746067b8200bf7c8f221da461376446b2c6a62050223d5e9b9f6a6af488c75d3b536fb3f40125069cc50851b06a1a8f748
|
@@ -1,32 +1,9 @@
|
|
1
1
|
// Protocol Buffers - Google's data interchange format
|
2
2
|
// Copyright 2008 Google Inc. All rights reserved.
|
3
|
-
// https://developers.google.com/protocol-buffers/
|
4
3
|
//
|
5
|
-
//
|
6
|
-
//
|
7
|
-
//
|
8
|
-
//
|
9
|
-
// * Redistributions of source code must retain the above copyright
|
10
|
-
// notice, this list of conditions and the following disclaimer.
|
11
|
-
// * Redistributions in binary form must reproduce the above
|
12
|
-
// copyright notice, this list of conditions and the following disclaimer
|
13
|
-
// in the documentation and/or other materials provided with the
|
14
|
-
// distribution.
|
15
|
-
// * Neither the name of Google Inc. nor the names of its
|
16
|
-
// contributors may be used to endorse or promote products derived from
|
17
|
-
// this software without specific prior written permission.
|
18
|
-
//
|
19
|
-
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
20
|
-
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
21
|
-
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
22
|
-
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
23
|
-
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
24
|
-
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
25
|
-
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
26
|
-
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
27
|
-
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
28
|
-
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
29
|
-
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
4
|
+
// Use of this source code is governed by a BSD-style
|
5
|
+
// license that can be found in the LICENSE file or at
|
6
|
+
// https://developers.google.com/open-source/licenses/bsd
|
30
7
|
|
31
8
|
// -----------------------------------------------------------------------------
|
32
9
|
// Ruby <-> upb data conversion functions.
|
@@ -41,6 +18,7 @@
|
|
41
18
|
|
42
19
|
#include "message.h"
|
43
20
|
#include "protobuf.h"
|
21
|
+
#include "shared_convert.h"
|
44
22
|
|
45
23
|
static upb_StringView Convert_StringData(VALUE str, upb_Arena* arena) {
|
46
24
|
upb_StringView ret;
|
@@ -111,8 +89,7 @@ static int32_t Convert_ToEnum(VALUE value, const char* name,
|
|
111
89
|
case T_SYMBOL: {
|
112
90
|
const upb_EnumValueDef* ev =
|
113
91
|
upb_EnumDef_FindValueByName(e, rb_id2name(SYM2ID(value)));
|
114
|
-
if (!ev)
|
115
|
-
goto unknownval;
|
92
|
+
if (!ev) goto unknownval;
|
116
93
|
val = upb_EnumValueDef_Number(ev);
|
117
94
|
break;
|
118
95
|
}
|
@@ -194,7 +171,7 @@ upb_MessageValue Convert_RubyToUpb(VALUE value, const char* name,
|
|
194
171
|
if (rb_obj_encoding(value) != bytes) {
|
195
172
|
// Note: this will not duplicate underlying string data unless
|
196
173
|
// necessary.
|
197
|
-
// TODO
|
174
|
+
// TODO: is this really necessary to get raw bytes?
|
198
175
|
value = rb_str_encode(value, bytes, 0, Qnil);
|
199
176
|
}
|
200
177
|
|
@@ -255,7 +232,7 @@ VALUE Convert_UpbToRuby(upb_MessageValue upb_val, TypeInfo type_info,
|
|
255
232
|
case kUpb_CType_UInt64:
|
256
233
|
return ULL2NUM(upb_val.int64_val);
|
257
234
|
case kUpb_CType_Enum: {
|
258
|
-
const upb_EnumValueDef
|
235
|
+
const upb_EnumValueDef* ev = upb_EnumDef_FindValueByNumber(
|
259
236
|
type_info.def.enumdef, upb_val.int32_val);
|
260
237
|
if (ev) {
|
261
238
|
return ID2SYM(rb_intern(upb_EnumValueDef_Name(ev)));
|
@@ -312,50 +289,26 @@ upb_MessageValue Msgval_DeepCopy(upb_MessageValue msgval, TypeInfo type_info,
|
|
312
289
|
|
313
290
|
bool Msgval_IsEqual(upb_MessageValue val1, upb_MessageValue val2,
|
314
291
|
TypeInfo type_info) {
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
case kUpb_CType_Double:
|
324
|
-
case kUpb_CType_Int64:
|
325
|
-
case kUpb_CType_UInt64:
|
326
|
-
return memcmp(&val1, &val2, 8) == 0;
|
327
|
-
case kUpb_CType_String:
|
328
|
-
case kUpb_CType_Bytes:
|
329
|
-
return val1.str_val.size == val2.str_val.size &&
|
330
|
-
memcmp(val1.str_val.data, val2.str_val.data, val1.str_val.size) ==
|
331
|
-
0;
|
332
|
-
case kUpb_CType_Message:
|
333
|
-
return Message_Equal(val1.msg_val, val2.msg_val, type_info.def.msgdef);
|
334
|
-
default:
|
335
|
-
rb_raise(rb_eRuntimeError, "Internal error, unexpected type");
|
292
|
+
upb_Status status;
|
293
|
+
upb_Status_Clear(&status);
|
294
|
+
bool return_value = shared_Msgval_IsEqual(val1, val2, type_info.type,
|
295
|
+
type_info.def.msgdef, &status);
|
296
|
+
if (upb_Status_IsOk(&status)) {
|
297
|
+
return return_value;
|
298
|
+
} else {
|
299
|
+
rb_raise(rb_eRuntimeError, upb_Status_ErrorMessage(&status));
|
336
300
|
}
|
337
301
|
}
|
338
302
|
|
339
303
|
uint64_t Msgval_GetHash(upb_MessageValue val, TypeInfo type_info,
|
340
304
|
uint64_t seed) {
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
case kUpb_CType_Double:
|
350
|
-
case kUpb_CType_Int64:
|
351
|
-
case kUpb_CType_UInt64:
|
352
|
-
return _upb_Hash(&val, 8, seed);
|
353
|
-
case kUpb_CType_String:
|
354
|
-
case kUpb_CType_Bytes:
|
355
|
-
return _upb_Hash(val.str_val.data, val.str_val.size, seed);
|
356
|
-
case kUpb_CType_Message:
|
357
|
-
return Message_Hash(val.msg_val, type_info.def.msgdef, seed);
|
358
|
-
default:
|
359
|
-
rb_raise(rb_eRuntimeError, "Internal error, unexpected type");
|
305
|
+
upb_Status status;
|
306
|
+
upb_Status_Clear(&status);
|
307
|
+
uint64_t return_value = shared_Msgval_GetHash(
|
308
|
+
val, type_info.type, type_info.def.msgdef, seed, &status);
|
309
|
+
if (upb_Status_IsOk(&status)) {
|
310
|
+
return return_value;
|
311
|
+
} else {
|
312
|
+
rb_raise(rb_eRuntimeError, upb_Status_ErrorMessage(&status));
|
360
313
|
}
|
361
314
|
}
|
@@ -1,38 +1,13 @@
|
|
1
1
|
// Protocol Buffers - Google's data interchange format
|
2
2
|
// Copyright 2008 Google Inc. All rights reserved.
|
3
|
-
// https://developers.google.com/protocol-buffers/
|
4
3
|
//
|
5
|
-
//
|
6
|
-
//
|
7
|
-
//
|
8
|
-
//
|
9
|
-
// * Redistributions of source code must retain the above copyright
|
10
|
-
// notice, this list of conditions and the following disclaimer.
|
11
|
-
// * Redistributions in binary form must reproduce the above
|
12
|
-
// copyright notice, this list of conditions and the following disclaimer
|
13
|
-
// in the documentation and/or other materials provided with the
|
14
|
-
// distribution.
|
15
|
-
// * Neither the name of Google Inc. nor the names of its
|
16
|
-
// contributors may be used to endorse or promote products derived from
|
17
|
-
// this software without specific prior written permission.
|
18
|
-
//
|
19
|
-
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
20
|
-
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
21
|
-
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
22
|
-
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
23
|
-
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
24
|
-
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
25
|
-
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
26
|
-
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
27
|
-
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
28
|
-
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
29
|
-
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
4
|
+
// Use of this source code is governed by a BSD-style
|
5
|
+
// license that can be found in the LICENSE file or at
|
6
|
+
// https://developers.google.com/open-source/licenses/bsd
|
30
7
|
|
31
8
|
#ifndef RUBY_PROTOBUF_CONVERT_H_
|
32
9
|
#define RUBY_PROTOBUF_CONVERT_H_
|
33
10
|
|
34
|
-
#include <ruby/ruby.h>
|
35
|
-
|
36
11
|
#include "protobuf.h"
|
37
12
|
#include "ruby-upb.h"
|
38
13
|
|