This reduces the implementation to our much narrower current use-cases, hardcoded directly where we need it. It also unifies google3 and OSS behavior, which may have deviated over time.
PiperOrigin-RevId: 502696374
This will prevent unsupported uses of these classes downstream, which can behave surprisingly and increase the friction of changes to protobuf. Specifically RepeatedField, RepeatedPtrField, and Map will only be allowed to hold the types listed in https://protobuf.dev/programming-guides/proto. The old behavior allowed them to hold just about anything, including custom user types.
PiperOrigin-RevId: 502672732
In the multi file case, the function to get the file descriptor has to be
referenced from multiple generated source, so it can't be `static`, ensure the
name is more unique to avoid issues.
PiperOrigin-RevId: 502611183
There are two issues here related to recent changes:
1) Our extern declarations of common RepeatedField types were removed, allowing RepeatedField::Reserve to get inlined. This results in an `array-bounds` warning from gcc due to our memcpy call. We had an explicit comment that this method shouldn't be inlined, and that silences the warning.
2) Using std::inserter with flat_hash_set::end() triggers a `maybe-uninitialized` warning from gcc. This is likely an Abseil issue, and showed up recently as part of our effort to migrate to the more efficient Abseil containers. Alternatively inserting into flat_hash_set::begin() works just fine and avoids this issue.
PiperOrigin-RevId: 501301957
I.e., if foo.extn is an extension for message foo.Foo, attempting to parse the document
{"[foo.extn]": 4}
as a foo.Bar would crash. This CL causes the parser to return an error instead.
PiperOrigin-RevId: 501299336
possible values form a contiguous range that starts with 0 or 1, and end no
greater than 126, when parsing a noncontiguous stream (such as from a Cord).
This routine was misusing `ParseContext::Done`. It should only be used at tag boundaries and not within field parsing.
PiperOrigin-RevId: 501107542
`ZeroCopyCodedInputStream::ReadCord()` is implemented in terms of `CodedInputStream::ReadCord()` which is incorrect: the contract for the interface method `ZeroCopyInputStream::ReadCord()` is that it appends to the provided cord output where `CodedInputStream::ReadCord()` sets the cord output value, clearing any pre-existing contents. This change fixes the internal implementation to append to any pre-existing contents.
PiperOrigin-RevId: 500872467
Implemented in java, c++, python and upb. Also added conformance test.
https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Value
where it says:
attempting to serialize NaN or Infinity results in error. (We can't serialize these as string "NaN" or "Infinity" values like we do for regular fields, because they would parse as string_value, not number_value).
PiperOrigin-RevId: 500828964
This removes the built in "extern template" declarations because they continue to cause issues in shared library builds. Users who need this optimization can define it themselves. This also adds PROTOBUF_EXPORT to some symbols that were previously missing it.
PiperOrigin-RevId: 500223387
- Add UntypedMapBase as a base class for all Map instances. Move all type independent methods to the base class.
- Remove InnerMap and make Map itself provide the base classes.
Also, update some stale documentation.
PiperOrigin-RevId: 500208690
Implemented in java, c++, python and upb. Also added conformance test.
https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Value
where it says:
attempting to serialize NaN or Infinity results in error. (We can't serialize these as string "NaN" or "Infinity" values like we do for regular fields, because they would parse as string_value, not number_value).
PiperOrigin-RevId: 500139380