google-protobuf 4.29.0.rc.1-aarch64-linux → 4.29.0.rc.3-aarch64-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/google/protobuf_c/message.c +15 -5
- data/ext/google/protobuf_c/ruby-upb.c +41 -12
- data/ext/google/protobuf_c/ruby-upb.h +747 -727
- data/lib/google/3.0/protobuf_c.so +0 -0
- data/lib/google/3.1/protobuf_c.so +0 -0
- data/lib/google/3.2/protobuf_c.so +0 -0
- data/lib/google/3.3/protobuf_c.so +0 -0
- data/lib/google/protobuf/descriptor_pb.rb +1 -1
- data/lib/google/protobuf/ffi/ffi.rb +5 -0
- data/lib/google/protobuf/ffi/message.rb +6 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9597e990bd88e59ce2f060f7fe4206fe01043800c8fd3e3da41b9040fc4bfb0c
|
4
|
+
data.tar.gz: f3001f4c09ef431632c1fa5220d9bc2268f294659d494687421264b3f13efe90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bdd9685c5852b938b5ef6fbf236f85566b00f25df10b19cd35dc16bf5cb5b785ccea79483497d4eb9ecfee43a1bf21539339ed63eb142e38caa7d7a1c21097d4
|
7
|
+
data.tar.gz: 9aebee71601132f32321e1ac63bd2ae6cd1317349800191c6903352ea3479d00ba2a32644e1d2d6a06980097f276992f11232f19b6e6b1359f9bee30c093303e
|
@@ -1038,11 +1038,21 @@ static VALUE Message_decode_json(int argc, VALUE* argv, VALUE klass) {
|
|
1038
1038
|
|
1039
1039
|
upb_Status_Clear(&status);
|
1040
1040
|
const upb_DefPool* pool = upb_FileDef_Pool(upb_MessageDef_File(msg->msgdef));
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1041
|
+
|
1042
|
+
int result = upb_JsonDecodeDetectingNonconformance(
|
1043
|
+
RSTRING_PTR(data), RSTRING_LEN(data), (upb_Message*)msg->msg,
|
1044
|
+
msg->msgdef, pool, options, Arena_get(msg->arena), &status);
|
1045
|
+
|
1046
|
+
switch (result) {
|
1047
|
+
case kUpb_JsonDecodeResult_Ok:
|
1048
|
+
break;
|
1049
|
+
case kUpb_JsonDecodeResult_OkWithEmptyStringNumerics:
|
1050
|
+
rb_warn("%s", upb_Status_ErrorMessage(&status));
|
1051
|
+
break;
|
1052
|
+
case kUpb_JsonDecodeResult_Error:
|
1053
|
+
rb_raise(cParseError, "Error occurred during parsing: %s",
|
1054
|
+
upb_Status_ErrorMessage(&status));
|
1055
|
+
break;
|
1046
1056
|
}
|
1047
1057
|
|
1048
1058
|
return msg_rb;
|
@@ -523,6 +523,7 @@ typedef struct {
|
|
523
523
|
upb_Arena* arena; /* TODO: should we have a tmp arena for tmp data? */
|
524
524
|
const upb_DefPool* symtab;
|
525
525
|
int depth;
|
526
|
+
int result;
|
526
527
|
upb_Status* status;
|
527
528
|
jmp_buf err;
|
528
529
|
int line;
|
@@ -1152,6 +1153,16 @@ static int64_t jsondec_strtoint64(jsondec* d, upb_StringView str) {
|
|
1152
1153
|
return ret;
|
1153
1154
|
}
|
1154
1155
|
|
1156
|
+
static void jsondec_checkempty(jsondec* d, upb_StringView str,
|
1157
|
+
const upb_FieldDef* f) {
|
1158
|
+
if (str.size != 0) return;
|
1159
|
+
d->result = kUpb_JsonDecodeResult_OkWithEmptyStringNumerics;
|
1160
|
+
upb_Status_SetErrorFormat(d->status,
|
1161
|
+
"Empty string is not a valid number (field: %s). "
|
1162
|
+
"This will be an error in a future version.",
|
1163
|
+
upb_FieldDef_FullName(f));
|
1164
|
+
}
|
1165
|
+
|
1155
1166
|
/* Primitive value types ******************************************************/
|
1156
1167
|
|
1157
1168
|
/* Parse INT32 or INT64 value. */
|
@@ -1173,6 +1184,7 @@ static upb_MessageValue jsondec_int(jsondec* d, const upb_FieldDef* f) {
|
|
1173
1184
|
}
|
1174
1185
|
case JD_STRING: {
|
1175
1186
|
upb_StringView str = jsondec_string(d);
|
1187
|
+
jsondec_checkempty(d, str, f);
|
1176
1188
|
val.int64_val = jsondec_strtoint64(d, str);
|
1177
1189
|
break;
|
1178
1190
|
}
|
@@ -1210,6 +1222,7 @@ static upb_MessageValue jsondec_uint(jsondec* d, const upb_FieldDef* f) {
|
|
1210
1222
|
}
|
1211
1223
|
case JD_STRING: {
|
1212
1224
|
upb_StringView str = jsondec_string(d);
|
1225
|
+
jsondec_checkempty(d, str, f);
|
1213
1226
|
val.uint64_val = jsondec_strtouint64(d, str);
|
1214
1227
|
break;
|
1215
1228
|
}
|
@@ -1238,14 +1251,26 @@ static upb_MessageValue jsondec_double(jsondec* d, const upb_FieldDef* f) {
|
|
1238
1251
|
break;
|
1239
1252
|
case JD_STRING:
|
1240
1253
|
str = jsondec_string(d);
|
1241
|
-
if (
|
1254
|
+
if (str.size == 0) {
|
1255
|
+
jsondec_checkempty(d, str, f);
|
1256
|
+
val.double_val = 0.0;
|
1257
|
+
} else if (jsondec_streql(str, "NaN")) {
|
1242
1258
|
val.double_val = NAN;
|
1243
1259
|
} else if (jsondec_streql(str, "Infinity")) {
|
1244
1260
|
val.double_val = INFINITY;
|
1245
1261
|
} else if (jsondec_streql(str, "-Infinity")) {
|
1246
1262
|
val.double_val = -INFINITY;
|
1247
1263
|
} else {
|
1248
|
-
|
1264
|
+
char* end;
|
1265
|
+
val.double_val = strtod(str.data, &end);
|
1266
|
+
if (end != str.data + str.size) {
|
1267
|
+
d->result = kUpb_JsonDecodeResult_OkWithEmptyStringNumerics;
|
1268
|
+
upb_Status_SetErrorFormat(
|
1269
|
+
d->status,
|
1270
|
+
"Non-number characters in quoted number (field: %s). "
|
1271
|
+
"This will be an error in a future version.",
|
1272
|
+
upb_FieldDef_FullName(f));
|
1273
|
+
}
|
1249
1274
|
}
|
1250
1275
|
break;
|
1251
1276
|
default:
|
@@ -1987,10 +2012,10 @@ static void jsondec_wellknown(jsondec* d, upb_Message* msg,
|
|
1987
2012
|
}
|
1988
2013
|
}
|
1989
2014
|
|
1990
|
-
static
|
1991
|
-
|
2015
|
+
static int upb_JsonDecoder_Decode(jsondec* const d, upb_Message* const msg,
|
2016
|
+
const upb_MessageDef* const m) {
|
1992
2017
|
UPB_ASSERT(!upb_Message_IsFrozen(msg));
|
1993
|
-
if (UPB_SETJMP(d->err)) return
|
2018
|
+
if (UPB_SETJMP(d->err)) return kUpb_JsonDecodeResult_Error;
|
1994
2019
|
|
1995
2020
|
jsondec_tomsg(d, msg, m);
|
1996
2021
|
|
@@ -1999,16 +2024,19 @@ static bool upb_JsonDecoder_Decode(jsondec* const d, upb_Message* const msg,
|
|
1999
2024
|
jsondec_consumews(d);
|
2000
2025
|
|
2001
2026
|
if (d->ptr == d->end) {
|
2002
|
-
return
|
2027
|
+
return d->result;
|
2003
2028
|
} else {
|
2004
2029
|
jsondec_seterrmsg(d, "unexpected trailing characters");
|
2005
|
-
return
|
2030
|
+
return kUpb_JsonDecodeResult_Error;
|
2006
2031
|
}
|
2007
2032
|
}
|
2008
2033
|
|
2009
|
-
|
2010
|
-
|
2011
|
-
|
2034
|
+
int upb_JsonDecodeDetectingNonconformance(const char* buf, size_t size,
|
2035
|
+
upb_Message* msg,
|
2036
|
+
const upb_MessageDef* m,
|
2037
|
+
const upb_DefPool* symtab,
|
2038
|
+
int options, upb_Arena* arena,
|
2039
|
+
upb_Status* status) {
|
2012
2040
|
UPB_ASSERT(!upb_Message_IsFrozen(msg));
|
2013
2041
|
jsondec d;
|
2014
2042
|
|
@@ -2021,6 +2049,7 @@ bool upb_JsonDecode(const char* buf, size_t size, upb_Message* msg,
|
|
2021
2049
|
d.status = status;
|
2022
2050
|
d.options = options;
|
2023
2051
|
d.depth = 64;
|
2052
|
+
d.result = kUpb_JsonDecodeResult_Ok;
|
2024
2053
|
d.line = 1;
|
2025
2054
|
d.line_begin = d.ptr;
|
2026
2055
|
d.debug_field = NULL;
|
@@ -8993,7 +9022,7 @@ static const upb_MiniTableField google_protobuf_FileDescriptorSet__fields[1] = {
|
|
8993
9022
|
const upb_MiniTable google__protobuf__FileDescriptorSet_msg_init = {
|
8994
9023
|
&google_protobuf_FileDescriptorSet__submsgs[0],
|
8995
9024
|
&google_protobuf_FileDescriptorSet__fields[0],
|
8996
|
-
16, 1,
|
9025
|
+
16, 1, kUpb_ExtMode_Extendable, 1, UPB_FASTTABLE_MASK(8), 0,
|
8997
9026
|
#ifdef UPB_TRACING_ENABLED
|
8998
9027
|
"google.protobuf.FileDescriptorSet",
|
8999
9028
|
#endif
|
@@ -10049,7 +10078,7 @@ static const upb_MiniTableField google_protobuf_SourceCodeInfo__fields[1] = {
|
|
10049
10078
|
const upb_MiniTable google__protobuf__SourceCodeInfo_msg_init = {
|
10050
10079
|
&google_protobuf_SourceCodeInfo__submsgs[0],
|
10051
10080
|
&google_protobuf_SourceCodeInfo__fields[0],
|
10052
|
-
16, 1,
|
10081
|
+
16, 1, kUpb_ExtMode_Extendable, 1, UPB_FASTTABLE_MASK(8), 0,
|
10053
10082
|
#ifdef UPB_TRACING_ENABLED
|
10054
10083
|
"google.protobuf.SourceCodeInfo",
|
10055
10084
|
#endif
|