Fixing merge issues

pull/10729/head
Mike Kruskal 2 years ago
parent c529965f0d
commit 5a95ef8fa2
  1. 2
      src/google/protobuf/arena_align.h
  2. 2
      src/google/protobuf/arena_allocation_policy.h
  3. 2
      src/google/protobuf/compiler/csharp/csharp_map_field.cc
  4. 12
      src/google/protobuf/json/internal/parser.cc
  5. 2
      src/google/protobuf/json/internal/parser_traits.h
  6. 19
      src/google/protobuf/util/message_differencer.h
  7. 3
      src/google/protobuf/util/message_differencer_unittest.cc

@ -30,7 +30,7 @@
// This file provides alignment utilities for use in arenas.
//
// `ArenaAlign` constains a single `align` data member and provides
// `ArenaAlign` contains a single `align` data member and provides
// the below functions which operate on the given alignment.
//
// Ceil(size_t n) - rounds `n` up to the nearest `align` boundary.

@ -41,7 +41,7 @@ namespace protobuf {
namespace internal {
// `AllocationPolicy` defines `Arena` allocation policies. Applications can
// customize the inital and maximum sizes for arena allocation, as well as set
// customize the initial and maximum sizes for arena allocation, as well as set
// custom allocation and deallocation functions. `AllocationPolicy` is for
// protocol buffer internal use only, and typically created from a user facing
// public configuration class such as `ArenaOptions`.

@ -88,7 +88,7 @@ void MapFieldGenerator::GenerateMembers(io::Printer* printer) {
void MapFieldGenerator::GenerateMergingCode(io::Printer* printer) {
printer->Print(
variables_,
"$name$_.Add(other.$name$_);\n");
"$name$_.MergeFrom(other.$name$_);\n");
}
void MapFieldGenerator::GenerateParsingCode(io::Printer* printer) {

@ -75,20 +75,20 @@ namespace {
// convert it into some form of proto.
//
// This semantic layer is duplicated: proto2-ish code can deserialize directly
// into a message, wheras proto3-ish code deserializes into a byte stream, using
// TypeResolvers instead of Descriptors.
// into a message, whereas proto3-ish code deserializes into a byte stream,
// using TypeResolvers instead of Descriptors.
//
// The parsing code is templated over which of these two reflection + output
// combinations is used. The traits types that collect the per-instantiation
// functionality can be found in json_util2_parser_traits-inl.h.
// This table maps an unsigned `char` value, intepreted as an ASCII character,
// This table maps an unsigned `char` value, interpreted as an ASCII character,
// to a corresponding value in the base64 alphabet (both traditional and
// "web-safe" characters are included).
//
// If a character is not valid base64, it maps to -1; this is used by the bit
// operations that assemble a base64-encoded word to determine if an error
// occured, by checking the sign bit.
// occurred, by checking the sign bit.
constexpr signed char kBase64Table[256] = {
-1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1,
@ -226,7 +226,7 @@ absl::StatusOr<LocationWith<T>> ParseIntInner(JsonLexer& lex, double lo,
absl::StatusOr<LocationWith<MaybeOwnedString>> str = lex.ParseUtf8();
RETURN_IF_ERROR(str.status());
// SimpleAtoi will ignore leading and trailing whitespace, so we need
// to check for it outselves.
// to check for it ourselves.
for (char c : str->value.AsView()) {
if (absl::ascii_isspace(c)) {
return lex.Invalid("non-number characters in quoted number");
@ -1209,7 +1209,7 @@ absl::Status ParseField(JsonLexer& lex, const Desc<Traits>& desc,
if (Traits::IsRepeated(*field)) {
if (lex.options().allow_legacy_syntax && !lex.Peek(JsonLexer::kArr)) {
// The original ESF parser premits a single element in place of an array
// The original ESF parser permits a single element in place of an array
// thereof.
return ParseSingular<Traits>(lex, *field, msg);
}

@ -105,7 +105,7 @@ struct ParseProto2Descriptor : Proto2Descriptor {
/// Functions for writing fields. ///
// Marks a field as having been "seen". This will clear the field if it is
// the first occurence thereof.
// the first occurrence thereof.
//
// All setters call this function automatically, but it may also be called
// eagerly to clear a pre-existing value that might not be overwritten, such

@ -188,7 +188,7 @@ class PROTOBUF_EXPORT MessageDifferencer {
// if the original message packs another Any, then unpacked_any=2, assuming
// the differencer unpacked both of them.
//
// When an Any object packes a non-Any proto object whose field includes
// When an Any object packs a non-Any proto object whose field includes
// Any, then unpacked_any=1. Thus, in most practical applications,
// unpacked_any will be 0 or 1.
const Message* message1 = nullptr;
@ -330,31 +330,20 @@ class PROTOBUF_EXPORT MessageDifferencer {
MapKeyComparator& operator=(const MapKeyComparator&) = delete;
virtual ~MapKeyComparator();
// This method is DEPRECATED. It is never called directly by
// MessageDifferencer. New code should implement only the next form of
// IsMatch.
//
// TODO(b/248337479) Remove this method.
virtual bool IsMatch(
const Message& /* message1 */, const Message& /* message2 */,
const std::vector<SpecificField>& /* parent_fields */) const {
GOOGLE_CHECK(false) << "IsMatch() is not implemented.";
return false;
}
// This method should be overridden by every implementation. The arg
// unmapped_any is nonzero the original messages provided by the user are of
// type google.protobuf.Any.
//
// More precisely, unpacked_any defines the nesting level of Any. For
// example, if Any packs another Any then unpacked_any=2, assuming the
// patcher unpacked both. Note that when an Any object packes a non-Any
// patcher unpacked both. Note that when an Any object packs a non-Any
// proto object whose field includes Any, then unpacked_any=1. Thus, in most
// practical applications, unpacked_any will be 0 or 1.
virtual bool IsMatch(const Message& message1, const Message& message2,
int /* unmapped_any */,
const std::vector<SpecificField>& fields) const {
return IsMatch(message1, message2, fields);
GOOGLE_CHECK(false) << "IsMatch() is not implemented.";
return false;
}
};

@ -1907,6 +1907,7 @@ class ValueProductMapKeyComparator
public:
typedef util::MessageDifferencer::SpecificField SpecificField;
bool IsMatch(const Message& message1, const Message& message2,
int unpacked_any,
const std::vector<SpecificField>& parent_fields) const override {
const Reflection* reflection1 = message1.GetReflection();
const Reflection* reflection2 = message2.GetReflection();
@ -1968,6 +1969,7 @@ class OffsetByOneMapKeyComparator
public:
typedef util::MessageDifferencer::SpecificField SpecificField;
bool IsMatch(const Message& message1, const Message& message2,
int unpacked_any,
const std::vector<SpecificField>& parent_fields) const override {
return parent_fields.back().index + 1 == parent_fields.back().new_index;
}
@ -3402,6 +3404,7 @@ class LengthMapKeyComparator
public:
typedef util::MessageDifferencer::SpecificField SpecificField;
bool IsMatch(const Message& message1, const Message& message2,
int unpacked_any,
const std::vector<SpecificField>& parent_fields) const override {
const Reflection* reflection1 = message1.GetReflection();
const Reflection* reflection2 = message2.GetReflection();

Loading…
Cancel
Save