updated protobuf to 3.18.1
This commit is contained in:
@@ -73,19 +73,21 @@ enum ProcessingTypes {
|
||||
TYPE_STRING_STRING_PIECE = 20,
|
||||
TYPE_BYTES_CORD = 21,
|
||||
TYPE_BYTES_STRING_PIECE = 22,
|
||||
TYPE_MAP = 23,
|
||||
TYPE_STRING_INLINED = 23,
|
||||
TYPE_BYTES_INLINED = 24,
|
||||
TYPE_MAP = 25,
|
||||
};
|
||||
|
||||
static_assert(TYPE_MAP < kRepeatedMask, "Invalid enum");
|
||||
|
||||
struct PROTOBUF_EXPORT FieldMetadata {
|
||||
uint32 offset; // offset of this field in the struct
|
||||
uint32 tag; // field * 8 + wire_type
|
||||
uint32_t offset; // offset of this field in the struct
|
||||
uint32_t tag; // field * 8 + wire_type
|
||||
// byte offset * 8 + bit_offset;
|
||||
// if the high bit is set then this is the byte offset of the oneof_case
|
||||
// for this field.
|
||||
uint32 has_offset;
|
||||
uint32 type; // the type of this field.
|
||||
uint32_t has_offset;
|
||||
uint32_t type; // the type of this field.
|
||||
const void* ptr; // auxiliary data
|
||||
|
||||
// From the serializer point of view each fundamental type can occur in
|
||||
@@ -104,7 +106,8 @@ struct PROTOBUF_EXPORT FieldMetadata {
|
||||
enum {
|
||||
kCordType = 19,
|
||||
kStringPieceType = 20,
|
||||
kNumTypes = 20,
|
||||
kInlinedType = 21,
|
||||
kNumTypes = 21,
|
||||
kSpecial = kNumTypes * kNumTypeClasses,
|
||||
};
|
||||
|
||||
@@ -119,10 +122,10 @@ struct PROTOBUF_EXPORT FieldMetadata {
|
||||
// Additional data, needed for some types, is stored in
|
||||
// AuxiliaryParseTableField.
|
||||
struct ParseTableField {
|
||||
uint32 offset;
|
||||
uint32_t offset;
|
||||
// The presence_index ordinarily represents a has_bit index, but for fields
|
||||
// inside a oneof it represents the index in _oneof_case_.
|
||||
uint32 presence_index;
|
||||
uint32_t presence_index;
|
||||
unsigned char normal_wiretype;
|
||||
unsigned char packed_wiretype;
|
||||
|
||||
@@ -184,10 +187,10 @@ struct ParseTable {
|
||||
// TODO(ckennelly): Do something with this padding.
|
||||
|
||||
// TODO(ckennelly): Vet these for sign extension.
|
||||
int64 has_bits_offset;
|
||||
int64 oneof_case_offset;
|
||||
int64 extension_offset;
|
||||
int64 arena_offset;
|
||||
int64_t has_bits_offset;
|
||||
int64_t oneof_case_offset;
|
||||
int64_t extension_offset;
|
||||
int64_t arena_offset;
|
||||
|
||||
// ExplicitlyInitialized<T> -> T requires a reinterpret_cast, which prevents
|
||||
// the tables from being constructed as a constexpr. We use void to avoid
|
||||
@@ -243,9 +246,9 @@ struct SerializationTable {
|
||||
const FieldMetadata* field_table;
|
||||
};
|
||||
|
||||
PROTOBUF_EXPORT void SerializeInternal(const uint8* base,
|
||||
PROTOBUF_EXPORT void SerializeInternal(const uint8_t* base,
|
||||
const FieldMetadata* table,
|
||||
int32 num_fields,
|
||||
int32_t num_fields,
|
||||
io::CodedOutputStream* output);
|
||||
|
||||
inline void TableSerialize(const MessageLite& msg,
|
||||
@@ -253,24 +256,25 @@ inline void TableSerialize(const MessageLite& msg,
|
||||
io::CodedOutputStream* output) {
|
||||
const FieldMetadata* field_table = table->field_table;
|
||||
int num_fields = table->num_fields - 1;
|
||||
const uint8* base = reinterpret_cast<const uint8*>(&msg);
|
||||
const uint8_t* base = reinterpret_cast<const uint8_t*>(&msg);
|
||||
// TODO(gerbens) This skips the first test if we could use the fast
|
||||
// array serialization path, we should make this
|
||||
// int cached_size =
|
||||
// *reinterpret_cast<const int32*>(base + field_table->offset);
|
||||
// *reinterpret_cast<const int32_t*>(base + field_table->offset);
|
||||
// SerializeWithCachedSize(msg, field_table + 1, num_fields, cached_size, ...)
|
||||
// But we keep conformance with the old way for now.
|
||||
SerializeInternal(base, field_table + 1, num_fields, output);
|
||||
}
|
||||
|
||||
PROTOBUF_EXPORT uint8* SerializeInternalToArray(const uint8* base, const FieldMetadata* table,
|
||||
int32 num_fields, bool is_deterministic,
|
||||
uint8* buffer);
|
||||
PROTOBUF_EXPORT uint8_t* SerializeInternalToArray(const uint8_t* base,
|
||||
const FieldMetadata* table,
|
||||
int32_t num_fields, bool is_deterministic,
|
||||
uint8_t* buffer);
|
||||
|
||||
inline uint8* TableSerializeToArray(const MessageLite& msg,
|
||||
const SerializationTable* table,
|
||||
bool is_deterministic, uint8* buffer) {
|
||||
const uint8* base = reinterpret_cast<const uint8*>(&msg);
|
||||
inline uint8_t* TableSerializeToArray(const MessageLite& msg,
|
||||
const SerializationTable* table,
|
||||
bool is_deterministic, uint8_t* buffer) {
|
||||
const uint8_t* base = reinterpret_cast<const uint8_t*>(&msg);
|
||||
const FieldMetadata* field_table = table->field_table + 1;
|
||||
int num_fields = table->num_fields - 1;
|
||||
return SerializeInternalToArray(base, field_table, num_fields,
|
||||
@@ -302,8 +306,8 @@ struct CompareMapKey {
|
||||
};
|
||||
|
||||
template <typename MapFieldType, const SerializationTable* table>
|
||||
void MapFieldSerializer(const uint8* base, uint32 offset, uint32 tag,
|
||||
uint32 has_offset, io::CodedOutputStream* output) {
|
||||
void MapFieldSerializer(const uint8_t* base, uint32_t offset, uint32_t tag,
|
||||
uint32_t has_offset, io::CodedOutputStream* output) {
|
||||
typedef MapEntryHelper<typename MapFieldType::EntryTypeTrait> Entry;
|
||||
typedef typename MapFieldType::MapType::const_iterator Iter;
|
||||
|
||||
@@ -318,7 +322,7 @@ void MapFieldSerializer(const uint8* base, uint32 offset, uint32 tag,
|
||||
Entry map_entry(*it);
|
||||
output->WriteVarint32(tag);
|
||||
output->WriteVarint32(map_entry._cached_size_);
|
||||
SerializeInternal(reinterpret_cast<const uint8*>(&map_entry),
|
||||
SerializeInternal(reinterpret_cast<const uint8_t*>(&map_entry),
|
||||
t->field_table, t->num_fields, output);
|
||||
}
|
||||
} else {
|
||||
@@ -331,7 +335,7 @@ void MapFieldSerializer(const uint8* base, uint32 offset, uint32 tag,
|
||||
for (int i = 0; i < v.size(); i++) {
|
||||
output->WriteVarint32(tag);
|
||||
output->WriteVarint32(v[i]._cached_size_);
|
||||
SerializeInternal(reinterpret_cast<const uint8*>(&v[i]), t->field_table,
|
||||
SerializeInternal(reinterpret_cast<const uint8_t*>(&v[i]), t->field_table,
|
||||
t->num_fields, output);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user