diff options
author | pg <pg@yandex-team.com> | 2023-02-05 17:18:56 +0300 |
---|---|---|
committer | pg <pg@yandex-team.com> | 2023-02-05 17:18:56 +0300 |
commit | f0dcf26e6c8006eed936664c53ef5234ac773c75 (patch) | |
tree | b3728c8bc17c24a6f8b3b9f762cc87b8dab1e54e /contrib/libs/protobuf | |
parent | 9331e4d05e2f395a0a5ab5f5647517eab412bbed (diff) | |
download | ydb-f0dcf26e6c8006eed936664c53ef5234ac773c75.tar.gz |
replace hand-crafted patch with computer program
Diffstat (limited to 'contrib/libs/protobuf')
99 files changed, 2079 insertions, 2550 deletions
diff --git a/contrib/libs/protobuf/src/google/protobuf/arena.cc b/contrib/libs/protobuf/src/google/protobuf/arena.cc index c12bf2b3fe..bdf756609d 100644 --- a/contrib/libs/protobuf/src/google/protobuf/arena.cc +++ b/contrib/libs/protobuf/src/google/protobuf/arena.cc @@ -168,8 +168,8 @@ void SerialArena::AllocateNewBlock(size_t n, const AllocationPolicy* policy) { #endif // ADDRESS_SANITIZER } -uint64_t SerialArena::SpaceUsed() const { - uint64_t space_used = ptr_ - head_->Pointer(kBlockHeaderSize); +ui64 SerialArena::SpaceUsed() const { + ui64 space_used = ptr_ - head_->Pointer(kBlockHeaderSize); space_used += space_used_; // Remove the overhead of the SerialArena itself. space_used -= ThreadSafeArena::kSerialArenaSize; @@ -263,11 +263,11 @@ void ThreadSafeArena::Init(bool record_allocs) { auto id = tc.next_lifecycle_id; // We increment lifecycle_id's by multiples of two so we can use bit 0 as // a tag. - constexpr uint64_t kDelta = 2; - constexpr uint64_t kInc = ThreadCache::kPerThreadIds * kDelta; + constexpr ui64 kDelta = 2; + constexpr ui64 kInc = ThreadCache::kPerThreadIds * kDelta; if (PROTOBUF_PREDICT_FALSE((id & (kInc - 1)) == 0)) { constexpr auto relaxed = std::memory_order_relaxed; - // On platforms that don't support uint64_t atomics we can certainly not + // On platforms that don't support ui64 atomics we can certainly not // afford to increment by large intervals and expect uniqueness due to // wrapping, hence we only add by 1. id = lifecycle_id_generator_.id.fetch_add(1, relaxed) * kInc; @@ -316,7 +316,7 @@ SerialArena::Memory ThreadSafeArena::Free(size_t* space_allocated) { return mem; } -uint64_t ThreadSafeArena::Reset() { +ui64 ThreadSafeArena::Reset() { // Have to do this in a first pass, because some of the destructors might // refer to memory in other blocks. CleanupList(); @@ -406,18 +406,18 @@ void ThreadSafeArena::AddCleanupFallback(void* elem, void (*cleanup)(void*)) { ->AddCleanup(elem, cleanup, AllocPolicy()); } -uint64_t ThreadSafeArena::SpaceAllocated() const { +ui64 ThreadSafeArena::SpaceAllocated() const { SerialArena* serial = threads_.load(std::memory_order_acquire); - uint64_t res = 0; + ui64 res = 0; for (; serial; serial = serial->next()) { res += serial->SpaceAllocated(); } return res; } -uint64_t ThreadSafeArena::SpaceUsed() const { +ui64 ThreadSafeArena::SpaceUsed() const { SerialArena* serial = threads_.load(std::memory_order_acquire); - uint64_t space_used = 0; + ui64 space_used = 0; for (; serial; serial = serial->next()) { space_used += serial->SpaceUsed(); } diff --git a/contrib/libs/protobuf/src/google/protobuf/arena.h b/contrib/libs/protobuf/src/google/protobuf/arena.h index dd78ded473..c0e833547a 100644 --- a/contrib/libs/protobuf/src/google/protobuf/arena.h +++ b/contrib/libs/protobuf/src/google/protobuf/arena.h @@ -351,19 +351,19 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena { // policies. Do not use these in unit tests. // Returns the total space allocated by the arena, which is the sum of the // sizes of the underlying blocks. - uint64_t SpaceAllocated() const { return impl_.SpaceAllocated(); } + ui64 SpaceAllocated() const { return impl_.SpaceAllocated(); } // Returns the total space used by the arena. Similar to SpaceAllocated but // does not include free space and block overhead. The total space returned // may not include space used by other threads executing concurrently with // the call to this method. - uint64_t SpaceUsed() const { return impl_.SpaceUsed(); } + ui64 SpaceUsed() const { return impl_.SpaceUsed(); } // Frees all storage allocated by this arena after calling destructors // registered with OwnDestructor() and freeing objects registered with Own(). // Any objects allocated on this arena are unusable after this call. It also // returns the total space used by the arena which is the sums of the sizes // of the allocated blocks. This method is not thread-safe. - uint64_t Reset() { return impl_.Reset(); } + ui64 Reset() { return impl_.Reset(); } // Adds |object| to a list of heap-allocated objects to be freed with |delete| // when the arena is destroyed or reset. diff --git a/contrib/libs/protobuf/src/google/protobuf/arena_impl.h b/contrib/libs/protobuf/src/google/protobuf/arena_impl.h index b47bad78c7..eb3d4fbeff 100644 --- a/contrib/libs/protobuf/src/google/protobuf/arena_impl.h +++ b/contrib/libs/protobuf/src/google/protobuf/arena_impl.h @@ -56,7 +56,7 @@ inline constexpr size_t AlignUpTo8(size_t n) { return (n + 7) & static_cast<size_t>(-8); } -using LifecycleIdAtomic = uint64_t; +using LifecycleIdAtomic = ui64; // MetricsCollector collects stats for a particular arena. class PROTOBUF_EXPORT ArenaMetricsCollector { @@ -66,11 +66,11 @@ class PROTOBUF_EXPORT ArenaMetricsCollector { // Invoked when the arena is about to be destroyed. This method will // typically finalize any metric collection and delete the collector. // space_allocated is the space used by the arena. - virtual void OnDestroy(uint64_t space_allocated) = 0; + virtual void OnDestroy(ui64 space_allocated) = 0; // OnReset() is called when the associated arena is reset. // space_allocated is the space used by the arena just before the reset. - virtual void OnReset(uint64_t space_allocated) = 0; + virtual void OnReset(ui64 space_allocated) = 0; // OnAlloc is called when an allocation happens. // type_info is promised to be static - its lifetime extends to @@ -79,7 +79,7 @@ class PROTOBUF_EXPORT ArenaMetricsCollector { // intentionally want to avoid monitoring an allocation. (i.e. internal // allocations for managing the arena) virtual void OnAlloc(const std::type_info* allocated_type, - uint64_t alloc_size) = 0; + ui64 alloc_size) = 0; // Does OnAlloc() need to be called? If false, metric collection overhead // will be reduced since we will not do extra work per allocation. @@ -141,10 +141,10 @@ class PROTOBUF_EXPORT SerialArena { Memory Free(Deallocator deallocator); void CleanupList(); - uint64_t SpaceAllocated() const { + ui64 SpaceAllocated() const { return space_allocated_.load(std::memory_order_relaxed); } - uint64_t SpaceUsed() const; + ui64 SpaceUsed() const; bool HasSpace(size_t n) { return n <= static_cast<size_t>(limit_ - ptr_); } @@ -287,10 +287,10 @@ class PROTOBUF_EXPORT ThreadSafeArena { // if it was passed in. ~ThreadSafeArena(); - uint64_t Reset(); + ui64 Reset(); - uint64_t SpaceAllocated() const; - uint64_t SpaceUsed() const; + ui64 SpaceAllocated() const; + ui64 SpaceUsed() const; void* AllocateAligned(size_t n, const std::type_info* type) { SerialArena* arena; @@ -322,7 +322,7 @@ class PROTOBUF_EXPORT ThreadSafeArena { private: // Unique for each arena. Changes on Reset(). - uint64_t tag_and_id_; + ui64 tag_and_id_; // The LSB of tag_and_id_ indicates if allocs in this arena are recorded. enum { kRecordAllocs = 1 }; @@ -353,7 +353,7 @@ class PROTOBUF_EXPORT ThreadSafeArena { inline bool ShouldRecordAlloc() const { return tag_and_id_ & kRecordAllocs; } - inline uint64_t LifeCycleId() const { + inline ui64 LifeCycleId() const { return tag_and_id_ & (-kRecordAllocs - 1); } @@ -372,7 +372,7 @@ class PROTOBUF_EXPORT ThreadSafeArena { hint_.store(serial, std::memory_order_release); } - PROTOBUF_NDEBUG_INLINE bool GetSerialArenaFast(uint64_t lifecycle_id, + PROTOBUF_NDEBUG_INLINE bool GetSerialArenaFast(ui64 lifecycle_id, SerialArena** arena) { if (GetSerialArenaFromThreadCache(lifecycle_id, arena)) return true; if (lifecycle_id & kRecordAllocs) return false; @@ -389,7 +389,7 @@ class PROTOBUF_EXPORT ThreadSafeArena { } PROTOBUF_NDEBUG_INLINE bool GetSerialArenaFromThreadCache( - uint64_t lifecycle_id, SerialArena** arena) { + ui64 lifecycle_id, SerialArena** arena) { // If this thread already owns a block in this arena then try to use that. // This fast path optimizes the case where multiple threads allocate from // the same arena. @@ -437,10 +437,10 @@ class PROTOBUF_EXPORT ThreadSafeArena { static constexpr size_t kPerThreadIds = 256; // Next lifecycle ID available to this thread. We need to reserve a new // batch, if `next_lifecycle_id & (kPerThreadIds - 1) == 0`. - uint64_t next_lifecycle_id; + ui64 next_lifecycle_id; // The ThreadCache is considered valid as long as this matches the // lifecycle_id of the arena being used. - uint64_t last_lifecycle_id_seen; + ui64 last_lifecycle_id_seen; SerialArena* last_serial_arena; }; diff --git a/contrib/libs/protobuf/src/google/protobuf/descriptor.cc b/contrib/libs/protobuf/src/google/protobuf/descriptor.cc index dffc45d72e..4a4ca1f6c8 100644 --- a/contrib/libs/protobuf/src/google/protobuf/descriptor.cc +++ b/contrib/libs/protobuf/src/google/protobuf/descriptor.cc @@ -664,8 +664,8 @@ bool AllowedExtendeeInProto3(const TProtoStringType& name) { class TableArena { public: // Allocate a block on `n` bytes, with no destructor information saved. - void* AllocateMemory(uint32_t n) { - uint32_t tag = SizeToRawTag(n) + kFirstRawTag; + void* AllocateMemory(ui32 n) { + ui32 tag = SizeToRawTag(n) + kFirstRawTag; if (tag > 255) { // We can't fit the size, use an OutOfLineAlloc. return Create<OutOfLineAlloc>(OutOfLineAlloc{::operator new(n), n})->ptr; @@ -709,7 +709,7 @@ class TableArena { // inspect the usage of the arena. void PrintUsageInfo() const { const auto print_histogram = [](Block* b, int size) { - std::map<uint32_t, uint32_t> unused_space_count; + std::map<ui32, ui32> unused_space_count; int count = 0; for (; b != nullptr; b = b->next) { ++unused_space_count[b->space_left()]; @@ -787,7 +787,7 @@ class TableArena { using Tag = unsigned char; - void* AllocRawInternal(uint32_t size, Tag tag) { + void* AllocRawInternal(ui32 size, Tag tag) { GOOGLE_DCHECK_GT(size, 0); size = RoundUp(size); @@ -840,7 +840,7 @@ class TableArena { struct OutOfLineAlloc { void* ptr; - uint32_t size; + ui32 size; }; template <typename... T> @@ -910,11 +910,11 @@ class TableArena { void operator()(OutOfLineAlloc* p) { OperatorDelete(p->ptr, p->size); } }; - static uint32_t SizeToRawTag(size_t n) { return (RoundUp(n) / 8) - 1; } + static ui32 SizeToRawTag(size_t n) { return (RoundUp(n) / 8) - 1; } - static uint32_t TagToSize(Tag tag) { + static ui32 TagToSize(Tag tag) { GOOGLE_DCHECK_GE(tag, kFirstRawTag); - return static_cast<uint32_t>(tag - kFirstRawTag + 1) * 8; + return static_cast<ui32>(tag - kFirstRawTag + 1) * 8; } struct Block { @@ -926,7 +926,7 @@ class TableArena { // `allocated_size` is the total size of the memory block allocated. // The `Block` structure is constructed at the start and the rest of the // memory is used as the payload of the `Block`. - explicit Block(uint32_t allocated_size) { + explicit Block(ui32 allocated_size) { start_offset = 0; end_offset = capacity = reinterpret_cast<char*>(this) + allocated_size - data(); @@ -937,12 +937,12 @@ class TableArena { return reinterpret_cast<char*>(this) + RoundUp(sizeof(Block)); } - uint32_t memory_used() { + ui32 memory_used() { return data() + capacity - reinterpret_cast<char*>(this); } - uint32_t space_left() const { return end_offset - start_offset; } + ui32 space_left() const { return end_offset - start_offset; } - void* Allocate(uint32_t n, Tag tag) { + void* Allocate(ui32 n, Tag tag) { GOOGLE_DCHECK_LE(n + 1, space_left()); void* p = data() + start_offset; start_offset += n; @@ -2471,16 +2471,16 @@ TProtoStringType FieldDescriptor::DefaultValueAsString( GOOGLE_CHECK(has_default_value()) << "No default value"; switch (cpp_type()) { case CPPTYPE_INT32: - return StrCat(default_value_int32_t()); + return StrCat(default_value_i32()); break; case CPPTYPE_INT64: - return StrCat(default_value_int64_t()); + return StrCat(default_value_i64()); break; case CPPTYPE_UINT32: - return StrCat(default_value_uint32_t()); + return StrCat(default_value_ui32()); break; case CPPTYPE_UINT64: - return StrCat(default_value_uint64_t()); + return StrCat(default_value_ui64()); break; case CPPTYPE_FLOAT: return SimpleFtoa(default_value_float()); @@ -3458,7 +3458,7 @@ bool FileDescriptor::GetSourceLocation(const std::vector<int>& path, if (source_code_info_) { if (const SourceCodeInfo_Location* loc = tables_->GetSourceLocation(path, source_code_info_)) { - const RepeatedField<int32_t>& span = loc->span(); + const RepeatedField<i32>& span = loc->span(); if (span.size() == 3 || span.size() == 4) { out_location->start_line = span.Get(0); out_location->start_column = span.Get(1); @@ -3924,13 +3924,13 @@ class DescriptorBuilder { // Convenience functions to set an int field the right way, depending on // its wire type (a single int CppType can represent multiple wire types). - void SetInt32(int number, int32_t value, FieldDescriptor::Type type, + void SetInt32(int number, i32 value, FieldDescriptor::Type type, UnknownFieldSet* unknown_fields); - void SetInt64(int number, int64_t value, FieldDescriptor::Type type, + void SetInt64(int number, i64 value, FieldDescriptor::Type type, UnknownFieldSet* unknown_fields); - void SetUInt32(int number, uint32_t value, FieldDescriptor::Type type, + void SetUInt32(int number, ui32 value, FieldDescriptor::Type type, UnknownFieldSet* unknown_fields); - void SetUInt64(int number, uint64_t value, FieldDescriptor::Type type, + void SetUInt64(int number, ui64 value, FieldDescriptor::Type type, UnknownFieldSet* unknown_fields); // A helper function that adds an error at the specified location of the @@ -5298,19 +5298,19 @@ void DescriptorBuilder::BuildFieldOrExtension(const FieldDescriptorProto& proto, char* end_pos = nullptr; switch (result->cpp_type()) { case FieldDescriptor::CPPTYPE_INT32: - result->default_value_int32_t_ = + result->default_value_i32_ = strtol(proto.default_value().c_str(), &end_pos, 0); break; case FieldDescriptor::CPPTYPE_INT64: - result->default_value_int64_t_ = + result->default_value_i64_ = strto64(proto.default_value().c_str(), &end_pos, 0); break; case FieldDescriptor::CPPTYPE_UINT32: - result->default_value_uint32_t_ = + result->default_value_ui32_ = strtoul(proto.default_value().c_str(), &end_pos, 0); break; case FieldDescriptor::CPPTYPE_UINT64: - result->default_value_uint64_t_ = + result->default_value_ui64_ = strtou64(proto.default_value().c_str(), &end_pos, 0); break; case FieldDescriptor::CPPTYPE_FLOAT: @@ -5391,16 +5391,16 @@ void DescriptorBuilder::BuildFieldOrExtension(const FieldDescriptorProto& proto, // No explicit default value switch (result->cpp_type()) { case FieldDescriptor::CPPTYPE_INT32: - result->default_value_int32_t_ = 0; + result->default_value_i32_ = 0; break; case FieldDescriptor::CPPTYPE_INT64: - result->default_value_int64_t_ = 0; + result->default_value_i64_ = 0; break; case FieldDescriptor::CPPTYPE_UINT32: - result->default_value_uint32_t_ = 0; + result->default_value_ui32_ = 0; break; case FieldDescriptor::CPPTYPE_UINT64: - result->default_value_uint64_t_ = 0; + result->default_value_ui64_ = 0; break; case FieldDescriptor::CPPTYPE_FLOAT: result->default_value_float_ = 0.0f; @@ -6525,8 +6525,8 @@ void DescriptorBuilder::ValidateMessageOptions(Descriptor* message, VALIDATE_OPTIONS_FROM_ARRAY(message, enum_type, Enum); VALIDATE_OPTIONS_FROM_ARRAY(message, extension, Field); - const int64_t max_extension_range = - static_cast<int64_t>(message->options().message_set_wire_format() + const i64 max_extension_range = + static_cast<i64>(message->options().message_set_wire_format() ? kint32max : FieldDescriptor::kMaxNumber); for (int i = 0; i < message->extension_range_count(); ++i) { @@ -7174,7 +7174,7 @@ void DescriptorBuilder::OptionInterpreter::UpdateSourceCodeInfo( if (matched) { // see if this location is in the range to remove bool loc_matches = true; - if (loc->path_size() < static_cast<int64_t>(pathv.size())) { + if (loc->path_size() < static_cast<i64>(pathv.size())) { loc_matches = false; } else { for (size_t j = 0; j < pathv.size(); j++) { @@ -7317,7 +7317,7 @@ bool DescriptorBuilder::OptionInterpreter::SetOptionValue( case FieldDescriptor::CPPTYPE_INT32: if (uninterpreted_option_->has_positive_int_value()) { if (uninterpreted_option_->positive_int_value() > - static_cast<uint64_t>(kint32max)) { + static_cast<ui64>(kint32max)) { return AddValueError("Value out of range for int32 option \"" + option_field->full_name() + "\"."); } else { @@ -7327,7 +7327,7 @@ bool DescriptorBuilder::OptionInterpreter::SetOptionValue( } } else if (uninterpreted_option_->has_negative_int_value()) { if (uninterpreted_option_->negative_int_value() < - static_cast<int64_t>(kint32min)) { + static_cast<i64>(kint32min)) { return AddValueError("Value out of range for int32 option \"" + option_field->full_name() + "\"."); } else { @@ -7344,7 +7344,7 @@ bool DescriptorBuilder::OptionInterpreter::SetOptionValue( case FieldDescriptor::CPPTYPE_INT64: if (uninterpreted_option_->has_positive_int_value()) { if (uninterpreted_option_->positive_int_value() > - static_cast<uint64_t>(kint64max)) { + static_cast<ui64>(kint64max)) { return AddValueError("Value out of range for int64 option \"" + option_field->full_name() + "\"."); } else { @@ -7428,7 +7428,7 @@ bool DescriptorBuilder::OptionInterpreter::SetOptionValue( } case FieldDescriptor::CPPTYPE_BOOL: - uint64_t value; + ui64 value; if (!uninterpreted_option_->has_identifier_value()) { return AddValueError( "Value must be identifier for boolean option " @@ -7498,11 +7498,11 @@ bool DescriptorBuilder::OptionInterpreter::SetOptionValue( "option \"" + option_field->full_name() + "\"."); } else { - // Sign-extension is not a problem, since we cast directly from int32_t - // to uint64_t, without first going through uint32_t. + // Sign-extension is not a problem, since we cast directly from i32 + // to ui64, without first going through ui32. unknown_fields->AddVarint( option_field->number(), - static_cast<uint64_t>(static_cast<int64_t>(enum_value->number()))); + static_cast<ui64>(static_cast<i64>(enum_value->number()))); } break; } @@ -7644,16 +7644,16 @@ bool DescriptorBuilder::OptionInterpreter::SetAggregateOption( } void DescriptorBuilder::OptionInterpreter::SetInt32( - int number, int32_t value, FieldDescriptor::Type type, + int number, i32 value, FieldDescriptor::Type type, UnknownFieldSet* unknown_fields) { switch (type) { case FieldDescriptor::TYPE_INT32: unknown_fields->AddVarint( - number, static_cast<uint64_t>(static_cast<int64_t>(value))); + number, static_cast<ui64>(static_cast<i64>(value))); break; case FieldDescriptor::TYPE_SFIXED32: - unknown_fields->AddFixed32(number, static_cast<uint32_t>(value)); + unknown_fields->AddFixed32(number, static_cast<ui32>(value)); break; case FieldDescriptor::TYPE_SINT32: @@ -7668,15 +7668,15 @@ void DescriptorBuilder::OptionInterpreter::SetInt32( } void DescriptorBuilder::OptionInterpreter::SetInt64( - int number, int64_t value, FieldDescriptor::Type type, + int number, i64 value, FieldDescriptor::Type type, UnknownFieldSet* unknown_fields) { switch (type) { case FieldDescriptor::TYPE_INT64: - unknown_fields->AddVarint(number, static_cast<uint64_t>(value)); + unknown_fields->AddVarint(number, static_cast<ui64>(value)); break; case FieldDescriptor::TYPE_SFIXED64: - unknown_fields->AddFixed64(number, static_cast<uint64_t>(value)); + unknown_fields->AddFixed64(number, static_cast<ui64>(value)); break; case FieldDescriptor::TYPE_SINT64: @@ -7691,15 +7691,15 @@ void DescriptorBuilder::OptionInterpreter::SetInt64( } void DescriptorBuilder::OptionInterpreter::SetUInt32( - int number, uint32_t value, FieldDescriptor::Type type, + int number, ui32 value, FieldDescriptor::Type type, UnknownFieldSet* unknown_fields) { switch (type) { case FieldDescriptor::TYPE_UINT32: - unknown_fields->AddVarint(number, static_cast<uint64_t>(value)); + unknown_fields->AddVarint(number, static_cast<ui64>(value)); break; case FieldDescriptor::TYPE_FIXED32: - unknown_fields->AddFixed32(number, static_cast<uint32_t>(value)); + unknown_fields->AddFixed32(number, static_cast<ui32>(value)); break; default: @@ -7709,7 +7709,7 @@ void DescriptorBuilder::OptionInterpreter::SetUInt32( } void DescriptorBuilder::OptionInterpreter::SetUInt64( - int number, uint64_t value, FieldDescriptor::Type type, + int number, ui64 value, FieldDescriptor::Type type, UnknownFieldSet* unknown_fields) { switch (type) { case FieldDescriptor::TYPE_UINT64: diff --git a/contrib/libs/protobuf/src/google/protobuf/descriptor.h b/contrib/libs/protobuf/src/google/protobuf/descriptor.h index 6739e8075b..ec9edb32bc 100644 --- a/contrib/libs/protobuf/src/google/protobuf/descriptor.h +++ b/contrib/libs/protobuf/src/google/protobuf/descriptor.h @@ -763,20 +763,20 @@ class PROTOBUF_EXPORT FieldDescriptor : private internal::SymbolBase { // Get the field default value if cpp_type() == CPPTYPE_INT32. If no // explicit default was defined, the default is 0. - int32_t default_value_int32_t() const; - int32_t default_value_int32() const { return default_value_int32_t(); } + i32 default_value_i32() const; + i32 default_value_int32() const { return default_value_i32(); } // Get the field default value if cpp_type() == CPPTYPE_INT64. If no // explicit default was defined, the default is 0. - int64_t default_value_int64_t() const; - int64 default_value_int64() const { return default_value_int64_t(); } + i64 default_value_i64() const; + i64 default_value_int64() const { return default_value_i64(); } // Get the field default value if cpp_type() == CPPTYPE_UINT32. If no // explicit default was defined, the default is 0. - uint32_t default_value_uint32_t() const; - uint32_t default_value_uint32() const { return default_value_uint32_t(); } + ui32 default_value_ui32() const; + ui32 default_value_uint32() const { return default_value_ui32(); } // Get the field default value if cpp_type() == CPPTYPE_UINT64. If no // explicit default was defined, the default is 0. - uint64_t default_value_uint64_t() const; - uint64 default_value_uint64() const { return default_value_uint64_t(); } + ui64 default_value_ui64() const; + ui64 default_value_uint64() const { return default_value_ui64(); } // Get the field default value if cpp_type() == CPPTYPE_FLOAT. If no // explicit default was defined, the default is 0.0. float default_value_float() const; @@ -952,10 +952,10 @@ class PROTOBUF_EXPORT FieldDescriptor : private internal::SymbolBase { // descriptor.cc and update them to initialize the field. union { - int32_t default_value_int32_t_; - int64_t default_value_int64_t_; - uint32_t default_value_uint32_t_; - uint64_t default_value_uint64_t_; + i32 default_value_i32_; + i64 default_value_i64_; + ui32 default_value_ui32_; + ui64 default_value_ui64_; float default_value_float_; double default_value_double_; bool default_value_bool_; @@ -2100,10 +2100,10 @@ PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, index_in_oneof, int) PROTOBUF_DEFINE_OPTIONS_ACCESSOR(FieldDescriptor, FieldOptions) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, has_default_value, bool) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, has_json_name, bool) -PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_int32_t, int32_t) -PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_int64_t, int64_t) -PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_uint32_t, uint32_t) -PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_uint64_t, uint64_t) +PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_i32, i32) +PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_i64, i64) +PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_ui32, ui32) +PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_ui64, ui64) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_float, float) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_double, double) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_bool, bool) diff --git a/contrib/libs/protobuf/src/google/protobuf/descriptor.pb.cc b/contrib/libs/protobuf/src/google/protobuf/descriptor.pb.cc index ef67494573..768d78f1b3 100644 --- a/contrib/libs/protobuf/src/google/protobuf/descriptor.pb.cc +++ b/contrib/libs/protobuf/src/google/protobuf/descriptor.pb.cc @@ -378,8 +378,8 @@ constexpr UninterpretedOption::UninterpretedOption( , identifier_value_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) , string_value_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) , aggregate_value_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) - , positive_int_value_(uint64_t{0u}) - , negative_int_value_(int64_t{0}) + , positive_int_value_(ui64{0u}) + , negative_int_value_(i64{0}) , double_value_(0){} struct UninterpretedOptionDefaultTypeInternal { constexpr UninterpretedOptionDefaultTypeInternal() diff --git a/contrib/libs/protobuf/src/google/protobuf/descriptor.pb.h b/contrib/libs/protobuf/src/google/protobuf/descriptor.pb.h index 197ea516aa..fe689b1fab 100644 --- a/contrib/libs/protobuf/src/google/protobuf/descriptor.pb.h +++ b/contrib/libs/protobuf/src/google/protobuf/descriptor.pb.h @@ -13488,7 +13488,7 @@ inline bool UninterpretedOption::has_positive_int_value() const { return _internal_has_positive_int_value(); } inline void UninterpretedOption::clear_positive_int_value() { - positive_int_value_ = uint64_t{0u}; + positive_int_value_ = ui64{0u}; _has_bits_[0] &= ~0x00000008u; } inline ::PROTOBUF_NAMESPACE_ID::uint64 UninterpretedOption::_internal_positive_int_value() const { @@ -13516,7 +13516,7 @@ inline bool UninterpretedOption::has_negative_int_value() const { return _internal_has_negative_int_value(); } inline void UninterpretedOption::clear_negative_int_value() { - negative_int_value_ = int64_t{0}; + negative_int_value_ = i64{0}; _has_bits_[0] &= ~0x00000010u; } inline ::PROTOBUF_NAMESPACE_ID::int64 UninterpretedOption::_internal_negative_int_value() const { diff --git a/contrib/libs/protobuf/src/google/protobuf/descriptor_database.cc b/contrib/libs/protobuf/src/google/protobuf/descriptor_database.cc index 33a7c9d01e..18c8558ceb 100644 --- a/contrib/libs/protobuf/src/google/protobuf/descriptor_database.cc +++ b/contrib/libs/protobuf/src/google/protobuf/descriptor_database.cc @@ -590,7 +590,7 @@ bool EncodedDescriptorDatabase::FindNameOfFileContainingSymbol( io::CodedInputStream input(static_cast<const uint8_t*>(encoded_file.first), encoded_file.second); - const uint32_t kNameTag = internal::WireFormatLite::MakeTag( + const ui32 kNameTag = internal::WireFormatLite::MakeTag( FileDescriptorProto::kNameFieldNumber, internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED); diff --git a/contrib/libs/protobuf/src/google/protobuf/duration.pb.cc b/contrib/libs/protobuf/src/google/protobuf/duration.pb.cc index 2326c68ef2..8ac55c1cf9 100644 --- a/contrib/libs/protobuf/src/google/protobuf/duration.pb.cc +++ b/contrib/libs/protobuf/src/google/protobuf/duration.pb.cc @@ -19,7 +19,7 @@ PROTOBUF_PRAGMA_INIT_SEG PROTOBUF_NAMESPACE_OPEN constexpr Duration::Duration( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) - : seconds_(int64_t{0}) + : seconds_(i64{0}) , nanos_(0){} struct DurationDefaultTypeInternal { constexpr DurationDefaultTypeInternal() diff --git a/contrib/libs/protobuf/src/google/protobuf/duration.pb.h b/contrib/libs/protobuf/src/google/protobuf/duration.pb.h index aa3baf51e6..bec7eab139 100644 --- a/contrib/libs/protobuf/src/google/protobuf/duration.pb.h +++ b/contrib/libs/protobuf/src/google/protobuf/duration.pb.h @@ -230,7 +230,7 @@ class PROTOBUF_EXPORT Duration final : // int64 seconds = 1; inline void Duration::clear_seconds() { - seconds_ = int64_t{0}; + seconds_ = i64{0}; } inline ::PROTOBUF_NAMESPACE_ID::int64 Duration::_internal_seconds() const { return seconds_; diff --git a/contrib/libs/protobuf/src/google/protobuf/dynamic_message.cc b/contrib/libs/protobuf/src/google/protobuf/dynamic_message.cc index 9394521119..066efc1780 100644 --- a/contrib/libs/protobuf/src/google/protobuf/dynamic_message.cc +++ b/contrib/libs/protobuf/src/google/protobuf/dynamic_message.cc @@ -140,13 +140,13 @@ int FieldSpaceUsed(const FieldDescriptor* field) { if (field->label() == FD::LABEL_REPEATED) { switch (field->cpp_type()) { case FD::CPPTYPE_INT32: - return sizeof(RepeatedField<int32_t>); + return sizeof(RepeatedField<i32>); case FD::CPPTYPE_INT64: - return sizeof(RepeatedField<int64_t>); + return sizeof(RepeatedField<i64>); case FD::CPPTYPE_UINT32: - return sizeof(RepeatedField<uint32_t>); + return sizeof(RepeatedField<ui32>); case FD::CPPTYPE_UINT64: - return sizeof(RepeatedField<uint64_t>); + return sizeof(RepeatedField<ui64>); case FD::CPPTYPE_DOUBLE: return sizeof(RepeatedField<double>); case FD::CPPTYPE_FLOAT: @@ -173,13 +173,13 @@ int FieldSpaceUsed(const FieldDescriptor* field) { } else { switch (field->cpp_type()) { case FD::CPPTYPE_INT32: - return sizeof(int32_t); + return sizeof(i32); case FD::CPPTYPE_INT64: - return sizeof(int64_t); + return sizeof(i64); case FD::CPPTYPE_UINT32: - return sizeof(uint32_t); + return sizeof(ui32); case FD::CPPTYPE_UINT64: - return sizeof(uint64_t); + return sizeof(ui64); case FD::CPPTYPE_DOUBLE: return sizeof(double); case FD::CPPTYPE_FLOAT: @@ -208,8 +208,8 @@ int FieldSpaceUsed(const FieldDescriptor* field) { inline int DivideRoundingUp(int i, int j) { return (i + (j - 1)) / j; } -static const int kSafeAlignment = sizeof(uint64_t); -static const int kMaxOneofUnionSize = sizeof(uint64_t); +static const int kSafeAlignment = sizeof(ui64); +static const int kMaxOneofUnionSize = sizeof(ui64); inline int AlignTo(int offset, int alignment) { return DivideRoundingUp(offset, alignment) * alignment; @@ -316,8 +316,8 @@ struct DynamicMessageFactory::TypeInfo { // Warning: The order in which the following pointers are defined is // important (the prototype must be deleted *before* the offsets). - std::unique_ptr<uint32_t[]> offsets; - std::unique_ptr<uint32_t[]> has_bits_indices; + std::unique_ptr<ui32[]> offsets; + std::unique_ptr<ui32[]> has_bits_indices; std::unique_ptr<const Reflection> reflection; // Don't use a unique_ptr to hold the prototype: the destructor for // DynamicMessage needs to know whether it is the prototype, and does so by @@ -346,7 +346,7 @@ DynamicMessage::DynamicMessage(DynamicMessageFactory::TypeInfo* type_info, bool lock_factory) : type_info_(type_info), cached_byte_size_(0) { // The prototype in type_info has to be set before creating the prototype - // instance on memory. e.g., message Foo { map<int32_t, Foo> a = 1; }. When + // instance on memory. e.g., message Foo { map<i32, Foo> a = 1; }. When // creating prototype for Foo, prototype of the map entry will also be // created, which needs the address of the prototype of Foo (the value in // map). To break the cyclic dependency, we have to assign the address of @@ -366,7 +366,7 @@ void* DynamicMessage::MutableWeakFieldMapRaw() { return OffsetToPointer(type_info_->weak_field_map_offset); } void* DynamicMessage::MutableOneofCaseRaw(int i) { - return OffsetToPointer(type_info_->oneof_case_offset + sizeof(uint32_t) * i); + return OffsetToPointer(type_info_->oneof_case_offset + sizeof(ui32) * i); } void* DynamicMessage::MutableOneofFieldRaw(const FieldDescriptor* f) { return OffsetToPointer( @@ -390,7 +390,7 @@ void DynamicMessage::SharedCtor(bool lock_factory) { int oneof_count = 0; for (int i = 0; i < descriptor->oneof_decl_count(); ++i) { if (descriptor->oneof_decl(i)->is_synthetic()) continue; - new (MutableOneofCaseRaw(oneof_count++)) uint32_t{0}; + new (MutableOneofCaseRaw(oneof_count++)) ui32{0}; } if (type_info_->extensions_offset != -1) { @@ -412,10 +412,10 @@ void DynamicMessage::SharedCtor(bool lock_factory) { } \ break; - HANDLE_TYPE(INT32, int32_t); - HANDLE_TYPE(INT64, int64_t); - HANDLE_TYPE(UINT32, uint32_t); - HANDLE_TYPE(UINT64, uint64_t); + HANDLE_TYPE(INT32, i32); + HANDLE_TYPE(INT64, i64); + HANDLE_TYPE(UINT32, ui32); + HANDLE_TYPE(UINT64, ui64); HANDLE_TYPE(DOUBLE, double); HANDLE_TYPE(FLOAT, float); HANDLE_TYPE(BOOL, bool); @@ -534,7 +534,7 @@ DynamicMessage::~DynamicMessage() { const FieldDescriptor* field = descriptor->field(i); if (InRealOneof(field)) { void* field_ptr = MutableOneofCaseRaw(field->containing_oneof()->index()); - if (*(reinterpret_cast<const int32_t*>(field_ptr)) == field->number()) { + if (*(reinterpret_cast<const i32*>(field_ptr)) == field->number()) { field_ptr = MutableOneofFieldRaw(field); if (field->cpp_type() == FieldDescriptor::CPPTYPE_STRING) { switch (field->options().ctype()) { @@ -566,10 +566,10 @@ DynamicMessage::~DynamicMessage() { ->~RepeatedField<LOWERCASE>(); \ break - HANDLE_TYPE(INT32, int32_t); - HANDLE_TYPE(INT64, int64_t); - HANDLE_TYPE(UINT32, uint32_t); - HANDLE_TYPE(UINT64, uint64_t); + HANDLE_TYPE(INT32, i32); + HANDLE_TYPE(INT64, i64); + HANDLE_TYPE(UINT32, ui32); + HANDLE_TYPE(UINT64, ui64); HANDLE_TYPE(DOUBLE, double); HANDLE_TYPE(FLOAT, float); HANDLE_TYPE(BOOL, bool); @@ -728,7 +728,7 @@ const Message* DynamicMessageFactory::GetPrototypeNoLock( } // Compute size and offsets. - uint32_t* offsets = new uint32_t[type->field_count() + real_oneof_count]; + ui32* offsets = new ui32[type->field_count() + real_oneof_count]; type_info->offsets.reset(offsets); // Decide all field offsets by packing in order. @@ -746,10 +746,10 @@ const Message* DynamicMessageFactory::GetPrototypeNoLock( // At least one field in the message requires a hasbit, so allocate // hasbits. type_info->has_bits_offset = size; - uint32_t* has_bits_indices = new uint32_t[type->field_count()]; + ui32* has_bits_indices = new ui32[type->field_count()]; for (int i = 0; i < type->field_count(); i++) { // Initialize to -1, fields that need a hasbit will overwrite. - has_bits_indices[i] = static_cast<uint32_t>(-1); + has_bits_indices[i] = static_cast<ui32>(-1); } type_info->has_bits_indices.reset(has_bits_indices); } @@ -758,15 +758,15 @@ const Message* DynamicMessageFactory::GetPrototypeNoLock( } if (max_hasbit > 0) { - int has_bits_array_size = DivideRoundingUp(max_hasbit, bitsizeof(uint32_t)); - size += has_bits_array_size * sizeof(uint32_t); + int has_bits_array_size = DivideRoundingUp(max_hasbit, bitsizeof(ui32)); + size += has_bits_array_size * sizeof(ui32); size = AlignOffset(size); } // The oneof_case, if any. It is an array of uint32s. if (real_oneof_count > 0) { type_info->oneof_case_offset = size; - size += real_oneof_count * sizeof(uint32_t); + size += real_oneof_count * sizeof(ui32); size = AlignOffset(size); } diff --git a/contrib/libs/protobuf/src/google/protobuf/dynamic_message.h b/contrib/libs/protobuf/src/google/protobuf/dynamic_message.h index 2b5130d2b6..9c92b1302e 100644 --- a/contrib/libs/protobuf/src/google/protobuf/dynamic_message.h +++ b/contrib/libs/protobuf/src/google/protobuf/dynamic_message.h @@ -182,23 +182,23 @@ class PROTOBUF_EXPORT DynamicMapSorter { return first < second; } case FieldDescriptor::CPPTYPE_INT32: { - int32_t first = reflection->GetInt32(*a, field_); - int32_t second = reflection->GetInt32(*b, field_); + i32 first = reflection->GetInt32(*a, field_); + i32 second = reflection->GetInt32(*b, field_); return first < second; } case FieldDescriptor::CPPTYPE_INT64: { - int64_t first = reflection->GetInt64(*a, field_); - int64_t second = reflection->GetInt64(*b, field_); + i64 first = reflection->GetInt64(*a, field_); + i64 second = reflection->GetInt64(*b, field_); return first < second; } case FieldDescriptor::CPPTYPE_UINT32: { - uint32_t first = reflection->GetUInt32(*a, field_); - uint32_t second = reflection->GetUInt32(*b, field_); + ui32 first = reflection->GetUInt32(*a, field_); + ui32 second = reflection->GetUInt32(*b, field_); return first < second; } case FieldDescriptor::CPPTYPE_UINT64: { - uint64_t first = reflection->GetUInt64(*a, field_); - uint64_t second = reflection->GetUInt64(*b, field_); + ui64 first = reflection->GetUInt64(*a, field_); + ui64 second = reflection->GetUInt64(*b, field_); return first < second; } case FieldDescriptor::CPPTYPE_STRING: { diff --git a/contrib/libs/protobuf/src/google/protobuf/extension_set.cc b/contrib/libs/protobuf/src/google/protobuf/extension_set.cc index c6de79a767..2ab830e53c 100644 --- a/contrib/libs/protobuf/src/google/protobuf/extension_set.cc +++ b/contrib/libs/protobuf/src/google/protobuf/extension_set.cc @@ -379,10 +379,10 @@ enum { REPEATED_FIELD, OPTIONAL_FIELD }; extension->repeated_##LOWERCASE##_value->Add(value); \ } -PRIMITIVE_ACCESSORS(INT32, int32_t, Int32) -PRIMITIVE_ACCESSORS(INT64, int64, Int64) -PRIMITIVE_ACCESSORS(UINT32, uint32_t, UInt32) -PRIMITIVE_ACCESSORS(UINT64, uint64, UInt64) +PRIMITIVE_ACCESSORS(INT32, i32, Int32) +PRIMITIVE_ACCESSORS(INT64, i64, Int64) +PRIMITIVE_ACCESSORS(UINT32, ui32, UInt32) +PRIMITIVE_ACCESSORS(UINT64, ui64, UInt64) PRIMITIVE_ACCESSORS(FLOAT, float, Float) PRIMITIVE_ACCESSORS(DOUBLE, double, Double) PRIMITIVE_ACCESSORS(BOOL, bool, Bool) @@ -397,7 +397,7 @@ const void* ExtensionSet::GetRawRepeatedField(int number, } // We assume that all the RepeatedField<>* pointers have the same // size and alignment within the anonymous union in Extension. - return extension->repeated_int32_t_value; + return extension->repeated_i32_value; } void* ExtensionSet::MutableRawRepeatedField(int number, FieldType field_type, @@ -415,20 +415,20 @@ void* ExtensionSet::MutableRawRepeatedField(int number, FieldType field_type, switch (WireFormatLite::FieldTypeToCppType( static_cast<WireFormatLite::FieldType>(field_type))) { case WireFormatLite::CPPTYPE_INT32: - extension->repeated_int32_t_value = - Arena::CreateMessage<RepeatedField<int32_t>>(arena_); + extension->repeated_i32_value = + Arena::CreateMessage<RepeatedField<i32>>(arena_); break; case WireFormatLite::CPPTYPE_INT64: - extension->repeated_int64_value = - Arena::CreateMessage<RepeatedField<int64>>(arena_); + extension->repeated_i64_value = + Arena::CreateMessage<RepeatedField<i64>>(arena_); break; case WireFormatLite::CPPTYPE_UINT32: - extension->repeated_uint32_t_value = - Arena::CreateMessage<RepeatedField<uint32_t>>(arena_); + extension->repeated_ui32_value = + Arena::CreateMessage<RepeatedField<ui32>>(arena_); break; case WireFormatLite::CPPTYPE_UINT64: - extension->repeated_uint64_value = - Arena::CreateMessage<RepeatedField<uint64>>(arena_); + extension->repeated_ui64_value = + Arena::CreateMessage<RepeatedField<ui64>>(arena_); break; case WireFormatLite::CPPTYPE_DOUBLE: extension->repeated_double_value = @@ -459,7 +459,7 @@ void* ExtensionSet::MutableRawRepeatedField(int number, FieldType field_type, // We assume that all the RepeatedField<>* pointers have the same // size and alignment within the anonymous union in Extension. - return extension->repeated_int32_t_value; + return extension->repeated_i32_value; } // Compatible version using old call signature. Does not create extensions when @@ -469,7 +469,7 @@ void* ExtensionSet::MutableRawRepeatedField(int number) { GOOGLE_CHECK(extension != NULL) << "Extension not found."; // We assume that all the RepeatedField<>* pointers have the same // size and alignment within the anonymous union in Extension. - return extension->repeated_int32_t_value; + return extension->repeated_i32_value; } // ------------------------------------------------------------------- @@ -848,16 +848,16 @@ void ExtensionSet::RemoveLast(int number) { switch (cpp_type(extension->type)) { case WireFormatLite::CPPTYPE_INT32: - extension->repeated_int32_t_value->RemoveLast(); + extension->repeated_i32_value->RemoveLast(); break; case WireFormatLite::CPPTYPE_INT64: - extension->repeated_int64_value->RemoveLast(); + extension->repeated_i64_value->RemoveLast(); break; case WireFormatLite::CPPTYPE_UINT32: - extension->repeated_uint32_t_value->RemoveLast(); + extension->repeated_ui32_value->RemoveLast(); break; case WireFormatLite::CPPTYPE_UINT64: - extension->repeated_uint64_value->RemoveLast(); + extension->repeated_ui64_value->RemoveLast(); break; case WireFormatLite::CPPTYPE_FLOAT: extension->repeated_float_value->RemoveLast(); @@ -903,16 +903,16 @@ void ExtensionSet::SwapElements(int number, int index1, int index2) { switch (cpp_type(extension->type)) { case WireFormatLite::CPPTYPE_INT32: - extension->repeated_int32_t_value->SwapElements(index1, index2); + extension->repeated_i32_value->SwapElements(index1, index2); break; case WireFormatLite::CPPTYPE_INT64: - extension->repeated_int64_value->SwapElements(index1, index2); + extension->repeated_i64_value->SwapElements(index1, index2); break; case WireFormatLite::CPPTYPE_UINT32: - extension->repeated_uint32_t_value->SwapElements(index1, index2); + extension->repeated_ui32_value->SwapElements(index1, index2); break; case WireFormatLite::CPPTYPE_UINT64: - extension->repeated_uint64_value->SwapElements(index1, index2); + extension->repeated_ui64_value->SwapElements(index1, index2); break; case WireFormatLite::CPPTYPE_FLOAT: extension->repeated_float_value->SwapElements(index1, index2); @@ -1007,10 +1007,10 @@ void ExtensionSet::InternalExtensionMergeFrom( *other_extension.repeated_##LOWERCASE##_value); \ break; - HANDLE_TYPE(INT32, int32_t, RepeatedField<int32_t>); - HANDLE_TYPE(INT64, int64, RepeatedField<int64>); - HANDLE_TYPE(UINT32, uint32_t, RepeatedField<uint32_t>); - HANDLE_TYPE(UINT64, uint64, RepeatedField<uint64>); + HANDLE_TYPE(INT32, i32, RepeatedField<i32>); + HANDLE_TYPE(INT64, i64, RepeatedField<i64>); + HANDLE_TYPE(UINT32, ui32, RepeatedField<ui32>); + HANDLE_TYPE(UINT64, ui64, RepeatedField<ui64>); HANDLE_TYPE(FLOAT, float, RepeatedField<float>); HANDLE_TYPE(DOUBLE, double, RepeatedField<double>); HANDLE_TYPE(BOOL, bool, RepeatedField<bool>); @@ -1051,10 +1051,10 @@ void ExtensionSet::InternalExtensionMergeFrom( other_extension.descriptor); \ break; - HANDLE_TYPE(INT32, int32_t, Int32); - HANDLE_TYPE(INT64, int64, Int64); - HANDLE_TYPE(UINT32, uint32_t, UInt32); - HANDLE_TYPE(UINT64, uint64, UInt64); + HANDLE_TYPE(INT32, i32, Int32); + HANDLE_TYPE(INT64, i64, Int64); + HANDLE_TYPE(UINT32, ui32, UInt32); + HANDLE_TYPE(UINT64, ui64, UInt64); HANDLE_TYPE(FLOAT, float, Float); HANDLE_TYPE(DOUBLE, double, Double); HANDLE_TYPE(BOOL, bool, Bool); @@ -1218,7 +1218,7 @@ bool ExtensionSet::IsInitialized() const { return true; } -bool ExtensionSet::FindExtensionInfoFromTag(uint32_t tag, +bool ExtensionSet::FindExtensionInfoFromTag(ui32 tag, ExtensionFinder* extension_finder, int* field_number, ExtensionInfo* extension, @@ -1252,7 +1252,7 @@ bool ExtensionSet::FindExtensionInfoFromFieldNumber( return expected_wire_type == wire_type; } -bool ExtensionSet::ParseField(uint32_t tag, io::CodedInputStream* input, +bool ExtensionSet::ParseField(ui32 tag, io::CodedInputStream* input, ExtensionFinder* extension_finder, FieldSkipper* field_skipper) { int number; @@ -1267,7 +1267,7 @@ bool ExtensionSet::ParseField(uint32_t tag, io::CodedInputStream* input, } } -const char* ExtensionSet::ParseField(uint64_t tag, const char* ptr, +const char* ExtensionSet::ParseField(ui64 tag, const char* ptr, const MessageLite* extendee, internal::InternalMetadata* metadata, internal::ParseContext* ctx) { @@ -1299,7 +1299,7 @@ bool ExtensionSet::ParseFieldWithExtensionInfo(int number, // Explicitly not read extension.is_packed, instead check whether the field // was encoded in packed form on the wire. if (was_packed_on_wire) { - uint32_t size; + ui32 size; if (!input->ReadVarint32(&size)) return false; io::CodedInputStream::Limit limit = input->PushLimit(size); @@ -1317,16 +1317,16 @@ bool ExtensionSet::ParseFieldWithExtensionInfo(int number, } \ break - HANDLE_TYPE(INT32, Int32, int32_t); - HANDLE_TYPE(INT64, Int64, int64); - HANDLE_TYPE(UINT32, UInt32, uint32_t); - HANDLE_TYPE(UINT64, UInt64, uint64); - HANDLE_TYPE(SINT32, Int32, int32_t); - HANDLE_TYPE(SINT64, Int64, int64); - HANDLE_TYPE(FIXED32, UInt32, uint32_t); - HANDLE_TYPE(FIXED64, UInt64, uint64); - HANDLE_TYPE(SFIXED32, Int32, int32_t); - HANDLE_TYPE(SFIXED64, Int64, int64); + HANDLE_TYPE(INT32, Int32, i32); + HANDLE_TYPE(INT64, Int64, i64); + HANDLE_TYPE(UINT32, UInt32, ui32); + HANDLE_TYPE(UINT64, UInt64, ui64); + HANDLE_TYPE(SINT32, Int32, i32); + HANDLE_TYPE(SINT64, Int64, i64); + HANDLE_TYPE(FIXED32, UInt32, ui32); + HANDLE_TYPE(FIXED64, UInt64, ui64); + HANDLE_TYPE(SFIXED32, Int32, i32); + HANDLE_TYPE(SFIXED64, Int64, i64); HANDLE_TYPE(FLOAT, Float, float); HANDLE_TYPE(DOUBLE, Double, double); HANDLE_TYPE(BOOL, Bool, bool); @@ -1376,16 +1376,16 @@ bool ExtensionSet::ParseFieldWithExtensionInfo(int number, } \ } break - HANDLE_TYPE(INT32, Int32, int32_t); - HANDLE_TYPE(INT64, Int64, int64); - HANDLE_TYPE(UINT32, UInt32, uint32_t); - HANDLE_TYPE(UINT64, UInt64, uint64); - HANDLE_TYPE(SINT32, Int32, int32_t); - HANDLE_TYPE(SINT64, Int64, int64); - HANDLE_TYPE(FIXED32, UInt32, uint32_t); - HANDLE_TYPE(FIXED64, UInt64, uint64); - HANDLE_TYPE(SFIXED32, Int32, int32_t); - HANDLE_TYPE(SFIXED64, Int64, int64); + HANDLE_TYPE(INT32, Int32, i32); + HANDLE_TYPE(INT64, Int64, i64); + HANDLE_TYPE(UINT32, UInt32, ui32); + HANDLE_TYPE(UINT64, UInt64, ui64); + HANDLE_TYPE(SINT32, Int32, i32); + HANDLE_TYPE(SINT64, Int64, i64); + HANDLE_TYPE(FIXED32, UInt32, ui32); + HANDLE_TYPE(FIXED64, UInt64, ui64); + HANDLE_TYPE(SFIXED32, Int32, i32); + HANDLE_TYPE(SFIXED64, Int64, i64); HANDLE_TYPE(FLOAT, Float, float); HANDLE_TYPE(DOUBLE, Double, double); HANDLE_TYPE(BOOL, Bool, bool); @@ -1464,14 +1464,14 @@ bool ExtensionSet::ParseFieldWithExtensionInfo(int number, return true; } -bool ExtensionSet::ParseField(uint32_t tag, io::CodedInputStream* input, +bool ExtensionSet::ParseField(ui32 tag, io::CodedInputStream* input, const MessageLite* extendee) { FieldSkipper skipper; GeneratedExtensionFinder finder(extendee); return ParseField(tag, input, &finder, &skipper); } -bool ExtensionSet::ParseField(uint32_t tag, io::CodedInputStream* input, +bool ExtensionSet::ParseField(ui32 tag, io::CodedInputStream* input, const MessageLite* extendee, io::CodedOutputStream* unknown_fields) { CodedOutputStreamFieldSkipper skipper(unknown_fields); @@ -1483,7 +1483,7 @@ bool ExtensionSet::ParseMessageSetLite(io::CodedInputStream* input, ExtensionFinder* extension_finder, FieldSkipper* field_skipper) { while (true) { - const uint32_t tag = input->ReadTag(); + const ui32 tag = input->ReadTag(); switch (tag) { case 0: return true; @@ -1511,7 +1511,7 @@ bool ExtensionSet::ParseMessageSetItemLite(io::CodedInputStream* input, extension_finder, field_skipper); } - bool SkipField(uint32_t tag, io::CodedInputStream* input) { + bool SkipField(ui32 tag, io::CodedInputStream* input) { return field_skipper->SkipField(input, tag); } @@ -1599,10 +1599,10 @@ void ExtensionSet::Extension::Clear() { repeated_##LOWERCASE##_value->Clear(); \ break - HANDLE_TYPE(INT32, int32_t); - HANDLE_TYPE(INT64, int64); - HANDLE_TYPE(UINT32, uint32_t); - HANDLE_TYPE(UINT64, uint64); + HANDLE_TYPE(INT32, i32); + HANDLE_TYPE(INT64, i64); + HANDLE_TYPE(UINT32, ui32); + HANDLE_TYPE(UINT64, ui64); HANDLE_TYPE(FLOAT, float); HANDLE_TYPE(DOUBLE, double); HANDLE_TYPE(BOOL, bool); @@ -1650,12 +1650,12 @@ size_t ExtensionSet::Extension::ByteSize(int number) const { } \ break - HANDLE_TYPE(INT32, Int32, int32_t); - HANDLE_TYPE(INT64, Int64, int64); - HANDLE_TYPE(UINT32, UInt32, uint32_t); - HANDLE_TYPE(UINT64, UInt64, uint64); - HANDLE_TYPE(SINT32, SInt32, int32_t); - HANDLE_TYPE(SINT64, SInt64, int64); + HANDLE_TYPE(INT32, Int32, i32); + HANDLE_TYPE(INT64, Int64, i64); + HANDLE_TYPE(UINT32, UInt32, ui32); + HANDLE_TYPE(UINT64, UInt64, ui64); + HANDLE_TYPE(SINT32, SInt32, i32); + HANDLE_TYPE(SINT64, SInt64, i64); HANDLE_TYPE(ENUM, Enum, enum); #undef HANDLE_TYPE @@ -1665,10 +1665,10 @@ size_t ExtensionSet::Extension::ByteSize(int number) const { result += WireFormatLite::k##CAMELCASE##Size * \ FromIntSize(repeated_##LOWERCASE##_value->size()); \ break - HANDLE_TYPE(FIXED32, Fixed32, uint32_t); - HANDLE_TYPE(FIXED64, Fixed64, uint64); - HANDLE_TYPE(SFIXED32, SFixed32, int32_t); - HANDLE_TYPE(SFIXED64, SFixed64, int64); + HANDLE_TYPE(FIXED32, Fixed32, ui32); + HANDLE_TYPE(FIXED64, Fixed64, ui64); + HANDLE_TYPE(SFIXED32, SFixed32, i32); + HANDLE_TYPE(SFIXED64, SFixed64, i64); HANDLE_TYPE(FLOAT, Float, float); HANDLE_TYPE(DOUBLE, Double, double); HANDLE_TYPE(BOOL, Bool, bool); @@ -1701,12 +1701,12 @@ size_t ExtensionSet::Extension::ByteSize(int number) const { } \ break - HANDLE_TYPE(INT32, Int32, int32_t); - HANDLE_TYPE(INT64, Int64, int64); - HANDLE_TYPE(UINT32, UInt32, uint32_t); - HANDLE_TYPE(UINT64, UInt64, uint64); - HANDLE_TYPE(SINT32, SInt32, int32_t); - HANDLE_TYPE(SINT64, SInt64, int64); + HANDLE_TYPE(INT32, Int32, i32); + HANDLE_TYPE(INT64, Int64, i64); + HANDLE_TYPE(UINT32, UInt32, ui32); + HANDLE_TYPE(UINT64, UInt64, ui64); + HANDLE_TYPE(SINT32, SInt32, i32); + HANDLE_TYPE(SINT64, SInt64, i64); HANDLE_TYPE(STRING, String, string); HANDLE_TYPE(BYTES, Bytes, string); HANDLE_TYPE(ENUM, Enum, enum); @@ -1720,10 +1720,10 @@ size_t ExtensionSet::Extension::ByteSize(int number) const { result += (tag_size + WireFormatLite::k##CAMELCASE##Size) * \ FromIntSize(repeated_##LOWERCASE##_value->size()); \ break - HANDLE_TYPE(FIXED32, Fixed32, uint32_t); - HANDLE_TYPE(FIXED64, Fixed64, uint64); - HANDLE_TYPE(SFIXED32, SFixed32, int32_t); - HANDLE_TYPE(SFIXED64, SFixed64, int64); + HANDLE_TYPE(FIXED32, Fixed32, ui32); + HANDLE_TYPE(FIXED64, Fixed64, ui64); + HANDLE_TYPE(SFIXED32, SFixed32, i32); + HANDLE_TYPE(SFIXED64, SFixed64, i64); HANDLE_TYPE(FLOAT, Float, float); HANDLE_TYPE(DOUBLE, Double, double); HANDLE_TYPE(BOOL, Bool, bool); @@ -1738,12 +1738,12 @@ size_t ExtensionSet::Extension::ByteSize(int number) const { result += WireFormatLite::CAMELCASE##Size(LOWERCASE); \ break - HANDLE_TYPE(INT32, Int32, int32_t_value); - HANDLE_TYPE(INT64, Int64, int64_value); - HANDLE_TYPE(UINT32, UInt32, uint32_t_value); - HANDLE_TYPE(UINT64, UInt64, uint64_value); - HANDLE_TYPE(SINT32, SInt32, int32_t_value); - HANDLE_TYPE(SINT64, SInt64, int64_value); + HANDLE_TYPE(INT32, Int32, i32_value); + HANDLE_TYPE(INT64, Int64, i64_value); + HANDLE_TYPE(UINT32, UInt32, ui32_value); + HANDLE_TYPE(UINT64, UInt64, ui64_value); + HANDLE_TYPE(SINT32, SInt32, i32_value); + HANDLE_TYPE(SINT64, SInt64, i64_value); HANDLE_TYPE(STRING, String, *string_value); HANDLE_TYPE(BYTES, Bytes, *string_value); HANDLE_TYPE(ENUM, Enum, enum_value); @@ -1785,10 +1785,10 @@ int ExtensionSet::Extension::GetSize() const { case WireFormatLite::CPPTYPE_##UPPERCASE: \ return repeated_##LOWERCASE##_value->size() - HANDLE_TYPE(INT32, int32_t); - HANDLE_TYPE(INT64, int64); - HANDLE_TYPE(UINT32, uint32_t); - HANDLE_TYPE(UINT64, uint64); + HANDLE_TYPE(INT32, i32); + HANDLE_TYPE(INT64, i64); + HANDLE_TYPE(UINT32, ui32); + HANDLE_TYPE(UINT64, ui64); HANDLE_TYPE(FLOAT, float); HANDLE_TYPE(DOUBLE, double); HANDLE_TYPE(BOOL, bool); @@ -1812,10 +1812,10 @@ void ExtensionSet::Extension::Free() { delete repeated_##LOWERCASE##_value; \ break - HANDLE_TYPE(INT32, int32_t); - HANDLE_TYPE(INT64, int64); - HANDLE_TYPE(UINT32, uint32_t); - HANDLE_TYPE(UINT64, uint64); + HANDLE_TYPE(INT32, i32); + HANDLE_TYPE(INT64, i64); + HANDLE_TYPE(UINT32, ui32); + HANDLE_TYPE(UINT64, ui64); HANDLE_TYPE(FLOAT, float); HANDLE_TYPE(DOUBLE, double); HANDLE_TYPE(BOOL, bool); @@ -2013,16 +2013,16 @@ uint8_t* ExtensionSet::Extension::InternalSerializeFieldWithCachedSizesToArray( } \ break - HANDLE_TYPE(INT32, Int32, int32_t); - HANDLE_TYPE(INT64, Int64, int64); - HANDLE_TYPE(UINT32, UInt32, uint32_t); - HANDLE_TYPE(UINT64, UInt64, uint64); - HANDLE_TYPE(SINT32, SInt32, int32_t); - HANDLE_TYPE(SINT64, SInt64, int64); - HANDLE_TYPE(FIXED32, Fixed32, uint32_t); - HANDLE_TYPE(FIXED64, Fixed64, uint64); - HANDLE_TYPE(SFIXED32, SFixed32, int32_t); - HANDLE_TYPE(SFIXED64, SFixed64, int64); + HANDLE_TYPE(INT32, Int32, i32); + HANDLE_TYPE(INT64, Int64, i64); + HANDLE_TYPE(UINT32, UInt32, ui32); + HANDLE_TYPE(UINT64, UInt64, ui64); + HANDLE_TYPE(SINT32, SInt32, i32); + HANDLE_TYPE(SINT64, SInt64, i64); + HANDLE_TYPE(FIXED32, Fixed32, ui32); + HANDLE_TYPE(FIXED64, Fixed64, ui64); + HANDLE_TYPE(SFIXED32, SFixed32, i32); + HANDLE_TYPE(SFIXED64, SFixed64, i64); HANDLE_TYPE(FLOAT, Float, float); HANDLE_TYPE(DOUBLE, Double, double); HANDLE_TYPE(BOOL, Bool, bool); @@ -2047,16 +2047,16 @@ uint8_t* ExtensionSet::Extension::InternalSerializeFieldWithCachedSizesToArray( } \ break - HANDLE_TYPE(INT32, Int32, int32_t); - HANDLE_TYPE(INT64, Int64, int64); - HANDLE_TYPE(UINT32, UInt32, uint32_t); - HANDLE_TYPE(UINT64, UInt64, uint64); - HANDLE_TYPE(SINT32, SInt32, int32_t); - HANDLE_TYPE(SINT64, SInt64, int64); - HANDLE_TYPE(FIXED32, Fixed32, uint32_t); - HANDLE_TYPE(FIXED64, Fixed64, uint64); - HANDLE_TYPE(SFIXED32, SFixed32, int32_t); - HANDLE_TYPE(SFIXED64, SFixed64, int64); + HANDLE_TYPE(INT32, Int32, i32); + HANDLE_TYPE(INT64, Int64, i64); + HANDLE_TYPE(UINT32, UInt32, ui32); + HANDLE_TYPE(UINT64, UInt64, ui64); + HANDLE_TYPE(SINT32, SInt32, i32); + HANDLE_TYPE(SINT64, SInt64, i64); + HANDLE_TYPE(FIXED32, Fixed32, ui32); + HANDLE_TYPE(FIXED64, Fixed64, ui64); + HANDLE_TYPE(SFIXED32, SFixed32, i32); + HANDLE_TYPE(SFIXED64, SFixed64, i64); HANDLE_TYPE(FLOAT, Float, float); HANDLE_TYPE(DOUBLE, Double, double); HANDLE_TYPE(BOOL, Bool, bool); @@ -2095,16 +2095,16 @@ uint8_t* ExtensionSet::Extension::InternalSerializeFieldWithCachedSizesToArray( target = WireFormatLite::Write##CAMELCASE##ToArray(number, VALUE, target); \ break - HANDLE_TYPE(INT32, Int32, int32_t_value); - HANDLE_TYPE(INT64, Int64, int64_value); - HANDLE_TYPE(UINT32, UInt32, uint32_t_value); - HANDLE_TYPE(UINT64, UInt64, uint64_value); - HANDLE_TYPE(SINT32, SInt32, int32_t_value); - HANDLE_TYPE(SINT64, SInt64, int64_value); - HANDLE_TYPE(FIXED32, Fixed32, uint32_t_value); - HANDLE_TYPE(FIXED64, Fixed64, uint64_value); - HANDLE_TYPE(SFIXED32, SFixed32, int32_t_value); - HANDLE_TYPE(SFIXED64, SFixed64, int64_value); + HANDLE_TYPE(INT32, Int32, i32_value); + HANDLE_TYPE(INT64, Int64, i64_value); + HANDLE_TYPE(UINT32, UInt32, ui32_value); + HANDLE_TYPE(UINT64, UInt64, ui64_value); + HANDLE_TYPE(SINT32, SInt32, i32_value); + HANDLE_TYPE(SINT64, SInt64, i64_value); + HANDLE_TYPE(FIXED32, Fixed32, ui32_value); + HANDLE_TYPE(FIXED64, Fixed64, ui64_value); + HANDLE_TYPE(SFIXED32, SFixed32, i32_value); + HANDLE_TYPE(SFIXED64, SFixed64, i64_value); HANDLE_TYPE(FLOAT, Float, float_value); HANDLE_TYPE(DOUBLE, Double, double_value); HANDLE_TYPE(BOOL, Bool, bool_value); diff --git a/contrib/libs/protobuf/src/google/protobuf/extension_set.h b/contrib/libs/protobuf/src/google/protobuf/extension_set.h index 2f2dde6014..45da392982 100644 --- a/contrib/libs/protobuf/src/google/protobuf/extension_set.h +++ b/contrib/libs/protobuf/src/google/protobuf/extension_set.h @@ -246,10 +246,10 @@ class PROTOBUF_EXPORT ExtensionSet { // singular fields ------------------------------------------------- - int32_t GetInt32(int number, int32_t default_value) const; - int64 GetInt64(int number, int64 default_value) const; - uint32_t GetUInt32(int number, uint32_t default_value) const; - uint64 GetUInt64(int number, uint64 default_value) const; + i32 GetInt32(int number, i32 default_value) const; + i64 GetInt64(int number, i64 default_value) const; + ui32 GetUInt32(int number, ui32 default_value) const; + ui64 GetUInt64(int number, ui64 default_value) const; float GetFloat(int number, float default_value) const; double GetDouble(int number, double default_value) const; bool GetBool(int number, bool default_value) const; @@ -265,10 +265,10 @@ class PROTOBUF_EXPORT ExtensionSet { // the extension lives in the same pool as the descriptor for the containing // type. #define desc const FieldDescriptor* descriptor // avoid line wrapping - void SetInt32(int number, FieldType type, int32_t value, desc); - void SetInt64(int number, FieldType type, int64 value, desc); - void SetUInt32(int number, FieldType type, uint32_t value, desc); - void SetUInt64(int number, FieldType type, uint64 value, desc); + void SetInt32(int number, FieldType type, i32 value, desc); + void SetInt64(int number, FieldType type, i64 value, desc); + void SetUInt32(int number, FieldType type, ui32 value, desc); + void SetUInt64(int number, FieldType type, ui64 value, desc); void SetFloat(int number, FieldType type, float value, desc); void SetDouble(int number, FieldType type, double value, desc); void SetBool(int number, FieldType type, bool value, desc); @@ -318,10 +318,10 @@ class PROTOBUF_EXPORT ExtensionSet { // (E.g.: borg/clients/internal/proto1/proto2_reflection.cc.) void* MutableRawRepeatedField(int number); - int32_t GetRepeatedInt32(int number, int index) const; - int64 GetRepeatedInt64(int number, int index) const; - uint32_t GetRepeatedUInt32(int number, int index) const; - uint64 GetRepeatedUInt64(int number, int index) const; + i32 GetRepeatedInt32(int number, int index) const; + i64 GetRepeatedInt64(int number, int index) const; + ui32 GetRepeatedUInt32(int number, int index) const; + ui64 GetRepeatedUInt64(int number, int index) const; float GetRepeatedFloat(int number, int index) const; double GetRepeatedDouble(int number, int index) const; bool GetRepeatedBool(int number, int index) const; @@ -329,10 +329,10 @@ class PROTOBUF_EXPORT ExtensionSet { const TProtoStringType& GetRepeatedString(int number, int index) const; const MessageLite& GetRepeatedMessage(int number, int index) const; - void SetRepeatedInt32(int number, int index, int32_t value); - void SetRepeatedInt64(int number, int index, int64 value); - void SetRepeatedUInt32(int number, int index, uint32_t value); - void SetRepeatedUInt64(int number, int index, uint64 value); + void SetRepeatedInt32(int number, int index, i32 value); + void SetRepeatedInt64(int number, int index, i64 value); + void SetRepeatedUInt32(int number, int index, ui32 value); + void SetRepeatedUInt64(int number, int index, ui64 value); void SetRepeatedFloat(int number, int index, float value); void SetRepeatedDouble(int number, int index, double value); void SetRepeatedBool(int number, int index, bool value); @@ -342,10 +342,10 @@ class PROTOBUF_EXPORT ExtensionSet { MessageLite* MutableRepeatedMessage(int number, int index); #define desc const FieldDescriptor* descriptor // avoid line wrapping - void AddInt32(int number, FieldType type, bool packed, int32_t value, desc); - void AddInt64(int number, FieldType type, bool packed, int64 value, desc); - void AddUInt32(int number, FieldType type, bool packed, uint32_t value, desc); - void AddUInt64(int number, FieldType type, bool packed, uint64 value, desc); + void AddInt32(int number, FieldType type, bool packed, i32 value, desc); + void AddInt64(int number, FieldType type, bool packed, i64 value, desc); + void AddUInt32(int number, FieldType type, bool packed, ui32 value, desc); + void AddUInt64(int number, FieldType type, bool packed, ui64 value, desc); void AddFloat(int number, FieldType type, bool packed, float value, desc); void AddDouble(int number, FieldType type, bool packed, double value, desc); void AddBool(int number, FieldType type, bool packed, bool value, desc); @@ -386,7 +386,7 @@ class PROTOBUF_EXPORT ExtensionSet { // Parses a single extension from the input. The input should start out // positioned immediately after the tag. - bool ParseField(uint32_t tag, io::CodedInputStream* input, + bool ParseField(ui32 tag, io::CodedInputStream* input, ExtensionFinder* extension_finder, FieldSkipper* field_skipper); @@ -396,21 +396,21 @@ class PROTOBUF_EXPORT ExtensionSet { // extension by number. See RegisterExtension(), above. Unlike the other // methods of ExtensionSet, this only works for generated message types -- // it looks up extensions registered using RegisterExtension(). - bool ParseField(uint32_t tag, io::CodedInputStream* input, + bool ParseField(ui32 tag, io::CodedInputStream* input, const MessageLite* extendee); - bool ParseField(uint32_t tag, io::CodedInputStream* input, + bool ParseField(ui32 tag, io::CodedInputStream* input, const Message* extendee, UnknownFieldSet* unknown_fields); - bool ParseField(uint32_t tag, io::CodedInputStream* input, + bool ParseField(ui32 tag, io::CodedInputStream* input, const MessageLite* extendee, io::CodedOutputStream* unknown_fields); // Lite parser - const char* ParseField(uint64_t tag, const char* ptr, + const char* ParseField(ui64 tag, const char* ptr, const MessageLite* extendee, internal::InternalMetadata* metadata, internal::ParseContext* ctx); // Full parser - const char* ParseField(uint64_t tag, const char* ptr, const Message* extendee, + const char* ParseField(ui64 tag, const char* ptr, const Message* extendee, internal::InternalMetadata* metadata, internal::ParseContext* ctx); template <typename Msg> @@ -426,7 +426,7 @@ class PROTOBUF_EXPORT ExtensionSet { InternalMetadata* metadata; } item{this, extendee, metadata}; while (!ctx->Done(&ptr)) { - uint32_t tag; + ui32 tag; ptr = ReadTag(ptr, &tag); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); if (tag == WireFormatLite::kMessageSetItemStartTag) { @@ -544,18 +544,18 @@ class PROTOBUF_EXPORT ExtensionSet { template <typename Type, bool IsValid(int)> friend class RepeatedEnumTypeTraits; - const int32_t& GetRefInt32(int number, const int32_t& default_value) const; - const int64& GetRefInt64(int number, const int64& default_value) const; - const uint32_t& GetRefUInt32(int number, const uint32_t& default_value) const; - const uint64& GetRefUInt64(int number, const uint64& default_value) const; + const i32& GetRefInt32(int number, const i32& default_value) const; + const i64& GetRefInt64(int number, const i64& default_value) const; + const ui32& GetRefUInt32(int number, const ui32& default_value) const; + const ui64& GetRefUInt64(int number, const ui64& default_value) const; const float& GetRefFloat(int number, const float& default_value) const; const double& GetRefDouble(int number, const double& default_value) const; const bool& GetRefBool(int number, const bool& default_value) const; const int& GetRefEnum(int number, const int& default_value) const; - const int32_t& GetRefRepeatedInt32(int number, int index) const; - const int64& GetRefRepeatedInt64(int number, int index) const; - const uint32_t& GetRefRepeatedUInt32(int number, int index) const; - const uint64& GetRefRepeatedUInt64(int number, int index) const; + const i32& GetRefRepeatedInt32(int number, int index) const; + const i64& GetRefRepeatedInt64(int number, int index) const; + const ui32& GetRefRepeatedUInt32(int number, int index) const; + const ui64& GetRefRepeatedUInt64(int number, int index) const; const float& GetRefRepeatedFloat(int number, int index) const; const double& GetRefRepeatedDouble(int number, int index) const; const bool& GetRefRepeatedBool(int number, int index) const; @@ -613,10 +613,10 @@ class PROTOBUF_EXPORT ExtensionSet { // The order of these fields packs Extension into 24 bytes when using 8 // byte alignment. Consider this when adding or removing fields here. union { - int32_t int32_t_value; - int64 int64_value; - uint32_t uint32_t_value; - uint64 uint64_value; + i32 i32_value; + i64 i64_value; + ui32 ui32_value; + ui64 ui64_value; float float_value; double double_value; bool bool_value; @@ -625,10 +625,10 @@ class PROTOBUF_EXPORT ExtensionSet { MessageLite* message_value; LazyMessageExtension* lazymessage_value; - RepeatedField<int32_t>* repeated_int32_t_value; - RepeatedField<int64>* repeated_int64_value; - RepeatedField<uint32_t>* repeated_uint32_t_value; - RepeatedField<uint64>* repeated_uint64_value; + RepeatedField<i32>* repeated_i32_value; + RepeatedField<i64>* repeated_i64_value; + RepeatedField<ui32>* repeated_ui32_value; + RepeatedField<ui64>* repeated_ui64_value; RepeatedField<float>* repeated_float_value; RepeatedField<double>* repeated_double_value; RepeatedField<bool>* repeated_bool_value; @@ -772,7 +772,7 @@ class PROTOBUF_EXPORT ExtensionSet { // Note to support packed repeated field compatibility, it also fills whether // the tag on wire is packed, which can be different from // extension->is_packed (whether packed=true is specified). - bool FindExtensionInfoFromTag(uint32_t tag, ExtensionFinder* extension_finder, + bool FindExtensionInfoFromTag(ui32 tag, ExtensionFinder* extension_finder, int* field_number, ExtensionInfo* extension, bool* was_packed_on_wire); @@ -826,26 +826,26 @@ class PROTOBUF_EXPORT ExtensionSet { ExtensionFinder* extension_finder, MessageSetFieldSkipper* field_skipper); - bool FindExtension(int wire_type, uint32_t field, const MessageLite* extendee, + bool FindExtension(int wire_type, ui32 field, const MessageLite* extendee, const internal::ParseContext* /*ctx*/, ExtensionInfo* extension, bool* was_packed_on_wire) { GeneratedExtensionFinder finder(extendee); return FindExtensionInfoFromFieldNumber(wire_type, field, &finder, extension, was_packed_on_wire); } - inline bool FindExtension(int wire_type, uint32_t field, + inline bool FindExtension(int wire_type, ui32 field, const Message* extendee, const internal::ParseContext* ctx, ExtensionInfo* extension, bool* was_packed_on_wire); // Used for MessageSet only - const char* ParseFieldMaybeLazily(uint64_t tag, const char* ptr, + const char* ParseFieldMaybeLazily(ui64 tag, const char* ptr, const MessageLite* extendee, internal::InternalMetadata* metadata, internal::ParseContext* ctx) { // Lite MessageSet doesn't implement lazy. return ParseField(tag, ptr, extendee, metadata, ctx); } - const char* ParseFieldMaybeLazily(uint64_t tag, const char* ptr, + const char* ParseFieldMaybeLazily(ui64 tag, const char* ptr, const Message* extendee, internal::InternalMetadata* metadata, internal::ParseContext* ctx); @@ -987,7 +987,7 @@ inline void ExtensionSet::AddString(int number, FieldType type, // For example, if "foo" is an extension of type "optional int32", then if you // try to write code like: // my_message.MutableExtension(foo) -// you will get a compile error because PrimitiveTypeTraits<int32_t> does not +// you will get a compile error because PrimitiveTypeTraits<i32> does not // have a "Mutable()" method. // ------------------------------------------------------------------- @@ -1055,10 +1055,10 @@ class PROTOBUF_EXPORT RepeatedPrimitiveDefaults { template <typename Type> friend class RepeatedPrimitiveTypeTraits; static const RepeatedPrimitiveDefaults* default_instance(); - RepeatedField<int32_t> default_repeated_field_int32_t_; - RepeatedField<int64> default_repeated_field_int64_; - RepeatedField<uint32_t> default_repeated_field_uint32_t_; - RepeatedField<uint64> default_repeated_field_uint64_; + RepeatedField<i32> default_repeated_field_i32_; + RepeatedField<i64> default_repeated_field_i64_; + RepeatedField<ui32> default_repeated_field_ui32_; + RepeatedField<ui64> default_repeated_field_ui64_; RepeatedField<double> default_repeated_field_double_; RepeatedField<float> default_repeated_field_float_; RepeatedField<bool> default_repeated_field_bool_; @@ -1129,10 +1129,10 @@ class PROTOBUF_EXPORT RepeatedPrimitiveDefaults { set->MutableRawRepeatedField(number, field_type, is_packed, NULL)); \ } -PROTOBUF_DEFINE_PRIMITIVE_TYPE(int32_t, Int32) -PROTOBUF_DEFINE_PRIMITIVE_TYPE(int64, Int64) -PROTOBUF_DEFINE_PRIMITIVE_TYPE(uint32_t, UInt32) -PROTOBUF_DEFINE_PRIMITIVE_TYPE(uint64, UInt64) +PROTOBUF_DEFINE_PRIMITIVE_TYPE(i32, Int32) +PROTOBUF_DEFINE_PRIMITIVE_TYPE(i64, Int64) +PROTOBUF_DEFINE_PRIMITIVE_TYPE(ui32, UInt32) +PROTOBUF_DEFINE_PRIMITIVE_TYPE(ui64, UInt64) PROTOBUF_DEFINE_PRIMITIVE_TYPE(float, Float) PROTOBUF_DEFINE_PRIMITIVE_TYPE(double, Double) PROTOBUF_DEFINE_PRIMITIVE_TYPE(bool, Bool) @@ -1319,9 +1319,9 @@ class RepeatedEnumTypeTraits { // objects to return as default (empty) repeated fields on non-existent // extensions. We would not be able to know a-priori all of the enum types // (values of |Type|) to instantiate all of these, so we just re-use - // int32_t's default repeated field object. + // i32's default repeated field object. return reinterpret_cast<const RepeatedField<Type>*>( - RepeatedPrimitiveTypeTraits<int32_t>::GetDefaultRepeatedField()); + RepeatedPrimitiveTypeTraits<i32>::GetDefaultRepeatedField()); } template <typename ExtendeeT> static void Register(int number, FieldType type, bool is_packed) { @@ -1460,7 +1460,7 @@ RepeatedMessageTypeTraits<Type>::GetDefaultRepeatedField() { // optional int32 bar = 1234; // } // then "bar" will be defined in C++ as: -// ExtensionIdentifier<Foo, PrimitiveTypeTraits<int32_t>, 5, false> bar(1234); +// ExtensionIdentifier<Foo, PrimitiveTypeTraits<i32>, 5, false> bar(1234); // // Note that we could, in theory, supply the field number as a template // parameter, and thus make an instance of ExtensionIdentifier have no diff --git a/contrib/libs/protobuf/src/google/protobuf/extension_set_heavy.cc b/contrib/libs/protobuf/src/google/protobuf/extension_set_heavy.cc index bb2f2f80f6..9a1fda4280 100644 --- a/contrib/libs/protobuf/src/google/protobuf/extension_set_heavy.cc +++ b/contrib/libs/protobuf/src/google/protobuf/extension_set_heavy.cc @@ -69,7 +69,7 @@ class MessageSetFieldSkipper : public UnknownFieldSetFieldSkipper { }; bool MessageSetFieldSkipper::SkipMessageSetField(io::CodedInputStream* input, int field_number) { - uint32_t length; + ui32 length; if (!input->ReadVarint32(&length)) return false; if (unknown_fields_ == nullptr) { return input->Skip(length); @@ -325,7 +325,7 @@ bool DescriptorPoolExtensionFinder::Find(int number, ExtensionInfo* output) { } -bool ExtensionSet::FindExtension(int wire_type, uint32_t field, +bool ExtensionSet::FindExtension(int wire_type, ui32 field, const Message* containing_type, const internal::ParseContext* ctx, ExtensionInfo* extension, @@ -347,7 +347,7 @@ bool ExtensionSet::FindExtension(int wire_type, uint32_t field, return true; } -const char* ExtensionSet::ParseField(uint64_t tag, const char* ptr, +const char* ExtensionSet::ParseField(ui64 tag, const char* ptr, const Message* containing_type, internal::InternalMetadata* metadata, internal::ParseContext* ctx) { @@ -364,7 +364,7 @@ const char* ExtensionSet::ParseField(uint64_t tag, const char* ptr, } const char* ExtensionSet::ParseFieldMaybeLazily( - uint64_t tag, const char* ptr, const Message* containing_type, + ui64 tag, const char* ptr, const Message* containing_type, internal::InternalMetadata* metadata, internal::ParseContext* ctx) { return ParseField(tag, ptr, containing_type, metadata, ctx); } @@ -376,7 +376,7 @@ const char* ExtensionSet::ParseMessageSetItem( metadata, ctx); } -bool ExtensionSet::ParseField(uint32_t tag, io::CodedInputStream* input, +bool ExtensionSet::ParseField(ui32 tag, io::CodedInputStream* input, const Message* containing_type, UnknownFieldSet* unknown_fields) { UnknownFieldSetFieldSkipper skipper(unknown_fields); @@ -433,10 +433,10 @@ size_t ExtensionSet::Extension::SpaceUsedExcludingSelfLong() const { repeated_##LOWERCASE##_value->SpaceUsedExcludingSelfLong(); \ break - HANDLE_TYPE(INT32, int32_t); - HANDLE_TYPE(INT64, int64); - HANDLE_TYPE(UINT32, uint32_t); - HANDLE_TYPE(UINT64, uint64); + HANDLE_TYPE(INT32, i32); + HANDLE_TYPE(INT64, i64); + HANDLE_TYPE(UINT32, ui32); + HANDLE_TYPE(UINT64, ui64); HANDLE_TYPE(FLOAT, float); HANDLE_TYPE(DOUBLE, double); HANDLE_TYPE(BOOL, bool); @@ -498,7 +498,7 @@ bool ExtensionSet::ParseMessageSet(io::CodedInputStream* input, ExtensionFinder* extension_finder, MessageSetFieldSkipper* field_skipper) { while (true) { - const uint32_t tag = input->ReadTag(); + const ui32 tag = input->ReadTag(); switch (tag) { case 0: return true; @@ -526,7 +526,7 @@ bool ExtensionSet::ParseMessageSetItem(io::CodedInputStream* input, extension_finder, field_skipper); } - bool SkipField(uint32_t tag, io::CodedInputStream* input) { + bool SkipField(ui32 tag, io::CodedInputStream* input) { return field_skipper->SkipField(input, tag); } diff --git a/contrib/libs/protobuf/src/google/protobuf/extension_set_inl.h b/contrib/libs/protobuf/src/google/protobuf/extension_set_inl.h index 513bd12010..97919dbac5 100644 --- a/contrib/libs/protobuf/src/google/protobuf/extension_set_inl.h +++ b/contrib/libs/protobuf/src/google/protobuf/extension_set_inl.h @@ -83,7 +83,7 @@ const char* ExtensionSet::ParseFieldWithExtensionInfo( switch (extension.type) { #define HANDLE_VARINT_TYPE(UPPERCASE, CPP_CAMELCASE) \ case WireFormatLite::TYPE_##UPPERCASE: { \ - uint64_t value; \ + ui64 value; \ ptr = VarintParse(ptr, &value); \ GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); \ if (extension.is_repeated) { \ @@ -103,7 +103,7 @@ const char* ExtensionSet::ParseFieldWithExtensionInfo( #undef HANDLE_VARINT_TYPE #define HANDLE_SVARINT_TYPE(UPPERCASE, CPP_CAMELCASE, SIZE) \ case WireFormatLite::TYPE_##UPPERCASE: { \ - uint64_t val; \ + ui64 val; \ ptr = VarintParse(ptr, &val); \ GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); \ auto value = WireFormatLite::ZigZagDecode##SIZE(val); \ @@ -132,16 +132,16 @@ const char* ExtensionSet::ParseFieldWithExtensionInfo( } \ } break - HANDLE_FIXED_TYPE(FIXED32, UInt32, uint32_t); - HANDLE_FIXED_TYPE(FIXED64, UInt64, uint64_t); - HANDLE_FIXED_TYPE(SFIXED32, Int32, int32_t); - HANDLE_FIXED_TYPE(SFIXED64, Int64, int64_t); + HANDLE_FIXED_TYPE(FIXED32, UInt32, ui32); + HANDLE_FIXED_TYPE(FIXED64, UInt64, ui64); + HANDLE_FIXED_TYPE(SFIXED32, Int32, i32); + HANDLE_FIXED_TYPE(SFIXED64, Int64, i64); HANDLE_FIXED_TYPE(FLOAT, Float, float); HANDLE_FIXED_TYPE(DOUBLE, Double, double); #undef HANDLE_FIXED_TYPE case WireFormatLite::TYPE_ENUM: { - uint64_t val; + ui64 val; ptr = VarintParse(ptr, &val); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); int value = val; @@ -181,7 +181,7 @@ const char* ExtensionSet::ParseFieldWithExtensionInfo( : MutableMessage(number, WireFormatLite::TYPE_GROUP, *extension.message_info.prototype, extension.descriptor); - uint32_t tag = (number << 3) + WireFormatLite::WIRETYPE_START_GROUP; + ui32 tag = (number << 3) + WireFormatLite::WIRETYPE_START_GROUP; return ctx->ParseGroup(value, ptr, tag); } @@ -206,14 +206,14 @@ const char* ExtensionSet::ParseMessageSetItemTmpl( const char* ptr, const Msg* extendee, internal::InternalMetadata* metadata, internal::ParseContext* ctx) { TProtoStringType payload; - uint32_t type_id; + ui32 type_id; enum class State { kNoTag, kHasType, kHasPayload, kDone }; State state = State::kNoTag; while (!ctx->Done(&ptr)) { - uint32_t tag = static_cast<uint8_t>(*ptr++); + ui32 tag = static_cast<uint8_t>(*ptr++); if (tag == WireFormatLite::kMessageSetTypeIdTag) { - uint64_t tmp; + ui64 tmp; ptr = ParseBigVarint(ptr, &tmp); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); if (state == State::kNoTag) { @@ -250,13 +250,13 @@ const char* ExtensionSet::ParseMessageSetItemTmpl( } } else if (tag == WireFormatLite::kMessageSetMessageTag) { if (state == State::kHasType) { - ptr = ParseFieldMaybeLazily(static_cast<uint64_t>(type_id) * 8 + 2, ptr, + ptr = ParseFieldMaybeLazily(static_cast<ui64>(type_id) * 8 + 2, ptr, extendee, metadata, ctx); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr != nullptr); state = State::kDone; } else { TProtoStringType tmp; - int32_t size = ReadSize(&ptr); + i32 size = ReadSize(&ptr); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); ptr = ctx->ReadString(ptr, size, &tmp); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); diff --git a/contrib/libs/protobuf/src/google/protobuf/generated_message_bases.cc b/contrib/libs/protobuf/src/google/protobuf/generated_message_bases.cc index 3acfa5f286..bc0b78fd67 100644 --- a/contrib/libs/protobuf/src/google/protobuf/generated_message_bases.cc +++ b/contrib/libs/protobuf/src/google/protobuf/generated_message_bases.cc @@ -68,7 +68,7 @@ const char* ZeroFieldsBase::_InternalParse(const char* ptr, } while (!ctx->Done(&ptr)) { - uint32_t tag; + ui32 tag; ptr = internal::ReadTag(ptr, &tag); if ((tag == 0) || ((tag & 7) == 4)) { CHK_(ptr); diff --git a/contrib/libs/protobuf/src/google/protobuf/generated_message_reflection.cc b/contrib/libs/protobuf/src/google/protobuf/generated_message_reflection.cc index 4984ccdc9d..cbcf613951 100644 --- a/contrib/libs/protobuf/src/google/protobuf/generated_message_reflection.cc +++ b/contrib/libs/protobuf/src/google/protobuf/generated_message_reflection.cc @@ -283,10 +283,10 @@ size_t Reflection::SpaceUsedLong(const Message& message) const { .SpaceUsedExcludingSelfLong(); \ break - HANDLE_TYPE(INT32, int32_t); - HANDLE_TYPE(INT64, int64); - HANDLE_TYPE(UINT32, uint32_t); - HANDLE_TYPE(UINT64, uint64); + HANDLE_TYPE(INT32, i32); + HANDLE_TYPE(INT64, i64); + HANDLE_TYPE(UINT32, ui32); + HANDLE_TYPE(UINT64, ui64); HANDLE_TYPE(DOUBLE, double); HANDLE_TYPE(FLOAT, float); HANDLE_TYPE(BOOL, bool); @@ -676,10 +676,10 @@ void Reflection::SwapField(Message* message1, Message* message2, ->Swap(MutableRaw<RepeatedField<TYPE> >(message2, field)); \ break; - SWAP_ARRAYS(INT32, int32_t); - SWAP_ARRAYS(INT64, int64); - SWAP_ARRAYS(UINT32, uint32_t); - SWAP_ARRAYS(UINT64, uint64); + SWAP_ARRAYS(INT32, i32); + SWAP_ARRAYS(INT64, i64); + SWAP_ARRAYS(UINT32, ui32); + SWAP_ARRAYS(UINT64, ui64); SWAP_ARRAYS(FLOAT, float); SWAP_ARRAYS(DOUBLE, double); SWAP_ARRAYS(BOOL, bool); @@ -706,10 +706,10 @@ void Reflection::SwapField(Message* message1, Message* message2, *MutableRaw<TYPE>(message2, field)); \ break; - SWAP_VALUES(INT32, int32_t); - SWAP_VALUES(INT64, int64); - SWAP_VALUES(UINT32, uint32_t); - SWAP_VALUES(UINT64, uint64); + SWAP_VALUES(INT32, i32); + SWAP_VALUES(INT64, i64); + SWAP_VALUES(UINT32, ui32); + SWAP_VALUES(UINT64, ui64); SWAP_VALUES(FLOAT, float); SWAP_VALUES(DOUBLE, double); SWAP_VALUES(BOOL, bool); @@ -753,10 +753,10 @@ void Reflection::UnsafeShallowSwapField(Message* message1, Message* message2, ->InternalSwap(MutableRaw<RepeatedField<TYPE>>(message2, field)); \ break; - SHALLOW_SWAP_ARRAYS(INT32, int32_t); - SHALLOW_SWAP_ARRAYS(INT64, int64); - SHALLOW_SWAP_ARRAYS(UINT32, uint32_t); - SHALLOW_SWAP_ARRAYS(UINT64, uint64); + SHALLOW_SWAP_ARRAYS(INT32, i32); + SHALLOW_SWAP_ARRAYS(INT64, i64); + SHALLOW_SWAP_ARRAYS(UINT32, ui32); + SHALLOW_SWAP_ARRAYS(UINT64, ui64); SHALLOW_SWAP_ARRAYS(FLOAT, float); SHALLOW_SWAP_ARRAYS(DOUBLE, double); SHALLOW_SWAP_ARRAYS(BOOL, bool); @@ -790,10 +790,10 @@ void Reflection::SwapOneofField(Message* lhs, Message* rhs, type Get##name() const { return oneof_val.type_##var; } \ void Set##name(type v) { oneof_val.type_##var = v; } - LOCAL_VAR_ACCESSOR(int32_t, int32, Int32); - LOCAL_VAR_ACCESSOR(int64, int64, Int64); - LOCAL_VAR_ACCESSOR(uint32_t, uint32, Uint32); - LOCAL_VAR_ACCESSOR(uint64, uint64, Uint64); + LOCAL_VAR_ACCESSOR(i32, int32, Int32); + LOCAL_VAR_ACCESSOR(i64, int64, Int64); + LOCAL_VAR_ACCESSOR(ui32, uint32, Uint32); + LOCAL_VAR_ACCESSOR(ui64, uint64, Uint64); LOCAL_VAR_ACCESSOR(float, float, Float); LOCAL_VAR_ACCESSOR(double, double, Double); LOCAL_VAR_ACCESSOR(bool, bool, Bool); @@ -807,10 +807,10 @@ void Reflection::SwapOneofField(Message* lhs, Message* rhs, void ClearOneofCase() {} union { - int32_t type_int32; - int64 type_int64; - uint32_t type_uint32; - uint64 type_uint64; + i32 type_int32; + i64 type_int64; + ui32 type_uint32; + ui64 type_uint64; float type_float; double type_double; bool type_bool; @@ -831,10 +831,10 @@ void Reflection::SwapOneofField(Message* lhs, Message* rhs, } \ void Set##name(type v) { reflection->SetField<type>(message, field, v); } - MESSAGE_FIELD_ACCESSOR(int32_t, int32, Int32); - MESSAGE_FIELD_ACCESSOR(int64, int64, Int64); - MESSAGE_FIELD_ACCESSOR(uint32_t, uint32, Uint32); - MESSAGE_FIELD_ACCESSOR(uint64, uint64, Uint64); + MESSAGE_FIELD_ACCESSOR(i32, int32, Int32); + MESSAGE_FIELD_ACCESSOR(i64, int64, Int64); + MESSAGE_FIELD_ACCESSOR(ui32, uint32, Uint32); + MESSAGE_FIELD_ACCESSOR(ui64, uint64, Uint64); MESSAGE_FIELD_ACCESSOR(float, float, Float); MESSAGE_FIELD_ACCESSOR(double, double, Double); MESSAGE_FIELD_ACCESSOR(bool, bool, Bool); @@ -1123,10 +1123,10 @@ int Reflection::FieldSize(const Message& message, case FieldDescriptor::CPPTYPE_##UPPERCASE: \ return GetRaw<RepeatedField<LOWERCASE> >(message, field).size() - HANDLE_TYPE(INT32, int32_t); - HANDLE_TYPE(INT64, int64); - HANDLE_TYPE(UINT32, uint32_t); - HANDLE_TYPE(UINT64, uint64); + HANDLE_TYPE(INT32, i32); + HANDLE_TYPE(INT64, i64); + HANDLE_TYPE(UINT32, ui32); + HANDLE_TYPE(UINT64, ui64); HANDLE_TYPE(DOUBLE, double); HANDLE_TYPE(FLOAT, float); HANDLE_TYPE(BOOL, bool); @@ -1177,10 +1177,10 @@ void Reflection::ClearField(Message* message, *MutableRaw<TYPE>(message, field) = field->default_value_##TYPE(); \ break; - CLEAR_TYPE(INT32, int32_t); - CLEAR_TYPE(INT64, int64); - CLEAR_TYPE(UINT32, uint32_t); - CLEAR_TYPE(UINT64, uint64); + CLEAR_TYPE(INT32, i32); + CLEAR_TYPE(INT64, i64); + CLEAR_TYPE(UINT32, ui32); + CLEAR_TYPE(UINT64, ui64); CLEAR_TYPE(FLOAT, float); CLEAR_TYPE(DOUBLE, double); CLEAR_TYPE(BOOL, bool); @@ -1213,7 +1213,7 @@ void Reflection::ClearField(Message* message, } case FieldDescriptor::CPPTYPE_MESSAGE: - if (schema_.HasBitIndex(field) == static_cast<uint32_t>(-1)) { + if (schema_.HasBitIndex(field) == static_cast<ui32>(-1)) { // Proto3 does not have has-bits and we need to set a message field // to nullptr in order to indicate its un-presence. if (message->GetArenaForAllocation() == nullptr) { @@ -1233,10 +1233,10 @@ void Reflection::ClearField(Message* message, MutableRaw<RepeatedField<LOWERCASE> >(message, field)->Clear(); \ break - HANDLE_TYPE(INT32, int32_t); - HANDLE_TYPE(INT64, int64); - HANDLE_TYPE(UINT32, uint32_t); - HANDLE_TYPE(UINT64, uint64); + HANDLE_TYPE(INT32, i32); + HANDLE_TYPE(INT64, i64); + HANDLE_TYPE(UINT32, ui32); + HANDLE_TYPE(UINT64, ui64); HANDLE_TYPE(DOUBLE, double); HANDLE_TYPE(FLOAT, float); HANDLE_TYPE(BOOL, bool); @@ -1283,10 +1283,10 @@ void Reflection::RemoveLast(Message* message, MutableRaw<RepeatedField<LOWERCASE> >(message, field)->RemoveLast(); \ break - HANDLE_TYPE(INT32, int32_t); - HANDLE_TYPE(INT64, int64); - HANDLE_TYPE(UINT32, uint32_t); - HANDLE_TYPE(UINT64, uint64); + HANDLE_TYPE(INT32, i32); + HANDLE_TYPE(INT64, i64); + HANDLE_TYPE(UINT32, ui32); + HANDLE_TYPE(UINT64, ui64); HANDLE_TYPE(DOUBLE, double); HANDLE_TYPE(FLOAT, float); HANDLE_TYPE(BOOL, bool); @@ -1379,10 +1379,10 @@ void Reflection::SwapElements(Message* message, const FieldDescriptor* field, ->SwapElements(index1, index2); \ break - HANDLE_TYPE(INT32, int32_t); - HANDLE_TYPE(INT64, int64); - HANDLE_TYPE(UINT32, uint32_t); - HANDLE_TYPE(UINT64, uint64); + HANDLE_TYPE(INT32, i32); + HANDLE_TYPE(INT64, i64); + HANDLE_TYPE(UINT32, ui32); + HANDLE_TYPE(UINT64, ui64); HANDLE_TYPE(DOUBLE, double); HANDLE_TYPE(FLOAT, float); HANDLE_TYPE(BOOL, bool); @@ -1413,10 +1413,10 @@ struct FieldNumberSorter { } }; -bool IsIndexInHasBitSet(const uint32_t* has_bit_set, uint32_t has_bit_index) { +bool IsIndexInHasBitSet(const ui32* has_bit_set, ui32 has_bit_index) { GOOGLE_DCHECK_NE(has_bit_index, ~0u); return ((has_bit_set[has_bit_index / 32] >> (has_bit_index % 32)) & - static_cast<uint32_t>(1)) != 0; + static_cast<ui32>(1)) != 0; } bool CreateUnknownEnumValues(const FileDescriptor* file) { @@ -1445,9 +1445,9 @@ void Reflection::ListFieldsMayFailOnStripped( // encapsulation because this function takes a noticeable about of CPU // fleetwide and properly allowing this optimization through public interfaces // seems more trouble than it is worth. - const uint32_t* const has_bits = + const ui32* const has_bits = schema_.HasHasbits() ? GetHasBits(message) : nullptr; - const uint32_t* const has_bits_indices = schema_.has_bit_indices_; + const ui32* const has_bits_indices = schema_.has_bit_indices_; output->reserve(descriptor_->field_count()); const int last_non_weak_field_index = last_non_weak_field_index_; for (int i = 0; i <= last_non_weak_field_index; i++) { @@ -1462,15 +1462,15 @@ void Reflection::ListFieldsMayFailOnStripped( } else { const OneofDescriptor* containing_oneof = field->containing_oneof(); if (schema_.InRealOneof(field)) { - const uint32_t* const oneof_case_array = - GetConstPointerAtOffset<uint32_t>(&message, + const ui32* const oneof_case_array = + GetConstPointerAtOffset<ui32>(&message, schema_.oneof_case_offset_); // Equivalent to: HasOneofField(message, field) - if (static_cast<int64>(oneof_case_array[containing_oneof->index()]) == + if (static_cast<i64>(oneof_case_array[containing_oneof->index()]) == field->number()) { output->push_back(field); } - } else if (has_bits && has_bits_indices[i] != static_cast<uint32_t>(-1)) { + } else if (has_bits && has_bits_indices[i] != static_cast<ui32>(-1)) { CheckInvalidAccess(schema_, field); // Equivalent to: HasBit(message, field) if (IsIndexInHasBitSet(has_bits, has_bits_indices[i])) { @@ -1563,10 +1563,10 @@ void Reflection::ListFieldsOmitStripped( } \ } -DEFINE_PRIMITIVE_ACCESSORS(Int32, int32_t, int32_t, INT32) -DEFINE_PRIMITIVE_ACCESSORS(Int64, int64, int64, INT64) -DEFINE_PRIMITIVE_ACCESSORS(UInt32, uint32_t, uint32_t, UINT32) -DEFINE_PRIMITIVE_ACCESSORS(UInt64, uint64, uint64, UINT64) +DEFINE_PRIMITIVE_ACCESSORS(Int32, i32, i32, INT32) +DEFINE_PRIMITIVE_ACCESSORS(Int64, i64, i64, INT64) +DEFINE_PRIMITIVE_ACCESSORS(UInt32, ui32, ui32, UINT32) +DEFINE_PRIMITIVE_ACCESSORS(UInt64, ui64, ui64, UINT64) DEFINE_PRIMITIVE_ACCESSORS(Float, float, float, FLOAT) DEFINE_PRIMITIVE_ACCESSORS(Double, double, double, DOUBLE) DEFINE_PRIMITIVE_ACCESSORS(Bool, bool, bool, BOOL) @@ -1641,10 +1641,10 @@ void Reflection::SetString(Message* message, const FieldDescriptor* field, default: // TODO(kenton): Support other string reps. case FieldOptions::STRING: { if (IsInlined(field)) { - const uint32_t index = schema_.InlinedStringIndex(field); - uint32_t* states = + const ui32 index = schema_.InlinedStringIndex(field); + ui32* states = &MutableInlinedStringDonatedArray(message)[index / 32]; - uint32_t mask = ~(static_cast<uint32_t>(1) << (index % 32)); + ui32 mask = ~(static_cast<ui32>(1) << (index % 32)); MutableField<InlinedStringField>(message, field) ->Set(nullptr, value, message->GetArenaForAllocation(), IsInlinedStringDonated(*message, field), states, mask); @@ -1754,7 +1754,7 @@ int Reflection::GetEnumValue(const Message& message, const FieldDescriptor* field) const { USAGE_CHECK_ALL(GetEnumValue, SINGULAR, ENUM); - int32_t value; + i32 value; if (field->is_extension()) { value = GetExtensionSet(message).GetEnum( field->number(), field->default_value_enum()->number()); @@ -2290,7 +2290,7 @@ const FieldDescriptor* Reflection::GetOneofFieldDescriptor( const FieldDescriptor* field = oneof_descriptor->field(0); return HasField(message, field) ? field : nullptr; } - uint32_t field_number = GetOneofCase(message, oneof_descriptor); + ui32 field_number = GetOneofCase(message, oneof_descriptor); if (field_number == 0) { return nullptr; } @@ -2398,20 +2398,20 @@ Type* Reflection::MutableRaw(Message* message, return GetPointerAtOffset<Type>(message, schema_.GetFieldOffset(field)); } -const uint32_t* Reflection::GetHasBits(const Message& message) const { +const ui32* Reflection::GetHasBits(const Message& message) const { GOOGLE_DCHECK(schema_.HasHasbits()); - return &GetConstRefAtOffset<uint32_t>(message, schema_.HasBitsOffset()); + return &GetConstRefAtOffset<ui32>(message, schema_.HasBitsOffset()); } -uint32_t* Reflection::MutableHasBits(Message* message) const { +ui32* Reflection::MutableHasBits(Message* message) const { GOOGLE_DCHECK(schema_.HasHasbits()); - return GetPointerAtOffset<uint32_t>(message, schema_.HasBitsOffset()); + return GetPointerAtOffset<ui32>(message, schema_.HasBitsOffset()); } -uint32_t* Reflection::MutableOneofCase( +ui32* Reflection::MutableOneofCase( Message* message, const OneofDescriptor* oneof_descriptor) const { GOOGLE_DCHECK(!oneof_descriptor->is_synthetic()); - return GetPointerAtOffset<uint32_t>( + return GetPointerAtOffset<ui32>( message, schema_.GetOneofCaseOffset(oneof_descriptor)); } @@ -2436,16 +2436,16 @@ InternalMetadata* Reflection::MutableInternalMetadata(Message* message) const { schema_.GetMetadataOffset()); } -const uint32_t* Reflection::GetInlinedStringDonatedArray( +const ui32* Reflection::GetInlinedStringDonatedArray( const Message& message) const { GOOGLE_DCHECK(schema_.HasInlinedString()); - return &GetConstRefAtOffset<uint32_t>(message, + return &GetConstRefAtOffset<ui32>(message, schema_.InlinedStringDonatedOffset()); } -uint32_t* Reflection::MutableInlinedStringDonatedArray(Message* message) const { +ui32* Reflection::MutableInlinedStringDonatedArray(Message* message) const { GOOGLE_DCHECK(schema_.HasHasbits()); - return GetPointerAtOffset<uint32_t>(message, + return GetPointerAtOffset<ui32>(message, schema_.InlinedStringDonatedOffset()); } @@ -2460,7 +2460,7 @@ bool Reflection::IsInlinedStringDonated(const Message& message, bool Reflection::HasBit(const Message& message, const FieldDescriptor* field) const { GOOGLE_DCHECK(!field->options().weak()); - if (schema_.HasBitIndex(field) != static_cast<uint32_t>(-1)) { + if (schema_.HasBitIndex(field) != static_cast<ui32>(-1)) { return IsIndexInHasBitSet(GetHasBits(message), schema_.HasBitIndex(field)); } @@ -2500,13 +2500,13 @@ bool Reflection::HasBit(const Message& message, case FieldDescriptor::CPPTYPE_BOOL: return GetRaw<bool>(message, field) != false; case FieldDescriptor::CPPTYPE_INT32: - return GetRaw<int32_t>(message, field) != 0; + return GetRaw<i32>(message, field) != 0; case FieldDescriptor::CPPTYPE_INT64: - return GetRaw<int64>(message, field) != 0; + return GetRaw<i64>(message, field) != 0; case FieldDescriptor::CPPTYPE_UINT32: - return GetRaw<uint32_t>(message, field) != 0; + return GetRaw<ui32>(message, field) != 0; case FieldDescriptor::CPPTYPE_UINT64: - return GetRaw<uint64>(message, field) != 0; + return GetRaw<ui64>(message, field) != 0; case FieldDescriptor::CPPTYPE_FLOAT: return GetRaw<float>(message, field) != 0.0; case FieldDescriptor::CPPTYPE_DOUBLE: @@ -2524,19 +2524,19 @@ bool Reflection::HasBit(const Message& message, void Reflection::SetBit(Message* message, const FieldDescriptor* field) const { GOOGLE_DCHECK(!field->options().weak()); - const uint32_t index = schema_.HasBitIndex(field); - if (index == static_cast<uint32_t>(-1)) return; + const ui32 index = schema_.HasBitIndex(field); + if (index == static_cast<ui32>(-1)) return; MutableHasBits(message)[index / 32] |= - (static_cast<uint32_t>(1) << (index % 32)); + (static_cast<ui32>(1) << (index % 32)); } void Reflection::ClearBit(Message* message, const FieldDescriptor* field) const { GOOGLE_DCHECK(!field->options().weak()); - const uint32_t index = schema_.HasBitIndex(field); - if (index == static_cast<uint32_t>(-1)) return; + const ui32 index = schema_.HasBitIndex(field); + if (index == static_cast<ui32>(-1)) return; MutableHasBits(message)[index / 32] &= - ~(static_cast<uint32_t>(1) << (index % 32)); + ~(static_cast<ui32>(1) << (index % 32)); } void Reflection::SwapBit(Message* message1, Message* message2, @@ -2587,7 +2587,7 @@ void Reflection::ClearOneof(Message* message, // TODO(jieluo): Consider to cache the unused object instead of deleting // it. It will be much faster if an application switches a lot from // a few oneof fields. Time/space tradeoff - uint32_t oneof_case = GetOneofCase(*message, oneof_descriptor); + ui32 oneof_case = GetOneofCase(*message, oneof_descriptor); if (oneof_case > 0) { const FieldDescriptor* field = descriptor_->FindFieldByNumber(oneof_case); if (message->GetArenaForAllocation() == nullptr) { @@ -2635,10 +2635,10 @@ void Reflection::ClearOneof(Message* message, MutableRawRepeatedField(message, field, CPPTYPE, CTYPE, NULL)); \ } -HANDLE_TYPE(int32_t, FieldDescriptor::CPPTYPE_INT32, -1); -HANDLE_TYPE(int64, FieldDescriptor::CPPTYPE_INT64, -1); -HANDLE_TYPE(uint32_t, FieldDescriptor::CPPTYPE_UINT32, -1); -HANDLE_TYPE(uint64, FieldDescriptor::CPPTYPE_UINT64, -1); +HANDLE_TYPE(i32, FieldDescriptor::CPPTYPE_INT32, -1); +HANDLE_TYPE(i64, FieldDescriptor::CPPTYPE_INT64, -1); +HANDLE_TYPE(ui32, FieldDescriptor::CPPTYPE_UINT32, -1); +HANDLE_TYPE(ui64, FieldDescriptor::CPPTYPE_UINT64, -1); HANDLE_TYPE(float, FieldDescriptor::CPPTYPE_FLOAT, -1); HANDLE_TYPE(double, FieldDescriptor::CPPTYPE_DOUBLE, -1); HANDLE_TYPE(bool, FieldDescriptor::CPPTYPE_BOOL, -1); @@ -2770,7 +2770,7 @@ namespace { // Helper function to transform migration schema into reflection schema. ReflectionSchema MigrationToReflectionSchema( - const Message* const* default_instance, const uint32_t* offsets, + const Message* const* default_instance, const ui32* offsets, MigrationSchema migration_schema) { ReflectionSchema result; result.default_instance_ = *default_instance; @@ -2800,7 +2800,7 @@ class AssignDescriptorsHelper { const EnumDescriptor** file_level_enum_descriptors, const MigrationSchema* schemas, const Message* const* default_instance_data, - const uint32_t* offsets) + const ui32* offsets) : factory_(factory), file_level_metadata_(file_level_metadata), file_level_enum_descriptors_(file_level_enum_descriptors), @@ -2841,7 +2841,7 @@ class AssignDescriptorsHelper { const EnumDescriptor** file_level_enum_descriptors_; const MigrationSchema* schemas_; const Message* const* default_instance_data_; - const uint32_t* offsets_; + const ui32* offsets_; }; namespace { @@ -3002,8 +3002,8 @@ void RegisterFileLevelMetadata(const DescriptorTable* table) { RegisterAllTypesInternal(table->file_level_metadata, table->num_messages); } -void UnknownFieldSetSerializer(const uint8_t* base, uint32_t offset, - uint32_t tag, uint32_t has_offset, +void UnknownFieldSetSerializer(const uint8_t* base, ui32 offset, + ui32 tag, ui32 has_offset, io::CodedOutputStream* output) { const void* ptr = base + offset; const InternalMetadata* metadata = static_cast<const InternalMetadata*>(ptr); diff --git a/contrib/libs/protobuf/src/google/protobuf/generated_message_reflection.h b/contrib/libs/protobuf/src/google/protobuf/generated_message_reflection.h index 6a570ff607..6a20ecae54 100644 --- a/contrib/libs/protobuf/src/google/protobuf/generated_message_reflection.h +++ b/contrib/libs/protobuf/src/google/protobuf/generated_message_reflection.h @@ -107,7 +107,7 @@ class WeakFieldMap; // weak_field_map.h // message, or -1 if the message type has no extension // ranges. // oneof_case_offset: Offset in the message of an array of uint32s of -// size descriptor->oneof_decl_count(). Each uint32_t +// size descriptor->oneof_decl_count(). Each ui32 // indicates what field is set for each oneof. // object_size: The size of a message object of this type, as measured // by sizeof(). @@ -119,7 +119,7 @@ class WeakFieldMap; // weak_field_map.h struct ReflectionSchema { public: // Size of a google::protobuf::Message object of this type. - uint32_t GetObjectSize() const { return static_cast<uint32_t>(object_size_); } + ui32 GetObjectSize() const { return static_cast<ui32>(object_size_); } bool InRealOneof(const FieldDescriptor* field) const { return field->containing_oneof() && @@ -128,13 +128,13 @@ struct ReflectionSchema { // Offset of a non-oneof field. Getting a field offset is slightly more // efficient when we know statically that it is not a oneof field. - uint32_t GetFieldOffsetNonOneof(const FieldDescriptor* field) const { + ui32 GetFieldOffsetNonOneof(const FieldDescriptor* field) const { GOOGLE_DCHECK(!InRealOneof(field)); return OffsetValue(offsets_[field->index()], field->type()); } // Offset of any field. - uint32_t GetFieldOffset(const FieldDescriptor* field) const { + ui32 GetFieldOffset(const FieldDescriptor* field) const { if (InRealOneof(field)) { size_t offset = static_cast<size_t>(field->containing_type()->field_count() + @@ -149,58 +149,58 @@ struct ReflectionSchema { return Inlined(offsets_[field->index()], field->type()); } - uint32_t GetOneofCaseOffset(const OneofDescriptor* oneof_descriptor) const { - return static_cast<uint32_t>(oneof_case_offset_) + - static_cast<uint32_t>( + ui32 GetOneofCaseOffset(const OneofDescriptor* oneof_descriptor) const { + return static_cast<ui32>(oneof_case_offset_) + + static_cast<ui32>( static_cast<size_t>(oneof_descriptor->index()) * - sizeof(uint32_t)); + sizeof(ui32)); } bool HasHasbits() const { return has_bits_offset_ != -1; } // Bit index within the bit array of hasbits. Bit order is low-to-high. - uint32_t HasBitIndex(const FieldDescriptor* field) const { - if (has_bits_offset_ == -1) return static_cast<uint32_t>(-1); + ui32 HasBitIndex(const FieldDescriptor* field) const { + if (has_bits_offset_ == -1) return static_cast<ui32>(-1); GOOGLE_DCHECK(HasHasbits()); return has_bit_indices_[field->index()]; } // Byte offset of the hasbits array. - uint32_t HasBitsOffset() const { + ui32 HasBitsOffset() const { GOOGLE_DCHECK(HasHasbits()); - return static_cast<uint32_t>(has_bits_offset_); + return static_cast<ui32>(has_bits_offset_); } bool HasInlinedString() const { return inlined_string_donated_offset_ != -1; } // Bit index within the bit array of _inlined_string_donated_. Bit order is // low-to-high. - uint32_t InlinedStringIndex(const FieldDescriptor* field) const { + ui32 InlinedStringIndex(const FieldDescriptor* field) const { GOOGLE_DCHECK(HasInlinedString()); return inlined_string_indices_[field->index()]; } // Byte offset of the _inlined_string_donated_ array. - uint32_t InlinedStringDonatedOffset() const { + ui32 InlinedStringDonatedOffset() const { GOOGLE_DCHECK(HasInlinedString()); - return static_cast<uint32_t>(inlined_string_donated_offset_); + return static_cast<ui32>(inlined_string_donated_offset_); } // The offset of the InternalMetadataWithArena member. // For Lite this will actually be an InternalMetadataWithArenaLite. // The schema doesn't contain enough information to distinguish between // these two cases. - uint32_t GetMetadataOffset() const { - return static_cast<uint32_t>(metadata_offset_); + ui32 GetMetadataOffset() const { + return static_cast<ui32>(metadata_offset_); } // Whether this message has an ExtensionSet. bool HasExtensionSet() const { return extensions_offset_ != -1; } // The offset of the ExtensionSet in this message. - uint32_t GetExtensionSetOffset() const { + ui32 GetExtensionSetOffset() const { GOOGLE_DCHECK(HasExtensionSet()); - return static_cast<uint32_t>(extensions_offset_); + return static_cast<ui32>(extensions_offset_); } // The off set of WeakFieldMap when the message contains weak fields. @@ -252,20 +252,20 @@ struct ReflectionSchema { // ReflectionSchema schema = {a, b, c, d, e, ...}; // private: const Message* default_instance_; - const uint32_t* offsets_; - const uint32_t* has_bit_indices_; + const ui32* offsets_; + const ui32* has_bit_indices_; int has_bits_offset_; int metadata_offset_; int extensions_offset_; int oneof_case_offset_; int object_size_; int weak_field_map_offset_; - const uint32_t* inlined_string_indices_; + const ui32* inlined_string_indices_; int inlined_string_donated_offset_; // We tag offset values to provide additional data about fields (such as // "unused" or "lazy" or "inlined"). - static uint32_t OffsetValue(uint32_t v, FieldDescriptor::Type type) { + static ui32 OffsetValue(ui32 v, FieldDescriptor::Type type) { if (type == FieldDescriptor::TYPE_MESSAGE || type == FieldDescriptor::TYPE_STRING || type == FieldDescriptor::TYPE_BYTES) { @@ -274,7 +274,7 @@ struct ReflectionSchema { return v & 0x7FFFFFFFu; } - static bool Inlined(uint32_t v, FieldDescriptor::Type type) { + static bool Inlined(ui32 v, FieldDescriptor::Type type) { if (type == FieldDescriptor::TYPE_STRING || type == FieldDescriptor::TYPE_BYTES) { return (v & 1u) != 0u; @@ -292,9 +292,9 @@ struct ReflectionSchema { // EXPERIMENTAL: these are changing rapidly, and may completely disappear // or merge with ReflectionSchema. struct MigrationSchema { - int32_t offsets_index; - int32_t has_bit_indices_index; - int32_t inlined_string_indices_index; + i32 offsets_index; + i32 has_bit_indices_index; + i32 inlined_string_indices_index; int object_size; }; @@ -313,7 +313,7 @@ struct PROTOBUF_EXPORT DescriptorTable { int num_messages; const MigrationSchema* schemas; const Message* const* default_instances; - const uint32_t* offsets; + const ui32* offsets; // update the following descriptor arrays. Metadata* file_level_metadata; const EnumDescriptor** file_level_enum_descriptors; @@ -345,8 +345,8 @@ Metadata PROTOBUF_EXPORT AssignDescriptors(const DescriptorTable* (*table)(), // These cannot be in lite so we put them in the reflection. PROTOBUF_EXPORT void UnknownFieldSetSerializer(const uint8_t* base, - uint32_t offset, uint32_t tag, - uint32_t has_offset, + ui32 offset, ui32 tag, + ui32 has_offset, io::CodedOutputStream* output); struct PROTOBUF_EXPORT AddDescriptorsRunner { diff --git a/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven.cc b/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven.cc index 71ee647565..14ad6f3d95 100644 --- a/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven.cc +++ b/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven.cc @@ -45,7 +45,7 @@ namespace internal { namespace { -UnknownFieldSet* MutableUnknownFields(MessageLite* msg, int64_t arena_offset) { +UnknownFieldSet* MutableUnknownFields(MessageLite* msg, i64 arena_offset) { return Raw<InternalMetadata>(msg, arena_offset) ->mutable_unknown_fields<UnknownFieldSet>(); } diff --git a/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven.h b/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven.h index 178a0c1c6a..933030abc1 100644 --- a/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven.h +++ b/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven.h @@ -81,13 +81,13 @@ enum ProcessingTypes { static_assert(TYPE_MAP < kRepeatedMask, "Invalid enum"); struct PROTOBUF_EXPORT FieldMetadata { - uint32_t offset; // offset of this field in the struct - uint32_t tag; // field * 8 + wire_type + ui32 offset; // offset of this field in the struct + ui32 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_t has_offset; - uint32_t type; // the type of this field. + ui32 has_offset; + ui32 type; // the type of this field. const void* ptr; // auxiliary data // From the serializer point of view each fundamental type can occur in @@ -122,10 +122,10 @@ struct PROTOBUF_EXPORT FieldMetadata { // Additional data, needed for some types, is stored in // AuxiliaryParseTableField. struct ParseTableField { - uint32_t offset; + ui32 offset; // The presence_index ordinarily represents a has_bit index, but for fields // inside a oneof it represents the index in _oneof_case_. - uint32_t presence_index; + ui32 presence_index; unsigned char normal_wiretype; unsigned char packed_wiretype; @@ -187,10 +187,10 @@ struct ParseTable { // TODO(ckennelly): Do something with this padding. // TODO(ckennelly): Vet these for sign extension. - int64_t has_bits_offset; - int64_t oneof_case_offset; - int64_t extension_offset; - int64_t arena_offset; + i64 has_bits_offset; + i64 oneof_case_offset; + i64 extension_offset; + i64 arena_offset; // ExplicitlyInitialized<T> -> T requires a reinterpret_cast, which prevents // the tables from being constructed as a constexpr. We use void to avoid @@ -248,7 +248,7 @@ struct SerializationTable { PROTOBUF_EXPORT void SerializeInternal(const uint8_t* base, const FieldMetadata* table, - int32_t num_fields, + i32 num_fields, io::CodedOutputStream* output); inline void TableSerialize(const MessageLite& msg, @@ -260,7 +260,7 @@ inline void TableSerialize(const MessageLite& 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_t*>(base + field_table->offset); + // *reinterpret_cast<const i32*>(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); @@ -268,7 +268,7 @@ inline void TableSerialize(const MessageLite& msg, PROTOBUF_EXPORT uint8_t* SerializeInternalToArray(const uint8_t* base, const FieldMetadata* table, - int32_t num_fields, bool is_deterministic, + i32 num_fields, bool is_deterministic, uint8_t* buffer); inline uint8_t* TableSerializeToArray(const MessageLite& msg, @@ -306,8 +306,8 @@ struct CompareMapKey { }; template <typename MapFieldType, const SerializationTable* table> -void MapFieldSerializer(const uint8_t* base, uint32_t offset, uint32_t tag, - uint32_t has_offset, io::CodedOutputStream* output) { +void MapFieldSerializer(const uint8_t* base, ui32 offset, ui32 tag, + ui32 has_offset, io::CodedOutputStream* output) { typedef MapEntryHelper<typename MapFieldType::EntryTypeTrait> Entry; typedef typename MapFieldType::MapType::const_iterator Iter; diff --git a/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven_lite.cc b/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven_lite.cc index 9bcdde5cee..fca8a57079 100644 --- a/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven_lite.cc +++ b/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven_lite.cc @@ -43,7 +43,7 @@ namespace internal { namespace { -TProtoStringType* MutableUnknownFields(MessageLite* msg, int64_t arena_offset) { +TProtoStringType* MutableUnknownFields(MessageLite* msg, i64 arena_offset) { return Raw<InternalMetadata>(msg, arena_offset) ->mutable_unknown_fields<TProtoStringType>(); } diff --git a/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven_lite.h b/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven_lite.h index 78c9bb6dd4..0c3bc16600 100644 --- a/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven_lite.h +++ b/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven_lite.h @@ -70,18 +70,18 @@ enum Cardinality { }; template <typename Type> -inline Type* Raw(MessageLite* msg, int64_t offset) { +inline Type* Raw(MessageLite* msg, i64 offset) { return reinterpret_cast<Type*>(reinterpret_cast<uint8_t*>(msg) + offset); } template <typename Type> -inline const Type* Raw(const MessageLite* msg, int64_t offset) { +inline const Type* Raw(const MessageLite* msg, i64 offset) { return reinterpret_cast<const Type*>(reinterpret_cast<const uint8_t*>(msg) + offset); } inline ExtensionSet* GetExtensionSet(MessageLite* msg, - int64_t extension_offset) { + i64 extension_offset) { if (extension_offset == -1) { return NULL; } @@ -90,7 +90,7 @@ inline ExtensionSet* GetExtensionSet(MessageLite* msg, } template <typename Type> -inline Type* AddField(MessageLite* msg, int64_t offset) { +inline Type* AddField(MessageLite* msg, i64 offset) { static_assert(std::is_trivial<Type>::value || std::is_same<Type, InlinedStringField>::value, "Do not assign"); @@ -100,7 +100,7 @@ inline Type* AddField(MessageLite* msg, int64_t offset) { } template <> -inline TProtoStringType* AddField<TProtoStringType>(MessageLite* msg, int64_t offset) { +inline TProtoStringType* AddField<TProtoStringType>(MessageLite* msg, i64 offset) { RepeatedPtrField<TProtoStringType>* repeated = Raw<RepeatedPtrField<TProtoStringType>>(msg, offset); return repeated->Add(); @@ -108,35 +108,35 @@ inline TProtoStringType* AddField<TProtoStringType>(MessageLite* msg, int64_t of template <typename Type> -inline void AddField(MessageLite* msg, int64_t offset, Type value) { +inline void AddField(MessageLite* msg, i64 offset, Type value) { static_assert(std::is_trivial<Type>::value, "Do not assign"); *AddField<Type>(msg, offset) = value; } -inline void SetBit(uint32_t* has_bits, uint32_t has_bit_index) { +inline void SetBit(ui32* has_bits, ui32 has_bit_index) { GOOGLE_DCHECK(has_bits != nullptr); - uint32_t mask = static_cast<uint32_t>(1u) << (has_bit_index % 32); + ui32 mask = static_cast<ui32>(1u) << (has_bit_index % 32); has_bits[has_bit_index / 32u] |= mask; } template <typename Type> -inline Type* MutableField(MessageLite* msg, uint32_t* has_bits, - uint32_t has_bit_index, int64_t offset) { +inline Type* MutableField(MessageLite* msg, ui32* has_bits, + ui32 has_bit_index, i64 offset) { SetBit(has_bits, has_bit_index); return Raw<Type>(msg, offset); } template <typename Type> -inline void SetField(MessageLite* msg, uint32_t* has_bits, - uint32_t has_bit_index, int64_t offset, Type value) { +inline void SetField(MessageLite* msg, ui32* has_bits, + ui32 has_bit_index, i64 offset, Type value) { static_assert(std::is_trivial<Type>::value, "Do not assign"); *MutableField<Type>(msg, has_bits, has_bit_index, offset) = value; } template <typename Type> -inline void SetOneofField(MessageLite* msg, uint32_t* oneof_case, - uint32_t oneof_case_index, int64_t offset, +inline void SetOneofField(MessageLite* msg, ui32* oneof_case, + ui32 oneof_case_index, i64 offset, int field_number, Type value) { oneof_case[oneof_case_index] = field_number; *Raw<Type>(msg, offset) = value; @@ -179,9 +179,9 @@ inline void ClearOneofField(const ParseTableField& field, Arena* arena, template <ProcessingType field_type> inline void ResetOneofField(const ParseTable& table, int field_number, Arena* arena, MessageLite* msg, - uint32_t* oneof_case, int64_t offset, + ui32* oneof_case, i64 offset, const void* default_ptr) { - if (static_cast<int64_t>(*oneof_case) == field_number) { + if (static_cast<i64>(*oneof_case) == field_number) { // The oneof is already set to the right type, so there is no need to clear // it. return; @@ -213,8 +213,8 @@ inline void ResetOneofField(const ParseTable& table, int field_number, template <typename UnknownFieldHandler, Cardinality cardinality, bool is_string_type, StringType ctype> static inline bool HandleString(io::CodedInputStream* input, MessageLite* msg, - Arena* arena, uint32_t* has_bits, - uint32_t has_bit_index, int64_t offset, + Arena* arena, ui32* has_bits, + ui32 has_bit_index, i64 offset, const void* default_ptr, const char* field_name) { StringPiece utf8_string_data; @@ -300,8 +300,8 @@ static inline bool HandleString(io::CodedInputStream* input, MessageLite* msg, template <typename UnknownFieldHandler, Cardinality cardinality> inline bool HandleEnum(const ParseTable& table, io::CodedInputStream* input, - MessageLite* msg, uint32_t* presence, - uint32_t presence_index, int64_t offset, uint32_t tag, + MessageLite* msg, ui32* presence, + ui32 presence_index, i64 offset, ui32 tag, int field_number) { int value; if (PROTOBUF_PREDICT_FALSE( @@ -366,7 +366,7 @@ class MergePartialFromCodedStreamHelper { } }; -template <typename UnknownFieldHandler, uint32_t kMaxTag> +template <typename UnknownFieldHandler, ui32 kMaxTag> bool MergePartialFromCodedStreamInlined(MessageLite* msg, const ParseTable& table, io::CodedInputStream* input) { @@ -375,11 +375,11 @@ bool MergePartialFromCodedStreamInlined(MessageLite* msg, // // TODO(ckennelly): Make this a compile-time parameter with templates. GOOGLE_DCHECK_GE(table.has_bits_offset, 0); - uint32_t* has_bits = Raw<uint32_t>(msg, table.has_bits_offset); + ui32* has_bits = Raw<ui32>(msg, table.has_bits_offset); GOOGLE_DCHECK(has_bits != NULL); while (true) { - uint32_t tag = input->ReadTagWithCutoffNoLastTag(kMaxTag).first; + ui32 tag = input->ReadTagWithCutoffNoLastTag(kMaxTag).first; const WireFormatLite::WireType wire_type = WireFormatLite::GetTagWireType(tag); const int field_number = WireFormatLite::GetTagFieldNumber(tag); @@ -407,8 +407,8 @@ bool MergePartialFromCodedStreamInlined(MessageLite* msg, const ParseTableField* data = table.fields + field_number; // TODO(ckennelly): Avoid sign extension - const int64_t presence_index = data->presence_index; - const int64_t offset = data->offset; + const i64 presence_index = data->presence_index; + const i64 offset = data->offset; const unsigned char processing_type = data->processing_type; if (data->normal_wiretype == static_cast<unsigned char>(wire_type)) { @@ -434,7 +434,7 @@ bool MergePartialFromCodedStreamInlined(MessageLite* msg, break; \ } \ case (WireFormatLite::TYPE_##TYPE) | kOneofMask: { \ - uint32_t* oneof_case = Raw<uint32_t>(msg, table.oneof_case_offset); \ + ui32* oneof_case = Raw<ui32>(msg, table.oneof_case_offset); \ CPPTYPE value; \ if (PROTOBUF_PREDICT_FALSE( \ (!WireFormatLite::ReadPrimitive< \ @@ -448,17 +448,17 @@ bool MergePartialFromCodedStreamInlined(MessageLite* msg, break; \ } - HANDLE_TYPE(INT32, int32_t) - HANDLE_TYPE(INT64, int64_t) - HANDLE_TYPE(SINT32, int32_t) - HANDLE_TYPE(SINT64, int64_t) - HANDLE_TYPE(UINT32, uint32_t) - HANDLE_TYPE(UINT64, uint64_t) + HANDLE_TYPE(INT32, i32) + HANDLE_TYPE(INT64, i64) + HANDLE_TYPE(SINT32, i32) + HANDLE_TYPE(SINT64, i64) + HANDLE_TYPE(UINT32, ui32) + HANDLE_TYPE(UINT64, ui64) - HANDLE_TYPE(FIXED32, uint32_t) - HANDLE_TYPE(FIXED64, uint64_t) - HANDLE_TYPE(SFIXED32, int32_t) - HANDLE_TYPE(SFIXED64, int64_t) + HANDLE_TYPE(FIXED32, ui32) + HANDLE_TYPE(FIXED64, ui64) + HANDLE_TYPE(SFIXED32, i32) + HANDLE_TYPE(SFIXED64, i64) HANDLE_TYPE(FLOAT, float) HANDLE_TYPE(DOUBLE, double) @@ -505,7 +505,7 @@ bool MergePartialFromCodedStreamInlined(MessageLite* msg, #endif // !GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED { Arena* const arena = msg->GetArena(); - uint32_t* oneof_case = Raw<uint32_t>(msg, table.oneof_case_offset); + ui32* oneof_case = Raw<ui32>(msg, table.oneof_case_offset); const void* default_ptr = table.aux[field_number].strings.default_ptr; ResetOneofField<ProcessingType_STRING>( @@ -572,7 +572,7 @@ bool MergePartialFromCodedStreamInlined(MessageLite* msg, } case (WireFormatLite::TYPE_STRING) | kOneofMask: { Arena* const arena = msg->GetArena(); - uint32_t* oneof_case = Raw<uint32_t>(msg, table.oneof_case_offset); + ui32* oneof_case = Raw<ui32>(msg, table.oneof_case_offset); const void* default_ptr = table.aux[field_number].strings.default_ptr; const char* field_name = table.aux[field_number].strings.field_name; @@ -609,7 +609,7 @@ bool MergePartialFromCodedStreamInlined(MessageLite* msg, break; } case WireFormatLite::TYPE_ENUM | kOneofMask: { - uint32_t* oneof_case = Raw<uint32_t>(msg, table.oneof_case_offset); + ui32* oneof_case = Raw<ui32>(msg, table.oneof_case_offset); if (PROTOBUF_PREDICT_FALSE( (!HandleEnum<UnknownFieldHandler, Cardinality_ONEOF>( table, input, msg, oneof_case, presence_index, offset, @@ -699,7 +699,7 @@ bool MergePartialFromCodedStreamInlined(MessageLite* msg, } case WireFormatLite::TYPE_MESSAGE | kOneofMask: { Arena* const arena = msg->GetArena(); - uint32_t* oneof_case = Raw<uint32_t>(msg, table.oneof_case_offset); + ui32* oneof_case = Raw<ui32>(msg, table.oneof_case_offset); MessageLite** submsg_holder = Raw<MessageLite*>(msg, offset); ResetOneofField<ProcessingType_MESSAGE>( table, field_number, arena, msg, oneof_case + presence_index, @@ -768,17 +768,17 @@ bool MergePartialFromCodedStreamInlined(MessageLite* msg, break; \ } - HANDLE_PACKED_TYPE(INT32, int32_t, Int32) - HANDLE_PACKED_TYPE(INT64, int64_t, Int64) - HANDLE_PACKED_TYPE(SINT32, int32_t, Int32) - HANDLE_PACKED_TYPE(SINT64, int64_t, Int64) - HANDLE_PACKED_TYPE(UINT32, uint32_t, UInt32) - HANDLE_PACKED_TYPE(UINT64, uint64_t, UInt64) + HANDLE_PACKED_TYPE(INT32, i32, Int32) + HANDLE_PACKED_TYPE(INT64, i64, Int64) + HANDLE_PACKED_TYPE(SINT32, i32, Int32) + HANDLE_PACKED_TYPE(SINT64, i64, Int64) + HANDLE_PACKED_TYPE(UINT32, ui32, UInt32) + HANDLE_PACKED_TYPE(UINT64, ui64, UInt64) - HANDLE_PACKED_TYPE(FIXED32, uint32_t, UInt32) - HANDLE_PACKED_TYPE(FIXED64, uint64_t, UInt64) - HANDLE_PACKED_TYPE(SFIXED32, int32_t, Int32) - HANDLE_PACKED_TYPE(SFIXED64, int64_t, Int64) + HANDLE_PACKED_TYPE(FIXED32, ui32, UInt32) + HANDLE_PACKED_TYPE(FIXED64, ui64, UInt64) + HANDLE_PACKED_TYPE(SFIXED32, i32, Int32) + HANDLE_PACKED_TYPE(SFIXED64, i64, Int64) HANDLE_PACKED_TYPE(FLOAT, float, Float) HANDLE_PACKED_TYPE(DOUBLE, double, Double) @@ -790,7 +790,7 @@ bool MergePartialFromCodedStreamInlined(MessageLite* msg, // InternalMetadata) when all inputs in the repeated series // are valid, we implement our own parser rather than call // WireFormat::ReadPackedEnumPreserveUnknowns. - uint32_t length; + ui32 length; if (PROTOBUF_PREDICT_FALSE(!input->ReadVarint32(&length))) { return false; } @@ -863,7 +863,7 @@ bool MergePartialFromCodedStreamImpl(MessageLite* msg, const ParseTable& table, msg, table, input); } else { return MergePartialFromCodedStreamInlined< - UnknownFieldHandler, std::numeric_limits<uint32_t>::max()>(msg, table, + UnknownFieldHandler, std::numeric_limits<ui32>::max()>(msg, table, input); } } diff --git a/contrib/libs/protobuf/src/google/protobuf/generated_message_tctable_decl.h b/contrib/libs/protobuf/src/google/protobuf/generated_message_tctable_decl.h index d294caa5df..389472ca69 100644 --- a/contrib/libs/protobuf/src/google/protobuf/generated_message_tctable_decl.h +++ b/contrib/libs/protobuf/src/google/protobuf/generated_message_tctable_decl.h @@ -52,8 +52,8 @@ namespace internal { struct TcFieldData { constexpr TcFieldData() : data(0) {} constexpr TcFieldData(uint16_t coded_tag, uint8_t hasbit_idx, uint16_t offset) - : data(static_cast<uint64_t>(offset) << 48 | - static_cast<uint64_t>(hasbit_idx) << 16 | coded_tag) {} + : data(static_cast<ui64>(offset) << 48 | + static_cast<ui64>(hasbit_idx) << 16 | coded_tag) {} template <typename TagType = uint16_t> TagType coded_tag() const { @@ -62,7 +62,7 @@ struct TcFieldData { uint8_t hasbit_idx() const { return static_cast<uint8_t>(data >> 16); } uint16_t offset() const { return static_cast<uint16_t>(data >> 48); } - uint64_t data; + ui64 data; }; struct TailCallParseTableBase; @@ -77,12 +77,12 @@ typedef const char* (*TailCallParseFunc)(PROTOBUF_TC_PARAM_DECL); #endif // Base class for message-level table with info for the tail-call parser. -struct alignas(uint64_t) TailCallParseTableBase { +struct alignas(ui64) TailCallParseTableBase { // Common attributes for message layout: uint16_t has_bits_offset; uint16_t extension_offset; - uint32_t extension_range_low; - uint32_t extension_range_high; + ui32 extension_range_low; + ui32 extension_range_high; const MessageLite* default_instance; // Handler for fields which are not handled by table dispatch. diff --git a/contrib/libs/protobuf/src/google/protobuf/generated_message_tctable_impl.h b/contrib/libs/protobuf/src/google/protobuf/generated_message_tctable_impl.h index 6ea72d9bf3..159637cc3e 100644 --- a/contrib/libs/protobuf/src/google/protobuf/generated_message_tctable_impl.h +++ b/contrib/libs/protobuf/src/google/protobuf/generated_message_tctable_impl.h @@ -118,7 +118,7 @@ class TcParserBase { return table->fallback(PROTOBUF_TC_PARAM_PASS); } ptr += sizeof(TagType); - hasbits |= (uint64_t{1} << data.hasbit_idx()); + hasbits |= (ui64{1} << data.hasbit_idx()); auto& field = RefAt<FieldType*>(msg, data.offset()); if (field == nullptr) { auto arena = ctx->data().arena; @@ -175,12 +175,12 @@ class TcParserBase { } static inline PROTOBUF_ALWAYS_INLINE void SyncHasbits( - MessageLite* msg, uint64_t hasbits, const TailCallParseTableBase* table) { - const uint32_t has_bits_offset = table->has_bits_offset; + MessageLite* msg, ui64 hasbits, const TailCallParseTableBase* table) { + const ui32 has_bits_offset = table->has_bits_offset; if (has_bits_offset) { // Only the first 32 has-bits are updated. Nothing above those is stored, // but e.g. messages without has-bits update the upper bits. - RefAt<uint32_t>(msg, has_bits_offset) = static_cast<uint32_t>(hasbits); + RefAt<ui32>(msg, has_bits_offset) = static_cast<ui32>(hasbits); } } @@ -217,14 +217,14 @@ class TcParserBase { if (PROTOBUF_PREDICT_FALSE(!(x))) return nullptr /* NOLINT */ SyncHasbits(msg, hasbits, table); - uint32 tag; + ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); CHK_(ptr); if ((tag & 7) == WireFormatLite::WIRETYPE_END_GROUP || tag == 0) { ctx->SetLastTag(tag); return ptr; } - uint32_t num = tag >> 3; + ui32 num = tag >> 3; if (table->extension_range_low <= num && num <= table->extension_range_high) { return RefAt<ExtensionSet>(msg, table->extension_offset) @@ -244,7 +244,7 @@ class TcParserBase { // This is templated on lg2(table size), since dispatching depends upon the size // of the table. The template parameter avoids runtime overhead for computing // the table entry index. -template <uint32_t kPowerOf2> +template <ui32 kPowerOf2> struct TcParser final : TcParserBase { // Dispatch to the designated parse function inline PROTOBUF_ALWAYS_INLINE static const char* TagDispatch( @@ -274,10 +274,10 @@ struct TcParser final : TcParserBase { ParseContext* ctx, const TailCallParseTableBase* table) { ScopedArenaSwap saved(msg, ctx); - const uint32_t has_bits_offset = table->has_bits_offset; + const ui32 has_bits_offset = table->has_bits_offset; while (!ctx->Done(&ptr)) { - uint64_t hasbits = 0; - if (has_bits_offset) hasbits = RefAt<uint32_t>(msg, has_bits_offset); + ui64 hasbits = 0; + if (has_bits_offset) hasbits = RefAt<ui32>(msg, has_bits_offset); ptr = TagDispatch(msg, ptr, ctx, table, hasbits, {}); if (ptr == nullptr) break; if (ctx->LastTag() != 1) break; // Ended on terminating tag diff --git a/contrib/libs/protobuf/src/google/protobuf/generated_message_tctable_impl.inc b/contrib/libs/protobuf/src/google/protobuf/generated_message_tctable_impl.inc index 8d38a513e2..7af615973d 100644 --- a/contrib/libs/protobuf/src/google/protobuf/generated_message_tctable_impl.inc +++ b/contrib/libs/protobuf/src/google/protobuf/generated_message_tctable_impl.inc @@ -39,48 +39,48 @@ PROTOBUF_TCT_EXTERN template const char *TcParser<2>::ParseLoop(::PROTOBUF_NAMES PROTOBUF_TCT_EXTERN template const char *TcParser<3>::ParseLoop(::PROTOBUF_NAMESPACE_ID::MessageLite*, char const*, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext*, ::PROTOBUF_NAMESPACE_ID::internal::TailCallParseTableBase const*); PROTOBUF_TCT_EXTERN template const char *TcParser<4>::ParseLoop(::PROTOBUF_NAMESPACE_ID::MessageLite*, char const*, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext*, ::PROTOBUF_NAMESPACE_ID::internal::TailCallParseTableBase const*); PROTOBUF_TCT_EXTERN template const char *TcParser<5>::ParseLoop(::PROTOBUF_NAMESPACE_ID::MessageLite*, char const*, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext*, ::PROTOBUF_NAMESPACE_ID::internal::TailCallParseTableBase const*); -PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularFixed<ui64, uint8_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularFixed<ui64, uint8_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularFixed<ui64, uint8_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularFixed<ui64, uint8_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularFixed<ui64, uint8_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedFixed<ui64, uint8_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedFixed<ui64, uint8_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularFixed<ui32, uint8_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularFixed<ui32, uint8_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularFixed<ui32, uint8_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularFixed<ui32, uint8_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularFixed<ui32, uint8_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedFixed<ui32, uint8_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedFixed<ui32, uint8_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<ui64, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<ui64, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<ui64, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<ui64, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<ui64, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<ui64, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<ui64, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<ui32, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<ui32, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<ui32, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<ui32, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<ui32, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<ui32, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<ui32, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<i64, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<i64, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<i64, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<i64, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<i64, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<i64, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<i64, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<i32, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<i32, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<i32, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<i32, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<i32, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<i32, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<i32, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); @@ -94,48 +94,48 @@ PROTOBUF_TCT_EXTERN template const char* TcParserBase::SingularString<uint8_t, : PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8>(PROTOBUF_TC_PARAM_DECL); PROTOBUF_TCT_EXTERN template const char* TcParserBase::SingularString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL); PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularFixed<ui64, uint16_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularFixed<ui64, uint16_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularFixed<ui64, uint16_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularFixed<ui64, uint16_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularFixed<ui64, uint16_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedFixed<ui64, uint16_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedFixed<ui64, uint16_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularFixed<ui32, uint16_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularFixed<ui32, uint16_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularFixed<ui32, uint16_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularFixed<ui32, uint16_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularFixed<ui32, uint16_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedFixed<ui32, uint16_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedFixed<ui32, uint16_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<ui64, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<ui64, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<ui64, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<ui64, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<ui64, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<ui64, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<ui64, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<ui32, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<ui32, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<ui32, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<ui32, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<ui32, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<ui32, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<ui32, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<i64, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<i64, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<i64, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<i64, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<i64, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<i64, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<i64, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<i32, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<i32, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<i32, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<i32, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<i32, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<i32, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<i32, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); diff --git a/contrib/libs/protobuf/src/google/protobuf/generated_message_util.cc b/contrib/libs/protobuf/src/google/protobuf/generated_message_util.cc index 4da3bff9ba..c6458275ca 100644 --- a/contrib/libs/protobuf/src/google/protobuf/generated_message_util.cc +++ b/contrib/libs/protobuf/src/google/protobuf/generated_message_util.cc @@ -126,9 +126,9 @@ struct PrimitiveTypeHelper<WireFormatLite::TYPE_BOOL> { template <> struct PrimitiveTypeHelper<WireFormatLite::TYPE_INT32> { - typedef int32_t Type; + typedef i32 Type; static void Serialize(const void* ptr, io::CodedOutputStream* output) { - WireFormatLite::WriteInt32NoTag(Get<int32_t>(ptr), output); + WireFormatLite::WriteInt32NoTag(Get<i32>(ptr), output); } static uint8_t* SerializeToArray(const void* ptr, uint8_t* buffer) { return WireFormatLite::WriteInt32NoTagToArray(Get<Type>(ptr), buffer); @@ -137,9 +137,9 @@ struct PrimitiveTypeHelper<WireFormatLite::TYPE_INT32> { template <> struct PrimitiveTypeHelper<WireFormatLite::TYPE_SINT32> { - typedef int32_t Type; + typedef i32 Type; static void Serialize(const void* ptr, io::CodedOutputStream* output) { - WireFormatLite::WriteSInt32NoTag(Get<int32_t>(ptr), output); + WireFormatLite::WriteSInt32NoTag(Get<i32>(ptr), output); } static uint8_t* SerializeToArray(const void* ptr, uint8_t* buffer) { return WireFormatLite::WriteSInt32NoTagToArray(Get<Type>(ptr), buffer); @@ -148,9 +148,9 @@ struct PrimitiveTypeHelper<WireFormatLite::TYPE_SINT32> { template <> struct PrimitiveTypeHelper<WireFormatLite::TYPE_UINT32> { - typedef uint32_t Type; + typedef ui32 Type; static void Serialize(const void* ptr, io::CodedOutputStream* output) { - WireFormatLite::WriteUInt32NoTag(Get<uint32_t>(ptr), output); + WireFormatLite::WriteUInt32NoTag(Get<ui32>(ptr), output); } static uint8_t* SerializeToArray(const void* ptr, uint8_t* buffer) { return WireFormatLite::WriteUInt32NoTagToArray(Get<Type>(ptr), buffer); @@ -158,9 +158,9 @@ struct PrimitiveTypeHelper<WireFormatLite::TYPE_UINT32> { }; template <> struct PrimitiveTypeHelper<WireFormatLite::TYPE_INT64> { - typedef int64_t Type; + typedef i64 Type; static void Serialize(const void* ptr, io::CodedOutputStream* output) { - WireFormatLite::WriteInt64NoTag(Get<int64_t>(ptr), output); + WireFormatLite::WriteInt64NoTag(Get<i64>(ptr), output); } static uint8_t* SerializeToArray(const void* ptr, uint8_t* buffer) { return WireFormatLite::WriteInt64NoTagToArray(Get<Type>(ptr), buffer); @@ -169,9 +169,9 @@ struct PrimitiveTypeHelper<WireFormatLite::TYPE_INT64> { template <> struct PrimitiveTypeHelper<WireFormatLite::TYPE_SINT64> { - typedef int64_t Type; + typedef i64 Type; static void Serialize(const void* ptr, io::CodedOutputStream* output) { - WireFormatLite::WriteSInt64NoTag(Get<int64_t>(ptr), output); + WireFormatLite::WriteSInt64NoTag(Get<i64>(ptr), output); } static uint8_t* SerializeToArray(const void* ptr, uint8_t* buffer) { return WireFormatLite::WriteSInt64NoTagToArray(Get<Type>(ptr), buffer); @@ -179,9 +179,9 @@ struct PrimitiveTypeHelper<WireFormatLite::TYPE_SINT64> { }; template <> struct PrimitiveTypeHelper<WireFormatLite::TYPE_UINT64> { - typedef uint64_t Type; + typedef ui64 Type; static void Serialize(const void* ptr, io::CodedOutputStream* output) { - WireFormatLite::WriteUInt64NoTag(Get<uint64_t>(ptr), output); + WireFormatLite::WriteUInt64NoTag(Get<ui64>(ptr), output); } static uint8_t* SerializeToArray(const void* ptr, uint8_t* buffer) { return WireFormatLite::WriteUInt64NoTagToArray(Get<Type>(ptr), buffer); @@ -190,9 +190,9 @@ struct PrimitiveTypeHelper<WireFormatLite::TYPE_UINT64> { template <> struct PrimitiveTypeHelper<WireFormatLite::TYPE_FIXED32> { - typedef uint32_t Type; + typedef ui32 Type; static void Serialize(const void* ptr, io::CodedOutputStream* output) { - WireFormatLite::WriteFixed32NoTag(Get<uint32_t>(ptr), output); + WireFormatLite::WriteFixed32NoTag(Get<ui32>(ptr), output); } static uint8_t* SerializeToArray(const void* ptr, uint8_t* buffer) { return WireFormatLite::WriteFixed32NoTagToArray(Get<Type>(ptr), buffer); @@ -201,9 +201,9 @@ struct PrimitiveTypeHelper<WireFormatLite::TYPE_FIXED32> { template <> struct PrimitiveTypeHelper<WireFormatLite::TYPE_FIXED64> { - typedef uint64_t Type; + typedef ui64 Type; static void Serialize(const void* ptr, io::CodedOutputStream* output) { - WireFormatLite::WriteFixed64NoTag(Get<uint64_t>(ptr), output); + WireFormatLite::WriteFixed64NoTag(Get<ui64>(ptr), output); } static uint8_t* SerializeToArray(const void* ptr, uint8_t* buffer) { return WireFormatLite::WriteFixed64NoTagToArray(Get<Type>(ptr), buffer); @@ -217,12 +217,12 @@ struct PrimitiveTypeHelper<WireFormatLite::TYPE_ENUM> template <> struct PrimitiveTypeHelper<WireFormatLite::TYPE_SFIXED32> : PrimitiveTypeHelper<WireFormatLite::TYPE_FIXED32> { - typedef int32_t Type; + typedef i32 Type; }; template <> struct PrimitiveTypeHelper<WireFormatLite::TYPE_SFIXED64> : PrimitiveTypeHelper<WireFormatLite::TYPE_FIXED64> { - typedef int64_t Type; + typedef i64 Type; }; template <> struct PrimitiveTypeHelper<WireFormatLite::TYPE_FLOAT> @@ -270,12 +270,12 @@ void SerializeTo(const void* ptr, O* output) { } template <typename O> -void WriteTagTo(uint32_t tag, O* output) { +void WriteTagTo(ui32 tag, O* output) { SerializeTo<WireFormatLite::TYPE_UINT32>(&tag, output); } template <typename O> -void WriteLengthTo(uint32_t length, O* output) { +void WriteLengthTo(ui32 length, O* output) { SerializeTo<WireFormatLite::TYPE_UINT32>(&length, output); } @@ -316,7 +316,7 @@ void SerializeMessageNoTable(const MessageLite* msg, ArrayOutput* output) { // Helper to branch to fast path if possible void SerializeMessageDispatch(const MessageLite& msg, const FieldMetadata* field_table, int num_fields, - int32_t cached_size, + i32 cached_size, io::CodedOutputStream* output) { const uint8_t* base = reinterpret_cast<const uint8_t*>(&msg); SerializeInternal(base, field_table, num_fields, output); @@ -325,7 +325,7 @@ void SerializeMessageDispatch(const MessageLite& msg, // Helper to branch to fast path if possible void SerializeMessageDispatch(const MessageLite& msg, const FieldMetadata* field_table, int num_fields, - int32_t cached_size, ArrayOutput* output) { + i32 cached_size, ArrayOutput* output) { const uint8_t* base = reinterpret_cast<const uint8_t*>(&msg); output->ptr = SerializeInternalToArray(base, field_table, num_fields, output->is_deterministic, output->ptr); @@ -347,7 +347,7 @@ void SerializeMessageTo(const MessageLite* msg, const void* table_ptr, const FieldMetadata* field_table = table->field_table; const uint8_t* base = reinterpret_cast<const uint8_t*>(msg); int cached_size = - *reinterpret_cast<const int32_t*>(base + field_table->offset); + *reinterpret_cast<const i32*>(base + field_table->offset); WriteLengthTo(cached_size, output); int num_fields = table->num_fields - 1; SerializeMessageDispatch(*msg, field_table + 1, num_fields, cached_size, @@ -368,7 +368,7 @@ void SerializeGroupTo(const MessageLite* msg, const void* table_ptr, const FieldMetadata* field_table = table->field_table; const uint8_t* base = reinterpret_cast<const uint8_t*>(msg); int cached_size = - *reinterpret_cast<const int32_t*>(base + field_table->offset); + *reinterpret_cast<const i32*>(base + field_table->offset); int num_fields = table->num_fields - 1; SerializeMessageDispatch(*msg, field_table + 1, num_fields, cached_size, output); @@ -628,7 +628,7 @@ bool IsNull<FieldMetadata::kInlinedType>(const void* ptr) { void SerializeInternal(const uint8_t* base, const FieldMetadata* field_metadata_table, - int32_t num_fields, io::CodedOutputStream* output) { + i32 num_fields, io::CodedOutputStream* output) { SpecialSerializer func = nullptr; for (int i = 0; i < num_fields; i++) { const FieldMetadata& field_metadata = field_metadata_table[i]; @@ -670,7 +670,7 @@ void SerializeInternal(const uint8_t* base, uint8_t* SerializeInternalToArray(const uint8_t* base, const FieldMetadata* field_metadata_table, - int32_t num_fields, bool is_deterministic, + i32 num_fields, bool is_deterministic, uint8_t* buffer) { ArrayOutput array_output = {buffer, is_deterministic}; ArrayOutput* output = &array_output; @@ -719,14 +719,14 @@ uint8_t* SerializeInternalToArray(const uint8_t* base, #undef SERIALIZERS_FOR_TYPE void ExtensionSerializer(const MessageLite* extendee, const uint8_t* ptr, - uint32_t offset, uint32_t tag, uint32_t has_offset, + ui32 offset, ui32 tag, ui32 has_offset, io::CodedOutputStream* output) { reinterpret_cast<const ExtensionSet*>(ptr + offset) ->SerializeWithCachedSizes(extendee, tag, has_offset, output); } -void UnknownFieldSerializerLite(const uint8_t* ptr, uint32_t offset, - uint32_t tag, uint32_t has_offset, +void UnknownFieldSerializerLite(const uint8_t* ptr, ui32 offset, + ui32 tag, ui32 has_offset, io::CodedOutputStream* output) { output->WriteString( reinterpret_cast<const InternalMetadata*>(ptr + offset) diff --git a/contrib/libs/protobuf/src/google/protobuf/generated_message_util.h b/contrib/libs/protobuf/src/google/protobuf/generated_message_util.h index 65139d032a..a1f6c2169c 100644 --- a/contrib/libs/protobuf/src/google/protobuf/generated_message_util.h +++ b/contrib/libs/protobuf/src/google/protobuf/generated_message_util.h @@ -132,28 +132,28 @@ bool AllAreInitializedWeak(const RepeatedPtrField<T>& t) { return true; } -inline bool IsPresent(const void* base, uint32_t hasbit) { - const uint32_t* has_bits_array = static_cast<const uint32_t*>(base); +inline bool IsPresent(const void* base, ui32 hasbit) { + const ui32* has_bits_array = static_cast<const ui32*>(base); return (has_bits_array[hasbit / 32] & (1u << (hasbit & 31))) != 0; } -inline bool IsOneofPresent(const void* base, uint32_t offset, uint32_t tag) { - const uint32_t* oneof = reinterpret_cast<const uint32_t*>( +inline bool IsOneofPresent(const void* base, ui32 offset, ui32 tag) { + const ui32* oneof = reinterpret_cast<const ui32*>( static_cast<const uint8_t*>(base) + offset); return *oneof == tag >> 3; } -typedef void (*SpecialSerializer)(const uint8_t* base, uint32_t offset, - uint32_t tag, uint32_t has_offset, +typedef void (*SpecialSerializer)(const uint8_t* base, ui32 offset, + ui32 tag, ui32 has_offset, io::CodedOutputStream* output); PROTOBUF_EXPORT void ExtensionSerializer(const MessageLite* extendee, - const uint8_t* ptr, uint32_t offset, - uint32_t tag, uint32_t has_offset, + const uint8_t* ptr, ui32 offset, + ui32 tag, ui32 has_offset, io::CodedOutputStream* output); PROTOBUF_EXPORT void UnknownFieldSerializerLite(const uint8_t* base, - uint32_t offset, uint32_t tag, - uint32_t has_offset, + ui32 offset, ui32 tag, + ui32 has_offset, io::CodedOutputStream* output); PROTOBUF_EXPORT MessageLite* DuplicateIfNonNullInternal(MessageLite* message); diff --git a/contrib/libs/protobuf/src/google/protobuf/has_bits.h b/contrib/libs/protobuf/src/google/protobuf/has_bits.h index acbca689ed..1881a6f8ad 100644 --- a/contrib/libs/protobuf/src/google/protobuf/has_bits.h +++ b/contrib/libs/protobuf/src/google/protobuf/has_bits.h @@ -53,11 +53,11 @@ class HasBits { memset(has_bits_, 0, sizeof(has_bits_)); } - PROTOBUF_NDEBUG_INLINE uint32_t& operator[](int index) { + PROTOBUF_NDEBUG_INLINE ui32& operator[](int index) { return has_bits_[index]; } - PROTOBUF_NDEBUG_INLINE const uint32_t& operator[](int index) const { + PROTOBUF_NDEBUG_INLINE const ui32& operator[](int index) const { return has_bits_[index]; } @@ -76,7 +76,7 @@ class HasBits { bool empty() const; private: - uint32_t has_bits_[doublewords]; + ui32 has_bits_[doublewords]; }; template <> diff --git a/contrib/libs/protobuf/src/google/protobuf/inlined_string_field.cc b/contrib/libs/protobuf/src/google/protobuf/inlined_string_field.cc index 62c623366c..d0db3f6cc8 100644 --- a/contrib/libs/protobuf/src/google/protobuf/inlined_string_field.cc +++ b/contrib/libs/protobuf/src/google/protobuf/inlined_string_field.cc @@ -47,8 +47,8 @@ namespace internal { TProtoStringType* InlinedStringField::Mutable(const LazyString& /*default_value*/, Arena* arena, bool donated, - uint32_t* donating_states, - uint32_t mask) { + ui32* donating_states, + ui32 mask) { if (arena == nullptr || !donated) { return UnsafeMutablePointer(); } @@ -57,8 +57,8 @@ TProtoStringType* InlinedStringField::Mutable(const LazyString& /*default_value* TProtoStringType* InlinedStringField::Mutable(ArenaStringPtr::EmptyDefault, Arena* arena, bool donated, - uint32_t* donating_states, - uint32_t mask) { + ui32* donating_states, + ui32 mask) { if (arena == nullptr || !donated) { return UnsafeMutablePointer(); } @@ -67,21 +67,21 @@ TProtoStringType* InlinedStringField::Mutable(ArenaStringPtr::EmptyDefault, TProtoStringType* InlinedStringField::MutableSlow(::google::protobuf::Arena* arena, bool donated, - uint32_t* donating_states, - uint32_t mask) { + ui32* donating_states, + ui32 mask) { return UnsafeMutablePointer(); } void InlinedStringField::SetAllocated(const TProtoStringType* default_value, TProtoStringType* value, Arena* arena, - bool donated, uint32_t* donating_states, - uint32_t mask) { + bool donated, ui32* donating_states, + ui32 mask) { SetAllocatedNoArena(default_value, value); } void InlinedStringField::Set(const TProtoStringType* default_value, TProtoStringType&& value, Arena* arena, bool donated, - uint32_t* donating_states, uint32_t mask) { + ui32* donating_states, ui32 mask) { SetNoArena(default_value, std::move(value)); } diff --git a/contrib/libs/protobuf/src/google/protobuf/inlined_string_field.h b/contrib/libs/protobuf/src/google/protobuf/inlined_string_field.h index 6b8bdc73b9..8fc9d3e697 100644 --- a/contrib/libs/protobuf/src/google/protobuf/inlined_string_field.h +++ b/contrib/libs/protobuf/src/google/protobuf/inlined_string_field.h @@ -121,7 +121,7 @@ class PROTOBUF_EXPORT InlinedStringField { ~InlinedStringField() { Destruct(); } // Lvalue Set. To save space, we pack the donating states of multiple - // InlinedStringFields into an uint32_t `donating_states`. The `mask` + // InlinedStringFields into an ui32 `donating_states`. The `mask` // indicates the position of the bit for this InlinedStringField. `donated` is // whether this field is donated. // @@ -131,8 +131,8 @@ class PROTOBUF_EXPORT InlinedStringField { // // This method never changes the `donating_states`. void Set(const TProtoStringType* default_value, ConstStringParam value, - Arena* arena, bool donated, uint32_t* /*donating_states*/, - uint32_t /*mask*/) { + Arena* arena, bool donated, ui32* /*donating_states*/, + ui32 /*mask*/) { (void)arena; (void)donated; SetNoArena(default_value, value); @@ -141,17 +141,17 @@ class PROTOBUF_EXPORT InlinedStringField { // Rvalue Set. If this field is donated, this method will undonate this field // by mutating the `donating_states` according to `mask`. void Set(const TProtoStringType* default_value, TProtoStringType&& value, Arena* arena, - bool donated, uint32_t* donating_states, uint32_t mask); + bool donated, ui32* donating_states, ui32 mask); template <typename FirstParam> void Set(FirstParam p1, const char* str, ::google::protobuf::Arena* arena, bool donated, - uint32_t* donating_states, uint32_t mask) { + ui32* donating_states, ui32 mask) { Set(p1, ConstStringParam(str), arena, donated, donating_states, mask); } template <typename FirstParam> void Set(FirstParam p1, const char* str, size_t size, ::google::protobuf::Arena* arena, - bool donated, uint32_t* donating_states, uint32_t mask) { + bool donated, ui32* donating_states, ui32 mask) { ConstStringParam sp{str, size}; // for string_view and `const string &` Set(p1, sp, arena, donated, donating_states, mask); } @@ -159,22 +159,22 @@ class PROTOBUF_EXPORT InlinedStringField { template <typename FirstParam, typename RefWrappedType> void Set(FirstParam p1, std::reference_wrapper<RefWrappedType> const_string_ref, - ::google::protobuf::Arena* arena, bool donated, uint32_t* donating_states, - uint32_t mask) { + ::google::protobuf::Arena* arena, bool donated, ui32* donating_states, + ui32 mask) { Set(p1, const_string_ref.get(), arena, donated, donating_states, mask); } template <typename FirstParam, typename SecondParam> void SetBytes(FirstParam p1, SecondParam&& p2, ::google::protobuf::Arena* arena, - bool donated, uint32_t* donating_states, uint32_t mask) { + bool donated, ui32* donating_states, ui32 mask) { Set(p1, static_cast<SecondParam&&>(p2), arena, donated, donating_states, mask); } template <typename FirstParam> void SetBytes(FirstParam p1, const void* str, size_t size, - ::google::protobuf::Arena* arena, bool donated, uint32_t* donating_states, - uint32_t mask) { + ::google::protobuf::Arena* arena, bool donated, ui32* donating_states, + ui32 mask) { // Must work whether ConstStringParam is string_view or `const string &` ConstStringParam sp{static_cast<const char*>(str), size}; Set(p1, sp, arena, donated, donating_states, mask); @@ -194,9 +194,9 @@ class PROTOBUF_EXPORT InlinedStringField { // `donating_states` according to `mask`, and copies the content of the // original string to the returning string. TProtoStringType* Mutable(const LazyString& default_value, Arena* arena, - bool donated, uint32_t* donating_states, uint32_t mask); + bool donated, ui32* donating_states, ui32 mask); TProtoStringType* Mutable(ArenaStringPtr::EmptyDefault, Arena* arena, bool donated, - uint32_t* donating_states, uint32_t mask); + ui32* donating_states, ui32 mask); // Release returns a TProtoStringType* instance that is heap-allocated and is not // Own()'d by any arena. If the field is not set, this returns NULL. The @@ -215,8 +215,8 @@ class PROTOBUF_EXPORT InlinedStringField { // If this field is donated, this method undonates this field by mutating the // `donating_states` according to `mask`. void SetAllocated(const TProtoStringType* default_value, TProtoStringType* value, - Arena* arena, bool donated, uint32_t* donating_states, - uint32_t mask); + Arena* arena, bool donated, ui32* donating_states, + ui32 mask); void SetAllocatedNoArena(const TProtoStringType* default_value, TProtoStringType* value); @@ -227,9 +227,9 @@ class PROTOBUF_EXPORT InlinedStringField { PROTOBUF_NDEBUG_INLINE void Swap(InlinedStringField* from, const TProtoStringType* default_value, Arena* arena, bool donated, - bool from_donated, uint32_t* donating_states, - uint32_t* from_donating_states, - uint32_t mask); + bool from_donated, ui32* donating_states, + ui32* from_donating_states, + ui32 mask); // Frees storage (if not on an arena). PROTOBUF_NDEBUG_INLINE void Destroy(const TProtoStringType* default_value, @@ -275,7 +275,7 @@ class PROTOBUF_EXPORT InlinedStringField { alignas(TProtoStringType) char value_[sizeof(TProtoStringType)]; TProtoStringType* MutableSlow(::google::protobuf::Arena* arena, bool donated, - uint32_t* donating_states, uint32_t mask); + ui32* donating_states, ui32 mask); // When constructed in an Arena, we want our destructor to be skipped. @@ -345,8 +345,8 @@ inline void InlinedStringField::SetNoArena(const TProtoStringType* /*default_val inline void InlinedStringField::Swap( InlinedStringField* from, const TProtoStringType* /*default_value*/, - Arena* arena, bool donated, bool from_donated, uint32_t* donating_states, - uint32_t* from_donating_states, uint32_t mask) { + Arena* arena, bool donated, bool from_donated, ui32* donating_states, + ui32* from_donating_states, ui32 mask) { #if GOOGLE_PROTOBUF_INTERNAL_DONATE_STEAL_INLINE // If one is donated and the other is not, undonate the donated one. if (donated && !from_donated) { diff --git a/contrib/libs/protobuf/src/google/protobuf/io/coded_stream.cc b/contrib/libs/protobuf/src/google/protobuf/io/coded_stream.cc index 8c61bcbff7..1688c98121 100644 --- a/contrib/libs/protobuf/src/google/protobuf/io/coded_stream.cc +++ b/contrib/libs/protobuf/src/google/protobuf/io/coded_stream.cc @@ -151,7 +151,7 @@ CodedInputStream::IncrementRecursionDepthAndPushLimit(int byte_limit) { } CodedInputStream::Limit CodedInputStream::ReadLengthAndPushLimit() { - uint32_t length; + ui32 length; return PushLimit(ReadVarint32(&length) ? length : 0); } @@ -308,11 +308,11 @@ bool CodedInputStream::ReadStringFallback(TProtoStringType* buffer, int size) { } -bool CodedInputStream::ReadLittleEndian32Fallback(uint32_t* value) { +bool CodedInputStream::ReadLittleEndian32Fallback(ui32* value) { uint8_t bytes[sizeof(*value)]; const uint8_t* ptr; - if (BufferSize() >= static_cast<int64_t>(sizeof(*value))) { + if (BufferSize() >= static_cast<i64>(sizeof(*value))) { // Fast path: Enough bytes in the buffer to read directly. ptr = buffer_; Advance(sizeof(*value)); @@ -325,11 +325,11 @@ bool CodedInputStream::ReadLittleEndian32Fallback(uint32_t* value) { return true; } -bool CodedInputStream::ReadLittleEndian64Fallback(uint64* value) { +bool CodedInputStream::ReadLittleEndian64Fallback(ui64* value) { uint8_t bytes[sizeof(*value)]; const uint8_t* ptr; - if (BufferSize() >= static_cast<int64_t>(sizeof(*value))) { + if (BufferSize() >= static_cast<i64>(sizeof(*value))) { // Fast path: Enough bytes in the buffer to read directly. ptr = buffer_; Advance(sizeof(*value)); @@ -341,24 +341,6 @@ bool CodedInputStream::ReadLittleEndian64Fallback(uint64* value) { ReadLittleEndian64FromArray(ptr, value); return true; } -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -bool CodedInputStream::ReadLittleEndian64Fallback(uint64_t* value) { - uint8_t bytes[sizeof(*value)]; - - const uint8_t* ptr; - if (BufferSize() >= static_cast<int64_t>(sizeof(*value))) { - // Fast path: Enough bytes in the buffer to read directly. - ptr = buffer_; - Advance(sizeof(*value)); - } else { - // Slow path: Had to read past the end of the buffer. - if (!ReadRaw(bytes, sizeof(*value))) return false; - ptr = bytes; - } - ReadLittleEndian64FromArray(ptr, value); - return true; -} -#endif namespace { @@ -366,11 +348,11 @@ namespace { // compile time, compiler can generate optimal code. For example, instead of // subtracting 0x80 at each iteration, it subtracts properly shifted mask once. template <size_t N> -const uint8_t* DecodeVarint64KnownSize(const uint8_t* buffer, uint64_t* value) { +const uint8_t* DecodeVarint64KnownSize(const uint8_t* buffer, ui64* value) { GOOGLE_DCHECK_GT(N, 0); - uint64_t result = static_cast<uint64_t>(buffer[N - 1]) << (7 * (N - 1)); + ui64 result = static_cast<ui64>(buffer[N - 1]) << (7 * (N - 1)); for (size_t i = 0, offset = 0; i < N - 1; i++, offset += 7) { - result += static_cast<uint64_t>(buffer[i] - 0x80) << offset; + result += static_cast<ui64>(buffer[i] - 0x80) << offset; } *value = result; return buffer + N; @@ -381,18 +363,18 @@ const uint8_t* DecodeVarint64KnownSize(const uint8_t* buffer, uint64_t* value) { // part is buffer + (number of bytes read). This function is always inlined, // so returning a pair is costless. PROTOBUF_ALWAYS_INLINE -::std::pair<bool, const uint8_t*> ReadVarint32FromArray(uint32_t first_byte, +::std::pair<bool, const uint8_t*> ReadVarint32FromArray(ui32 first_byte, const uint8_t* buffer, - uint32_t* value); + ui32* value); inline ::std::pair<bool, const uint8_t*> ReadVarint32FromArray( - uint32_t first_byte, const uint8_t* buffer, uint32_t* value) { + ui32 first_byte, const uint8_t* buffer, ui32* value) { // Fast path: We have enough bytes left in the buffer to guarantee that // this read won't cross the end, so we can skip the checks. GOOGLE_DCHECK_EQ(*buffer, first_byte); GOOGLE_DCHECK_EQ(first_byte & 0x80, 0x80) << first_byte; const uint8_t* ptr = buffer; - uint32_t b; - uint32_t result = first_byte - 0x80; + ui32 b; + ui32 result = first_byte - 0x80; ++ptr; // We just processed the first byte. Move on to the second. b = *(ptr++); result += b << 7; @@ -428,9 +410,9 @@ done: } PROTOBUF_ALWAYS_INLINE::std::pair<bool, const uint8_t*> ReadVarint64FromArray( - const uint8_t* buffer, uint64_t* value); + const uint8_t* buffer, ui64* value); inline ::std::pair<bool, const uint8_t*> ReadVarint64FromArray( - const uint8_t* buffer, uint64_t* value) { + const uint8_t* buffer, ui64* value) { // Assumes varint64 is at least 2 bytes. GOOGLE_DCHECK_GE(buffer[0], 128); @@ -464,22 +446,22 @@ inline ::std::pair<bool, const uint8_t*> ReadVarint64FromArray( } // namespace -bool CodedInputStream::ReadVarint32Slow(uint32_t* value) { +bool CodedInputStream::ReadVarint32Slow(ui32* value) { // Directly invoke ReadVarint64Fallback, since we already tried to optimize // for one-byte varints. - std::pair<uint64_t, bool> p = ReadVarint64Fallback(); - *value = static_cast<uint32_t>(p.first); + std::pair<ui64, bool> p = ReadVarint64Fallback(); + *value = static_cast<ui32>(p.first); return p.second; } -int64_t CodedInputStream::ReadVarint32Fallback(uint32_t first_byte_or_zero) { +i64 CodedInputStream::ReadVarint32Fallback(ui32 first_byte_or_zero) { if (BufferSize() >= kMaxVarintBytes || // Optimization: We're also safe if the buffer is non-empty and it ends // with a byte that would terminate a varint. (buffer_end_ > buffer_ && !(buffer_end_[-1] & 0x80))) { GOOGLE_DCHECK_NE(first_byte_or_zero, 0) << "Caller should provide us with *buffer_ when buffer is non-empty"; - uint32_t temp; + ui32 temp; ::std::pair<bool, const uint8_t*> p = ReadVarint32FromArray(first_byte_or_zero, buffer_, &temp); if (!p.first) return -1; @@ -489,16 +471,16 @@ int64_t CodedInputStream::ReadVarint32Fallback(uint32_t first_byte_or_zero) { // Really slow case: we will incur the cost of an extra function call here, // but moving this out of line reduces the size of this function, which // improves the common case. In micro benchmarks, this is worth about 10-15% - uint32_t temp; - return ReadVarint32Slow(&temp) ? static_cast<int64_t>(temp) : -1; + ui32 temp; + return ReadVarint32Slow(&temp) ? static_cast<i64>(temp) : -1; } } int CodedInputStream::ReadVarintSizeAsIntSlow() { // Directly invoke ReadVarint64Fallback, since we already tried to optimize // for one-byte varints. - std::pair<uint64_t, bool> p = ReadVarint64Fallback(); - if (!p.second || p.first > static_cast<uint64_t>(INT_MAX)) return -1; + std::pair<ui64, bool> p = ReadVarint64Fallback(); + if (!p.second || p.first > static_cast<ui64>(INT_MAX)) return -1; return p.first; } @@ -507,9 +489,9 @@ int CodedInputStream::ReadVarintSizeAsIntFallback() { // Optimization: We're also safe if the buffer is non-empty and it ends // with a byte that would terminate a varint. (buffer_end_ > buffer_ && !(buffer_end_[-1] & 0x80))) { - uint64_t temp; + ui64 temp; ::std::pair<bool, const uint8_t*> p = ReadVarint64FromArray(buffer_, &temp); - if (!p.first || temp > static_cast<uint64_t>(INT_MAX)) return -1; + if (!p.first || temp > static_cast<ui64>(INT_MAX)) return -1; buffer_ = p.second; return temp; } else { @@ -520,7 +502,7 @@ int CodedInputStream::ReadVarintSizeAsIntFallback() { } } -uint32_t CodedInputStream::ReadTagSlow() { +ui32 CodedInputStream::ReadTagSlow() { if (buffer_ == buffer_end_) { // Call refresh. if (!Refresh()) { @@ -541,12 +523,12 @@ uint32_t CodedInputStream::ReadTagSlow() { // For the slow path, just do a 64-bit read. Try to optimize for one-byte tags // again, since we have now refreshed the buffer. - uint64_t result = 0; + ui64 result = 0; if (!ReadVarint64(&result)) return 0; - return static_cast<uint32_t>(result); + return static_cast<ui32>(result); } -uint32_t CodedInputStream::ReadTagFallback(uint32_t first_byte_or_zero) { +ui32 CodedInputStream::ReadTagFallback(ui32 first_byte_or_zero) { const int buf_size = BufferSize(); if (buf_size >= kMaxVarintBytes || // Optimization: We're also safe if the buffer is non-empty and it ends @@ -557,7 +539,7 @@ uint32_t CodedInputStream::ReadTagFallback(uint32_t first_byte_or_zero) { ++buffer_; return 0; } - uint32_t tag; + ui32 tag; ::std::pair<bool, const uint8_t*> p = ReadVarint32FromArray(first_byte_or_zero, buffer_, &tag); if (!p.first) { @@ -583,13 +565,13 @@ uint32_t CodedInputStream::ReadTagFallback(uint32_t first_byte_or_zero) { } } -bool CodedInputStream::ReadVarint64Slow(uint64_t* value) { +bool CodedInputStream::ReadVarint64Slow(ui64* value) { // Slow path: This read might cross the end of the buffer, so we // need to check and refresh the buffer if and when it does. - uint64_t result = 0; + ui64 result = 0; int count = 0; - uint32_t b; + ui32 b; do { if (count == kMaxVarintBytes) { @@ -603,7 +585,7 @@ bool CodedInputStream::ReadVarint64Slow(uint64_t* value) { } } b = *buffer_; - result |= static_cast<uint64_t>(b & 0x7F) << (7 * count); + result |= static_cast<ui64>(b & 0x7F) << (7 * count); Advance(1); ++count; } while (b & 0x80); @@ -612,12 +594,12 @@ bool CodedInputStream::ReadVarint64Slow(uint64_t* value) { return true; } -std::pair<uint64_t, bool> CodedInputStream::ReadVarint64Fallback() { +std::pair<ui64, bool> CodedInputStream::ReadVarint64Fallback() { if (BufferSize() >= kMaxVarintBytes || // Optimization: We're also safe if the buffer is non-empty and it ends // with a byte that would terminate a varint. (buffer_end_ > buffer_ && !(buffer_end_[-1] & 0x80))) { - uint64_t temp; + ui64 temp; ::std::pair<bool, const uint8_t*> p = ReadVarint64FromArray(buffer_, &temp); if (!p.first) { return std::make_pair(0, false); @@ -625,7 +607,7 @@ std::pair<uint64_t, bool> CodedInputStream::ReadVarint64Fallback() { buffer_ = p.second; return std::make_pair(temp, true); } else { - uint64_t temp; + ui64 temp; bool success = ReadVarint64Slow(&temp); return std::make_pair(temp, success); } @@ -885,7 +867,7 @@ uint8_t* EpsCopyOutputStream::WriteRawLittleEndian32(const void* data, int size, auto end = p + size; while (end - p >= kSlopBytes) { ptr = EnsureSpace(ptr); - uint32_t buffer[4]; + ui32 buffer[4]; static_assert(sizeof(buffer) == kSlopBytes, "Buffer must be kSlopBytes"); std::memcpy(buffer, p, kSlopBytes); p += kSlopBytes; @@ -894,7 +876,7 @@ uint8_t* EpsCopyOutputStream::WriteRawLittleEndian32(const void* data, int size, } while (p < end) { ptr = EnsureSpace(ptr); - uint32_t buffer; + ui32 buffer; std::memcpy(&buffer, p, 4); p += 4; ptr = CodedOutputStream::WriteLittleEndian32ToArray(buffer, ptr); @@ -908,7 +890,7 @@ uint8_t* EpsCopyOutputStream::WriteRawLittleEndian64(const void* data, int size, auto end = p + size; while (end - p >= kSlopBytes) { ptr = EnsureSpace(ptr); - uint64_t buffer[2]; + ui64 buffer[2]; static_assert(sizeof(buffer) == kSlopBytes, "Buffer must be kSlopBytes"); std::memcpy(buffer, p, kSlopBytes); p += kSlopBytes; @@ -917,7 +899,7 @@ uint8_t* EpsCopyOutputStream::WriteRawLittleEndian64(const void* data, int size, } while (p < end) { ptr = EnsureSpace(ptr); - uint64_t buffer; + ui64 buffer; std::memcpy(&buffer, p, 8); p += 8; ptr = CodedOutputStream::WriteLittleEndian64ToArray(buffer, ptr); @@ -927,19 +909,19 @@ uint8_t* EpsCopyOutputStream::WriteRawLittleEndian64(const void* data, int size, #endif -uint8_t* EpsCopyOutputStream::WriteStringMaybeAliasedOutline(uint32_t num, +uint8_t* EpsCopyOutputStream::WriteStringMaybeAliasedOutline(ui32 num, const TProtoStringType& s, uint8_t* ptr) { ptr = EnsureSpace(ptr); - uint32_t size = s.size(); + ui32 size = s.size(); ptr = WriteLengthDelim(num, size, ptr); return WriteRawMaybeAliased(s.data(), size, ptr); } -uint8_t* EpsCopyOutputStream::WriteStringOutline(uint32_t num, const TProtoStringType& s, +uint8_t* EpsCopyOutputStream::WriteStringOutline(ui32 num, const TProtoStringType& s, uint8_t* ptr) { ptr = EnsureSpace(ptr); - uint32_t size = s.size(); + ui32 size = s.size(); ptr = WriteLengthDelim(num, size, ptr); return WriteRaw(s.data(), size, ptr); } @@ -969,7 +951,7 @@ uint8_t* CodedOutputStream::WriteStringWithSizeToArray(const TProtoStringType& s return WriteStringToArray(str, target); } -uint8_t* CodedOutputStream::WriteVarint32ToArrayOutOfLineHelper(uint32_t value, +uint8_t* CodedOutputStream::WriteVarint32ToArrayOutOfLineHelper(ui32 value, uint8_t* target) { GOOGLE_DCHECK_GE(value, 0x80); target[0] |= static_cast<uint8_t>(0x80); diff --git a/contrib/libs/protobuf/src/google/protobuf/io/coded_stream.h b/contrib/libs/protobuf/src/google/protobuf/io/coded_stream.h index 9a4d1161c7..70886e31fe 100644 --- a/contrib/libs/protobuf/src/google/protobuf/io/coded_stream.h +++ b/contrib/libs/protobuf/src/google/protobuf/io/coded_stream.h @@ -75,7 +75,7 @@ // return; // } // -// uint32_t size; +// ui32 size; // coded_input->ReadVarint32(&size); // // char* text = new char[size + 1]; @@ -233,35 +233,25 @@ class PROTOBUF_EXPORT CodedInputStream { // Read a 32-bit little-endian integer. - bool ReadLittleEndian32(uint32_t* value); + bool ReadLittleEndian32(ui32* value); // Read a 64-bit little-endian integer. - bool ReadLittleEndian64(uint64* value); -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) - bool ReadLittleEndian64(uint64_t* value); -#endif + bool ReadLittleEndian64(ui64* value); // These methods read from an externally provided buffer. The caller is // responsible for ensuring that the buffer has sufficient space. // Read a 32-bit little-endian integer. static const uint8_t* ReadLittleEndian32FromArray(const uint8_t* buffer, - uint32_t* value); + ui32* value); // Read a 64-bit little-endian integer. static const uint8_t* ReadLittleEndian64FromArray(const uint8_t* buffer, - uint64* value); -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) - static const uint8_t* ReadLittleEndian64FromArray(const uint8_t* buffer, - uint64_t* value); -#endif + ui64* value); // Read an unsigned integer with Varint encoding, truncating to 32 bits. // Reading a 32-bit value is equivalent to reading a 64-bit one and casting - // it to uint32_t, but may be more efficient. - bool ReadVarint32(uint32_t* value); + // it to ui32, but may be more efficient. + bool ReadVarint32(ui32* value); // Read an unsigned integer with Varint encoding. - bool ReadVarint64(uint64* value); -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) - bool ReadVarint64(uint64_t* value); -#endif + bool ReadVarint64(ui64* value); // Reads a varint off the wire into an "int". This should be used for reading // sizes off the wire (sizes of strings, submessages, bytes fields, etc). @@ -282,11 +272,11 @@ class PROTOBUF_EXPORT CodedInputStream { // Always inline because this is only called in one place per parse loop // but it is called for every iteration of said loop, so it should be fast. // GCC doesn't want to inline this by default. - PROTOBUF_ALWAYS_INLINE uint32_t ReadTag() { + PROTOBUF_ALWAYS_INLINE ui32 ReadTag() { return last_tag_ = ReadTagNoLastTag(); } - PROTOBUF_ALWAYS_INLINE uint32_t ReadTagNoLastTag(); + PROTOBUF_ALWAYS_INLINE ui32 ReadTagNoLastTag(); // This usually a faster alternative to ReadTag() when cutoff is a manifest // constant. It does particularly well for cutoff >= 127. The first part @@ -297,14 +287,14 @@ class PROTOBUF_EXPORT CodedInputStream { // because that can arise in several ways, and for best performance we want // to avoid an extra "is tag == 0?" check here.) PROTOBUF_ALWAYS_INLINE - std::pair<uint32_t, bool> ReadTagWithCutoff(uint32_t cutoff) { - std::pair<uint32_t, bool> result = ReadTagWithCutoffNoLastTag(cutoff); + std::pair<ui32, bool> ReadTagWithCutoff(ui32 cutoff) { + std::pair<ui32, bool> result = ReadTagWithCutoffNoLastTag(cutoff); last_tag_ = result.first; return result; } PROTOBUF_ALWAYS_INLINE - std::pair<uint32_t, bool> ReadTagWithCutoffNoLastTag(uint32_t cutoff); + std::pair<ui32, bool> ReadTagWithCutoffNoLastTag(ui32 cutoff); // Usually returns true if calling ReadVarint32() now would produce the given // value. Will always return false if ReadVarint32() would not return the @@ -313,7 +303,7 @@ class PROTOBUF_EXPORT CodedInputStream { // parameter. // Always inline because this collapses to a small number of instructions // when given a constant parameter, but GCC doesn't want to inline by default. - PROTOBUF_ALWAYS_INLINE bool ExpectTag(uint32_t expected); + PROTOBUF_ALWAYS_INLINE bool ExpectTag(ui32 expected); // Like above, except this reads from the specified buffer. The caller is // responsible for ensuring that the buffer is large enough to read a varint @@ -324,7 +314,7 @@ class PROTOBUF_EXPORT CodedInputStream { // was not. PROTOBUF_ALWAYS_INLINE static const uint8_t* ExpectTagFromArray(const uint8_t* buffer, - uint32_t expected); + ui32 expected); // Usually returns true if no more bytes can be read. Always returns false // if more bytes can be read. If ExpectAtEnd() returns true, a subsequent @@ -343,8 +333,8 @@ class PROTOBUF_EXPORT CodedInputStream { // of the enclosing message. The enclosing message would like to check that // tag to make sure it had the right number, so it calls LastTagWas() on // return from the embedded parser to check. - bool LastTagWas(uint32_t expected); - void SetLastTag(uint32_t tag) { last_tag_ = tag; } + bool LastTagWas(ui32 expected); + void SetLastTag(ui32 tag) { last_tag_ = tag; } // When parsing message (but NOT a group), this method must be called // immediately after MergeFromCodedStream() returns (if it returns true) @@ -558,7 +548,7 @@ class PROTOBUF_EXPORT CodedInputStream { int overflow_bytes_; // LastTagWas() stuff. - uint32_t last_tag_; // result of last ReadTag() or ReadTagWithCutoff(). + ui32 last_tag_; // result of last ReadTag() or ReadTagWithCutoff(). // This is set true by ReadTag{Fallback/Slow}() if it is called when exactly // at EOF, or by ExpectAtEnd() when it returns true. This happens when we @@ -626,25 +616,22 @@ class PROTOBUF_EXPORT CodedInputStream { // message crosses multiple buffers. Note: ReadVarint32Fallback() and // ReadVarint64Fallback() are called frequently and generally not inlined, so // they have been optimized to avoid "out" parameters. The former returns -1 - // if it fails and the uint32_t it read otherwise. The latter has a bool + // if it fails and the ui32 it read otherwise. The latter has a bool // indicating success or failure as part of its return type. - int64_t ReadVarint32Fallback(uint32_t first_byte_or_zero); + i64 ReadVarint32Fallback(ui32 first_byte_or_zero); int ReadVarintSizeAsIntFallback(); - std::pair<uint64_t, bool> ReadVarint64Fallback(); - bool ReadVarint32Slow(uint32_t* value); - bool ReadVarint64Slow(uint64_t* value); + std::pair<ui64, bool> ReadVarint64Fallback(); + bool ReadVarint32Slow(ui32* value); + bool ReadVarint64Slow(ui64* value); int ReadVarintSizeAsIntSlow(); - bool ReadLittleEndian32Fallback(uint32_t* value); - bool ReadLittleEndian64Fallback(uint64* value); -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) - bool ReadLittleEndian64Fallback(uint64_t* value); -#endif + bool ReadLittleEndian32Fallback(ui32* value); + bool ReadLittleEndian64Fallback(ui64* value); // Fallback/slow methods for reading tags. These do not update last_tag_, // but will set legitimate_message_end_ if we are at the end of the input // stream. - uint32_t ReadTagFallback(uint32_t first_byte_or_zero); - uint32_t ReadTagSlow(); + ui32 ReadTagFallback(ui32 first_byte_or_zero); + ui32 ReadTagSlow(); bool ReadStringFallback(TProtoStringType* buffer, int size); // Return the size of the buffer. @@ -727,7 +714,7 @@ class PROTOBUF_EXPORT EpsCopyOutputStream { } - uint8_t* WriteStringMaybeAliased(uint32_t num, const TProtoStringType& s, uint8_t* ptr) { + uint8_t* WriteStringMaybeAliased(ui32 num, const TProtoStringType& s, uint8_t* ptr) { std::ptrdiff_t size = s.size(); if (PROTOBUF_PREDICT_FALSE( size >= 128 || end_ - ptr + 16 - TagSize(num << 3) - 1 < size)) { @@ -738,12 +725,12 @@ class PROTOBUF_EXPORT EpsCopyOutputStream { std::memcpy(ptr, s.data(), size); return ptr + size; } - uint8_t* WriteBytesMaybeAliased(uint32_t num, const TProtoStringType& s, uint8_t* ptr) { + uint8_t* WriteBytesMaybeAliased(ui32 num, const TProtoStringType& s, uint8_t* ptr) { return WriteStringMaybeAliased(num, s, ptr); } template <typename T> - PROTOBUF_ALWAYS_INLINE uint8_t* WriteString(uint32_t num, const T& s, + PROTOBUF_ALWAYS_INLINE uint8_t* WriteString(ui32 num, const T& s, uint8_t* ptr) { std::ptrdiff_t size = s.size(); if (PROTOBUF_PREDICT_FALSE( @@ -756,7 +743,7 @@ class PROTOBUF_EXPORT EpsCopyOutputStream { return ptr + size; } template <typename T> - uint8_t* WriteBytes(uint32_t num, const T& s, uint8_t* ptr) { + uint8_t* WriteBytes(ui32 num, const T& s, uint8_t* ptr) { return WriteString(num, s, ptr); } @@ -861,7 +848,7 @@ class PROTOBUF_EXPORT EpsCopyOutputStream { return buffer_; } - static constexpr int TagSize(uint32_t tag) { + static constexpr int TagSize(ui32 tag) { return (tag < (1 << 7)) ? 1 : (tag < (1 << 14)) ? 2 : (tag < (1 << 21)) ? 3 @@ -869,12 +856,12 @@ class PROTOBUF_EXPORT EpsCopyOutputStream { : 5; } - PROTOBUF_ALWAYS_INLINE uint8_t* WriteTag(uint32_t num, uint32_t wt, uint8_t* ptr) { + PROTOBUF_ALWAYS_INLINE uint8_t* WriteTag(ui32 num, ui32 wt, uint8_t* ptr) { GOOGLE_DCHECK(ptr < end_); // NOLINT return UnsafeVarint((num << 3) | wt, ptr); } - PROTOBUF_ALWAYS_INLINE uint8_t* WriteLengthDelim(int num, uint32_t size, + PROTOBUF_ALWAYS_INLINE uint8_t* WriteLengthDelim(int num, ui32 size, uint8_t* ptr) { ptr = WriteTag(num, 2, ptr); return UnsafeWriteSize(size, ptr); @@ -884,9 +871,9 @@ class PROTOBUF_EXPORT EpsCopyOutputStream { uint8_t* WriteAliasedRaw(const void* data, int size, uint8_t* ptr); - uint8_t* WriteStringMaybeAliasedOutline(uint32_t num, const TProtoStringType& s, + uint8_t* WriteStringMaybeAliasedOutline(ui32 num, const TProtoStringType& s, uint8_t* ptr); - uint8_t* WriteStringOutline(uint32_t num, const TProtoStringType& s, uint8_t* ptr); + uint8_t* WriteStringOutline(ui32 num, const TProtoStringType& s, uint8_t* ptr); template <typename T, typename E> PROTOBUF_ALWAYS_INLINE uint8_t* WriteVarintPacked(int num, const T& r, int size, @@ -902,13 +889,13 @@ class PROTOBUF_EXPORT EpsCopyOutputStream { return ptr; } - static uint32_t Encode32(uint32_t v) { return v; } - static uint64_t Encode64(uint64_t v) { return v; } - static uint32_t ZigZagEncode32(int32_t v) { - return (static_cast<uint32_t>(v) << 1) ^ static_cast<uint32_t>(v >> 31); + static ui32 Encode32(ui32 v) { return v; } + static ui64 Encode64(ui64 v) { return v; } + static ui32 ZigZagEncode32(i32 v) { + return (static_cast<ui32>(v) << 1) ^ static_cast<ui32>(v >> 31); } - static uint64_t ZigZagEncode64(int64_t v) { - return (static_cast<uint64_t>(v) << 1) ^ static_cast<uint64_t>(v >> 63); + static ui64 ZigZagEncode64(i64 v) { + return (static_cast<ui64>(v) << 1) ^ static_cast<ui64>(v >> 63); } template <typename T> @@ -937,7 +924,7 @@ class PROTOBUF_EXPORT EpsCopyOutputStream { return ptr; } - PROTOBUF_ALWAYS_INLINE static uint8_t* UnsafeWriteSize(uint32_t value, + PROTOBUF_ALWAYS_INLINE static uint8_t* UnsafeWriteSize(ui32 value, uint8_t* ptr) { while (PROTOBUF_PREDICT_FALSE(value >= 0x80)) { *ptr = static_cast<uint8_t>(value | 0x80); @@ -1142,65 +1129,65 @@ class PROTOBUF_EXPORT CodedOutputStream { // Write a 32-bit little-endian integer. - void WriteLittleEndian32(uint32_t value) { + void WriteLittleEndian32(ui32 value) { cur_ = impl_.EnsureSpace(cur_); SetCur(WriteLittleEndian32ToArray(value, Cur())); } // Like WriteLittleEndian32() but writing directly to the target array. - static uint8_t* WriteLittleEndian32ToArray(uint32_t value, uint8_t* target); + static uint8_t* WriteLittleEndian32ToArray(ui32 value, uint8_t* target); // Write a 64-bit little-endian integer. - void WriteLittleEndian64(uint64_t value) { + void WriteLittleEndian64(ui64 value) { cur_ = impl_.EnsureSpace(cur_); SetCur(WriteLittleEndian64ToArray(value, Cur())); } // Like WriteLittleEndian64() but writing directly to the target array. - static uint8_t* WriteLittleEndian64ToArray(uint64_t value, uint8_t* target); + static uint8_t* WriteLittleEndian64ToArray(ui64 value, uint8_t* target); // Write an unsigned integer with Varint encoding. Writing a 32-bit value - // is equivalent to casting it to uint64_t and writing it as a 64-bit value, + // is equivalent to casting it to ui64 and writing it as a 64-bit value, // but may be more efficient. - void WriteVarint32(uint32_t value); + void WriteVarint32(ui32 value); // Like WriteVarint32() but writing directly to the target array. - static uint8_t* WriteVarint32ToArray(uint32_t value, uint8_t* target); + static uint8_t* WriteVarint32ToArray(ui32 value, uint8_t* target); // Like WriteVarint32() but writing directly to the target array, and with the // less common-case paths being out of line rather than inlined. - static uint8_t* WriteVarint32ToArrayOutOfLine(uint32_t value, uint8_t* target); + static uint8_t* WriteVarint32ToArrayOutOfLine(ui32 value, uint8_t* target); // Write an unsigned integer with Varint encoding. - void WriteVarint64(uint64_t value); + void WriteVarint64(ui64 value); // Like WriteVarint64() but writing directly to the target array. - static uint8_t* WriteVarint64ToArray(uint64_t value, uint8_t* target); + static uint8_t* WriteVarint64ToArray(ui64 value, uint8_t* target); // Equivalent to WriteVarint32() except when the value is negative, // in which case it must be sign-extended to a full 10 bytes. - void WriteVarint32SignExtended(int32_t value); + void WriteVarint32SignExtended(i32 value); // Like WriteVarint32SignExtended() but writing directly to the target array. - static uint8_t* WriteVarint32SignExtendedToArray(int32_t value, uint8_t* target); + static uint8_t* WriteVarint32SignExtendedToArray(i32 value, uint8_t* target); // This is identical to WriteVarint32(), but optimized for writing tags. // In particular, if the input is a compile-time constant, this method // compiles down to a couple instructions. // Always inline because otherwise the aforementioned optimization can't work, // but GCC by default doesn't want to inline this. - void WriteTag(uint32_t value); + void WriteTag(ui32 value); // Like WriteTag() but writing directly to the target array. PROTOBUF_ALWAYS_INLINE - static uint8_t* WriteTagToArray(uint32_t value, uint8_t* target); + static uint8_t* WriteTagToArray(ui32 value, uint8_t* target); // Returns the number of bytes needed to encode the given value as a varint. - static size_t VarintSize32(uint32_t value); + static size_t VarintSize32(ui32 value); // Returns the number of bytes needed to encode the given value as a varint. - static size_t VarintSize64(uint64_t value); + static size_t VarintSize64(ui64 value); // If negative, 10 bytes. Otherwise, same as VarintSize32(). - static size_t VarintSize32SignExtended(int32_t value); + static size_t VarintSize32SignExtended(i32 value); // Same as above, plus one. The additional one comes at no compute cost. - static size_t VarintSize32PlusOne(uint32_t value); - static size_t VarintSize64PlusOne(uint64_t value); - static size_t VarintSize32SignExtendedPlusOne(int32_t value); + static size_t VarintSize32PlusOne(ui32 value); + static size_t VarintSize64PlusOne(ui64 value); + static size_t VarintSize32SignExtendedPlusOne(i32 value); // Compile-time equivalent of VarintSize32(). - template <uint32_t Value> + template <ui32 Value> struct StaticVarintSize32 { static const size_t value = (Value < (1 << 7)) ? 1 : (Value < (1 << 14)) ? 2 @@ -1270,7 +1257,7 @@ class PROTOBUF_EXPORT CodedOutputStream { private: EpsCopyOutputStream impl_; uint8_t* cur_; - int64_t start_count_; + i64 start_count_; static std::atomic<bool> default_serialization_deterministic_; // See above. Other projects may use "friend" to allow them to call this. @@ -1285,7 +1272,7 @@ class PROTOBUF_EXPORT CodedOutputStream { default_serialization_deterministic_.store(true, std::memory_order_relaxed); } // REQUIRES: value >= 0x80, and that (value & 7f) has been written to *target. - static uint8_t* WriteVarint32ToArrayOutOfLineHelper(uint32_t value, uint8_t* target); + static uint8_t* WriteVarint32ToArrayOutOfLineHelper(ui32 value, uint8_t* target); GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CodedOutputStream); }; @@ -1293,8 +1280,8 @@ class PROTOBUF_EXPORT CodedOutputStream { // The vast majority of varints are only one byte. These inline // methods optimize for that case. -inline bool CodedInputStream::ReadVarint32(uint32_t* value) { - uint32_t v = 0; +inline bool CodedInputStream::ReadVarint32(ui32* value) { + ui32 v = 0; if (PROTOBUF_PREDICT_TRUE(buffer_ < buffer_end_)) { v = *buffer_; if (v < 0x80) { @@ -1303,33 +1290,21 @@ inline bool CodedInputStream::ReadVarint32(uint32_t* value) { return true; } } - int64_t result = ReadVarint32Fallback(v); - *value = static_cast<uint32_t>(result); + i64 result = ReadVarint32Fallback(v); + *value = static_cast<ui32>(result); return result >= 0; } -inline bool CodedInputStream::ReadVarint64(uint64* value) { - if (PROTOBUF_PREDICT_TRUE(buffer_ < buffer_end_) && *buffer_ < 0x80) { - *value = *buffer_; - Advance(1); - return true; - } - std::pair<uint64, bool> p = ReadVarint64Fallback(); - *value = p.first; - return p.second; -} -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -inline bool CodedInputStream::ReadVarint64(uint64_t* value) { +inline bool CodedInputStream::ReadVarint64(ui64* value) { if (PROTOBUF_PREDICT_TRUE(buffer_ < buffer_end_) && *buffer_ < 0x80) { *value = *buffer_; Advance(1); return true; } - std::pair<uint64_t, bool> p = ReadVarint64Fallback(); + std::pair<ui64, bool> p = ReadVarint64Fallback(); *value = p.first; return p.second; } -#endif inline bool CodedInputStream::ReadVarintSizeAsInt(int* value) { if (PROTOBUF_PREDICT_TRUE(buffer_ < buffer_end_)) { @@ -1346,60 +1321,39 @@ inline bool CodedInputStream::ReadVarintSizeAsInt(int* value) { // static inline const uint8_t* CodedInputStream::ReadLittleEndian32FromArray( - const uint8_t* buffer, uint32_t* value) { + const uint8_t* buffer, ui32* value) { #if defined(PROTOBUF_LITTLE_ENDIAN) memcpy(value, buffer, sizeof(*value)); return buffer + sizeof(*value); #else - *value = (static_cast<uint32_t>(buffer[0])) | - (static_cast<uint32_t>(buffer[1]) << 8) | - (static_cast<uint32_t>(buffer[2]) << 16) | - (static_cast<uint32_t>(buffer[3]) << 24); + *value = (static_cast<ui32>(buffer[0])) | + (static_cast<ui32>(buffer[1]) << 8) | + (static_cast<ui32>(buffer[2]) << 16) | + (static_cast<ui32>(buffer[3]) << 24); return buffer + sizeof(*value); #endif } // static inline const uint8_t* CodedInputStream::ReadLittleEndian64FromArray( - const uint8_t* buffer, uint64* value) { -#if defined(PROTOBUF_LITTLE_ENDIAN) - memcpy(value, buffer, sizeof(*value)); - return buffer + sizeof(*value); -#else - uint32_t part0 = (static_cast<uint32_t>(buffer[0])) | - (static_cast<uint32_t>(buffer[1]) << 8) | - (static_cast<uint32_t>(buffer[2]) << 16) | - (static_cast<uint32_t>(buffer[3]) << 24); - uint32_t part1 = (static_cast<uint32_t>(buffer[4])) | - (static_cast<uint32_t>(buffer[5]) << 8) | - (static_cast<uint32_t>(buffer[6]) << 16) | - (static_cast<uint32_t>(buffer[7]) << 24); - *value = static_cast<uint64>(part0) | (static_cast<uint64>(part1) << 32); - return buffer + sizeof(*value); -#endif -} - -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -inline const uint8_t* CodedInputStream::ReadLittleEndian64FromArray( - const uint8_t* buffer, uint64_t* value) { + const uint8_t* buffer, ui64* value) { #if defined(PROTOBUF_LITTLE_ENDIAN) memcpy(value, buffer, sizeof(*value)); return buffer + sizeof(*value); #else - uint32_t part0 = (static_cast<uint32_t>(buffer[0])) | - (static_cast<uint32_t>(buffer[1]) << 8) | - (static_cast<uint32_t>(buffer[2]) << 16) | - (static_cast<uint32_t>(buffer[3]) << 24); - uint32_t part1 = (static_cast<uint32_t>(buffer[4])) | - (static_cast<uint32_t>(buffer[5]) << 8) | - (static_cast<uint32_t>(buffer[6]) << 16) | - (static_cast<uint32_t>(buffer[7]) << 24); - *value = static_cast<uint64_t>(part0) | (static_cast<uint64_t>(part1) << 32); + ui32 part0 = (static_cast<ui32>(buffer[0])) | + (static_cast<ui32>(buffer[1]) << 8) | + (static_cast<ui32>(buffer[2]) << 16) | + (static_cast<ui32>(buffer[3]) << 24); + ui32 part1 = (static_cast<ui32>(buffer[4])) | + (static_cast<ui32>(buffer[5]) << 8) | + (static_cast<ui32>(buffer[6]) << 16) | + (static_cast<ui32>(buffer[7]) << 24); + *value = static_cast<ui64>(part0) | (static_cast<ui64>(part1) << 32); return buffer + sizeof(*value); #endif } -#endif -inline bool CodedInputStream::ReadLittleEndian32(uint32_t* value) { +inline bool CodedInputStream::ReadLittleEndian32(ui32* value) { #if defined(PROTOBUF_LITTLE_ENDIAN) if (PROTOBUF_PREDICT_TRUE(BufferSize() >= static_cast<int>(sizeof(*value)))) { buffer_ = ReadLittleEndian32FromArray(buffer_, value); @@ -1412,20 +1366,7 @@ inline bool CodedInputStream::ReadLittleEndian32(uint32_t* value) { #endif } -inline bool CodedInputStream::ReadLittleEndian64(uint64* value) { -#if defined(PROTOBUF_LITTLE_ENDIAN) - if (PROTOBUF_PREDICT_TRUE(BufferSize() >= static_cast<int>(sizeof(*value)))) { - buffer_ = ReadLittleEndian64FromArray(buffer_, value); - return true; - } else { - return ReadLittleEndian64Fallback(value); - } -#else - return ReadLittleEndian64Fallback(value); -#endif -} -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -inline bool CodedInputStream::ReadLittleEndian64(uint64_t* value) { +inline bool CodedInputStream::ReadLittleEndian64(ui64* value) { #if defined(PROTOBUF_LITTLE_ENDIAN) if (PROTOBUF_PREDICT_TRUE(BufferSize() >= static_cast<int>(sizeof(*value)))) { buffer_ = ReadLittleEndian64FromArray(buffer_, value); @@ -1437,10 +1378,9 @@ inline bool CodedInputStream::ReadLittleEndian64(uint64_t* value) { return ReadLittleEndian64Fallback(value); #endif } -#endif -inline uint32_t CodedInputStream::ReadTagNoLastTag() { - uint32_t v = 0; +inline ui32 CodedInputStream::ReadTagNoLastTag() { + ui32 v = 0; if (PROTOBUF_PREDICT_TRUE(buffer_ < buffer_end_)) { v = *buffer_; if (v < 0x80) { @@ -1452,20 +1392,20 @@ inline uint32_t CodedInputStream::ReadTagNoLastTag() { return v; } -inline std::pair<uint32_t, bool> CodedInputStream::ReadTagWithCutoffNoLastTag( - uint32_t cutoff) { +inline std::pair<ui32, bool> CodedInputStream::ReadTagWithCutoffNoLastTag( + ui32 cutoff) { // In performance-sensitive code we can expect cutoff to be a compile-time // constant, and things like "cutoff >= kMax1ByteVarint" to be evaluated at // compile time. - uint32_t first_byte_or_zero = 0; + ui32 first_byte_or_zero = 0; if (PROTOBUF_PREDICT_TRUE(buffer_ < buffer_end_)) { // Hot case: buffer_ non_empty, buffer_[0] in [1, 128). // TODO(gpike): Is it worth rearranging this? E.g., if the number of fields // is large enough then is it better to check for the two-byte case first? first_byte_or_zero = buffer_[0]; if (static_cast<int8_t>(buffer_[0]) > 0) { - const uint32_t kMax1ByteVarint = 0x7f; - uint32_t tag = buffer_[0]; + const ui32 kMax1ByteVarint = 0x7f; + ui32 tag = buffer_[0]; Advance(1); return std::make_pair(tag, cutoff >= kMax1ByteVarint || tag <= cutoff); } @@ -1474,8 +1414,8 @@ inline std::pair<uint32_t, bool> CodedInputStream::ReadTagWithCutoffNoLastTag( // first byte and the second byte. if (cutoff >= 0x80 && PROTOBUF_PREDICT_TRUE(buffer_ + 1 < buffer_end_) && PROTOBUF_PREDICT_TRUE((buffer_[0] & ~buffer_[1]) >= 0x80)) { - const uint32_t kMax2ByteVarint = (0x7f << 7) + 0x7f; - uint32_t tag = (1u << 7) * buffer_[1] + (buffer_[0] - 0x80); + const ui32 kMax2ByteVarint = (0x7f << 7) + 0x7f; + ui32 tag = (1u << 7) * buffer_[1] + (buffer_[0] - 0x80); Advance(2); // It might make sense to test for tag == 0 now, but it is so rare that // that we don't bother. A varint-encoded 0 should be one byte unless @@ -1488,11 +1428,11 @@ inline std::pair<uint32_t, bool> CodedInputStream::ReadTagWithCutoffNoLastTag( } } // Slow path - const uint32_t tag = ReadTagFallback(first_byte_or_zero); - return std::make_pair(tag, static_cast<uint32_t>(tag - 1) < cutoff); + const ui32 tag = ReadTagFallback(first_byte_or_zero); + return std::make_pair(tag, static_cast<ui32>(tag - 1) < cutoff); } -inline bool CodedInputStream::LastTagWas(uint32_t expected) { +inline bool CodedInputStream::LastTagWas(ui32 expected) { return last_tag_ == expected; } @@ -1500,7 +1440,7 @@ inline bool CodedInputStream::ConsumedEntireMessage() { return legitimate_message_end_; } -inline bool CodedInputStream::ExpectTag(uint32_t expected) { +inline bool CodedInputStream::ExpectTag(ui32 expected) { if (expected < (1 << 7)) { if (PROTOBUF_PREDICT_TRUE(buffer_ < buffer_end_) && buffer_[0] == expected) { @@ -1525,7 +1465,7 @@ inline bool CodedInputStream::ExpectTag(uint32_t expected) { } inline const uint8_t* CodedInputStream::ExpectTagFromArray(const uint8_t* buffer, - uint32_t expected) { + ui32 expected) { if (expected < (1 << 7)) { if (buffer[0] == expected) { return buffer + 1; @@ -1658,13 +1598,13 @@ inline bool CodedInputStream::Skip(int count) { return SkipFallback(count, original_buffer_size); } -inline uint8_t* CodedOutputStream::WriteVarint32ToArray(uint32_t value, +inline uint8_t* CodedOutputStream::WriteVarint32ToArray(ui32 value, uint8_t* target) { return EpsCopyOutputStream::UnsafeVarint(value, target); } inline uint8_t* CodedOutputStream::WriteVarint32ToArrayOutOfLine( - uint32_t value, uint8_t* target) { + ui32 value, uint8_t* target) { target[0] = static_cast<uint8_t>(value); if (value < 0x80) { return target + 1; @@ -1673,21 +1613,21 @@ inline uint8_t* CodedOutputStream::WriteVarint32ToArrayOutOfLine( } } -inline uint8_t* CodedOutputStream::WriteVarint64ToArray(uint64_t value, +inline uint8_t* CodedOutputStream::WriteVarint64ToArray(ui64 value, uint8_t* target) { return EpsCopyOutputStream::UnsafeVarint(value, target); } -inline void CodedOutputStream::WriteVarint32SignExtended(int32_t value) { - WriteVarint64(static_cast<uint64_t>(value)); +inline void CodedOutputStream::WriteVarint32SignExtended(i32 value) { + WriteVarint64(static_cast<ui64>(value)); } inline uint8_t* CodedOutputStream::WriteVarint32SignExtendedToArray( - int32_t value, uint8_t* target) { - return WriteVarint64ToArray(static_cast<uint64_t>(value), target); + i32 value, uint8_t* target) { + return WriteVarint64ToArray(static_cast<ui64>(value), target); } -inline uint8_t* CodedOutputStream::WriteLittleEndian32ToArray(uint32_t value, +inline uint8_t* CodedOutputStream::WriteLittleEndian32ToArray(ui32 value, uint8_t* target) { #if defined(PROTOBUF_LITTLE_ENDIAN) memcpy(target, &value, sizeof(value)); @@ -1700,13 +1640,13 @@ inline uint8_t* CodedOutputStream::WriteLittleEndian32ToArray(uint32_t value, return target + sizeof(value); } -inline uint8_t* CodedOutputStream::WriteLittleEndian64ToArray(uint64_t value, +inline uint8_t* CodedOutputStream::WriteLittleEndian64ToArray(ui64 value, uint8_t* target) { #if defined(PROTOBUF_LITTLE_ENDIAN) memcpy(target, &value, sizeof(value)); #else - uint32_t part0 = static_cast<uint32_t>(value); - uint32_t part1 = static_cast<uint32_t>(value >> 32); + ui32 part0 = static_cast<ui32>(value); + ui32 part1 = static_cast<ui32>(value >> 32); target[0] = static_cast<uint8_t>(part0); target[1] = static_cast<uint8_t>(part0 >> 8); @@ -1720,63 +1660,63 @@ inline uint8_t* CodedOutputStream::WriteLittleEndian64ToArray(uint64_t value, return target + sizeof(value); } -inline void CodedOutputStream::WriteVarint32(uint32_t value) { +inline void CodedOutputStream::WriteVarint32(ui32 value) { cur_ = impl_.EnsureSpace(cur_); SetCur(WriteVarint32ToArray(value, Cur())); } -inline void CodedOutputStream::WriteVarint64(uint64_t value) { +inline void CodedOutputStream::WriteVarint64(ui64 value) { cur_ = impl_.EnsureSpace(cur_); SetCur(WriteVarint64ToArray(value, Cur())); } -inline void CodedOutputStream::WriteTag(uint32_t value) { +inline void CodedOutputStream::WriteTag(ui32 value) { WriteVarint32(value); } -inline uint8_t* CodedOutputStream::WriteTagToArray(uint32_t value, +inline uint8_t* CodedOutputStream::WriteTagToArray(ui32 value, uint8_t* target) { return WriteVarint32ToArray(value, target); } -inline size_t CodedOutputStream::VarintSize32(uint32_t value) { +inline size_t CodedOutputStream::VarintSize32(ui32 value) { // This computes value == 0 ? 1 : floor(log2(value)) / 7 + 1 // Use an explicit multiplication to implement the divide of // a number in the 1..31 range. // Explicit OR 0x1 to avoid calling Bits::Log2FloorNonZero(0), which is // undefined. - uint32_t log2value = Bits::Log2FloorNonZero(value | 0x1); + ui32 log2value = Bits::Log2FloorNonZero(value | 0x1); return static_cast<size_t>((log2value * 9 + 73) / 64); } -inline size_t CodedOutputStream::VarintSize32PlusOne(uint32_t value) { +inline size_t CodedOutputStream::VarintSize32PlusOne(ui32 value) { // Same as above, but one more. - uint32_t log2value = Bits::Log2FloorNonZero(value | 0x1); + ui32 log2value = Bits::Log2FloorNonZero(value | 0x1); return static_cast<size_t>((log2value * 9 + 73 + 64) / 64); } -inline size_t CodedOutputStream::VarintSize64(uint64_t value) { +inline size_t CodedOutputStream::VarintSize64(ui64 value) { // This computes value == 0 ? 1 : floor(log2(value)) / 7 + 1 // Use an explicit multiplication to implement the divide of // a number in the 1..63 range. // Explicit OR 0x1 to avoid calling Bits::Log2FloorNonZero(0), which is // undefined. - uint32_t log2value = Bits::Log2FloorNonZero64(value | 0x1); + ui32 log2value = Bits::Log2FloorNonZero64(value | 0x1); return static_cast<size_t>((log2value * 9 + 73) / 64); } -inline size_t CodedOutputStream::VarintSize64PlusOne(uint64_t value) { +inline size_t CodedOutputStream::VarintSize64PlusOne(ui64 value) { // Same as above, but one more. - uint32_t log2value = Bits::Log2FloorNonZero64(value | 0x1); + ui32 log2value = Bits::Log2FloorNonZero64(value | 0x1); return static_cast<size_t>((log2value * 9 + 73 + 64) / 64); } -inline size_t CodedOutputStream::VarintSize32SignExtended(int32_t value) { - return VarintSize64(static_cast<uint64_t>(int64_t{value})); +inline size_t CodedOutputStream::VarintSize32SignExtended(i32 value) { + return VarintSize64(static_cast<ui64>(i64{value})); } -inline size_t CodedOutputStream::VarintSize32SignExtendedPlusOne(int32_t value) { - return VarintSize64PlusOne(static_cast<uint64_t>(int64_t{value})); +inline size_t CodedOutputStream::VarintSize32SignExtendedPlusOne(i32 value) { + return VarintSize64PlusOne(static_cast<ui64>(i64{value})); } inline void CodedOutputStream::WriteString(const TProtoStringType& str) { diff --git a/contrib/libs/protobuf/src/google/protobuf/io/gzip_stream.cc b/contrib/libs/protobuf/src/google/protobuf/io/gzip_stream.cc index 2f1d26f410..84b7993cc0 100644 --- a/contrib/libs/protobuf/src/google/protobuf/io/gzip_stream.cc +++ b/contrib/libs/protobuf/src/google/protobuf/io/gzip_stream.cc @@ -186,7 +186,7 @@ bool GzipInputStream::Skip(int count) { return ok; } int64_t GzipInputStream::ByteCount() const { - int64_t ret = byte_count_ + zcontext_.total_out; + i64 ret = byte_count_ + zcontext_.total_out; if (zcontext_.next_out != NULL && output_position_ != NULL) { ret += reinterpret_cast<uintptr_t>(zcontext_.next_out) - reinterpret_cast<uintptr_t>(output_position_); diff --git a/contrib/libs/protobuf/src/google/protobuf/io/gzip_stream.h b/contrib/libs/protobuf/src/google/protobuf/io/gzip_stream.h index f0283e86f4..90a9cccfa6 100644 --- a/contrib/libs/protobuf/src/google/protobuf/io/gzip_stream.h +++ b/contrib/libs/protobuf/src/google/protobuf/io/gzip_stream.h @@ -96,7 +96,7 @@ class PROTOBUF_EXPORT GzipInputStream : public ZeroCopyInputStream { void* output_buffer_; void* output_position_; size_t output_buffer_length_; - int64_t byte_count_; + i64 byte_count_; int Inflate(int flush); void DoNextOutput(const void** data, int* size); diff --git a/contrib/libs/protobuf/src/google/protobuf/io/tokenizer.cc b/contrib/libs/protobuf/src/google/protobuf/io/tokenizer.cc index ed5e012210..54c6f7bed9 100644 --- a/contrib/libs/protobuf/src/google/protobuf/io/tokenizer.cc +++ b/contrib/libs/protobuf/src/google/protobuf/io/tokenizer.cc @@ -860,48 +860,9 @@ bool Tokenizer::NextWithComments(TProtoStringType* prev_trailing_comments, // tokenizing. Also, these can assume that whatever text they // are given is text that the tokenizer actually parsed as a token // of the given type. -bool Tokenizer::ParseInteger(const TProtoStringType& text, uint64_t max_value, - uint64* output) { - // Sadly, we can't just use strtoul() since it is only 32-bit and strtoull() - // is non-standard. I hate the C standard library. :( - - // return strtoull(text.c_str(), NULL, 0); - - const char* ptr = text.c_str(); - int base = 10; - if (ptr[0] == '0') { - if (ptr[1] == 'x' || ptr[1] == 'X') { - // This is hex. - base = 16; - ptr += 2; - } else { - // This is octal. - base = 8; - } - } - uint64_t result = 0; - for (; *ptr != '\0'; ptr++) { - int digit = DigitValue(*ptr); - if (digit < 0 || digit >= base) { - // The token provided by Tokenizer is invalid. i.e., 099 is an invalid - // token, but Tokenizer still think it's integer. - return false; - } - if (static_cast<uint64>(digit) > max_value || - result > (max_value - digit) / base) { - // Overflow. - return false; - } - result = result * base + digit; - } - - *output = result; - return true; -} -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -bool Tokenizer::ParseInteger(const TProtoStringType& text, uint64_t max_value, - uint64_t* output) { +bool Tokenizer::ParseInteger(const TProtoStringType& text, ui64 max_value, + ui64* output) { // Sadly, we can't just use strtoul() since it is only 32-bit and strtoull() // is non-standard. I hate the C standard library. :( @@ -920,7 +881,7 @@ bool Tokenizer::ParseInteger(const TProtoStringType& text, uint64_t max_value, } } - uint64_t result = 0; + ui64 result = 0; for (; *ptr != '\0'; ptr++) { int digit = DigitValue(*ptr); if (digit < 0 || digit >= base) { @@ -928,7 +889,7 @@ bool Tokenizer::ParseInteger(const TProtoStringType& text, uint64_t max_value, // token, but Tokenizer still think it's integer. return false; } - if (static_cast<uint64_t>(digit) > max_value || + if (static_cast<ui64>(digit) > max_value || result > (max_value - digit) / base) { // Overflow. return false; @@ -939,7 +900,6 @@ bool Tokenizer::ParseInteger(const TProtoStringType& text, uint64_t max_value, *output = result; return true; } -#endif double Tokenizer::ParseFloat(const TProtoStringType& text) { const char* start = text.c_str(); @@ -970,8 +930,8 @@ double Tokenizer::ParseFloat(const TProtoStringType& text) { // Helper to append a Unicode code point to a string as UTF8, without bringing // in any external dependencies. -static void AppendUTF8(uint32_t code_point, TProtoStringType* output) { - uint32_t tmp = 0; +static void AppendUTF8(ui32 code_point, TProtoStringType* output) { + ui32 tmp = 0; int len = 0; if (code_point <= 0x7f) { tmp = code_point; @@ -1001,7 +961,7 @@ static void AppendUTF8(uint32_t code_point, TProtoStringType* output) { // Try to read <len> hex digits from ptr, and stuff the numeric result into // *result. Returns true if that many digits were successfully consumed. -static bool ReadHexDigits(const char* ptr, int len, uint32_t* result) { +static bool ReadHexDigits(const char* ptr, int len, ui32* result) { *result = 0; if (len == 0) return false; for (const char* end = ptr + len; ptr < end; ++ptr) { @@ -1016,22 +976,22 @@ static bool ReadHexDigits(const char* ptr, int len, uint32_t* result) { // surrogate. These numbers are in a reserved range of Unicode code points, so // if we encounter such a pair we know how to parse it and convert it into a // single code point. -static const uint32_t kMinHeadSurrogate = 0xd800; -static const uint32_t kMaxHeadSurrogate = 0xdc00; -static const uint32_t kMinTrailSurrogate = 0xdc00; -static const uint32_t kMaxTrailSurrogate = 0xe000; +static const ui32 kMinHeadSurrogate = 0xd800; +static const ui32 kMaxHeadSurrogate = 0xdc00; +static const ui32 kMinTrailSurrogate = 0xdc00; +static const ui32 kMaxTrailSurrogate = 0xe000; -static inline bool IsHeadSurrogate(uint32_t code_point) { +static inline bool IsHeadSurrogate(ui32 code_point) { return (code_point >= kMinHeadSurrogate) && (code_point < kMaxHeadSurrogate); } -static inline bool IsTrailSurrogate(uint32_t code_point) { +static inline bool IsTrailSurrogate(ui32 code_point) { return (code_point >= kMinTrailSurrogate) && (code_point < kMaxTrailSurrogate); } // Combine a head and trail surrogate into a single Unicode code point. -static uint32_t AssembleUTF16(uint32_t head_surrogate, uint32_t trail_surrogate) { +static ui32 AssembleUTF16(ui32 head_surrogate, ui32 trail_surrogate) { GOOGLE_DCHECK(IsHeadSurrogate(head_surrogate)); GOOGLE_DCHECK(IsTrailSurrogate(trail_surrogate)); return 0x10000 + (((head_surrogate - kMinHeadSurrogate) << 10) | @@ -1049,7 +1009,7 @@ static inline int UnicodeLength(char key) { // to parse that sequence. On success, returns a pointer to the first char // beyond that sequence, and fills in *code_point. On failure, returns ptr // itself. -static const char* FetchUnicodePoint(const char* ptr, uint32_t* code_point) { +static const char* FetchUnicodePoint(const char* ptr, ui32* code_point) { const char* p = ptr; // Fetch the code point. const int len = UnicodeLength(*p++); @@ -1061,7 +1021,7 @@ static const char* FetchUnicodePoint(const char* ptr, uint32_t* code_point) { // "trail surrogate," and together they form a UTF-16 pair which decodes into // a single Unicode point. Trail surrogates may only use \u, not \U. if (IsHeadSurrogate(*code_point) && *p == '\\' && *(p + 1) == 'u') { - uint32_t trail_surrogate; + ui32 trail_surrogate; if (ReadHexDigits(p + 2, 4, &trail_surrogate) && IsTrailSurrogate(trail_surrogate)) { *code_point = AssembleUTF16(*code_point, trail_surrogate); @@ -1133,7 +1093,7 @@ void Tokenizer::ParseStringAppend(const TProtoStringType& text, output->push_back(static_cast<char>(code)); } else if (*ptr == 'u' || *ptr == 'U') { - uint32_t unicode; + ui32 unicode; const char* end = FetchUnicodePoint(ptr, &unicode); if (end == ptr) { // Failure: Just dump out what we saw, don't try to parse it. diff --git a/contrib/libs/protobuf/src/google/protobuf/io/tokenizer.h b/contrib/libs/protobuf/src/google/protobuf/io/tokenizer.h index 5021df4fc1..f2d71f4454 100644 --- a/contrib/libs/protobuf/src/google/protobuf/io/tokenizer.h +++ b/contrib/libs/protobuf/src/google/protobuf/io/tokenizer.h @@ -217,12 +217,8 @@ class PROTOBUF_EXPORT Tokenizer { // result. If the text is not from a Token of type TYPE_INTEGER originally // parsed by a Tokenizer, the result is undefined (possibly an assert // failure). - static bool ParseInteger(const TProtoStringType& text, uint64_t max_value, - uint64* output); -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) - static bool ParseInteger(const TProtoStringType& text, uint64_t max_value, - uint64_t* output); -#endif + static bool ParseInteger(const TProtoStringType& text, ui64 max_value, + ui64* output); // Options --------------------------------------------------------- diff --git a/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc b/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc index 0986ea271f..7f577c4088 100644 --- a/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc +++ b/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc @@ -338,12 +338,12 @@ bool ConcatenatingInputStream::Skip(int count) { while (stream_count_ > 0) { // Assume that ByteCount() can be used to find out how much we actually // skipped when Skip() fails. - int64_t target_byte_count = streams_[0]->ByteCount() + count; + i64 target_byte_count = streams_[0]->ByteCount() + count; if (streams_[0]->Skip(count)) return true; // Hit the end of the stream. Figure out how many more bytes we still have // to skip. - int64_t final_byte_count = streams_[0]->ByteCount(); + i64 final_byte_count = streams_[0]->ByteCount(); GOOGLE_DCHECK_LT(final_byte_count, target_byte_count); count = target_byte_count - final_byte_count; diff --git a/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl.h b/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl.h index e6ba902e8d..3cb84d7e08 100644 --- a/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl.h +++ b/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl.h @@ -311,7 +311,7 @@ class PROTOBUF_EXPORT ConcatenatingInputStream : public ZeroCopyInputStream { // decremented. ZeroCopyInputStream* const* streams_; int stream_count_; - int64_t bytes_retired_; // Bytes read from previous streams. + i64 bytes_retired_; // Bytes read from previous streams. GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ConcatenatingInputStream); }; diff --git a/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc b/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc index 8be9ab9c13..e45e1e0346 100644 --- a/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc +++ b/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc @@ -406,7 +406,7 @@ void CopyingOutputStreamAdaptor::FreeBuffer() { // =================================================================== LimitingInputStream::LimitingInputStream(ZeroCopyInputStream* input, - int64_t limit) + i64 limit) : input_(input), limit_(limit) { prior_bytes_read_ = input_->ByteCount(); } diff --git a/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h b/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h index 200af105b8..115aca68a2 100644 --- a/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h +++ b/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h @@ -236,7 +236,7 @@ class PROTOBUF_EXPORT CopyingInputStreamAdaptor : public ZeroCopyInputStream { // The current position of copying_stream_, relative to the point where // we started reading. - int64_t position_; + i64 position_; // Data is read into this buffer. It may be NULL if no buffer is currently // in use. Otherwise, it points to an array of size buffer_size_. @@ -327,7 +327,7 @@ class PROTOBUF_EXPORT CopyingOutputStreamAdaptor : public ZeroCopyOutputStream { // The current position of copying_stream_, relative to the point where // we started writing. - int64_t position_; + i64 position_; // Data is written from this buffer. It may be NULL if no buffer is // currently in use. Otherwise, it points to an array of size buffer_size_. @@ -348,7 +348,7 @@ class PROTOBUF_EXPORT CopyingOutputStreamAdaptor : public ZeroCopyOutputStream { // a particular byte count. class PROTOBUF_EXPORT LimitingInputStream : public ZeroCopyInputStream { public: - LimitingInputStream(ZeroCopyInputStream* input, int64_t limit); + LimitingInputStream(ZeroCopyInputStream* input, i64 limit); ~LimitingInputStream() override; // implements ZeroCopyInputStream ---------------------------------- @@ -360,8 +360,8 @@ class PROTOBUF_EXPORT LimitingInputStream : public ZeroCopyInputStream { private: ZeroCopyInputStream* input_; - int64_t limit_; // Decreases as we go, becomes negative if we overshoot. - int64_t prior_bytes_read_; // Bytes read on underlying stream at construction + i64 limit_; // Decreases as we go, becomes negative if we overshoot. + i64 prior_bytes_read_; // Bytes read on underlying stream at construction GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(LimitingInputStream); }; diff --git a/contrib/libs/protobuf/src/google/protobuf/map.h b/contrib/libs/protobuf/src/google/protobuf/map.h index a3f1b42fc9..a6dfc02979 100644 --- a/contrib/libs/protobuf/src/google/protobuf/map.h +++ b/contrib/libs/protobuf/src/google/protobuf/map.h @@ -1023,12 +1023,12 @@ class Map { size_type BucketNumber(const K& k) const { // We xor the hash value against the random seed so that we effectively // have a random hash function. - uint64_t h = hash_function()(k) ^ seed_; + ui64 h = hash_function()(k) ^ seed_; // We use the multiplication method to determine the bucket number from // the hash value. The constant kPhi (suggested by Knuth) is roughly // (sqrt(5) - 1) / 2 * 2^64. - constexpr uint64_t kPhi = uint64_t{0x9e3779b97f4a7c15}; + constexpr ui64 kPhi = ui64{0x9e3779b97f4a7c15}; return ((kPhi * h) >> 32) & (num_buckets_ - 1); } @@ -1082,9 +1082,9 @@ class Map { size_type s = reinterpret_cast<uintptr_t>(this) >> 4; #if defined(__x86_64__) && defined(__GNUC__) && \ !defined(GOOGLE_PROTOBUF_NO_RDTSC) - uint32_t hi, lo; + ui32 hi, lo; asm volatile("rdtsc" : "=a"(lo), "=d"(hi)); - s += ((static_cast<uint64_t>(hi) << 32) | lo); + s += ((static_cast<ui64>(hi) << 32) | lo); #endif return s; } diff --git a/contrib/libs/protobuf/src/google/protobuf/map_entry.h b/contrib/libs/protobuf/src/google/protobuf/map_entry.h index 2aec2d4b08..c054520931 100644 --- a/contrib/libs/protobuf/src/google/protobuf/map_entry.h +++ b/contrib/libs/protobuf/src/google/protobuf/map_entry.h @@ -78,8 +78,8 @@ namespace internal { // field. // // cpp type | proto type | in-memory type | MapEntry accessor type -// int32_t TYPE_INT32 int32_t int32_t -// int32_t TYPE_FIXED32 int32_t int32_t +// i32 TYPE_INT32 i32 i32 +// i32 TYPE_FIXED32 i32 i32 // string TYPE_STRING ArenaStringPtr string // FooEnum TYPE_ENUM int int // FooMessage TYPE_MESSAGE FooMessage* FooMessage diff --git a/contrib/libs/protobuf/src/google/protobuf/map_entry_lite.h b/contrib/libs/protobuf/src/google/protobuf/map_entry_lite.h index 442dc9f623..72ab073da4 100644 --- a/contrib/libs/protobuf/src/google/protobuf/map_entry_lite.h +++ b/contrib/libs/protobuf/src/google/protobuf/map_entry_lite.h @@ -125,7 +125,7 @@ struct MapEntryFuncs { size_t inner_length = 2 + KeyTypeHandler::ByteSize(key) + ValueTypeHandler::ByteSize(value); return inner_length + io::CodedOutputStream::VarintSize32( - static_cast<uint32_t>(inner_length)); + static_cast<ui32>(inner_length)); } static int GetCachedSize(const Key& key, const Value& value) { @@ -229,7 +229,7 @@ class MapEntryImpl : public Base { const char* _InternalParse(const char* ptr, ParseContext* ctx) final { while (!ctx->Done(&ptr)) { - uint32_t tag; + ui32 tag; ptr = ReadTag(ptr, &tag); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); if (tag == kKeyTag) { @@ -423,7 +423,7 @@ class MapEntryImpl : public Base { template <typename UnknownType> const char* ParseWithEnumValidation(const char* ptr, ParseContext* ctx, bool (*is_valid)(int), - uint32_t field_num, + ui32 field_num, InternalMetadata* metadata) { auto entry = NewEntry(); ptr = entry->_InternalParse(ptr, ctx); @@ -501,7 +501,7 @@ class MapEntryImpl : public Base { public: // Needed for constructing tables KeyOnMemory key_; ValueOnMemory value_; - uint32_t _has_bits_[1]; + ui32 _has_bits_[1]; private: friend class ::PROTOBUF_NAMESPACE_ID::Arena; @@ -642,8 +642,8 @@ struct MapEntryHelper< // The proto compiler generates the offsets in this struct as if this was // a regular message. This way the table driven code barely notices it's // dealing with a map field. - uint32_t _has_bits_; // NOLINT - uint32_t _cached_size_; // NOLINT + ui32 _has_bits_; // NOLINT + ui32 _cached_size_; // NOLINT KeyOnMemory key_; // NOLINT ValueOnMemory value_; // NOLINT }; diff --git a/contrib/libs/protobuf/src/google/protobuf/map_field.cc b/contrib/libs/protobuf/src/google/protobuf/map_field.cc index 8fc49b20f3..3aa8658ac4 100644 --- a/contrib/libs/protobuf/src/google/protobuf/map_field.cc +++ b/contrib/libs/protobuf/src/google/protobuf/map_field.cc @@ -236,15 +236,15 @@ void DynamicMapField::AllocateMapValue(MapValueRef* map_val) { map_val->SetValue(value); \ break; \ } - HANDLE_TYPE(INT32, int32_t); - HANDLE_TYPE(INT64, int64_t); - HANDLE_TYPE(UINT32, uint32_t); - HANDLE_TYPE(UINT64, uint64_t); + HANDLE_TYPE(INT32, i32); + HANDLE_TYPE(INT64, i64); + HANDLE_TYPE(UINT32, ui32); + HANDLE_TYPE(UINT64, ui64); HANDLE_TYPE(DOUBLE, double); HANDLE_TYPE(FLOAT, float); HANDLE_TYPE(BOOL, bool); HANDLE_TYPE(STRING, TProtoStringType); - HANDLE_TYPE(ENUM, int32_t); + HANDLE_TYPE(ENUM, i32); #undef HANDLE_TYPE case FieldDescriptor::CPPTYPE_MESSAGE: { const Message& message = @@ -543,15 +543,15 @@ void DynamicMapField::SyncMapWithRepeatedFieldNoLock() const { map_val.SetValue(value); \ break; \ } - HANDLE_TYPE(INT32, int32_t, Int32); - HANDLE_TYPE(INT64, int64_t, Int64); - HANDLE_TYPE(UINT32, uint32_t, UInt32); - HANDLE_TYPE(UINT64, uint64_t, UInt64); + HANDLE_TYPE(INT32, i32, Int32); + HANDLE_TYPE(INT64, i64, Int64); + HANDLE_TYPE(UINT32, ui32, UInt32); + HANDLE_TYPE(UINT64, ui64, UInt64); HANDLE_TYPE(DOUBLE, double, Double); HANDLE_TYPE(FLOAT, float, Float); HANDLE_TYPE(BOOL, bool, Bool); HANDLE_TYPE(STRING, TProtoStringType, String); - HANDLE_TYPE(ENUM, int32_t, EnumValue); + HANDLE_TYPE(ENUM, i32, EnumValue); #undef HANDLE_TYPE case FieldDescriptor::CPPTYPE_MESSAGE: { const Message& message = reflection->GetMessage(*it, val_des); @@ -586,15 +586,15 @@ size_t DynamicMapField::SpaceUsedExcludingSelfNoLock() const { size += sizeof(TYPE) * map_size; \ break; \ } - HANDLE_TYPE(INT32, int32_t); - HANDLE_TYPE(INT64, int64_t); - HANDLE_TYPE(UINT32, uint32_t); - HANDLE_TYPE(UINT64, uint64_t); + HANDLE_TYPE(INT32, i32); + HANDLE_TYPE(INT64, i64); + HANDLE_TYPE(UINT32, ui32); + HANDLE_TYPE(UINT64, ui64); HANDLE_TYPE(DOUBLE, double); HANDLE_TYPE(FLOAT, float); HANDLE_TYPE(BOOL, bool); HANDLE_TYPE(STRING, TProtoStringType); - HANDLE_TYPE(ENUM, int32_t); + HANDLE_TYPE(ENUM, i32); #undef HANDLE_TYPE case FieldDescriptor::CPPTYPE_MESSAGE: { while (it != map_.end()) { diff --git a/contrib/libs/protobuf/src/google/protobuf/map_field.h b/contrib/libs/protobuf/src/google/protobuf/map_field.h index 57d691267d..05258a8eea 100644 --- a/contrib/libs/protobuf/src/google/protobuf/map_field.h +++ b/contrib/libs/protobuf/src/google/protobuf/map_field.h @@ -96,19 +96,19 @@ class PROTOBUF_EXPORT MapKey { return type_; } - void SetInt64Value(int64_t value) { + void SetInt64Value(i64 value) { SetType(FieldDescriptor::CPPTYPE_INT64); val_.int64_value_ = value; } - void SetUInt64Value(uint64_t value) { + void SetUInt64Value(ui64 value) { SetType(FieldDescriptor::CPPTYPE_UINT64); val_.uint64_value_ = value; } - void SetInt32Value(int32_t value) { + void SetInt32Value(i32 value) { SetType(FieldDescriptor::CPPTYPE_INT32); val_.int32_value_ = value; } - void SetUInt32Value(uint32_t value) { + void SetUInt32Value(ui32 value) { SetType(FieldDescriptor::CPPTYPE_UINT32); val_.uint32_value_ = value; } @@ -121,19 +121,19 @@ class PROTOBUF_EXPORT MapKey { *val_.string_value_.get_mutable() = std::move(val); } - int64_t GetInt64Value() const { + i64 GetInt64Value() const { TYPE_CHECK(FieldDescriptor::CPPTYPE_INT64, "MapKey::GetInt64Value"); return val_.int64_value_; } - uint64_t GetUInt64Value() const { + ui64 GetUInt64Value() const { TYPE_CHECK(FieldDescriptor::CPPTYPE_UINT64, "MapKey::GetUInt64Value"); return val_.uint64_value_; } - int32_t GetInt32Value() const { + i32 GetInt32Value() const { TYPE_CHECK(FieldDescriptor::CPPTYPE_INT32, "MapKey::GetInt32Value"); return val_.int32_value_; } - uint32_t GetUInt32Value() const { + ui32 GetUInt32Value() const { TYPE_CHECK(FieldDescriptor::CPPTYPE_UINT32, "MapKey::GetUInt32Value"); return val_.uint32_value_; } @@ -243,10 +243,10 @@ class PROTOBUF_EXPORT MapKey { union KeyValue { KeyValue() {} internal::ExplicitlyConstructed<TProtoStringType> string_value_; - int64_t int64_value_; - int32_t int32_value_; - uint64_t uint64_value_; - uint32_t uint32_value_; + i64 int64_value_; + i32 int32_value_; + ui64 uint64_value_; + ui32 uint32_value_; bool bool_value_; } val_; @@ -592,7 +592,7 @@ class MapField : public TypeDefinedMapFieldBase<Key, T> { } template <typename UnknownType> const char* ParseWithEnumValidation(const char* ptr, ParseContext* ctx, - bool (*is_valid)(int), uint32_t field_num, + bool (*is_valid)(int), ui32 field_num, InternalMetadata* metadata) { return impl_.template ParseWithEnumValidation<UnknownType>( ptr, ctx, is_valid, field_num, metadata); @@ -683,25 +683,25 @@ class PROTOBUF_EXPORT MapValueConstRef { public: MapValueConstRef() : data_(nullptr), type_() {} - int64_t GetInt64Value() const { + i64 GetInt64Value() const { TYPE_CHECK(FieldDescriptor::CPPTYPE_INT64, "MapValueConstRef::GetInt64Value"); - return *reinterpret_cast<int64_t*>(data_); + return *reinterpret_cast<i64*>(data_); } - uint64_t GetUInt64Value() const { + ui64 GetUInt64Value() const { TYPE_CHECK(FieldDescriptor::CPPTYPE_UINT64, "MapValueConstRef::GetUInt64Value"); - return *reinterpret_cast<uint64_t*>(data_); + return *reinterpret_cast<ui64*>(data_); } - int32_t GetInt32Value() const { + i32 GetInt32Value() const { TYPE_CHECK(FieldDescriptor::CPPTYPE_INT32, "MapValueConstRef::GetInt32Value"); - return *reinterpret_cast<int32_t*>(data_); + return *reinterpret_cast<i32*>(data_); } - uint32_t GetUInt32Value() const { + ui32 GetUInt32Value() const { TYPE_CHECK(FieldDescriptor::CPPTYPE_UINT32, "MapValueConstRef::GetUInt32Value"); - return *reinterpret_cast<uint32_t*>(data_); + return *reinterpret_cast<ui32*>(data_); } bool GetBoolValue() const { TYPE_CHECK(FieldDescriptor::CPPTYPE_BOOL, "MapValueConstRef::GetBoolValue"); @@ -775,21 +775,21 @@ class PROTOBUF_EXPORT MapValueRef final : public MapValueConstRef { public: MapValueRef() {} - void SetInt64Value(int64_t value) { + void SetInt64Value(i64 value) { TYPE_CHECK(FieldDescriptor::CPPTYPE_INT64, "MapValueRef::SetInt64Value"); - *reinterpret_cast<int64_t*>(data_) = value; + *reinterpret_cast<i64*>(data_) = value; } - void SetUInt64Value(uint64_t value) { + void SetUInt64Value(ui64 value) { TYPE_CHECK(FieldDescriptor::CPPTYPE_UINT64, "MapValueRef::SetUInt64Value"); - *reinterpret_cast<uint64_t*>(data_) = value; + *reinterpret_cast<ui64*>(data_) = value; } - void SetInt32Value(int32_t value) { + void SetInt32Value(i32 value) { TYPE_CHECK(FieldDescriptor::CPPTYPE_INT32, "MapValueRef::SetInt32Value"); - *reinterpret_cast<int32_t*>(data_) = value; + *reinterpret_cast<i32*>(data_) = value; } - void SetUInt32Value(uint32_t value) { + void SetUInt32Value(ui32 value) { TYPE_CHECK(FieldDescriptor::CPPTYPE_UINT32, "MapValueRef::SetUInt32Value"); - *reinterpret_cast<uint32_t*>(data_) = value; + *reinterpret_cast<ui32*>(data_) = value; } void SetBoolValue(bool value) { TYPE_CHECK(FieldDescriptor::CPPTYPE_BOOL, "MapValueRef::SetBoolValue"); @@ -830,15 +830,15 @@ class PROTOBUF_EXPORT MapValueRef final : public MapValueConstRef { delete reinterpret_cast<TYPE*>(data_); \ break; \ } - HANDLE_TYPE(INT32, int32_t); - HANDLE_TYPE(INT64, int64_t); - HANDLE_TYPE(UINT32, uint32_t); - HANDLE_TYPE(UINT64, uint64_t); + HANDLE_TYPE(INT32, i32); + HANDLE_TYPE(INT64, i64); + HANDLE_TYPE(UINT32, ui32); + HANDLE_TYPE(UINT64, ui64); HANDLE_TYPE(DOUBLE, double); HANDLE_TYPE(FLOAT, float); HANDLE_TYPE(BOOL, bool); HANDLE_TYPE(STRING, TProtoStringType); - HANDLE_TYPE(ENUM, int32_t); + HANDLE_TYPE(ENUM, i32); HANDLE_TYPE(MESSAGE, Message); #undef HANDLE_TYPE } diff --git a/contrib/libs/protobuf/src/google/protobuf/map_field_inl.h b/contrib/libs/protobuf/src/google/protobuf/map_field_inl.h index 0ff81e3dcb..78d96b8f44 100644 --- a/contrib/libs/protobuf/src/google/protobuf/map_field_inl.h +++ b/contrib/libs/protobuf/src/google/protobuf/map_field_inl.h @@ -49,31 +49,21 @@ namespace internal { template <typename T> T UnwrapMapKey(const MapKey& map_key); template <> -inline int32_t UnwrapMapKey<int32_t>(const MapKey& map_key) { +inline i32 UnwrapMapKey<i32>(const MapKey& map_key) { return map_key.GetInt32Value(); } template <> -inline uint32_t UnwrapMapKey<uint32_t>(const MapKey& map_key) { +inline ui32 UnwrapMapKey<ui32>(const MapKey& map_key) { return map_key.GetUInt32Value(); } template <> -inline int64 UnwrapMapKey<int64>(const MapKey& map_key) { +inline i64 UnwrapMapKey<i64>(const MapKey& map_key) { return map_key.GetInt64Value(); } template <> -inline uint64 UnwrapMapKey<uint64>(const MapKey& map_key) { +inline ui64 UnwrapMapKey<ui64>(const MapKey& map_key) { return map_key.GetUInt64Value(); } -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -template <> -inline int64_t UnwrapMapKey<int64_t>(const MapKey& map_key) { - return map_key.GetInt64Value(); -} -template <> -inline uint64_t UnwrapMapKey<uint64_t>(const MapKey& map_key) { - return map_key.GetUInt64Value(); -} -#endif template <> inline bool UnwrapMapKey<bool>(const MapKey& map_key) { return map_key.GetBoolValue(); @@ -87,33 +77,21 @@ inline TProtoStringType UnwrapMapKey<TProtoStringType>(const MapKey& map_key) { template <typename T> inline void SetMapKey(MapKey* map_key, const T& value); template <> -inline void SetMapKey<int32_t>(MapKey* map_key, const int32_t& value) { +inline void SetMapKey<i32>(MapKey* map_key, const i32& value) { map_key->SetInt32Value(value); } template <> -inline void SetMapKey<uint32_t>(MapKey* map_key, const uint32_t& value) { +inline void SetMapKey<ui32>(MapKey* map_key, const ui32& value) { map_key->SetUInt32Value(value); } template <> -inline void SetMapKey<int64>(MapKey* map_key, const int64& value) { +inline void SetMapKey<i64>(MapKey* map_key, const i64& value) { map_key->SetInt64Value(value); } -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) template <> -inline void SetMapKey<int64_t>(MapKey* map_key, const int64_t& value) { - map_key->SetInt64Value(value); -} -#endif -template <> -inline void SetMapKey<uint64>(MapKey* map_key, const uint64& value) { +inline void SetMapKey<ui64>(MapKey* map_key, const ui64& value) { map_key->SetUInt64Value(value); } -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -template <> -inline void SetMapKey<uint64_t>(MapKey* map_key, const uint64_t& value) { - map_key->SetUInt64Value(value); -} -#endif template <> inline void SetMapKey<bool>(MapKey* map_key, const bool& value) { map_key->SetBoolValue(value); diff --git a/contrib/libs/protobuf/src/google/protobuf/map_field_lite.h b/contrib/libs/protobuf/src/google/protobuf/map_field_lite.h index 2a321063e1..91edd5f82f 100644 --- a/contrib/libs/protobuf/src/google/protobuf/map_field_lite.h +++ b/contrib/libs/protobuf/src/google/protobuf/map_field_lite.h @@ -106,7 +106,7 @@ class MapFieldLite { template <typename UnknownType> const char* ParseWithEnumValidation(const char* ptr, ParseContext* ctx, - bool (*is_valid)(int), uint32_t field_num, + bool (*is_valid)(int), ui32 field_num, InternalMetadata* metadata) { typename Derived::template Parser<MapFieldLite, Map<Key, T>> parser(this); return parser.template ParseWithEnumValidation<UnknownType>( @@ -129,7 +129,7 @@ struct EnumParseWrapper { } T* map_field; bool (*is_valid)(int); - uint32_t field_num; + ui32 field_num; InternalMetadata* metadata; }; @@ -138,7 +138,7 @@ struct EnumParseWrapper { // generated code template <typename UnknownType, typename T> EnumParseWrapper<UnknownType, T> InitEnumParseWrapper( - T* map_field, bool (*is_valid)(int), uint32_t field_num, + T* map_field, bool (*is_valid)(int), ui32 field_num, InternalMetadata* metadata) { return EnumParseWrapper<UnknownType, T>{map_field, is_valid, field_num, metadata}; diff --git a/contrib/libs/protobuf/src/google/protobuf/map_type_handler.h b/contrib/libs/protobuf/src/google/protobuf/map_type_handler.h index 22a0f9325f..5ca4e62159 100644 --- a/contrib/libs/protobuf/src/google/protobuf/map_type_handler.h +++ b/contrib/libs/protobuf/src/google/protobuf/map_type_handler.h @@ -100,19 +100,19 @@ class MapWireFieldTypeTraits {}; TYPE_TRAITS(MESSAGE, Type, LENGTH_DELIMITED, true, false) TYPE_TRAITS(STRING, ArenaStringPtr, LENGTH_DELIMITED, false, false) TYPE_TRAITS(BYTES, ArenaStringPtr, LENGTH_DELIMITED, false, false) -TYPE_TRAITS(INT64, int64, VARINT, false, false) -TYPE_TRAITS(UINT64, uint64, VARINT, false, false) -TYPE_TRAITS(INT32, int32_t, VARINT, false, false) -TYPE_TRAITS(UINT32, uint32_t, VARINT, false, false) -TYPE_TRAITS(SINT64, int64, VARINT, false, false) -TYPE_TRAITS(SINT32, int32_t, VARINT, false, false) +TYPE_TRAITS(INT64, i64, VARINT, false, false) +TYPE_TRAITS(UINT64, ui64, VARINT, false, false) +TYPE_TRAITS(INT32, i32, VARINT, false, false) +TYPE_TRAITS(UINT32, ui32, VARINT, false, false) +TYPE_TRAITS(SINT64, i64, VARINT, false, false) +TYPE_TRAITS(SINT32, i32, VARINT, false, false) TYPE_TRAITS(ENUM, int, VARINT, false, true) TYPE_TRAITS(DOUBLE, double, FIXED64, false, false) TYPE_TRAITS(FLOAT, float, FIXED32, false, false) -TYPE_TRAITS(FIXED64, uint64, FIXED64, false, false) -TYPE_TRAITS(FIXED32, uint32_t, FIXED32, false, false) -TYPE_TRAITS(SFIXED64, int64, FIXED64, false, false) -TYPE_TRAITS(SFIXED32, int32_t, FIXED32, false, false) +TYPE_TRAITS(FIXED64, ui64, FIXED64, false, false) +TYPE_TRAITS(FIXED32, ui32, FIXED32, false, false) +TYPE_TRAITS(SFIXED64, i64, FIXED64, false, false) +TYPE_TRAITS(SFIXED32, i32, FIXED32, false, false) TYPE_TRAITS(BOOL, bool, VARINT, false, false) #undef TYPE_TRAITS @@ -406,23 +406,23 @@ const char* MapTypeHandler<WireFormatLite::TYPE_BYTES, Type>::Read( return ctx->ReadString(ptr, size, value); } -inline const char* ReadINT64(const char* ptr, int64* value) { - return VarintParse(ptr, reinterpret_cast<uint64*>(value)); +inline const char* ReadINT64(const char* ptr, i64* value) { + return VarintParse(ptr, reinterpret_cast<ui64*>(value)); } -inline const char* ReadUINT64(const char* ptr, uint64* value) { +inline const char* ReadUINT64(const char* ptr, ui64* value) { return VarintParse(ptr, value); } -inline const char* ReadINT32(const char* ptr, int32_t* value) { - return VarintParse(ptr, reinterpret_cast<uint32_t*>(value)); +inline const char* ReadINT32(const char* ptr, i32* value) { + return VarintParse(ptr, reinterpret_cast<ui32*>(value)); } -inline const char* ReadUINT32(const char* ptr, uint32_t* value) { +inline const char* ReadUINT32(const char* ptr, ui32* value) { return VarintParse(ptr, value); } -inline const char* ReadSINT64(const char* ptr, int64* value) { +inline const char* ReadSINT64(const char* ptr, i64* value) { *value = ReadVarintZigZag64(&ptr); return ptr; } -inline const char* ReadSINT32(const char* ptr, int32_t* value) { +inline const char* ReadSINT32(const char* ptr, i32* value) { *value = ReadVarintZigZag32(&ptr); return ptr; } @@ -447,16 +447,16 @@ inline const char* ReadFLOAT(const char* ptr, float* value) { inline const char* ReadDOUBLE(const char* ptr, double* value) { return ReadUnaligned(ptr, value); } -inline const char* ReadFIXED64(const char* ptr, uint64* value) { +inline const char* ReadFIXED64(const char* ptr, ui64* value) { return ReadUnaligned(ptr, value); } -inline const char* ReadFIXED32(const char* ptr, uint32_t* value) { +inline const char* ReadFIXED32(const char* ptr, ui32* value) { return ReadUnaligned(ptr, value); } -inline const char* ReadSFIXED64(const char* ptr, int64* value) { +inline const char* ReadSFIXED64(const char* ptr, i64* value) { return ReadUnaligned(ptr, value); } -inline const char* ReadSFIXED32(const char* ptr, int32_t* value) { +inline const char* ReadSFIXED32(const char* ptr, i32* value) { return ReadUnaligned(ptr, value); } diff --git a/contrib/libs/protobuf/src/google/protobuf/message.cc b/contrib/libs/protobuf/src/google/protobuf/message.cc index aa0e24bb0c..8d28f595f6 100644 --- a/contrib/libs/protobuf/src/google/protobuf/message.cc +++ b/contrib/libs/protobuf/src/google/protobuf/message.cc @@ -251,7 +251,7 @@ size_t Message::SpaceUsedLong() const { return GetReflection()->SpaceUsedLong(*this); } -uint64_t Message::GetInvariantPerBuild(uint64_t salt) { +ui64 Message::GetInvariantPerBuild(ui64 salt) { return salt; } @@ -389,14 +389,14 @@ const internal::RepeatedFieldAccessor* Reflection::RepeatedFieldAccessor( #define HANDLE_PRIMITIVE_TYPE(TYPE, type) \ case FieldDescriptor::CPPTYPE_##TYPE: \ return GetSingleton<internal::RepeatedFieldPrimitiveAccessor<type> >(); - HANDLE_PRIMITIVE_TYPE(INT32, int32_t) - HANDLE_PRIMITIVE_TYPE(UINT32, uint32_t) - HANDLE_PRIMITIVE_TYPE(INT64, int64_t) - HANDLE_PRIMITIVE_TYPE(UINT64, uint64_t) + HANDLE_PRIMITIVE_TYPE(INT32, i32) + HANDLE_PRIMITIVE_TYPE(UINT32, ui32) + HANDLE_PRIMITIVE_TYPE(INT64, i64) + HANDLE_PRIMITIVE_TYPE(UINT64, ui64) HANDLE_PRIMITIVE_TYPE(FLOAT, float) HANDLE_PRIMITIVE_TYPE(DOUBLE, double) HANDLE_PRIMITIVE_TYPE(BOOL, bool) - HANDLE_PRIMITIVE_TYPE(ENUM, int32_t) + HANDLE_PRIMITIVE_TYPE(ENUM, i32) #undef HANDLE_PRIMITIVE_TYPE case FieldDescriptor::CPPTYPE_STRING: switch (field->options().ctype()) { diff --git a/contrib/libs/protobuf/src/google/protobuf/message.h b/contrib/libs/protobuf/src/google/protobuf/message.h index d25d9f414b..451c78e87c 100644 --- a/contrib/libs/protobuf/src/google/protobuf/message.h +++ b/contrib/libs/protobuf/src/google/protobuf/message.h @@ -206,18 +206,18 @@ struct Metadata { namespace internal { template <class To> -inline To* GetPointerAtOffset(Message* message, uint32_t offset) { +inline To* GetPointerAtOffset(Message* message, ui32 offset) { return reinterpret_cast<To*>(reinterpret_cast<char*>(message) + offset); } template <class To> -const To* GetConstPointerAtOffset(const Message* message, uint32_t offset) { +const To* GetConstPointerAtOffset(const Message* message, ui32 offset) { return reinterpret_cast<const To*>(reinterpret_cast<const char*>(message) + offset); } template <class To> -const To& GetConstRefAtOffset(const Message& message, uint32_t offset) { +const To& GetConstRefAtOffset(const Message& message, ui32 offset) { return *GetConstPointerAtOffset<To>(&message, offset); } @@ -421,7 +421,7 @@ class PROTOBUF_EXPORT Message : public MessageLite { protected: - static uint64_t GetInvariantPerBuild(uint64_t salt); + static ui64 GetInvariantPerBuild(ui64 salt); private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Message); @@ -575,11 +575,11 @@ class PROTOBUF_EXPORT Reflection final { // These get the value of a non-repeated field. They return the default // value for fields that aren't set. - int32_t GetInt32(const Message& message, const FieldDescriptor* field) const; - int64 GetInt64(const Message& message, const FieldDescriptor* field) const; - uint32_t GetUInt32(const Message& message, + i32 GetInt32(const Message& message, const FieldDescriptor* field) const; + i64 GetInt64(const Message& message, const FieldDescriptor* field) const; + ui32 GetUInt32(const Message& message, const FieldDescriptor* field) const; - uint64 GetUInt64(const Message& message, + ui64 GetUInt64(const Message& message, const FieldDescriptor* field) const; float GetFloat(const Message& message, const FieldDescriptor* field) const; double GetDouble(const Message& message, const FieldDescriptor* field) const; @@ -625,13 +625,13 @@ class PROTOBUF_EXPORT Reflection final { // These mutate the value of a non-repeated field. void SetInt32(Message* message, const FieldDescriptor* field, - int32_t value) const; + i32 value) const; void SetInt64(Message* message, const FieldDescriptor* field, - int64 value) const; + i64 value) const; void SetUInt32(Message* message, const FieldDescriptor* field, - uint32_t value) const; + ui32 value) const; void SetUInt64(Message* message, const FieldDescriptor* field, - uint64 value) const; + ui64 value) const; void SetFloat(Message* message, const FieldDescriptor* field, float value) const; void SetDouble(Message* message, const FieldDescriptor* field, @@ -700,13 +700,13 @@ class PROTOBUF_EXPORT Reflection final { // Repeated field getters ------------------------------------------ // These get the value of one element of a repeated field. - int32_t GetRepeatedInt32(const Message& message, const FieldDescriptor* field, + i32 GetRepeatedInt32(const Message& message, const FieldDescriptor* field, int index) const; - int64 GetRepeatedInt64(const Message& message, const FieldDescriptor* field, + i64 GetRepeatedInt64(const Message& message, const FieldDescriptor* field, int index) const; - uint32_t GetRepeatedUInt32(const Message& message, + ui32 GetRepeatedUInt32(const Message& message, const FieldDescriptor* field, int index) const; - uint64 GetRepeatedUInt64(const Message& message, + ui64 GetRepeatedUInt64(const Message& message, const FieldDescriptor* field, int index) const; float GetRepeatedFloat(const Message& message, const FieldDescriptor* field, int index) const; @@ -741,13 +741,13 @@ class PROTOBUF_EXPORT Reflection final { // These mutate the value of one element of a repeated field. void SetRepeatedInt32(Message* message, const FieldDescriptor* field, - int index, int32_t value) const; + int index, i32 value) const; void SetRepeatedInt64(Message* message, const FieldDescriptor* field, - int index, int64 value) const; + int index, i64 value) const; void SetRepeatedUInt32(Message* message, const FieldDescriptor* field, - int index, uint32_t value) const; + int index, ui32 value) const; void SetRepeatedUInt64(Message* message, const FieldDescriptor* field, - int index, uint64 value) const; + int index, ui64 value) const; void SetRepeatedFloat(Message* message, const FieldDescriptor* field, int index, float value) const; void SetRepeatedDouble(Message* message, const FieldDescriptor* field, @@ -778,13 +778,13 @@ class PROTOBUF_EXPORT Reflection final { // These add an element to a repeated field. void AddInt32(Message* message, const FieldDescriptor* field, - int32_t value) const; + i32 value) const; void AddInt64(Message* message, const FieldDescriptor* field, - int64 value) const; + i64 value) const; void AddUInt32(Message* message, const FieldDescriptor* field, - uint32_t value) const; + ui32 value) const; void AddUInt64(Message* message, const FieldDescriptor* field, - uint64 value) const; + ui64 value) const; void AddFloat(Message* message, const FieldDescriptor* field, float value) const; void AddDouble(Message* message, const FieldDescriptor* field, @@ -827,14 +827,14 @@ class PROTOBUF_EXPORT Reflection final { // to acceptable T. // // field->cpp_type() T - // CPPTYPE_INT32 int32_t - // CPPTYPE_UINT32 uint32_t - // CPPTYPE_INT64 int64_t - // CPPTYPE_UINT64 uint64_t + // CPPTYPE_INT32 i32 + // CPPTYPE_UINT32 ui32 + // CPPTYPE_INT64 i64 + // CPPTYPE_UINT64 ui64 // CPPTYPE_DOUBLE double // CPPTYPE_FLOAT float // CPPTYPE_BOOL bool - // CPPTYPE_ENUM generated enum type or int32_t + // CPPTYPE_ENUM generated enum type or i32 // CPPTYPE_STRING TProtoStringType // CPPTYPE_MESSAGE generated message type or google::protobuf::Message // @@ -1157,11 +1157,11 @@ class PROTOBUF_EXPORT Reflection final { const Message* GetDefaultMessageInstance(const FieldDescriptor* field) const; - inline const uint32_t* GetHasBits(const Message& message) const; - inline uint32_t* MutableHasBits(Message* message) const; - inline uint32_t GetOneofCase(const Message& message, + inline const ui32* GetHasBits(const Message& message) const; + inline ui32* MutableHasBits(Message* message) const; + inline ui32 GetOneofCase(const Message& message, const OneofDescriptor* oneof_descriptor) const; - inline uint32_t* MutableOneofCase( + inline ui32* MutableOneofCase( Message* message, const OneofDescriptor* oneof_descriptor) const; inline bool HasExtensionSet(const Message& /* message */) const { return schema_.HasExtensionSet(); @@ -1183,9 +1183,9 @@ class PROTOBUF_EXPORT Reflection final { inline void SwapBit(Message* message1, Message* message2, const FieldDescriptor* field) const; - inline const uint32_t* GetInlinedStringDonatedArray( + inline const ui32* GetInlinedStringDonatedArray( const Message& message) const; - inline uint32_t* MutableInlinedStringDonatedArray(Message* message) const; + inline ui32* MutableInlinedStringDonatedArray(Message* message) const; inline bool IsInlinedStringDonated(const Message& message, const FieldDescriptor* field) const; @@ -1354,10 +1354,10 @@ class PROTOBUF_EXPORT MessageFactory { Reflection::MutableRepeatedFieldInternal<TYPE>( \ Message * message, const FieldDescriptor* field) const; -DECLARE_GET_REPEATED_FIELD(int32_t) -DECLARE_GET_REPEATED_FIELD(int64) -DECLARE_GET_REPEATED_FIELD(uint32_t) -DECLARE_GET_REPEATED_FIELD(uint64) +DECLARE_GET_REPEATED_FIELD(i32) +DECLARE_GET_REPEATED_FIELD(i64) +DECLARE_GET_REPEATED_FIELD(ui32) +DECLARE_GET_REPEATED_FIELD(ui64) DECLARE_GET_REPEATED_FIELD(float) DECLARE_GET_REPEATED_FIELD(double) DECLARE_GET_REPEATED_FIELD(bool) @@ -1483,17 +1483,17 @@ const Type& Reflection::DefaultRaw(const FieldDescriptor* field) const { return *reinterpret_cast<const Type*>(schema_.GetFieldDefault(field)); } -uint32_t Reflection::GetOneofCase( +ui32 Reflection::GetOneofCase( const Message& message, const OneofDescriptor* oneof_descriptor) const { GOOGLE_DCHECK(!oneof_descriptor->is_synthetic()); - return internal::GetConstRefAtOffset<uint32_t>( + return internal::GetConstRefAtOffset<ui32>( message, schema_.GetOneofCaseOffset(oneof_descriptor)); } bool Reflection::HasOneofField(const Message& message, const FieldDescriptor* field) const { return (GetOneofCase(message, field->containing_oneof()) == - static_cast<uint32_t>(field->number())); + static_cast<ui32>(field->number())); } template <typename Type> diff --git a/contrib/libs/protobuf/src/google/protobuf/message_lite.cc b/contrib/libs/protobuf/src/google/protobuf/message_lite.cc index 1fa4ee5c21..fba73634b7 100644 --- a/contrib/libs/protobuf/src/google/protobuf/message_lite.cc +++ b/contrib/libs/protobuf/src/google/protobuf/message_lite.cc @@ -393,7 +393,7 @@ bool MessageLite::SerializePartialToCodedStream( } int final_byte_count = output->ByteCount(); - if (final_byte_count - original_byte_count != static_cast<int64_t>(size)) { + if (final_byte_count - original_byte_count != static_cast<i64>(size)) { ByteSizeConsistencyError(size, ByteSizeLong(), final_byte_count - original_byte_count, *this); } @@ -492,7 +492,7 @@ bool MessageLite::SerializePartialToArray(void* data, int size) const { << " exceeded maximum protobuf size of 2GB: " << byte_size; return false; } - if (size < static_cast<int64_t>(byte_size)) return false; + if (size < static_cast<i64>(byte_size)) return false; uint8_t* start = reinterpret_cast<uint8_t*>(data); SerializeToArrayImpl(*this, start, byte_size); return true; diff --git a/contrib/libs/protobuf/src/google/protobuf/message_lite.h b/contrib/libs/protobuf/src/google/protobuf/message_lite.h index d7a9f678b3..e754e6b62b 100644 --- a/contrib/libs/protobuf/src/google/protobuf/message_lite.h +++ b/contrib/libs/protobuf/src/google/protobuf/message_lite.h @@ -158,7 +158,7 @@ class ExplicitlyConstructed { // Prefer c++14 aligned_storage, but for compatibility this will do. union AlignedUnion { alignas(T) char space[sizeof(T)]; - int64_t align_to_int64; + i64 align_to_int64; void* align_to_ptr; } union_; }; diff --git a/contrib/libs/protobuf/src/google/protobuf/parse_context.cc b/contrib/libs/protobuf/src/google/protobuf/parse_context.cc index ca5afad600..71346327d4 100644 --- a/contrib/libs/protobuf/src/google/protobuf/parse_context.cc +++ b/contrib/libs/protobuf/src/google/protobuf/parse_context.cc @@ -55,7 +55,7 @@ bool ParseEndsInSlopRegion(const char* begin, int overrun, int depth) { auto ptr = begin + overrun; auto end = begin + kSlopBytes; while (ptr < end) { - uint32_t tag; + ui32 tag; ptr = ReadTag(ptr, &tag); if (ptr == nullptr || ptr > end) return false; // ending on 0 tag is allowed and is the major reason for the necessity of @@ -63,7 +63,7 @@ bool ParseEndsInSlopRegion(const char* begin, int overrun, int depth) { if (tag == 0) return true; switch (tag & 7) { case 0: { // Varint - uint64_t val; + ui64 val; ptr = VarintParse(ptr, &val); if (ptr == nullptr) return false; break; @@ -73,7 +73,7 @@ bool ParseEndsInSlopRegion(const char* begin, int overrun, int depth) { break; } case 2: { // len delim - int32_t size = ReadSize(&ptr); + i32 size = ReadSize(&ptr); if (ptr == nullptr || size > end - ptr) return false; ptr += size; break; @@ -240,11 +240,11 @@ template <> void byteswap<1>(void* p) {} template <> void byteswap<4>(void* p) { - *static_cast<uint32_t*>(p) = bswap_32(*static_cast<uint32_t*>(p)); + *static_cast<ui32*>(p) = bswap_32(*static_cast<ui32*>(p)); } template <> void byteswap<8>(void* p) { - *static_cast<uint64_t*>(p) = bswap_64(*static_cast<uint64_t*>(p)); + *static_cast<ui64*>(p) = bswap_64(*static_cast<ui64*>(p)); } const char* EpsCopyInputStream::InitFrom(io::ZeroCopyInputStream* zcis) { @@ -297,7 +297,7 @@ const char* ParseContext::ParseMessage(MessageLite* msg, const char* ptr) { return ptr; } -inline void WriteVarint(uint64_t val, TProtoStringType* s) { +inline void WriteVarint(ui64 val, TProtoStringType* s) { while (val >= 128) { uint8_t c = val | 0x80; s->push_back(c); @@ -306,29 +306,29 @@ inline void WriteVarint(uint64_t val, TProtoStringType* s) { s->push_back(val); } -void WriteVarint(uint32_t num, uint64_t val, TProtoStringType* s) { +void WriteVarint(ui32 num, ui64 val, TProtoStringType* s) { WriteVarint(num << 3, s); WriteVarint(val, s); } -void WriteLengthDelimited(uint32_t num, StringPiece val, TProtoStringType* s) { +void WriteLengthDelimited(ui32 num, StringPiece val, TProtoStringType* s) { WriteVarint((num << 3) + 2, s); WriteVarint(val.size(), s); s->append(val.data(), val.size()); } -std::pair<const char*, uint32_t> VarintParseSlow32(const char* p, - uint32_t res) { - for (std::uint32_t i = 2; i < 5; i++) { - uint32_t byte = static_cast<uint8_t>(p[i]); +std::pair<const char*, ui32> VarintParseSlow32(const char* p, + ui32 res) { + for (ui32 i = 2; i < 5; i++) { + ui32 byte = static_cast<uint8_t>(p[i]); res += (byte - 1) << (7 * i); if (PROTOBUF_PREDICT_TRUE(byte < 128)) { return {p + i + 1, res}; } } // Accept >5 bytes - for (std::uint32_t i = 5; i < 10; i++) { - uint32_t byte = static_cast<uint8_t>(p[i]); + for (ui32 i = 5; i < 10; i++) { + ui32 byte = static_cast<uint8_t>(p[i]); if (PROTOBUF_PREDICT_TRUE(byte < 128)) { return {p + i + 1, res}; } @@ -336,11 +336,11 @@ std::pair<const char*, uint32_t> VarintParseSlow32(const char* p, return {nullptr, 0}; } -std::pair<const char*, uint64_t> VarintParseSlow64(const char* p, - uint32_t res32) { - uint64_t res = res32; - for (std::uint32_t i = 2; i < 10; i++) { - uint64_t byte = static_cast<uint8_t>(p[i]); +std::pair<const char*, ui64> VarintParseSlow64(const char* p, + ui32 res32) { + ui64 res = res32; + for (ui32 i = 2; i < 10; i++) { + ui64 byte = static_cast<uint8_t>(p[i]); res += (byte - 1) << (7 * i); if (PROTOBUF_PREDICT_TRUE(byte < 128)) { return {p + i + 1, res}; @@ -349,9 +349,9 @@ std::pair<const char*, uint64_t> VarintParseSlow64(const char* p, return {nullptr, 0}; } -std::pair<const char*, uint32_t> ReadTagFallback(const char* p, uint32_t res) { - for (std::uint32_t i = 2; i < 5; i++) { - uint32_t byte = static_cast<uint8_t>(p[i]); +std::pair<const char*, ui32> ReadTagFallback(const char* p, ui32 res) { + for (ui32 i = 2; i < 5; i++) { + ui32 byte = static_cast<uint8_t>(p[i]); res += (byte - 1) << (7 * i); if (PROTOBUF_PREDICT_TRUE(byte < 128)) { return {p + i + 1, res}; @@ -360,15 +360,15 @@ std::pair<const char*, uint32_t> ReadTagFallback(const char* p, uint32_t res) { return {nullptr, 0}; } -std::pair<const char*, int32_t> ReadSizeFallback(const char* p, uint32_t res) { - for (std::uint32_t i = 1; i < 4; i++) { - uint32_t byte = static_cast<uint8_t>(p[i]); +std::pair<const char*, i32> ReadSizeFallback(const char* p, ui32 res) { + for (ui32 i = 1; i < 4; i++) { + ui32 byte = static_cast<uint8_t>(p[i]); res += (byte - 1) << (7 * i); if (PROTOBUF_PREDICT_TRUE(byte < 128)) { return {p + i + 1, res}; } } - std::uint32_t byte = static_cast<uint8_t>(p[4]); + ui32 byte = static_cast<uint8_t>(p[4]); if (PROTOBUF_PREDICT_FALSE(byte >= 8)) return {nullptr, 0}; // size >= 2gb res += (byte - 1) << 28; // Protect against sign integer overflow in PushLimit. Limits are relative @@ -409,7 +409,7 @@ const char* InlineGreedyStringParser(TProtoStringType* s, const char* ptr, template <typename T, bool sign> const char* VarintParser(void* object, const char* ptr, ParseContext* ctx) { - return ctx->ReadPackedVarint(ptr, [object](uint64_t varint) { + return ctx->ReadPackedVarint(ptr, [object](ui64 varint) { T val; if (sign) { if (sizeof(T) == 8) { @@ -426,27 +426,27 @@ const char* VarintParser(void* object, const char* ptr, ParseContext* ctx) { const char* PackedInt32Parser(void* object, const char* ptr, ParseContext* ctx) { - return VarintParser<int32_t, false>(object, ptr, ctx); + return VarintParser<i32, false>(object, ptr, ctx); } const char* PackedUInt32Parser(void* object, const char* ptr, ParseContext* ctx) { - return VarintParser<uint32_t, false>(object, ptr, ctx); + return VarintParser<ui32, false>(object, ptr, ctx); } const char* PackedInt64Parser(void* object, const char* ptr, ParseContext* ctx) { - return VarintParser<int64_t, false>(object, ptr, ctx); + return VarintParser<i64, false>(object, ptr, ctx); } const char* PackedUInt64Parser(void* object, const char* ptr, ParseContext* ctx) { - return VarintParser<uint64_t, false>(object, ptr, ctx); + return VarintParser<ui64, false>(object, ptr, ctx); } const char* PackedSInt32Parser(void* object, const char* ptr, ParseContext* ctx) { - return VarintParser<int32_t, true>(object, ptr, ctx); + return VarintParser<i32, true>(object, ptr, ctx); } const char* PackedSInt64Parser(void* object, const char* ptr, ParseContext* ctx) { - return VarintParser<int64_t, true>(object, ptr, ctx); + return VarintParser<i64, true>(object, ptr, ctx); } const char* PackedEnumParser(void* object, const char* ptr, ParseContext* ctx) { @@ -467,19 +467,19 @@ const char* FixedParser(void* object, const char* ptr, ParseContext* ctx) { const char* PackedFixed32Parser(void* object, const char* ptr, ParseContext* ctx) { - return FixedParser<uint32_t>(object, ptr, ctx); + return FixedParser<ui32>(object, ptr, ctx); } const char* PackedSFixed32Parser(void* object, const char* ptr, ParseContext* ctx) { - return FixedParser<int32_t>(object, ptr, ctx); + return FixedParser<i32>(object, ptr, ctx); } const char* PackedFixed64Parser(void* object, const char* ptr, ParseContext* ctx) { - return FixedParser<uint64_t>(object, ptr, ctx); + return FixedParser<ui64>(object, ptr, ctx); } const char* PackedSFixed64Parser(void* object, const char* ptr, ParseContext* ctx) { - return FixedParser<int64_t>(object, ptr, ctx); + return FixedParser<i64>(object, ptr, ctx); } const char* PackedFloatParser(void* object, const char* ptr, ParseContext* ctx) { @@ -495,12 +495,12 @@ class UnknownFieldLiteParserHelper { explicit UnknownFieldLiteParserHelper(TProtoStringType* unknown) : unknown_(unknown) {} - void AddVarint(uint32_t num, uint64_t value) { + void AddVarint(ui32 num, ui64 value) { if (unknown_ == nullptr) return; WriteVarint(num * 8, unknown_); WriteVarint(value, unknown_); } - void AddFixed64(uint32_t num, uint64_t value) { + void AddFixed64(ui32 num, ui64 value) { if (unknown_ == nullptr) return; WriteVarint(num * 8 + 1, unknown_); char buffer[8]; @@ -508,7 +508,7 @@ class UnknownFieldLiteParserHelper { value, reinterpret_cast<uint8_t*>(buffer)); unknown_->append(buffer, 8); } - const char* ParseLengthDelimited(uint32_t num, const char* ptr, + const char* ParseLengthDelimited(ui32 num, const char* ptr, ParseContext* ctx) { int size = ReadSize(&ptr); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); @@ -517,14 +517,14 @@ class UnknownFieldLiteParserHelper { WriteVarint(size, unknown_); return ctx->AppendString(ptr, size, unknown_); } - const char* ParseGroup(uint32_t num, const char* ptr, ParseContext* ctx) { + const char* ParseGroup(ui32 num, const char* ptr, ParseContext* ctx) { if (unknown_) WriteVarint(num * 8 + 3, unknown_); ptr = ctx->ParseGroup(this, ptr, num * 8 + 3); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); if (unknown_) WriteVarint(num * 8 + 4, unknown_); return ptr; } - void AddFixed32(uint32_t num, uint32_t value) { + void AddFixed32(ui32 num, ui32 value) { if (unknown_ == nullptr) return; WriteVarint(num * 8 + 5, unknown_); char buffer[4]; @@ -547,7 +547,7 @@ const char* UnknownGroupLiteParse(TProtoStringType* unknown, const char* ptr, return WireFormatParser(field_parser, ptr, ctx); } -const char* UnknownFieldParse(uint32_t tag, TProtoStringType* unknown, +const char* UnknownFieldParse(ui32 tag, TProtoStringType* unknown, const char* ptr, ParseContext* ctx) { UnknownFieldLiteParserHelper field_parser(unknown); return FieldParser(tag, field_parser, ptr, ctx); diff --git a/contrib/libs/protobuf/src/google/protobuf/parse_context.h b/contrib/libs/protobuf/src/google/protobuf/parse_context.h index 242dc27e82..6c8f8606e2 100644 --- a/contrib/libs/protobuf/src/google/protobuf/parse_context.h +++ b/contrib/libs/protobuf/src/google/protobuf/parse_context.h @@ -60,12 +60,12 @@ class MessageFactory; namespace internal { // Template code below needs to know about the existence of these functions. -PROTOBUF_EXPORT void WriteVarint(uint32_t num, uint64_t val, TProtoStringType* s); -PROTOBUF_EXPORT void WriteLengthDelimited(uint32_t num, StringPiece val, +PROTOBUF_EXPORT void WriteVarint(ui32 num, ui64 val, TProtoStringType* s); +PROTOBUF_EXPORT void WriteLengthDelimited(ui32 num, StringPiece val, TProtoStringType* s); // Inline because it is just forwarding to s->WriteVarint -inline void WriteVarint(uint32_t num, uint64_t val, UnknownFieldSet* s); -inline void WriteLengthDelimited(uint32_t num, StringPiece val, +inline void WriteVarint(ui32 num, ui64 val, UnknownFieldSet* s); +inline void WriteLengthDelimited(ui32 num, StringPiece val, UnknownFieldSet* s); @@ -185,15 +185,15 @@ class PROTOBUF_EXPORT EpsCopyInputStream { PROTOBUF_MUST_USE_RESULT const char* ReadPackedVarint(const char* ptr, Add add); - uint32_t LastTag() const { return last_tag_minus_1_ + 1; } - bool ConsumeEndGroup(uint32_t start_tag) { + ui32 LastTag() const { return last_tag_minus_1_ + 1; } + bool ConsumeEndGroup(ui32 start_tag) { bool res = last_tag_minus_1_ == start_tag; last_tag_minus_1_ = 0; return res; } bool EndedAtLimit() const { return last_tag_minus_1_ == 0; } bool EndedAtEndOfStream() const { return last_tag_minus_1_ == 1; } - void SetLastTag(uint32_t tag) { last_tag_minus_1_ = tag - 1; } + void SetLastTag(ui32 tag) { last_tag_minus_1_ = tag - 1; } void SetEndOfStream() { last_tag_minus_1_ = 1; } bool IsExceedingLimit(const char* ptr) { return ptr > limit_end_ && @@ -282,7 +282,7 @@ class PROTOBUF_EXPORT EpsCopyInputStream { // This var doesn't really belong in EpsCopyInputStream and should be part of // the ParseContext, but case 2 is most easily and optimally implemented in // DoneFallback. - uint32_t last_tag_minus_1_ = 0; + ui32 last_tag_minus_1_ = 0; int overall_limit_ = INT_MAX; // Overall limit independent of pushed limits. // Pretty random large number that seems like a safe allocation on most // systems. TODO(gerbens) do we need to set this as build flag? @@ -411,7 +411,7 @@ class PROTOBUF_EXPORT ParseContext : public EpsCopyInputStream { template <typename T> PROTOBUF_MUST_USE_RESULT PROTOBUF_NDEBUG_INLINE const char* ParseGroup( - T* msg, const char* ptr, uint32_t tag) { + T* msg, const char* ptr, ui32 tag) { if (--depth_ < 0) return nullptr; group_depth_++; ptr = msg->_InternalParse(ptr, this); @@ -445,7 +445,7 @@ class PROTOBUF_EXPORT ParseContext : public EpsCopyInputStream { Data data_; }; -template <uint32_t tag> +template <ui32 tag> bool ExpectTag(const char* ptr) { if (tag < 128) { return *ptr == static_cast<char>(tag); @@ -478,8 +478,8 @@ struct EndianHelper<2> { template <> struct EndianHelper<4> { - static uint32_t Load(const void* p) { - uint32_t tmp; + static ui32 Load(const void* p) { + ui32 tmp; std::memcpy(&tmp, p, 4); #ifndef PROTOBUF_LITTLE_ENDIAN tmp = bswap_32(tmp); @@ -490,8 +490,8 @@ struct EndianHelper<4> { template <> struct EndianHelper<8> { - static uint64_t Load(const void* p) { - uint64_t tmp; + static ui64 Load(const void* p) { + ui64 tmp; std::memcpy(&tmp, p, 8); #ifndef PROTOBUF_LITTLE_ENDIAN tmp = bswap_64(tmp); @@ -509,38 +509,31 @@ T UnalignedLoad(const char* p) { } PROTOBUF_EXPORT -std::pair<const char*, uint32_t> VarintParseSlow32(const char* p, uint32_t res); +std::pair<const char*, ui32> VarintParseSlow32(const char* p, ui32 res); PROTOBUF_EXPORT -std::pair<const char*, uint64_t> VarintParseSlow64(const char* p, uint32_t res); +std::pair<const char*, ui64> VarintParseSlow64(const char* p, ui32 res); -inline const char* VarintParseSlow(const char* p, uint32_t res, uint32_t* out) { +inline const char* VarintParseSlow(const char* p, ui32 res, ui32* out) { auto tmp = VarintParseSlow32(p, res); *out = tmp.second; return tmp.first; } -inline const char* VarintParseSlow(const char* p, uint32_t res, uint64* out) { +inline const char* VarintParseSlow(const char* p, ui32 res, ui64* out) { auto tmp = VarintParseSlow64(p, res); *out = tmp.second; return tmp.first; } -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -inline const char* VarintParseSlow(const char* p, uint32_t res, uint64_t* out) { - auto tmp = VarintParseSlow64(p, res); - *out = tmp.second; - return tmp.first; -} -#endif template <typename T> PROTOBUF_MUST_USE_RESULT const char* VarintParse(const char* p, T* out) { auto ptr = reinterpret_cast<const uint8_t*>(p); - uint32_t res = ptr[0]; + ui32 res = ptr[0]; if (!(res & 0x80)) { *out = res; return p + 1; } - uint32_t byte = ptr[1]; + ui32 byte = ptr[1]; res += (byte - 1) << 7; if (!(byte & 0x80)) { *out = res; @@ -553,17 +546,17 @@ PROTOBUF_MUST_USE_RESULT const char* VarintParse(const char* p, T* out) { // Caller must ensure its safe to call. PROTOBUF_EXPORT -std::pair<const char*, uint32_t> ReadTagFallback(const char* p, uint32_t res); +std::pair<const char*, ui32> ReadTagFallback(const char* p, ui32 res); // Same as ParseVarint but only accept 5 bytes at most. -inline const char* ReadTag(const char* p, uint32_t* out, - uint32_t /*max_tag*/ = 0) { - uint32_t res = static_cast<uint8_t>(p[0]); +inline const char* ReadTag(const char* p, ui32* out, + ui32 /*max_tag*/ = 0) { + ui32 res = static_cast<uint8_t>(p[0]); if (res < 128) { *out = res; return p + 1; } - uint32_t second = static_cast<uint8_t>(p[1]); + ui32 second = static_cast<uint8_t>(p[1]); res += (second - 1) << 7; if (second < 128) { *out = res; @@ -584,10 +577,10 @@ inline const char* ReadTag(const char* p, uint32_t* out, // adc [rsi], 1 // add eax, eax // and eax, edi -inline uint32_t DecodeTwoBytes(const char** ptr) { - uint32_t value = UnalignedLoad<uint16_t>(*ptr); +inline ui32 DecodeTwoBytes(const char** ptr) { + ui32 value = UnalignedLoad<uint16_t>(*ptr); // Sign extend the low byte continuation bit - uint32_t x = static_cast<int8_t>(value); + ui32 x = static_cast<int8_t>(value); // This add is an amazing operation, it cancels the low byte continuation bit // from y transferring it to the carry. Simultaneously it also shifts the 7 // LSB left by one tightly against high byte varint bits. Hence value now @@ -599,18 +592,18 @@ inline uint32_t DecodeTwoBytes(const char** ptr) { } // More efficient varint parsing for big varints -inline const char* ParseBigVarint(const char* p, uint64_t* out) { +inline const char* ParseBigVarint(const char* p, ui64* out) { auto pnew = p; auto tmp = DecodeTwoBytes(&pnew); - uint64_t res = tmp >> 1; + ui64 res = tmp >> 1; if (PROTOBUF_PREDICT_TRUE(static_cast<std::int16_t>(tmp) >= 0)) { *out = res; return pnew; } - for (std::uint32_t i = 1; i < 5; i++) { + for (ui32 i = 1; i < 5; i++) { pnew = p + 2 * i; tmp = DecodeTwoBytes(&pnew); - res += (static_cast<std::uint64_t>(tmp) - 2) << (14 * i - 1); + res += (static_cast<ui64>(tmp) - 2) << (14 * i - 1); if (PROTOBUF_PREDICT_TRUE(static_cast<std::int16_t>(tmp) >= 0)) { *out = res; return pnew; @@ -620,13 +613,13 @@ inline const char* ParseBigVarint(const char* p, uint64_t* out) { } PROTOBUF_EXPORT -std::pair<const char*, int32_t> ReadSizeFallback(const char* p, uint32_t first); +std::pair<const char*, i32> ReadSizeFallback(const char* p, ui32 first); // Used for tags, could read up to 5 bytes which must be available. Additionally -// it makes sure the unsigned value fits a int32_t, otherwise returns nullptr. +// it makes sure the unsigned value fits a i32, otherwise returns nullptr. // Caller must ensure its safe to call. -inline uint32_t ReadSize(const char** pp) { +inline ui32 ReadSize(const char** pp) { auto p = *pp; - uint32_t res = static_cast<uint8_t>(p[0]); + ui32 res = static_cast<uint8_t>(p[0]); if (res < 128) { *pp = p + 1; return res; @@ -641,28 +634,28 @@ inline uint32_t ReadSize(const char** pp) { // function composition. We rely on the compiler to inline this. // Also in debug compiles having local scoped variables tend to generated // stack frames that scale as O(num fields). -inline uint64_t ReadVarint64(const char** p) { - uint64_t tmp; +inline ui64 ReadVarint64(const char** p) { + ui64 tmp; *p = VarintParse(*p, &tmp); return tmp; } -inline uint32_t ReadVarint32(const char** p) { - uint32_t tmp; +inline ui32 ReadVarint32(const char** p) { + ui32 tmp; *p = VarintParse(*p, &tmp); return tmp; } -inline int64_t ReadVarintZigZag64(const char** p) { - uint64_t tmp; +inline i64 ReadVarintZigZag64(const char** p) { + ui64 tmp; *p = VarintParse(*p, &tmp); return WireFormatLite::ZigZagDecode64(tmp); } -inline int32_t ReadVarintZigZag32(const char** p) { - uint64_t tmp; +inline i32 ReadVarintZigZag32(const char** p) { + ui64 tmp; *p = VarintParse(*p, &tmp); - return WireFormatLite::ZigZagDecode32(static_cast<uint32_t>(tmp)); + return WireFormatLite::ZigZagDecode32(static_cast<ui32>(tmp)); } template <typename T, typename std::enable_if< @@ -730,7 +723,7 @@ const char* EpsCopyInputStream::ReadPackedFixed(const char* ptr, int size, template <typename Add> const char* ReadPackedVarintArray(const char* ptr, const char* end, Add add) { while (ptr < end) { - uint64_t varint; + ui64 varint; ptr = VarintParse(ptr, &varint); if (ptr == nullptr) return nullptr; add(varint); @@ -800,22 +793,22 @@ PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* InlineGreedyStringParser( GOOGLE_PROTOBUF_ASSERT_RETURN(predicate, nullptr) template <typename T> -PROTOBUF_MUST_USE_RESULT const char* FieldParser(uint64_t tag, T& field_parser, +PROTOBUF_MUST_USE_RESULT const char* FieldParser(ui64 tag, T& field_parser, const char* ptr, ParseContext* ctx) { - uint32_t number = tag >> 3; + ui32 number = tag >> 3; GOOGLE_PROTOBUF_PARSER_ASSERT(number != 0); using WireType = internal::WireFormatLite::WireType; switch (tag & 7) { case WireType::WIRETYPE_VARINT: { - uint64_t value; + ui64 value; ptr = VarintParse(ptr, &value); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); field_parser.AddVarint(number, value); break; } case WireType::WIRETYPE_FIXED64: { - uint64_t value = UnalignedLoad<uint64_t>(ptr); + ui64 value = UnalignedLoad<ui64>(ptr); ptr += 8; field_parser.AddFixed64(number, value); break; @@ -835,7 +828,7 @@ PROTOBUF_MUST_USE_RESULT const char* FieldParser(uint64_t tag, T& field_parser, break; } case WireType::WIRETYPE_FIXED32: { - uint32_t value = UnalignedLoad<uint32_t>(ptr); + ui32 value = UnalignedLoad<ui32>(ptr); ptr += 4; field_parser.AddFixed32(number, value); break; @@ -851,7 +844,7 @@ PROTOBUF_MUST_USE_RESULT const char* WireFormatParser(T& field_parser, const char* ptr, ParseContext* ctx) { while (!ctx->Done(&ptr)) { - uint32_t tag; + ui32 tag; ptr = ReadTag(ptr, &tag); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr != nullptr); if (tag == 0 || (tag & 7) == 4) { @@ -888,7 +881,7 @@ PROTOBUF_MUST_USE_RESULT const char* PackedEnumParser( void* object, const char* ptr, ParseContext* ctx, bool (*is_valid)(int), InternalMetadata* metadata, int field_num) { return ctx->ReadPackedVarint( - ptr, [object, is_valid, metadata, field_num](uint64_t val) { + ptr, [object, is_valid, metadata, field_num](ui64 val) { if (is_valid(val)) { static_cast<RepeatedField<int>*>(object)->Add(val); } else { @@ -903,7 +896,7 @@ PROTOBUF_MUST_USE_RESULT const char* PackedEnumParserArg( bool (*is_valid)(const void*, int), const void* data, InternalMetadata* metadata, int field_num) { return ctx->ReadPackedVarint( - ptr, [object, is_valid, data, metadata, field_num](uint64_t val) { + ptr, [object, is_valid, data, metadata, field_num](ui64 val) { if (is_valid(data, val)) { static_cast<RepeatedField<int>*>(object)->Add(val); } else { @@ -934,7 +927,7 @@ PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* UnknownGroupLiteParse( // useful in the generated code. It uses overload on TProtoStringType* vs // UnknownFieldSet* to make the generated code isomorphic between full and lite. PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* UnknownFieldParse( - uint32_t tag, TProtoStringType* unknown, const char* ptr, ParseContext* ctx); + ui32 tag, TProtoStringType* unknown, const char* ptr, ParseContext* ctx); } // namespace internal } // namespace protobuf diff --git a/contrib/libs/protobuf/src/google/protobuf/port_def.inc b/contrib/libs/protobuf/src/google/protobuf/port_def.inc index a0d33dbe5b..d3f1db964f 100644 --- a/contrib/libs/protobuf/src/google/protobuf/port_def.inc +++ b/contrib/libs/protobuf/src/google/protobuf/port_def.inc @@ -662,7 +662,7 @@ ::google::protobuf::MessageLite *msg, const char *ptr, \ ::google::protobuf::internal::ParseContext *ctx, \ const ::google::protobuf::internal::TailCallParseTableBase *table, \ - uint64_t hasbits, ::google::protobuf::internal::TcFieldData data + ui64 hasbits, ::google::protobuf::internal::TcFieldData data #ifdef PROTOBUF_UNUSED #error PROTOBUF_UNUSED was previously defined diff --git a/contrib/libs/protobuf/src/google/protobuf/reflection.h b/contrib/libs/protobuf/src/google/protobuf/reflection.h index 52749b6786..36328ee21c 100644 --- a/contrib/libs/protobuf/src/google/protobuf/reflection.h +++ b/contrib/libs/protobuf/src/google/protobuf/reflection.h @@ -282,19 +282,19 @@ namespace internal { // cpp_type to the type that should be used in this interface: // // field->cpp_type() T Actual type of void* -// CPPTYPE_INT32 int32_t int32_t -// CPPTYPE_UINT32 uint32_t uint32_t -// CPPTYPE_INT64 int64_t int64_t -// CPPTYPE_UINT64 uint64_t uint64_t +// CPPTYPE_INT32 i32 i32 +// CPPTYPE_UINT32 ui32 ui32 +// CPPTYPE_INT64 i64 i64 +// CPPTYPE_UINT64 ui64 ui64 // CPPTYPE_DOUBLE double double // CPPTYPE_FLOAT float float // CPPTYPE_BOOL bool bool -// CPPTYPE_ENUM generated enum type int32_t +// CPPTYPE_ENUM generated enum type i32 // CPPTYPE_STRING string TProtoStringType // CPPTYPE_MESSAGE generated message type google::protobuf::Message // or google::protobuf::Message // -// Note that for enums we use int32_t in the interface. +// Note that for enums we use i32 in the interface. // // You can map from T to the actual type using RefTypeTraits: // typedef RefTypeTraits<T>::AccessorValueType ActualType; @@ -362,7 +362,7 @@ class PROTOBUF_EXPORT RepeatedFieldAccessor { // be ActualType. Here we have a ValueType object and want a ActualType // pointer. We can't cast a ValueType pointer to an ActualType pointer // directly because their type might be different (for enums ValueType - // may be a generated enum type while ActualType is int32_t). To be safe + // may be a generated enum type while ActualType is i32). To be safe // we make a copy to get a temporary ActualType object and use it. ActualType tmp = static_cast<ActualType>(value); Set(data, index, static_cast<const Value*>(&tmp)); @@ -376,7 +376,7 @@ class PROTOBUF_EXPORT RepeatedFieldAccessor { // be ActualType. Here we have a ValueType object and want a ActualType // pointer. We can't cast a ValueType pointer to an ActualType pointer // directly because their type might be different (for enums ValueType - // may be a generated enum type while ActualType is int32_t). To be safe + // may be a generated enum type while ActualType is i32). To be safe // we make a copy to get a temporary ActualType object and use it. ActualType tmp = static_cast<ActualType>(value); Add(data, static_cast<const Value*>(&tmp)); @@ -485,10 +485,10 @@ struct PrimitiveTraits { static const FieldDescriptor::CppType cpp_type = \ FieldDescriptor::CPPTYPE_##TYPE; \ }; -DEFINE_PRIMITIVE(INT32, int32_t) -DEFINE_PRIMITIVE(UINT32, uint32_t) -DEFINE_PRIMITIVE(INT64, int64) -DEFINE_PRIMITIVE(UINT64, uint64) +DEFINE_PRIMITIVE(INT32, i32) +DEFINE_PRIMITIVE(UINT32, ui32) +DEFINE_PRIMITIVE(INT64, i64) +DEFINE_PRIMITIVE(UINT64, ui64) DEFINE_PRIMITIVE(FLOAT, float) DEFINE_PRIMITIVE(DOUBLE, double) DEFINE_PRIMITIVE(BOOL, bool) @@ -512,10 +512,10 @@ struct RefTypeTraits< T, typename std::enable_if<is_proto_enum<T>::value>::type> { typedef RepeatedFieldRefIterator<T> iterator; typedef RepeatedFieldAccessor AccessorType; - // We use int32_t for repeated enums in RepeatedFieldAccessor. - typedef int32_t AccessorValueType; + // We use i32 for repeated enums in RepeatedFieldAccessor. + typedef i32 AccessorValueType; typedef T IteratorValueType; - typedef int32_t* IteratorPointerType; + typedef i32* IteratorPointerType; static constexpr FieldDescriptor::CppType cpp_type = FieldDescriptor::CPPTYPE_ENUM; static const Descriptor* GetMessageFieldDescriptor() { return NULL; } diff --git a/contrib/libs/protobuf/src/google/protobuf/repeated_field.cc b/contrib/libs/protobuf/src/google/protobuf/repeated_field.cc index 13bbf92603..5c33f4c995 100644 --- a/contrib/libs/protobuf/src/google/protobuf/repeated_field.cc +++ b/contrib/libs/protobuf/src/google/protobuf/repeated_field.cc @@ -58,8 +58,8 @@ void** RepeatedPtrFieldBase::InternalExtend(int extend_amount) { Arena* arena = GetArena(); new_size = std::max(internal::kRepeatedFieldLowerClampLimit, std::max(total_size_ * 2, new_size)); - GOOGLE_CHECK_LE(static_cast<int64_t>(new_size), - static_cast<int64_t>( + GOOGLE_CHECK_LE(static_cast<i64>(new_size), + static_cast<i64>( (std::numeric_limits<size_t>::max() - kRepHeaderSize) / sizeof(old_rep->elements[0]))) << "Requested size is too large to fit into size_t."; @@ -135,10 +135,10 @@ MessageLite* RepeatedPtrFieldBase::AddWeak(const MessageLite* prototype) { template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField<bool>; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField<int32_t>; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField<uint32_t>; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField<int64_t>; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField<uint64_t>; +template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField<i32>; +template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField<ui32>; +template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField<i64>; +template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField<ui64>; template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField<float>; template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField<double>; template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedPtrField<TProtoStringType>; diff --git a/contrib/libs/protobuf/src/google/protobuf/repeated_field.h b/contrib/libs/protobuf/src/google/protobuf/repeated_field.h index e0c565e1e2..7cda18dba3 100644 --- a/contrib/libs/protobuf/src/google/protobuf/repeated_field.h +++ b/contrib/libs/protobuf/src/google/protobuf/repeated_field.h @@ -146,13 +146,13 @@ inline typename std::enable_if<(kSize == 0), void>::type memswap(char*, char*) { PROTO_MEMSWAP_DEF_SIZE(uint8_t, 2) PROTO_MEMSWAP_DEF_SIZE(uint16_t, 4) -PROTO_MEMSWAP_DEF_SIZE(uint32_t, 8) +PROTO_MEMSWAP_DEF_SIZE(ui32, 8) #ifdef __SIZEOF_INT128__ -PROTO_MEMSWAP_DEF_SIZE(uint64_t, 16) +PROTO_MEMSWAP_DEF_SIZE(ui64, 16) PROTO_MEMSWAP_DEF_SIZE(__uint128_t, (1u << 31)) #else -PROTO_MEMSWAP_DEF_SIZE(uint64_t, (1u << 31)) +PROTO_MEMSWAP_DEF_SIZE(ui64, (1u << 31)) #endif #undef PROTO_MEMSWAP_DEF_SIZE @@ -1383,7 +1383,7 @@ inline void RepeatedField<Element>::Set(int index, const Element& value) { template <typename Element> inline void RepeatedField<Element>::Add(const Element& value) { - uint32_t size = current_size_; + ui32 size = current_size_; if (static_cast<int>(size) == total_size_) { // value could reference an element of the array. Reserving new space will // invalidate the reference. So we must make a copy first. @@ -1398,7 +1398,7 @@ inline void RepeatedField<Element>::Add(const Element& value) { template <typename Element> inline Element* RepeatedField<Element>::Add() { - uint32_t size = current_size_; + ui32 size = current_size_; if (static_cast<int>(size) == total_size_) Reserve(total_size_ + 1); auto ptr = &elements()[size]; current_size_ = size + 1; @@ -1645,7 +1645,7 @@ void RepeatedField<Element>::Reserve(int new_size) { // this, since Element is supposed to be POD, but a previous version of this // code allocated storage with "new Element[size]" and some code uses // RepeatedField with non-POD types, relying on constructor invocation. If - // Element has a trivial constructor (e.g., int32_t), gcc (tested with -O2) + // Element has a trivial constructor (e.g., i32), gcc (tested with -O2) // completely removes this loop because the loop body is empty, so this has no // effect unless its side-effects are required for correctness. // Note that we do this before MoveArray() below because Element's copy @@ -2946,10 +2946,10 @@ UnsafeArenaAllocatedRepeatedPtrFieldBackInserter( // Extern declarations of common instantiations to reduce library bloat. extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<bool>; -extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<int32_t>; -extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<uint32_t>; -extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<int64_t>; -extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<uint64_t>; +extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<i32>; +extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<ui32>; +extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<i64>; +extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<ui64>; extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<float>; extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<double>; extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE diff --git a/contrib/libs/protobuf/src/google/protobuf/stubs/int128.cc b/contrib/libs/protobuf/src/google/protobuf/stubs/int128.cc index f008ce8d26..c8e20c6782 100644 --- a/contrib/libs/protobuf/src/google/protobuf/stubs/int128.cc +++ b/contrib/libs/protobuf/src/google/protobuf/stubs/int128.cc @@ -41,8 +41,8 @@ namespace google { namespace protobuf { -const uint128_pod kuint128max = {uint64_t{0xFFFFFFFFFFFFFFFFu}, - uint64_t{0xFFFFFFFFFFFFFFFFu}}; +const uint128_pod kuint128max = {ui64{0xFFFFFFFFFFFFFFFFu}, + ui64{0xFFFFFFFFFFFFFFFFu}}; // Returns the 0-based position of the last set bit (i.e., most significant bit) // in the given uint64. The argument may not be 0. @@ -65,7 +65,7 @@ static inline int Fls64(uint64 n) { STEP(uint32, n32, pos, 0x10); STEP(uint32, n32, pos, 0x08); STEP(uint32, n32, pos, 0x04); - return pos + ((uint64_t{0x3333333322221100u} >> (n32 << 2)) & 0x3); + return pos + ((ui64{0x3333333322221100u} >> (n32 << 2)) & 0x3); } #undef STEP @@ -132,17 +132,17 @@ std::ostream& operator<<(std::ostream& o, const uint128& b) { switch (flags & std::ios::basefield) { case std::ios::hex: div = - static_cast<uint64>(uint64_t{0x1000000000000000u}); // 16^15 + static_cast<uint64>(ui64{0x1000000000000000u}); // 16^15 div_base_log = 15; break; case std::ios::oct: div = static_cast<uint64>( - uint64_t{01000000000000000000000u}); // 8^21 + ui64{01000000000000000000000u}); // 8^21 div_base_log = 21; break; default: // std::ios::dec div = static_cast<uint64>( - uint64_t{10000000000000000000u}); // 10^19 + ui64{10000000000000000000u}); // 10^19 div_base_log = 19; break; } diff --git a/contrib/libs/protobuf/src/google/protobuf/stubs/port.h b/contrib/libs/protobuf/src/google/protobuf/stubs/port.h index bc0be2b828..75448709de 100644 --- a/contrib/libs/protobuf/src/google/protobuf/stubs/port.h +++ b/contrib/libs/protobuf/src/google/protobuf/stubs/port.h @@ -144,10 +144,10 @@ typedef ui64 uint64; static const int32 kint32max = 0x7FFFFFFF; static const int32 kint32min = -kint32max - 1; -static const int64 kint64max = int64_t{0x7FFFFFFFFFFFFFFF}; +static const int64 kint64max = i64{0x7FFFFFFFFFFFFFFF}; static const int64 kint64min = -kint64max - 1; static const uint32 kuint32max = 0xFFFFFFFFu; -static const uint64 kuint64max = uint64_t{0xFFFFFFFFFFFFFFFFu}; +static const uint64 kuint64max = ui64{0xFFFFFFFFFFFFFFFFu}; #if defined(ADDRESS_SANITIZER) || defined(THREAD_SANITIZER) ||\ defined(MEMORY_SANITIZER) @@ -156,11 +156,11 @@ static const uint64 kuint64max = uint64_t{0xFFFFFFFFFFFFFFFFu}; extern "C" { #endif // __cplusplus uint16_t __sanitizer_unaligned_load16(const void *p); -uint32_t __sanitizer_unaligned_load32(const void *p); -uint64_t __sanitizer_unaligned_load64(const void *p); +ui32 __sanitizer_unaligned_load32(const void *p); +ui64 __sanitizer_unaligned_load64(const void *p); void __sanitizer_unaligned_store16(void *p, uint16_t v); -void __sanitizer_unaligned_store32(void *p, uint32_t v); -void __sanitizer_unaligned_store64(void *p, uint64_t v); +void __sanitizer_unaligned_store32(void *p, ui32 v); +void __sanitizer_unaligned_store64(void *p, ui64 v); #ifdef __cplusplus } // extern "C" #endif // __cplusplus @@ -271,14 +271,14 @@ static inline uint32 bswap_32(uint32 x) { #ifndef bswap_64 static inline uint64 bswap_64(uint64 x) { - return (((x & uint64_t{0xFFu}) << 56) | - ((x & uint64_t{0xFF00u}) << 40) | - ((x & uint64_t{0xFF0000u}) << 24) | - ((x & uint64_t{0xFF000000u}) << 8) | - ((x & uint64_t{0xFF00000000u}) >> 8) | - ((x & uint64_t{0xFF0000000000u}) >> 24) | - ((x & uint64_t{0xFF000000000000u}) >> 40) | - ((x & uint64_t{0xFF00000000000000u}) >> 56)); + return (((x & ui64{0xFFu}) << 56) | + ((x & ui64{0xFF00u}) << 40) | + ((x & ui64{0xFF0000u}) << 24) | + ((x & ui64{0xFF000000u}) << 8) | + ((x & ui64{0xFF00000000u}) >> 8) | + ((x & ui64{0xFF0000000000u}) >> 24) | + ((x & ui64{0xFF000000000000u}) >> 40) | + ((x & ui64{0xFF00000000000000u}) >> 56)); } #define bswap_64(x) bswap_64(x) #endif diff --git a/contrib/libs/protobuf/src/google/protobuf/stubs/strutil.cc b/contrib/libs/protobuf/src/google/protobuf/stubs/strutil.cc index 7a09e582cb..f84ead99c1 100644 --- a/contrib/libs/protobuf/src/google/protobuf/stubs/strutil.cc +++ b/contrib/libs/protobuf/src/google/protobuf/stubs/strutil.cc @@ -2353,7 +2353,7 @@ void CleanStringLineEndings(TProtoStringType *str, bool auto_end_last_line) { for (ptrdiff_t input_pos = 0; input_pos < len;) { if (!r_seen && input_pos + 8 < len) { - uint64_t v = GOOGLE_UNALIGNED_LOAD64(p + input_pos); + ui64 v = GOOGLE_UNALIGNED_LOAD64(p + input_pos); // Loop over groups of 8 bytes at a time until we come across // a word that has a byte whose value is less than or equal to // '\r' (i.e. could contain a \n (0x0a) or a \r (0x0d) ). diff --git a/contrib/libs/protobuf/src/google/protobuf/stubs/strutil.h b/contrib/libs/protobuf/src/google/protobuf/stubs/strutil.h index 06610ccfd6..ad08ad8988 100644 --- a/contrib/libs/protobuf/src/google/protobuf/stubs/strutil.h +++ b/contrib/libs/protobuf/src/google/protobuf/stubs/strutil.h @@ -41,8 +41,6 @@ #include <google/protobuf/port_def.inc> #include <vector> -#include <util/system/platform.h> - namespace google { namespace protobuf { @@ -416,33 +414,12 @@ inline bool safe_strto64(const char* str, int64* value) { inline bool safe_strto64(StringPiece str, int64* value) { return safe_strto64(str.ToString(), value); } -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -inline bool safe_strto64(StringPiece str, int64_t* value) { - int64 otherValue; - bool ok = safe_strto64(str.ToString(), &otherValue); - if (ok) { - *value = otherValue; - } - return ok; -} -#endif - inline bool safe_strtou64(const char* str, uint64* value) { return safe_strtou64(TProtoStringType(str), value); } inline bool safe_strtou64(StringPiece str, uint64* value) { return safe_strtou64(str.ToString(), value); } -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -inline bool safe_strtou64(StringPiece str, uint64_t* value) { - uint64 otherValue; - bool ok = safe_strtou64(str.ToString(), &otherValue); - if (ok) { - *value = otherValue; - } - return ok; -} -#endif PROTOBUF_EXPORT bool safe_strtof(const char* str, float* value); PROTOBUF_EXPORT bool safe_strtod(const char* str, double* value); diff --git a/contrib/libs/protobuf/src/google/protobuf/text_format.cc b/contrib/libs/protobuf/src/google/protobuf/text_format.cc index d92e99dc0d..7278cc90f4 100644 --- a/contrib/libs/protobuf/src/google/protobuf/text_format.cc +++ b/contrib/libs/protobuf/src/google/protobuf/text_format.cc @@ -165,7 +165,7 @@ TextFormat::ParseLocationRange TextFormat::ParseInfoTree::GetLocationRange( const std::vector<TextFormat::ParseLocationRange>* locations = FindOrNull(locations_, field); if (locations == nullptr || - index >= static_cast<int64_t>(locations->size())) { + index >= static_cast<i64>(locations->size())) { return TextFormat::ParseLocationRange(); } @@ -180,7 +180,7 @@ TextFormat::ParseInfoTree* TextFormat::ParseInfoTree::GetTreeForNested( } auto it = nested_.find(field); - if (it == nested_.end() || index >= static_cast<int64_t>(it->second.size())) { + if (it == nested_.end() || index >= static_cast<i64>(it->second.size())) { return nullptr; } @@ -459,7 +459,7 @@ class TextFormat::Parser::ParserImpl { } else { DO(ConsumeIdentifier(&field_name)); - int32_t field_number; + i32 field_number; if (allow_field_number_ && safe_strto32(field_name, &field_number)) { if (descriptor->IsExtensionNumber(field_number)) { field = finder_ @@ -726,28 +726,28 @@ class TextFormat::Parser::ParserImpl { switch (field->cpp_type()) { case FieldDescriptor::CPPTYPE_INT32: { - int64_t value; + i64 value; DO(ConsumeSignedInteger(&value, kint32max)); - SET_FIELD(Int32, static_cast<int32_t>(value)); + SET_FIELD(Int32, static_cast<i32>(value)); break; } case FieldDescriptor::CPPTYPE_UINT32: { - uint64_t value; + ui64 value; DO(ConsumeUnsignedInteger(&value, kuint32max)); - SET_FIELD(UInt32, static_cast<uint32_t>(value)); + SET_FIELD(UInt32, static_cast<ui32>(value)); break; } case FieldDescriptor::CPPTYPE_INT64: { - int64_t value; + i64 value; DO(ConsumeSignedInteger(&value, kint64max)); SET_FIELD(Int64, value); break; } case FieldDescriptor::CPPTYPE_UINT64: { - uint64_t value; + ui64 value; DO(ConsumeUnsignedInteger(&value, kuint64max)); SET_FIELD(UInt64, value); break; @@ -776,7 +776,7 @@ class TextFormat::Parser::ParserImpl { case FieldDescriptor::CPPTYPE_BOOL: { if (LookingAtType(io::Tokenizer::TYPE_INTEGER)) { - uint64_t value; + ui64 value; DO(ConsumeUnsignedInteger(&value, 1)); SET_FIELD(Bool, value); } else { @@ -797,7 +797,7 @@ class TextFormat::Parser::ParserImpl { case FieldDescriptor::CPPTYPE_ENUM: { TProtoStringType value; - int64_t int_value = kint64max; + i64 int_value = kint64max; const EnumDescriptor* enum_type = field->enum_type(); const EnumValueDescriptor* enum_value = nullptr; @@ -1006,9 +1006,9 @@ class TextFormat::Parser::ParserImpl { return true; } - // Consumes a uint64_t and saves its value in the value parameter. + // Consumes a ui64 and saves its value in the value parameter. // Returns false if the token is not of type INTEGER. - bool ConsumeUnsignedInteger(uint64_t* value, uint64_t max_value) { + bool ConsumeUnsignedInteger(ui64* value, ui64 max_value) { if (!LookingAtType(io::Tokenizer::TYPE_INTEGER)) { ReportError("Expected integer, got: " + tokenizer_.current().text); return false; @@ -1024,12 +1024,12 @@ class TextFormat::Parser::ParserImpl { return true; } - // Consumes an int64_t and saves its value in the value parameter. + // Consumes an i64 and saves its value in the value parameter. // Note that since the tokenizer does not support negative numbers, // we actually may consume an additional token (for the minus sign) in this // method. Returns false if the token is not an integer // (signed or otherwise). - bool ConsumeSignedInteger(int64_t* value, uint64_t max_value) { + bool ConsumeSignedInteger(i64* value, ui64 max_value) { bool negative = false; if (TryConsume("-")) { @@ -1039,18 +1039,18 @@ class TextFormat::Parser::ParserImpl { ++max_value; } - uint64_t unsigned_value; + ui64 unsigned_value; DO(ConsumeUnsignedInteger(&unsigned_value, max_value)); if (negative) { - if ((static_cast<uint64_t>(kint64max) + 1) == unsigned_value) { + if ((static_cast<ui64>(kint64max) + 1) == unsigned_value) { *value = kint64min; } else { - *value = -static_cast<int64_t>(unsigned_value); + *value = -static_cast<i64>(unsigned_value); } } else { - *value = static_cast<int64_t>(unsigned_value); + *value = static_cast<i64>(unsigned_value); } return true; @@ -1058,7 +1058,7 @@ class TextFormat::Parser::ParserImpl { // Consumes a double and saves its value in the value parameter. // Accepts decimal numbers only, rejects hex or oct numbers. - bool ConsumeUnsignedDecimalAsDouble(double* value, uint64_t max_value) { + bool ConsumeUnsignedDecimalAsDouble(double* value, ui64 max_value) { if (!LookingAtType(io::Tokenizer::TYPE_INTEGER)) { ReportError("Expected integer, got: " + tokenizer_.current().text); return false; @@ -1070,7 +1070,7 @@ class TextFormat::Parser::ParserImpl { return false; } - uint64_t uint64_value; + ui64 uint64_value; if (io::Tokenizer::ParseInteger(text, max_value, &uint64_value)) { *value = static_cast<double>(uint64_value); } else { @@ -1362,7 +1362,7 @@ class TextFormat::Printer::TextGenerator if (failed_) return; } - while (static_cast<int64_t>(size) > buffer_size_) { + while (static_cast<i64>(size) > buffer_size_) { // Data exceeds space in the buffer. Copy what we can and request a // new buffer. if (buffer_size_ > 0) { @@ -1672,16 +1672,16 @@ TextFormat::FieldValuePrinter::~FieldValuePrinter() {} TProtoStringType TextFormat::FieldValuePrinter::PrintBool(bool val) const { FORWARD_IMPL(PrintBool, val); } -TProtoStringType TextFormat::FieldValuePrinter::PrintInt32(int32_t val) const { +TProtoStringType TextFormat::FieldValuePrinter::PrintInt32(i32 val) const { FORWARD_IMPL(PrintInt32, val); } -TProtoStringType TextFormat::FieldValuePrinter::PrintUInt32(uint32_t val) const { +TProtoStringType TextFormat::FieldValuePrinter::PrintUInt32(ui32 val) const { FORWARD_IMPL(PrintUInt32, val); } -TProtoStringType TextFormat::FieldValuePrinter::PrintInt64(int64 val) const { +TProtoStringType TextFormat::FieldValuePrinter::PrintInt64(i64 val) const { FORWARD_IMPL(PrintInt64, val); } -TProtoStringType TextFormat::FieldValuePrinter::PrintUInt64(uint64 val) const { +TProtoStringType TextFormat::FieldValuePrinter::PrintUInt64(ui64 val) const { FORWARD_IMPL(PrintUInt64, val); } TProtoStringType TextFormat::FieldValuePrinter::PrintFloat(float val) const { @@ -1699,7 +1699,7 @@ TProtoStringType TextFormat::FieldValuePrinter::PrintBytes( return PrintString(val); } TProtoStringType TextFormat::FieldValuePrinter::PrintEnum( - int32_t val, const TProtoStringType& name) const { + i32 val, const TProtoStringType& name) const { FORWARD_IMPL(PrintEnum, val, name); } TProtoStringType TextFormat::FieldValuePrinter::PrintFieldName( @@ -1732,19 +1732,19 @@ void TextFormat::FastFieldValuePrinter::PrintBool( } } void TextFormat::FastFieldValuePrinter::PrintInt32( - int32_t val, BaseTextGenerator* generator) const { + i32 val, BaseTextGenerator* generator) const { generator->PrintString(StrCat(val)); } void TextFormat::FastFieldValuePrinter::PrintUInt32( - uint32_t val, BaseTextGenerator* generator) const { + ui32 val, BaseTextGenerator* generator) const { generator->PrintString(StrCat(val)); } void TextFormat::FastFieldValuePrinter::PrintInt64( - int64 val, BaseTextGenerator* generator) const { + i64 val, BaseTextGenerator* generator) const { generator->PrintString(StrCat(val)); } void TextFormat::FastFieldValuePrinter::PrintUInt64( - uint64 val, BaseTextGenerator* generator) const { + ui64 val, BaseTextGenerator* generator) const { generator->PrintString(StrCat(val)); } void TextFormat::FastFieldValuePrinter::PrintFloat( @@ -1756,7 +1756,7 @@ void TextFormat::FastFieldValuePrinter::PrintDouble( generator->PrintString(!std::isnan(val) ? SimpleDtoa(val) : "nan"); } void TextFormat::FastFieldValuePrinter::PrintEnum( - int32_t val, const TProtoStringType& name, BaseTextGenerator* generator) const { + i32 val, const TProtoStringType& name, BaseTextGenerator* generator) const { generator->PrintString(name); } @@ -1831,19 +1831,19 @@ class FieldValuePrinterWrapper : public TextFormat::FastFieldValuePrinter { TextFormat::BaseTextGenerator* generator) const override { generator->PrintString(delegate_->PrintBool(val)); } - void PrintInt32(int32_t val, + void PrintInt32(i32 val, TextFormat::BaseTextGenerator* generator) const override { generator->PrintString(delegate_->PrintInt32(val)); } - void PrintUInt32(uint32_t val, + void PrintUInt32(ui32 val, TextFormat::BaseTextGenerator* generator) const override { generator->PrintString(delegate_->PrintUInt32(val)); } - void PrintInt64(int64 val, + void PrintInt64(i64 val, TextFormat::BaseTextGenerator* generator) const override { generator->PrintString(delegate_->PrintInt64(val)); } - void PrintUInt64(uint64 val, + void PrintUInt64(ui64 val, TextFormat::BaseTextGenerator* generator) const override { generator->PrintString(delegate_->PrintUInt64(val)); } @@ -1863,7 +1863,7 @@ class FieldValuePrinterWrapper : public TextFormat::FastFieldValuePrinter { TextFormat::BaseTextGenerator* generator) const override { generator->PrintString(delegate_->PrintBytes(val)); } - void PrintEnum(int32_t val, const TProtoStringType& name, + void PrintEnum(i32 val, const TProtoStringType& name, TextFormat::BaseTextGenerator* generator) const override { generator->PrintString(delegate_->PrintEnum(val, name)); } @@ -2166,23 +2166,23 @@ class MapEntryMessageComparator { return first < second; } case FieldDescriptor::CPPTYPE_INT32: { - int32_t first = reflection->GetInt32(*a, field_); - int32_t second = reflection->GetInt32(*b, field_); + i32 first = reflection->GetInt32(*a, field_); + i32 second = reflection->GetInt32(*b, field_); return first < second; } case FieldDescriptor::CPPTYPE_INT64: { - int64_t first = reflection->GetInt64(*a, field_); - int64_t second = reflection->GetInt64(*b, field_); + i64 first = reflection->GetInt64(*a, field_); + i64 second = reflection->GetInt64(*b, field_); return first < second; } case FieldDescriptor::CPPTYPE_UINT32: { - uint32_t first = reflection->GetUInt32(*a, field_); - uint32_t second = reflection->GetUInt32(*b, field_); + ui32 first = reflection->GetUInt32(*a, field_); + ui32 second = reflection->GetUInt32(*b, field_); return first < second; } case FieldDescriptor::CPPTYPE_UINT64: { - uint64_t first = reflection->GetUInt64(*a, field_); - uint64_t second = reflection->GetUInt64(*b, field_); + ui64 first = reflection->GetUInt64(*a, field_); + ui64 second = reflection->GetUInt64(*b, field_); return first < second; } case FieldDescriptor::CPPTYPE_STRING: { diff --git a/contrib/libs/protobuf/src/google/protobuf/text_format.h b/contrib/libs/protobuf/src/google/protobuf/text_format.h index fd252be870..070a59e3ec 100644 --- a/contrib/libs/protobuf/src/google/protobuf/text_format.h +++ b/contrib/libs/protobuf/src/google/protobuf/text_format.h @@ -126,17 +126,17 @@ class PROTOBUF_EXPORT TextFormat { FastFieldValuePrinter(); virtual ~FastFieldValuePrinter(); virtual void PrintBool(bool val, BaseTextGenerator* generator) const; - virtual void PrintInt32(int32_t val, BaseTextGenerator* generator) const; - virtual void PrintUInt32(uint32_t val, BaseTextGenerator* generator) const; - virtual void PrintInt64(int64 val, BaseTextGenerator* generator) const; - virtual void PrintUInt64(uint64 val, BaseTextGenerator* generator) const; + virtual void PrintInt32(i32 val, BaseTextGenerator* generator) const; + virtual void PrintUInt32(ui32 val, BaseTextGenerator* generator) const; + virtual void PrintInt64(i64 val, BaseTextGenerator* generator) const; + virtual void PrintUInt64(ui64 val, BaseTextGenerator* generator) const; virtual void PrintFloat(float val, BaseTextGenerator* generator) const; virtual void PrintDouble(double val, BaseTextGenerator* generator) const; virtual void PrintString(const TProtoStringType& val, BaseTextGenerator* generator) const; virtual void PrintBytes(const TProtoStringType& val, BaseTextGenerator* generator) const; - virtual void PrintEnum(int32_t val, const TProtoStringType& name, + virtual void PrintEnum(i32 val, const TProtoStringType& name, BaseTextGenerator* generator) const; virtual void PrintFieldName(const Message& message, int field_index, int field_count, const Reflection* reflection, @@ -171,15 +171,15 @@ class PROTOBUF_EXPORT TextFormat { FieldValuePrinter(); virtual ~FieldValuePrinter(); virtual TProtoStringType PrintBool(bool val) const; - virtual TProtoStringType PrintInt32(int32_t val) const; - virtual TProtoStringType PrintUInt32(uint32_t val) const; - virtual TProtoStringType PrintInt64(int64 val) const; - virtual TProtoStringType PrintUInt64(uint64 val) const; + virtual TProtoStringType PrintInt32(i32 val) const; + virtual TProtoStringType PrintUInt32(ui32 val) const; + virtual TProtoStringType PrintInt64(i64 val) const; + virtual TProtoStringType PrintUInt64(ui64 val) const; virtual TProtoStringType PrintFloat(float val) const; virtual TProtoStringType PrintDouble(double val) const; virtual TProtoStringType PrintString(const TProtoStringType& val) const; virtual TProtoStringType PrintBytes(const TProtoStringType& val) const; - virtual TProtoStringType PrintEnum(int32_t val, const TProtoStringType& name) const; + virtual TProtoStringType PrintEnum(i32 val, const TProtoStringType& name) const; virtual TProtoStringType PrintFieldName(const Message& message, const Reflection* reflection, const FieldDescriptor* field) const; @@ -341,7 +341,7 @@ class PROTOBUF_EXPORT TextFormat { // property of TextFormat::Printer. That is, from the printed message, we // cannot fully recover the original string field any more. void SetTruncateStringFieldLongerThan( - const int64_t truncate_string_field_longer_than) { + const i64 truncate_string_field_longer_than) { truncate_string_field_longer_than_ = truncate_string_field_longer_than; } @@ -431,7 +431,7 @@ class PROTOBUF_EXPORT TextFormat { bool hide_unknown_fields_; bool print_message_fields_in_index_order_; bool expand_any_; - int64_t truncate_string_field_longer_than_; + i64 truncate_string_field_longer_than_; std::unique_ptr<const FastFieldValuePrinter> default_field_value_printer_; typedef std::map<const FieldDescriptor*, diff --git a/contrib/libs/protobuf/src/google/protobuf/timestamp.pb.cc b/contrib/libs/protobuf/src/google/protobuf/timestamp.pb.cc index a7ab3b9b23..965094916b 100644 --- a/contrib/libs/protobuf/src/google/protobuf/timestamp.pb.cc +++ b/contrib/libs/protobuf/src/google/protobuf/timestamp.pb.cc @@ -19,7 +19,7 @@ PROTOBUF_PRAGMA_INIT_SEG PROTOBUF_NAMESPACE_OPEN constexpr Timestamp::Timestamp( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) - : seconds_(int64_t{0}) + : seconds_(i64{0}) , nanos_(0){} struct TimestampDefaultTypeInternal { constexpr TimestampDefaultTypeInternal() diff --git a/contrib/libs/protobuf/src/google/protobuf/timestamp.pb.h b/contrib/libs/protobuf/src/google/protobuf/timestamp.pb.h index 3b4971a20b..1e1ff0e09e 100644 --- a/contrib/libs/protobuf/src/google/protobuf/timestamp.pb.h +++ b/contrib/libs/protobuf/src/google/protobuf/timestamp.pb.h @@ -230,7 +230,7 @@ class PROTOBUF_EXPORT Timestamp final : // int64 seconds = 1; inline void Timestamp::clear_seconds() { - seconds_ = int64_t{0}; + seconds_ = i64{0}; } inline ::PROTOBUF_NAMESPACE_ID::int64 Timestamp::_internal_seconds() const { return seconds_; diff --git a/contrib/libs/protobuf/src/google/protobuf/unknown_field_set.cc b/contrib/libs/protobuf/src/google/protobuf/unknown_field_set.cc index 9664de42c8..c43aa4dc37 100644 --- a/contrib/libs/protobuf/src/google/protobuf/unknown_field_set.cc +++ b/contrib/libs/protobuf/src/google/protobuf/unknown_field_set.cc @@ -132,7 +132,7 @@ size_t UnknownFieldSet::SpaceUsedLong() const { return sizeof(*this) + SpaceUsedExcludingSelf(); } -void UnknownFieldSet::AddVarint(int number, uint64_t value) { +void UnknownFieldSet::AddVarint(int number, ui64 value) { UnknownField field; field.number_ = number; field.SetType(UnknownField::TYPE_VARINT); @@ -140,7 +140,7 @@ void UnknownFieldSet::AddVarint(int number, uint64_t value) { fields_.push_back(field); } -void UnknownFieldSet::AddFixed32(int number, uint32_t value) { +void UnknownFieldSet::AddFixed32(int number, ui32 value) { UnknownField field; field.number_ = number; field.SetType(UnknownField::TYPE_FIXED32); @@ -148,7 +148,7 @@ void UnknownFieldSet::AddFixed32(int number, uint32_t value) { fields_.push_back(field); } -void UnknownFieldSet::AddFixed64(int number, uint64_t value) { +void UnknownFieldSet::AddFixed64(int number, ui64 value) { UnknownField field; field.number_ = number; field.SetType(UnknownField::TYPE_FIXED64); @@ -285,24 +285,24 @@ class UnknownFieldParserHelper { explicit UnknownFieldParserHelper(UnknownFieldSet* unknown) : unknown_(unknown) {} - void AddVarint(uint32_t num, uint64_t value) { + void AddVarint(ui32 num, ui64 value) { unknown_->AddVarint(num, value); } - void AddFixed64(uint32_t num, uint64_t value) { + void AddFixed64(ui32 num, ui64 value) { unknown_->AddFixed64(num, value); } - const char* ParseLengthDelimited(uint32_t num, const char* ptr, + const char* ParseLengthDelimited(ui32 num, const char* ptr, ParseContext* ctx) { TProtoStringType* s = unknown_->AddLengthDelimited(num); int size = ReadSize(&ptr); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); return ctx->ReadString(ptr, size, s); } - const char* ParseGroup(uint32_t num, const char* ptr, ParseContext* ctx) { + const char* ParseGroup(ui32 num, const char* ptr, ParseContext* ctx) { UnknownFieldParserHelper child(unknown_->AddGroup(num)); return ctx->ParseGroup(&child, ptr, num * 8 + 3); } - void AddFixed32(uint32_t num, uint32_t value) { + void AddFixed32(ui32 num, ui32 value) { unknown_->AddFixed32(num, value); } @@ -320,7 +320,7 @@ const char* UnknownGroupParse(UnknownFieldSet* unknown, const char* ptr, return WireFormatParser(field_parser, ptr, ctx); } -const char* UnknownFieldParse(uint64_t tag, UnknownFieldSet* unknown, +const char* UnknownFieldParse(ui64 tag, UnknownFieldSet* unknown, const char* ptr, ParseContext* ctx) { UnknownFieldParserHelper field_parser(unknown); return FieldParser(tag, field_parser, ptr, ctx); diff --git a/contrib/libs/protobuf/src/google/protobuf/unknown_field_set.h b/contrib/libs/protobuf/src/google/protobuf/unknown_field_set.h index bc4dc34f7f..04cb319f71 100644 --- a/contrib/libs/protobuf/src/google/protobuf/unknown_field_set.h +++ b/contrib/libs/protobuf/src/google/protobuf/unknown_field_set.h @@ -136,9 +136,9 @@ class PROTOBUF_EXPORT UnknownFieldSet { // Adding fields --------------------------------------------------- - void AddVarint(int number, uint64_t value); - void AddFixed32(int number, uint32_t value); - void AddFixed64(int number, uint64_t value); + void AddVarint(int number, ui64 value); + void AddFixed32(int number, ui32 value); + void AddFixed64(int number, ui64 value); void AddLengthDelimited(int number, const TProtoStringType& value); TProtoStringType* AddLengthDelimited(int number); UnknownFieldSet* AddGroup(int number); @@ -209,10 +209,10 @@ class PROTOBUF_EXPORT UnknownFieldSet { namespace internal { -inline void WriteVarint(uint32_t num, uint64_t val, UnknownFieldSet* unknown) { +inline void WriteVarint(ui32 num, ui64 val, UnknownFieldSet* unknown) { unknown->AddVarint(num, val); } -inline void WriteLengthDelimited(uint32_t num, StringPiece val, +inline void WriteLengthDelimited(ui32 num, StringPiece val, UnknownFieldSet* unknown) { unknown->AddLengthDelimited(num)->assign(val.data(), val.size()); } @@ -221,7 +221,7 @@ PROTOBUF_EXPORT const char* UnknownGroupParse(UnknownFieldSet* unknown, const char* ptr, ParseContext* ctx); PROTOBUF_EXPORT -const char* UnknownFieldParse(uint64_t tag, UnknownFieldSet* unknown, +const char* UnknownFieldParse(ui64 tag, UnknownFieldSet* unknown, const char* ptr, ParseContext* ctx); } // namespace internal @@ -246,15 +246,15 @@ class PROTOBUF_EXPORT UnknownField { // Accessors ------------------------------------------------------- // Each method works only for UnknownFields of the corresponding type. - inline uint64_t varint() const; - inline uint32_t fixed32() const; - inline uint64_t fixed64() const; + inline ui64 varint() const; + inline ui32 fixed32() const; + inline ui64 fixed64() const; inline const TProtoStringType& length_delimited() const; inline const UnknownFieldSet& group() const; - inline void set_varint(uint64_t value); - inline void set_fixed32(uint32_t value); - inline void set_fixed64(uint64_t value); + inline void set_varint(ui64 value); + inline void set_fixed32(ui32 value); + inline void set_fixed64(ui64 value); inline void set_length_delimited(const TProtoStringType& value); inline TProtoStringType* mutable_length_delimited(); inline UnknownFieldSet* mutable_group(); @@ -287,12 +287,12 @@ class PROTOBUF_EXPORT UnknownField { TProtoStringType* string_value; }; - uint32_t number_; - uint32_t type_; + ui32 number_; + ui32 type_; union { - uint64_t varint_; - uint32_t fixed32_; - uint64_t fixed64_; + ui64 varint_; + ui32 fixed32_; + ui64 fixed64_; mutable union LengthDelimited length_delimited_; UnknownFieldSet* group_; } data_; @@ -342,15 +342,15 @@ inline UnknownField::Type UnknownField::type() const { return static_cast<Type>(type_); } -inline uint64_t UnknownField::varint() const { +inline ui64 UnknownField::varint() const { assert(type() == TYPE_VARINT); return data_.varint_; } -inline uint32_t UnknownField::fixed32() const { +inline ui32 UnknownField::fixed32() const { assert(type() == TYPE_FIXED32); return data_.fixed32_; } -inline uint64_t UnknownField::fixed64() const { +inline ui64 UnknownField::fixed64() const { assert(type() == TYPE_FIXED64); return data_.fixed64_; } @@ -363,15 +363,15 @@ inline const UnknownFieldSet& UnknownField::group() const { return *data_.group_; } -inline void UnknownField::set_varint(uint64_t value) { +inline void UnknownField::set_varint(ui64 value) { assert(type() == TYPE_VARINT); data_.varint_ = value; } -inline void UnknownField::set_fixed32(uint32_t value) { +inline void UnknownField::set_fixed32(ui32 value) { assert(type() == TYPE_FIXED32); data_.fixed32_ = value; } -inline void UnknownField::set_fixed64(uint64_t value) { +inline void UnknownField::set_fixed64(ui64 value) { assert(type() == TYPE_FIXED64); data_.fixed64_ = value; } diff --git a/contrib/libs/protobuf/src/google/protobuf/util/field_comparator.h b/contrib/libs/protobuf/src/google/protobuf/util/field_comparator.h index 434400eb45..b2b0df8c5a 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/field_comparator.h +++ b/contrib/libs/protobuf/src/google/protobuf/util/field_comparator.h @@ -203,13 +203,13 @@ class PROTOBUF_EXPORT SimpleFieldComparator : public FieldComparator { // CompareFloat. bool CompareFloat(const FieldDescriptor& field, float value_1, float value_2); - bool CompareInt32(const FieldDescriptor& /* unused */, int32_t value_1, - int32_t value_2) { + bool CompareInt32(const FieldDescriptor& /* unused */, i32 value_1, + i32 value_2) { return value_1 == value_2; } - bool CompareInt64(const FieldDescriptor& /* unused */, int64_t value_1, - int64_t value_2) { + bool CompareInt64(const FieldDescriptor& /* unused */, i64 value_1, + i64 value_2) { return value_1 == value_2; } @@ -218,13 +218,13 @@ class PROTOBUF_EXPORT SimpleFieldComparator : public FieldComparator { return value_1 == value_2; } - bool CompareUInt32(const FieldDescriptor& /* unused */, uint32_t value_1, - uint32_t value_2) { + bool CompareUInt32(const FieldDescriptor& /* unused */, ui32 value_1, + ui32 value_2) { return value_1 == value_2; } - bool CompareUInt64(const FieldDescriptor& /* unused */, uint64_t value_1, - uint64_t value_2) { + bool CompareUInt64(const FieldDescriptor& /* unused */, ui64 value_1, + ui64 value_2) { return value_1 == value_2; } diff --git a/contrib/libs/protobuf/src/google/protobuf/util/field_mask_util.cc b/contrib/libs/protobuf/src/google/protobuf/util/field_mask_util.cc index 1e69f8e4f7..29e620ecd9 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/field_mask_util.cc +++ b/contrib/libs/protobuf/src/google/protobuf/util/field_mask_util.cc @@ -552,7 +552,7 @@ void FieldMaskTree::MergeMessage(const Node* node, const Message& source, void FieldMaskTree::AddRequiredFieldPath(Node* node, const Descriptor* descriptor) { - const int32_t field_count = descriptor->field_count(); + const i32 field_count = descriptor->field_count(); for (int index = 0; index < field_count; ++index) { const FieldDescriptor* field = descriptor->field(index); if (field->is_required()) { @@ -589,7 +589,7 @@ bool FieldMaskTree::TrimMessage(const Node* node, Message* message) { GOOGLE_DCHECK(!node->children.empty()); const Reflection* reflection = message->GetReflection(); const Descriptor* descriptor = message->GetDescriptor(); - const int32_t field_count = descriptor->field_count(); + const i32 field_count = descriptor->field_count(); bool modified = false; for (int index = 0; index < field_count; ++index) { const FieldDescriptor* field = descriptor->field(index); diff --git a/contrib/libs/protobuf/src/google/protobuf/util/field_mask_util.h b/contrib/libs/protobuf/src/google/protobuf/util/field_mask_util.h index 70f8f55446..265c8b95b2 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/field_mask_util.h +++ b/contrib/libs/protobuf/src/google/protobuf/util/field_mask_util.h @@ -59,7 +59,7 @@ class PROTOBUF_EXPORT FieldMaskUtil { // Populates the FieldMask with the paths corresponding to the fields with the // given numbers, after checking that all field numbers are valid. template <typename T> - static void FromFieldNumbers(const std::vector<int64_t>& field_numbers, + static void FromFieldNumbers(const std::vector<i64>& field_numbers, FieldMask* out) { for (const auto field_number : field_numbers) { const FieldDescriptor* field_desc = diff --git a/contrib/libs/protobuf/src/google/protobuf/util/internal/constants.h b/contrib/libs/protobuf/src/google/protobuf/util/internal/constants.h index 65f1a34024..21a6b83e1c 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/internal/constants.h +++ b/contrib/libs/protobuf/src/google/protobuf/util/internal/constants.h @@ -52,19 +52,19 @@ const char kRfc3339TimeFormat[] = "%E4Y-%m-%dT%H:%M:%S"; const char kRfc3339TimeFormatNoPadding[] = "%Y-%m-%dT%H:%M:%S"; // Minimum seconds allowed in a google.protobuf.Timestamp value. -const int64_t kTimestampMinSeconds = -62135596800LL; +const i64 kTimestampMinSeconds = -62135596800LL; // Maximum seconds allowed in a google.protobuf.Timestamp value. -const int64_t kTimestampMaxSeconds = 253402300799LL; +const i64 kTimestampMaxSeconds = 253402300799LL; // Minimum seconds allowed in a google.protobuf.Duration value. -const int64_t kDurationMinSeconds = -315576000000LL; +const i64 kDurationMinSeconds = -315576000000LL; // Maximum seconds allowed in a google.protobuf.Duration value. -const int64_t kDurationMaxSeconds = 315576000000LL; +const i64 kDurationMaxSeconds = 315576000000LL; // Nano seconds in a second. -const int32_t kNanosPerSecond = 1000000000; +const i32 kNanosPerSecond = 1000000000; // Type url representing NULL values in google.protobuf.Struct type. const char kStructNullValueTypeUrl[] = diff --git a/contrib/libs/protobuf/src/google/protobuf/util/internal/datapiece.cc b/contrib/libs/protobuf/src/google/protobuf/util/internal/datapiece.cc index 777dadf820..785f1041fe 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/internal/datapiece.cc +++ b/contrib/libs/protobuf/src/google/protobuf/util/internal/datapiece.cc @@ -109,56 +109,56 @@ util::StatusOr<float> DoubleToFloat(double before) { } // namespace -util::StatusOr<int32_t> DataPiece::ToInt32() const { +util::StatusOr<i32> DataPiece::ToInt32() const { if (type_ == TYPE_STRING) - return StringToNumber<int32>(safe_strto32); + return StringToNumber<i32>(safe_strto32); if (type_ == TYPE_DOUBLE) - return FloatingPointToIntConvertAndCheck<int32_t, double>(double_); + return FloatingPointToIntConvertAndCheck<i32, double>(double_); if (type_ == TYPE_FLOAT) - return FloatingPointToIntConvertAndCheck<int32_t, float>(float_); + return FloatingPointToIntConvertAndCheck<i32, float>(float_); - return GenericConvert<int32_t>(); + return GenericConvert<i32>(); } -util::StatusOr<uint32_t> DataPiece::ToUint32() const { +util::StatusOr<ui32> DataPiece::ToUint32() const { if (type_ == TYPE_STRING) - return StringToNumber<uint32>(safe_strtou32); + return StringToNumber<ui32>(safe_strtou32); if (type_ == TYPE_DOUBLE) - return FloatingPointToIntConvertAndCheck<uint32_t, double>(double_); + return FloatingPointToIntConvertAndCheck<ui32, double>(double_); if (type_ == TYPE_FLOAT) - return FloatingPointToIntConvertAndCheck<uint32_t, float>(float_); + return FloatingPointToIntConvertAndCheck<ui32, float>(float_); - return GenericConvert<uint32_t>(); + return GenericConvert<ui32>(); } -util::StatusOr<int64_t> DataPiece::ToInt64() const { +util::StatusOr<i64> DataPiece::ToInt64() const { if (type_ == TYPE_STRING) - return StringToNumber<int64_t>(safe_strto64); + return StringToNumber<i64>(safe_strto64); if (type_ == TYPE_DOUBLE) - return FloatingPointToIntConvertAndCheck<int64_t, double>(double_); + return FloatingPointToIntConvertAndCheck<i64, double>(double_); if (type_ == TYPE_FLOAT) - return FloatingPointToIntConvertAndCheck<int64_t, float>(float_); + return FloatingPointToIntConvertAndCheck<i64, float>(float_); - return GenericConvert<int64_t>(); + return GenericConvert<i64>(); } -util::StatusOr<uint64_t> DataPiece::ToUint64() const { +util::StatusOr<ui64> DataPiece::ToUint64() const { if (type_ == TYPE_STRING) - return StringToNumber<uint64_t>(safe_strtou64); + return StringToNumber<ui64>(safe_strtou64); if (type_ == TYPE_DOUBLE) - return FloatingPointToIntConvertAndCheck<uint64_t, double>(double_); + return FloatingPointToIntConvertAndCheck<ui64, double>(double_); if (type_ == TYPE_FLOAT) - return FloatingPointToIntConvertAndCheck<uint64_t, float>(float_); + return FloatingPointToIntConvertAndCheck<ui64, float>(float_); - return GenericConvert<uint64_t>(); + return GenericConvert<ui64>(); } util::StatusOr<double> DataPiece::ToDouble() const { @@ -284,7 +284,7 @@ util::StatusOr<int> DataPiece::ToEnum(const google::protobuf::Enum* enum_type, if (value != nullptr) return value->number(); // Check if int version of enum is sent as string. - util::StatusOr<int32_t> int_value = ToInt32(); + util::StatusOr<i32> int_value = ToInt32(); if (int_value.ok()) { if (const google::protobuf::EnumValue* enum_value = FindEnumValueByNumberOrNull(enum_type, int_value.value())) { @@ -332,13 +332,13 @@ template <typename To> util::StatusOr<To> DataPiece::GenericConvert() const { switch (type_) { case TYPE_INT32: - return NumberConvertAndCheck<To, int32_t>(i32_); + return NumberConvertAndCheck<To, i32>(i32_); case TYPE_INT64: - return NumberConvertAndCheck<To, int64_t>(i64_); + return NumberConvertAndCheck<To, i64>(i64_); case TYPE_UINT32: - return NumberConvertAndCheck<To, uint32_t>(u32_); + return NumberConvertAndCheck<To, ui32>(u32_); case TYPE_UINT64: - return NumberConvertAndCheck<To, uint64_t>(u64_); + return NumberConvertAndCheck<To, ui64>(u64_); case TYPE_DOUBLE: return NumberConvertAndCheck<To, double>(double_); case TYPE_FLOAT: diff --git a/contrib/libs/protobuf/src/google/protobuf/util/internal/datapiece.h b/contrib/libs/protobuf/src/google/protobuf/util/internal/datapiece.h index ac0029e44b..f93afedfec 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/internal/datapiece.h +++ b/contrib/libs/protobuf/src/google/protobuf/util/internal/datapiece.h @@ -76,21 +76,13 @@ class PROTOBUF_EXPORT DataPiece { }; // Constructors and Destructor - explicit DataPiece(const int32_t value) + explicit DataPiece(const i32 value) : type_(TYPE_INT32), i32_(value), use_strict_base64_decoding_(false) {} -#if defined(_32_) && (defined(_darwin_) || defined(_ios)) - explicit DataPiece(const int32 value) - : type_(TYPE_INT32), i32_(value), use_strict_base64_decoding_(false) {} -#endif - explicit DataPiece(const int64_t value) - : type_(TYPE_INT64), i64_(value), use_strict_base64_decoding_(false) {} -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) - explicit DataPiece(const int64 value) + explicit DataPiece(const i64 value) : type_(TYPE_INT64), i64_(value), use_strict_base64_decoding_(false) {} -#endif - explicit DataPiece(const uint32_t value) + explicit DataPiece(const ui32 value) : type_(TYPE_UINT32), u32_(value), use_strict_base64_decoding_(false) {} - explicit DataPiece(const uint64_t value) + explicit DataPiece(const ui64 value) : type_(TYPE_UINT64), u64_(value), use_strict_base64_decoding_(false) {} explicit DataPiece(const double value) : type_(TYPE_DOUBLE), @@ -134,16 +126,16 @@ class PROTOBUF_EXPORT DataPiece { // Parses, casts or converts the value stored in the DataPiece into an int32. - util::StatusOr<int32_t> ToInt32() const; + util::StatusOr<i32> ToInt32() const; // Parses, casts or converts the value stored in the DataPiece into a uint32. - util::StatusOr<uint32_t> ToUint32() const; + util::StatusOr<ui32> ToUint32() const; // Parses, casts or converts the value stored in the DataPiece into an int64. - util::StatusOr<int64_t> ToInt64() const; + util::StatusOr<i64> ToInt64() const; // Parses, casts or converts the value stored in the DataPiece into a uint64. - util::StatusOr<uint64_t> ToUint64() const; + util::StatusOr<ui64> ToUint64() const; // Parses, casts or converts the value stored in the DataPiece into a double. util::StatusOr<double> ToDouble() const; @@ -170,7 +162,7 @@ class PROTOBUF_EXPORT DataPiece { DataPiece(); // Helper to create NULL or ENUM types. - DataPiece(Type type, int32_t val) + DataPiece(Type type, i32 val) : type_(type), i32_(val), use_strict_base64_decoding_(false) {} // Same as the ToEnum() method above but with additional flag to ignore @@ -202,10 +194,10 @@ class PROTOBUF_EXPORT DataPiece { // Stored piece of data. union { - int32_t i32_; - int64_t i64_; - uint32_t u32_; - uint64_t u64_; + i32 i32_; + i64 i64_; + ui32 u32_; + ui64 u64_; double double_; float float_; bool bool_; diff --git a/contrib/libs/protobuf/src/google/protobuf/util/internal/default_value_objectwriter.cc b/contrib/libs/protobuf/src/google/protobuf/util/internal/default_value_objectwriter.cc index c4734269a2..0301433b8a 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/internal/default_value_objectwriter.cc +++ b/contrib/libs/protobuf/src/google/protobuf/util/internal/default_value_objectwriter.cc @@ -86,7 +86,7 @@ DefaultValueObjectWriter* DefaultValueObjectWriter::RenderBool( } DefaultValueObjectWriter* DefaultValueObjectWriter::RenderInt32( - StringPiece name, int32_t value) { + StringPiece name, i32 value) { if (current_ == nullptr) { ow_->RenderInt32(name, value); } else { @@ -96,7 +96,7 @@ DefaultValueObjectWriter* DefaultValueObjectWriter::RenderInt32( } DefaultValueObjectWriter* DefaultValueObjectWriter::RenderUint32( - StringPiece name, uint32_t value) { + StringPiece name, ui32 value) { if (current_ == nullptr) { ow_->RenderUint32(name, value); } else { @@ -106,7 +106,7 @@ DefaultValueObjectWriter* DefaultValueObjectWriter::RenderUint32( } DefaultValueObjectWriter* DefaultValueObjectWriter::RenderInt64( - StringPiece name, int64_t value) { + StringPiece name, i64 value) { if (current_ == nullptr) { ow_->RenderInt64(name, value); } else { @@ -116,7 +116,7 @@ DefaultValueObjectWriter* DefaultValueObjectWriter::RenderInt64( } DefaultValueObjectWriter* DefaultValueObjectWriter::RenderUint64( - StringPiece name, uint64_t value) { + StringPiece name, ui64 value) { if (current_ == nullptr) { ow_->RenderUint64(name, value); } else { @@ -461,20 +461,20 @@ DataPiece DefaultValueObjectWriter::CreateDefaultDataPieceForField( case google::protobuf::Field::TYPE_INT64: case google::protobuf::Field::TYPE_SINT64: case google::protobuf::Field::TYPE_SFIXED64: { - return DataPiece(ConvertTo<int64_t>( - field.default_value(), &DataPiece::ToInt64, static_cast<int64_t>(0))); + return DataPiece(ConvertTo<i64>( + field.default_value(), &DataPiece::ToInt64, static_cast<i64>(0))); } case google::protobuf::Field::TYPE_UINT64: case google::protobuf::Field::TYPE_FIXED64: { - return DataPiece(ConvertTo<uint64_t>(field.default_value(), + return DataPiece(ConvertTo<ui64>(field.default_value(), &DataPiece::ToUint64, - static_cast<uint64_t>(0))); + static_cast<ui64>(0))); } case google::protobuf::Field::TYPE_INT32: case google::protobuf::Field::TYPE_SINT32: case google::protobuf::Field::TYPE_SFIXED32: { - return DataPiece(ConvertTo<int32_t>( - field.default_value(), &DataPiece::ToInt32, static_cast<int32_t>(0))); + return DataPiece(ConvertTo<i32>( + field.default_value(), &DataPiece::ToInt32, static_cast<i32>(0))); } case google::protobuf::Field::TYPE_BOOL: { return DataPiece( @@ -488,9 +488,9 @@ DataPiece DefaultValueObjectWriter::CreateDefaultDataPieceForField( } case google::protobuf::Field::TYPE_UINT32: case google::protobuf::Field::TYPE_FIXED32: { - return DataPiece(ConvertTo<uint32_t>(field.default_value(), + return DataPiece(ConvertTo<ui32>(field.default_value(), &DataPiece::ToUint32, - static_cast<uint32_t>(0))); + static_cast<ui32>(0))); } case google::protobuf::Field::TYPE_ENUM: { return FindEnumDefault(field, typeinfo, use_ints_for_enums); diff --git a/contrib/libs/protobuf/src/google/protobuf/util/internal/default_value_objectwriter.h b/contrib/libs/protobuf/src/google/protobuf/util/internal/default_value_objectwriter.h index ff8af3df22..f9b57f65cf 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/internal/default_value_objectwriter.h +++ b/contrib/libs/protobuf/src/google/protobuf/util/internal/default_value_objectwriter.h @@ -96,16 +96,16 @@ class PROTOBUF_EXPORT DefaultValueObjectWriter : public ObjectWriter { bool value) override; DefaultValueObjectWriter* RenderInt32(StringPiece name, - int32_t value) override; + i32 value) override; DefaultValueObjectWriter* RenderUint32(StringPiece name, - uint32_t value) override; + ui32 value) override; DefaultValueObjectWriter* RenderInt64(StringPiece name, - int64_t value) override; + i64 value) override; DefaultValueObjectWriter* RenderUint64(StringPiece name, - uint64_t value) override; + ui64 value) override; DefaultValueObjectWriter* RenderDouble(StringPiece name, double value) override; diff --git a/contrib/libs/protobuf/src/google/protobuf/util/internal/json_escaping.cc b/contrib/libs/protobuf/src/google/protobuf/util/internal/json_escaping.cc index e4fa8cf788..f7fa2cff20 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/internal/json_escaping.cc +++ b/contrib/libs/protobuf/src/google/protobuf/util/internal/json_escaping.cc @@ -79,7 +79,7 @@ static const char kCommonEscapes[160][7] = { // Determines if the given char value is a unicode surrogate code unit (either // high-surrogate or low-surrogate). -inline bool IsSurrogate(uint32_t c) { +inline bool IsSurrogate(ui32 c) { // Optimized form of: // return c >= kMinHighSurrogate && c <= kMaxLowSurrogate; // (Reduced from 3 ALU instructions to 2 ALU instructions) @@ -88,13 +88,13 @@ inline bool IsSurrogate(uint32_t c) { // Returns true if the given unicode code point cp is a valid // unicode code point (i.e. in the range 0 <= cp <= kMaxCodePoint). -inline bool IsValidCodePoint(uint32_t cp) { +inline bool IsValidCodePoint(ui32 cp) { return cp <= JsonEscaping::kMaxCodePoint; } // Returns the low surrogate for the given unicode code point. The result is // meaningless if the given code point is not a supplementary character. -inline uint16_t ToLowSurrogate(uint32_t cp) { +inline uint16_t ToLowSurrogate(ui32 cp) { return (cp & (JsonEscaping::kMaxLowSurrogate - JsonEscaping::kMinLowSurrogate)) + JsonEscaping::kMinLowSurrogate; @@ -102,7 +102,7 @@ inline uint16_t ToLowSurrogate(uint32_t cp) { // Returns the high surrogate for the given unicode code point. The result is // meaningless if the given code point is not a supplementary character. -inline uint16_t ToHighSurrogate(uint32_t cp) { +inline uint16_t ToHighSurrogate(ui32 cp) { return (cp >> 10) + (JsonEscaping::kMinHighSurrogate - (JsonEscaping::kMinSupplementaryCodePoint >> 10)); } @@ -127,7 +127,7 @@ inline uint16_t ToHighSurrogate(uint32_t cp) { // Returns false if we encounter an invalid UTF-8 string. Returns true // otherwise, including the case when we reach the end of the input (str) // before a complete unicode code point is read. -bool ReadCodePoint(StringPiece str, int index, uint32_t* cp, +bool ReadCodePoint(StringPiece str, int index, ui32* cp, int* num_left, int* num_read) { if (*num_left == 0) { // Last read was complete. Start reading a new unicode code point. @@ -180,7 +180,7 @@ bool ReadCodePoint(StringPiece str, int index, uint32_t* cp, *num_read = 0; } while (*num_left > 0 && index < str.size()) { - uint32_t ch = static_cast<uint8_t>(str[index++]); + ui32 ch = static_cast<uint8_t>(str[index++]); --(*num_left); ++(*num_read); *cp = (*cp << 6) | (ch & 0x3f); @@ -206,7 +206,7 @@ StringPiece ToHex(uint16_t cp, char* buffer) { // Stores the 32-bit unicode code point as its hexadecimal digits in buffer // and returns a StringPiece that points to this buffer. The input buffer needs // to be at least 12 bytes long. -StringPiece ToSurrogateHex(uint32_t cp, char* buffer) { +StringPiece ToSurrogateHex(ui32 cp, char* buffer) { uint16_t low = ToLowSurrogate(cp); uint16_t high = ToHighSurrogate(cp); @@ -236,7 +236,7 @@ StringPiece ToSurrogateHex(uint32_t cp, char* buffer) { // // If the given unicode code point does not need escaping, an empty // StringPiece is returned. -StringPiece EscapeCodePoint(uint32_t cp, char* buffer) { +StringPiece EscapeCodePoint(ui32 cp, char* buffer) { if (cp < 0xa0) return kCommonEscapes[cp]; switch (cp) { // These are not required by json spec @@ -274,7 +274,7 @@ StringPiece EscapeCodePoint(uint32_t cp, char* buffer) { // Tries to escape the given code point first. If the given code point // does not need to be escaped, but force_output is true, then render // the given multi-byte code point in UTF8 in the buffer and returns it. -StringPiece EscapeCodePoint(uint32_t cp, char* buffer, +StringPiece EscapeCodePoint(ui32 cp, char* buffer, bool force_output) { StringPiece sp = EscapeCodePoint(cp, buffer); if (force_output && sp.empty()) { @@ -304,7 +304,7 @@ StringPiece EscapeCodePoint(uint32_t cp, char* buffer, void JsonEscaping::Escape(strings::ByteSource* input, strings::ByteSink* output) { char buffer[12] = "\\udead\\ubee"; - uint32_t cp = 0; // Current unicode code point. + ui32 cp = 0; // Current unicode code point. int num_left = 0; // Num of chars to read to complete the code point. while (input->Available() > 0) { StringPiece str = input->Peek(); diff --git a/contrib/libs/protobuf/src/google/protobuf/util/internal/json_escaping.h b/contrib/libs/protobuf/src/google/protobuf/util/internal/json_escaping.h index 38cb645ee6..b09ed09b30 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/internal/json_escaping.h +++ b/contrib/libs/protobuf/src/google/protobuf/util/internal/json_escaping.h @@ -65,15 +65,15 @@ class JsonEscaping { // The minimum value of a unicode supplementary code point. // See http://www.unicode.org/glossary/#supplementary_code_point - static constexpr uint32_t kMinSupplementaryCodePoint = 0x010000; + static constexpr ui32 kMinSupplementaryCodePoint = 0x010000; // The minimum value of a unicode code point. // See http://www.unicode.org/glossary/#code_point - static constexpr uint32_t kMinCodePoint = 0x000000; + static constexpr ui32 kMinCodePoint = 0x000000; // The maximum value of a unicode code point. // See http://www.unicode.org/glossary/#code_point - static constexpr uint32_t kMaxCodePoint = 0x10ffff; + static constexpr ui32 kMaxCodePoint = 0x10ffff; JsonEscaping() {} virtual ~JsonEscaping() {} diff --git a/contrib/libs/protobuf/src/google/protobuf/util/internal/json_objectwriter.cc b/contrib/libs/protobuf/src/google/protobuf/util/internal/json_objectwriter.cc index 3a9b11ceca..a14676dfc7 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/internal/json_objectwriter.cc +++ b/contrib/libs/protobuf/src/google/protobuf/util/internal/json_objectwriter.cc @@ -87,17 +87,17 @@ JsonObjectWriter* JsonObjectWriter::RenderBool(StringPiece name, } JsonObjectWriter* JsonObjectWriter::RenderInt32(StringPiece name, - int32_t value) { + i32 value) { return RenderSimple(name, StrCat(value)); } JsonObjectWriter* JsonObjectWriter::RenderUint32(StringPiece name, - uint32_t value) { + ui32 value) { return RenderSimple(name, StrCat(value)); } JsonObjectWriter* JsonObjectWriter::RenderInt64(StringPiece name, - int64_t value) { + i64 value) { WritePrefix(name); WriteChar('"'); WriteRawString(StrCat(value)); @@ -106,7 +106,7 @@ JsonObjectWriter* JsonObjectWriter::RenderInt64(StringPiece name, } JsonObjectWriter* JsonObjectWriter::RenderUint64(StringPiece name, - uint64_t value) { + ui64 value) { WritePrefix(name); WriteChar('"'); WriteRawString(StrCat(value)); diff --git a/contrib/libs/protobuf/src/google/protobuf/util/internal/json_objectwriter.h b/contrib/libs/protobuf/src/google/protobuf/util/internal/json_objectwriter.h index 9088659be7..608a38a552 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/internal/json_objectwriter.h +++ b/contrib/libs/protobuf/src/google/protobuf/util/internal/json_objectwriter.h @@ -119,12 +119,12 @@ class PROTOBUF_EXPORT JsonObjectWriter : public StructuredObjectWriter { JsonObjectWriter* StartList(StringPiece name) override; JsonObjectWriter* EndList() override; JsonObjectWriter* RenderBool(StringPiece name, bool value) override; - JsonObjectWriter* RenderInt32(StringPiece name, int32_t value) override; + JsonObjectWriter* RenderInt32(StringPiece name, i32 value) override; JsonObjectWriter* RenderUint32(StringPiece name, - uint32_t value) override; - JsonObjectWriter* RenderInt64(StringPiece name, int64_t value) override; + ui32 value) override; + JsonObjectWriter* RenderInt64(StringPiece name, i64 value) override; JsonObjectWriter* RenderUint64(StringPiece name, - uint64_t value) override; + ui64 value) override; JsonObjectWriter* RenderDouble(StringPiece name, double value) override; JsonObjectWriter* RenderFloat(StringPiece name, float value) override; JsonObjectWriter* RenderString(StringPiece name, diff --git a/contrib/libs/protobuf/src/google/protobuf/util/internal/json_stream_parser.h b/contrib/libs/protobuf/src/google/protobuf/util/internal/json_stream_parser.h index 96cdd954ce..22e6280896 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/internal/json_stream_parser.h +++ b/contrib/libs/protobuf/src/google/protobuf/util/internal/json_stream_parser.h @@ -157,8 +157,8 @@ class PROTOBUF_EXPORT JsonStreamParser { Type type; union { double double_val; - int64_t int_val; - uint64_t uint_val; + i64 int_val; + ui64 uint_val; }; }; diff --git a/contrib/libs/protobuf/src/google/protobuf/util/internal/object_writer.h b/contrib/libs/protobuf/src/google/protobuf/util/internal/object_writer.h index 917a28041f..0a5f4f5651 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/internal/object_writer.h +++ b/contrib/libs/protobuf/src/google/protobuf/util/internal/object_writer.h @@ -81,18 +81,18 @@ class PROTOBUF_EXPORT ObjectWriter { virtual ObjectWriter* RenderBool(StringPiece name, bool value) = 0; // Renders an 32-bit integer value. - virtual ObjectWriter* RenderInt32(StringPiece name, int32_t value) = 0; + virtual ObjectWriter* RenderInt32(StringPiece name, i32 value) = 0; // Renders an 32-bit unsigned integer value. virtual ObjectWriter* RenderUint32(StringPiece name, - uint32_t value) = 0; + ui32 value) = 0; // Renders a 64-bit integer value. - virtual ObjectWriter* RenderInt64(StringPiece name, int64_t value) = 0; + virtual ObjectWriter* RenderInt64(StringPiece name, i64 value) = 0; // Renders an 64-bit unsigned integer value. virtual ObjectWriter* RenderUint64(StringPiece name, - uint64_t value) = 0; + ui64 value) = 0; // Renders a double value. diff --git a/contrib/libs/protobuf/src/google/protobuf/util/internal/proto_writer.cc b/contrib/libs/protobuf/src/google/protobuf/util/internal/proto_writer.cc index 9257b1081f..5e0d40d7b9 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/internal/proto_writer.cc +++ b/contrib/libs/protobuf/src/google/protobuf/util/internal/proto_writer.cc @@ -121,7 +121,7 @@ namespace { // Writes an INT32 field, including tag to the stream. inline util::Status WriteInt32(int field_number, const DataPiece& data, CodedOutputStream* stream) { - util::StatusOr<int32_t> i32 = data.ToInt32(); + util::StatusOr<i32> i32 = data.ToInt32(); if (i32.ok()) { WireFormatLite::WriteInt32(field_number, i32.value(), stream); } @@ -131,7 +131,7 @@ inline util::Status WriteInt32(int field_number, const DataPiece& data, // writes an SFIXED32 field, including tag, to the stream. inline util::Status WriteSFixed32(int field_number, const DataPiece& data, CodedOutputStream* stream) { - util::StatusOr<int32_t> i32 = data.ToInt32(); + util::StatusOr<i32> i32 = data.ToInt32(); if (i32.ok()) { WireFormatLite::WriteSFixed32(field_number, i32.value(), stream); } @@ -141,7 +141,7 @@ inline util::Status WriteSFixed32(int field_number, const DataPiece& data, // Writes an SINT32 field, including tag, to the stream. inline util::Status WriteSInt32(int field_number, const DataPiece& data, CodedOutputStream* stream) { - util::StatusOr<int32_t> i32 = data.ToInt32(); + util::StatusOr<i32> i32 = data.ToInt32(); if (i32.ok()) { WireFormatLite::WriteSInt32(field_number, i32.value(), stream); } @@ -151,7 +151,7 @@ inline util::Status WriteSInt32(int field_number, const DataPiece& data, // Writes a FIXED32 field, including tag, to the stream. inline util::Status WriteFixed32(int field_number, const DataPiece& data, CodedOutputStream* stream) { - util::StatusOr<uint32_t> u32 = data.ToUint32(); + util::StatusOr<ui32> u32 = data.ToUint32(); if (u32.ok()) { WireFormatLite::WriteFixed32(field_number, u32.value(), stream); } @@ -161,7 +161,7 @@ inline util::Status WriteFixed32(int field_number, const DataPiece& data, // Writes a UINT32 field, including tag, to the stream. inline util::Status WriteUInt32(int field_number, const DataPiece& data, CodedOutputStream* stream) { - util::StatusOr<uint32_t> u32 = data.ToUint32(); + util::StatusOr<ui32> u32 = data.ToUint32(); if (u32.ok()) { WireFormatLite::WriteUInt32(field_number, u32.value(), stream); } @@ -171,7 +171,7 @@ inline util::Status WriteUInt32(int field_number, const DataPiece& data, // Writes an INT64 field, including tag, to the stream. inline util::Status WriteInt64(int field_number, const DataPiece& data, CodedOutputStream* stream) { - util::StatusOr<int64_t> i64 = data.ToInt64(); + util::StatusOr<i64> i64 = data.ToInt64(); if (i64.ok()) { WireFormatLite::WriteInt64(field_number, i64.value(), stream); } @@ -181,7 +181,7 @@ inline util::Status WriteInt64(int field_number, const DataPiece& data, // Writes an SFIXED64 field, including tag, to the stream. inline util::Status WriteSFixed64(int field_number, const DataPiece& data, CodedOutputStream* stream) { - util::StatusOr<int64_t> i64 = data.ToInt64(); + util::StatusOr<i64> i64 = data.ToInt64(); if (i64.ok()) { WireFormatLite::WriteSFixed64(field_number, i64.value(), stream); } @@ -191,7 +191,7 @@ inline util::Status WriteSFixed64(int field_number, const DataPiece& data, // Writes an SINT64 field, including tag, to the stream. inline util::Status WriteSInt64(int field_number, const DataPiece& data, CodedOutputStream* stream) { - util::StatusOr<int64_t> i64 = data.ToInt64(); + util::StatusOr<i64> i64 = data.ToInt64(); if (i64.ok()) { WireFormatLite::WriteSInt64(field_number, i64.value(), stream); } @@ -201,7 +201,7 @@ inline util::Status WriteSInt64(int field_number, const DataPiece& data, // Writes a FIXED64 field, including tag, to the stream. inline util::Status WriteFixed64(int field_number, const DataPiece& data, CodedOutputStream* stream) { - util::StatusOr<uint64_t> u64 = data.ToUint64(); + util::StatusOr<ui64> u64 = data.ToUint64(); if (u64.ok()) { WireFormatLite::WriteFixed64(field_number, u64.value(), stream); } @@ -211,7 +211,7 @@ inline util::Status WriteFixed64(int field_number, const DataPiece& data, // Writes a UINT64 field, including tag, to the stream. inline util::Status WriteUInt64(int field_number, const DataPiece& data, CodedOutputStream* stream) { - util::StatusOr<uint64_t> u64 = data.ToUint64(); + util::StatusOr<ui64> u64 = data.ToUint64(); if (u64.ok()) { WireFormatLite::WriteUInt64(field_number, u64.value(), stream); } @@ -430,11 +430,11 @@ TProtoStringType ProtoWriter::ProtoElement::ToString() const { return loc; } -bool ProtoWriter::ProtoElement::IsOneofIndexTaken(int32_t index) { +bool ProtoWriter::ProtoElement::IsOneofIndexTaken(i32 index) { return oneof_indices_[index]; } -void ProtoWriter::ProtoElement::TakeOneofIndex(int32_t index) { +void ProtoWriter::ProtoElement::TakeOneofIndex(i32 index) { oneof_indices_[index] = true; } diff --git a/contrib/libs/protobuf/src/google/protobuf/util/internal/proto_writer.h b/contrib/libs/protobuf/src/google/protobuf/util/internal/proto_writer.h index f10e73be35..763428af13 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/internal/proto_writer.h +++ b/contrib/libs/protobuf/src/google/protobuf/util/internal/proto_writer.h @@ -83,16 +83,16 @@ class PROTOBUF_EXPORT ProtoWriter : public StructuredObjectWriter { ProtoWriter* RenderBool(StringPiece name, bool value) override { return RenderDataPiece(name, DataPiece(value)); } - ProtoWriter* RenderInt32(StringPiece name, int32_t value) override { + ProtoWriter* RenderInt32(StringPiece name, i32 value) override { return RenderDataPiece(name, DataPiece(value)); } - ProtoWriter* RenderUint32(StringPiece name, uint32_t value) override { + ProtoWriter* RenderUint32(StringPiece name, ui32 value) override { return RenderDataPiece(name, DataPiece(value)); } - ProtoWriter* RenderInt64(StringPiece name, int64_t value) override { + ProtoWriter* RenderInt64(StringPiece name, i64 value) override { return RenderDataPiece(name, DataPiece(value)); } - ProtoWriter* RenderUint64(StringPiece name, uint64_t value) override { + ProtoWriter* RenderUint64(StringPiece name, ui64 value) override { return RenderDataPiece(name, DataPiece(value)); } ProtoWriter* RenderDouble(StringPiece name, double value) override { @@ -205,11 +205,11 @@ class PROTOBUF_EXPORT ProtoWriter : public StructuredObjectWriter { } // Returns true if the index is already taken by a preceding oneof input. - bool IsOneofIndexTaken(int32_t index); + bool IsOneofIndexTaken(i32 index); // Marks the oneof 'index' as taken. Future inputs to this oneof will // generate an error. - void TakeOneofIndex(int32_t index); + void TakeOneofIndex(i32 index); bool proto3() { return proto3_; } diff --git a/contrib/libs/protobuf/src/google/protobuf/util/internal/protostream_objectsource.cc b/contrib/libs/protobuf/src/google/protobuf/util/internal/protostream_objectsource.cc index da423a7dc7..a9824fa77b 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/internal/protostream_objectsource.cc +++ b/contrib/libs/protobuf/src/google/protobuf/util/internal/protostream_objectsource.cc @@ -81,7 +81,7 @@ const google::protobuf::EnumValue* FindEnumValueByNumber( const google::protobuf::Enum& tech_enum, int number); // Utility function to format nanos. -const TProtoStringType FormatNanos(uint32_t nanos, bool with_trailing_zeros); +const TProtoStringType FormatNanos(ui32 nanos, bool with_trailing_zeros); util::StatusOr<TProtoStringType> MapKeyDefaultValueAsString( const google::protobuf::Field& field) { @@ -146,7 +146,7 @@ util::Status ProtoStreamObjectSource::NamedWriteTo(StringPiece name, } const google::protobuf::Field* ProtoStreamObjectSource::FindAndVerifyField( - const google::protobuf::Type& type, uint32_t tag) const { + const google::protobuf::Type& type, ui32 tag) const { // Lookup the new field in the type by tag number. const google::protobuf::Field* field = FindFieldByNumber(type, tag >> 3); // Verify if the field corresponds to the wire type in tag. @@ -167,7 +167,7 @@ const google::protobuf::Field* ProtoStreamObjectSource::FindAndVerifyField( util::Status ProtoStreamObjectSource::WriteMessage( const google::protobuf::Type& type, StringPiece name, - const uint32_t end_tag, bool include_start_and_end, + const ui32 end_tag, bool include_start_and_end, ObjectWriter* ow) const { const TypeRenderer* type_renderer = FindTypeRenderer(type.name()); @@ -178,7 +178,7 @@ util::Status ProtoStreamObjectSource::WriteMessage( const google::protobuf::Field* field = nullptr; TProtoStringType field_name; // last_tag set to dummy value that is different from tag. - uint32_t tag = stream_->ReadTag(), last_tag = tag + 1; + ui32 tag = stream_->ReadTag(), last_tag = tag + 1; UnknownFieldSet unknown_fields; @@ -229,10 +229,10 @@ util::Status ProtoStreamObjectSource::WriteMessage( return util::Status(); } -util::StatusOr<uint32_t> ProtoStreamObjectSource::RenderList( +util::StatusOr<ui32> ProtoStreamObjectSource::RenderList( const google::protobuf::Field* field, StringPiece name, - uint32_t list_tag, ObjectWriter* ow) const { - uint32_t tag_to_return = 0; + ui32 list_tag, ObjectWriter* ow) const { + ui32 tag_to_return = 0; ow->StartList(name); if (IsPackable(*field) && list_tag == @@ -251,19 +251,19 @@ util::StatusOr<uint32_t> ProtoStreamObjectSource::RenderList( return tag_to_return; } -util::StatusOr<uint32_t> ProtoStreamObjectSource::RenderMap( +util::StatusOr<ui32> ProtoStreamObjectSource::RenderMap( const google::protobuf::Field* field, StringPiece name, - uint32_t list_tag, ObjectWriter* ow) const { + ui32 list_tag, ObjectWriter* ow) const { const google::protobuf::Type* field_type = typeinfo_->GetTypeByTypeUrl(field->type_url()); - uint32_t tag_to_return = 0; + ui32 tag_to_return = 0; do { // Render map entry message type. - uint32 buffer32; + ui32 buffer32; stream_->ReadVarint32(&buffer32); // message length int old_limit = stream_->PushLimit(buffer32); TProtoStringType map_key; - for (uint32_t tag = stream_->ReadTag(); tag != 0; + for (ui32 tag = stream_->ReadTag(); tag != 0; tag = stream_->ReadTag()) { const google::protobuf::Field* field = FindAndVerifyField(*field_type, tag); @@ -300,7 +300,7 @@ util::StatusOr<uint32_t> ProtoStreamObjectSource::RenderMap( util::Status ProtoStreamObjectSource::RenderPacked( const google::protobuf::Field* field, ObjectWriter* ow) const { - uint32 length; + ui32 length; stream_->ReadVarint32(&length); int old_limit = stream_->PushLimit(length); while (stream_->BytesUntilLimit() > 0) { @@ -313,9 +313,9 @@ util::Status ProtoStreamObjectSource::RenderPacked( util::Status ProtoStreamObjectSource::RenderTimestamp( const ProtoStreamObjectSource* os, const google::protobuf::Type& type, StringPiece field_name, ObjectWriter* ow) { - std::pair<int64_t, int32_t> p = os->ReadSecondsAndNanos(type); - int64_t seconds = p.first; - int32_t nanos = p.second; + std::pair<i64, i32> p = os->ReadSecondsAndNanos(type); + i64 seconds = p.first; + i32 nanos = p.second; if (seconds > kTimestampMaxSeconds || seconds < kTimestampMinSeconds) { return util::InternalError(StrCat( "Timestamp seconds exceeds limit for field: ", field_name)); @@ -335,9 +335,9 @@ util::Status ProtoStreamObjectSource::RenderTimestamp( util::Status ProtoStreamObjectSource::RenderDuration( const ProtoStreamObjectSource* os, const google::protobuf::Type& type, StringPiece field_name, ObjectWriter* ow) { - std::pair<int64_t, int32_t> p = os->ReadSecondsAndNanos(type); - int64_t seconds = p.first; - int32_t nanos = p.second; + std::pair<i64, i32> p = os->ReadSecondsAndNanos(type); + i64 seconds = p.first; + i32 nanos = p.second; if (seconds > kDurationMaxSeconds || seconds < kDurationMinSeconds) { return util::InternalError( StrCat("Duration seconds exceeds limit for field: ", field_name)); @@ -377,8 +377,8 @@ util::Status ProtoStreamObjectSource::RenderDuration( util::Status ProtoStreamObjectSource::RenderDouble( const ProtoStreamObjectSource* os, const google::protobuf::Type& type, StringPiece field_name, ObjectWriter* ow) { - uint32_t tag = os->stream_->ReadTag(); - uint64 buffer64 = 0; // default value of Double wrapper value + ui32 tag = os->stream_->ReadTag(); + ui64 buffer64 = 0; // default value of Double wrapper value if (tag != 0) { os->stream_->ReadLittleEndian64(&buffer64); os->stream_->ReadTag(); @@ -390,8 +390,8 @@ util::Status ProtoStreamObjectSource::RenderDouble( util::Status ProtoStreamObjectSource::RenderFloat( const ProtoStreamObjectSource* os, const google::protobuf::Type& type, StringPiece field_name, ObjectWriter* ow) { - uint32_t tag = os->stream_->ReadTag(); - uint32 buffer32 = 0; // default value of Float wrapper value + ui32 tag = os->stream_->ReadTag(); + ui32 buffer32 = 0; // default value of Float wrapper value if (tag != 0) { os->stream_->ReadLittleEndian32(&buffer32); os->stream_->ReadTag(); @@ -403,60 +403,60 @@ util::Status ProtoStreamObjectSource::RenderFloat( util::Status ProtoStreamObjectSource::RenderInt64( const ProtoStreamObjectSource* os, const google::protobuf::Type& type, StringPiece field_name, ObjectWriter* ow) { - uint32_t tag = os->stream_->ReadTag(); - uint64 buffer64 = 0; // default value of Int64 wrapper value + ui32 tag = os->stream_->ReadTag(); + ui64 buffer64 = 0; // default value of Int64 wrapper value if (tag != 0) { os->stream_->ReadVarint64(&buffer64); os->stream_->ReadTag(); } - ow->RenderInt64(field_name, bit_cast<int64_t>(buffer64)); + ow->RenderInt64(field_name, bit_cast<i64>(buffer64)); return util::Status(); } util::Status ProtoStreamObjectSource::RenderUInt64( const ProtoStreamObjectSource* os, const google::protobuf::Type& type, StringPiece field_name, ObjectWriter* ow) { - uint32_t tag = os->stream_->ReadTag(); - uint64 buffer64 = 0; // default value of UInt64 wrapper value + ui32 tag = os->stream_->ReadTag(); + ui64 buffer64 = 0; // default value of UInt64 wrapper value if (tag != 0) { os->stream_->ReadVarint64(&buffer64); os->stream_->ReadTag(); } - ow->RenderUint64(field_name, bit_cast<uint64_t>(buffer64)); + ow->RenderUint64(field_name, bit_cast<ui64>(buffer64)); return util::Status(); } util::Status ProtoStreamObjectSource::RenderInt32( const ProtoStreamObjectSource* os, const google::protobuf::Type& type, StringPiece field_name, ObjectWriter* ow) { - uint32_t tag = os->stream_->ReadTag(); - uint32 buffer32 = 0; // default value of Int32 wrapper value + ui32 tag = os->stream_->ReadTag(); + ui32 buffer32 = 0; // default value of Int32 wrapper value if (tag != 0) { os->stream_->ReadVarint32(&buffer32); os->stream_->ReadTag(); } - ow->RenderInt32(field_name, bit_cast<int32_t>(buffer32)); + ow->RenderInt32(field_name, bit_cast<i32>(buffer32)); return util::Status(); } util::Status ProtoStreamObjectSource::RenderUInt32( const ProtoStreamObjectSource* os, const google::protobuf::Type& type, StringPiece field_name, ObjectWriter* ow) { - uint32_t tag = os->stream_->ReadTag(); - uint32 buffer32 = 0; // default value of UInt32 wrapper value + ui32 tag = os->stream_->ReadTag(); + ui32 buffer32 = 0; // default value of UInt32 wrapper value if (tag != 0) { os->stream_->ReadVarint32(&buffer32); os->stream_->ReadTag(); } - ow->RenderUint32(field_name, bit_cast<uint32_t>(buffer32)); + ow->RenderUint32(field_name, bit_cast<ui32>(buffer32)); return util::Status(); } util::Status ProtoStreamObjectSource::RenderBool( const ProtoStreamObjectSource* os, const google::protobuf::Type& type, StringPiece field_name, ObjectWriter* ow) { - uint32_t tag = os->stream_->ReadTag(); - uint64 buffer64 = 0; // results in 'false' value as default, which is the + ui32 tag = os->stream_->ReadTag(); + ui64 buffer64 = 0; // results in 'false' value as default, which is the // default value of Bool wrapper if (tag != 0) { os->stream_->ReadVarint64(&buffer64); @@ -469,8 +469,8 @@ util::Status ProtoStreamObjectSource::RenderBool( util::Status ProtoStreamObjectSource::RenderString( const ProtoStreamObjectSource* os, const google::protobuf::Type& type, StringPiece field_name, ObjectWriter* ow) { - uint32_t tag = os->stream_->ReadTag(); - uint32 buffer32; + ui32 tag = os->stream_->ReadTag(); + ui32 buffer32; TProtoStringType str; // default value of empty for String wrapper if (tag != 0) { os->stream_->ReadVarint32(&buffer32); // string size. @@ -484,8 +484,8 @@ util::Status ProtoStreamObjectSource::RenderString( util::Status ProtoStreamObjectSource::RenderBytes( const ProtoStreamObjectSource* os, const google::protobuf::Type& type, StringPiece field_name, ObjectWriter* ow) { - uint32_t tag = os->stream_->ReadTag(); - uint32 buffer32; + ui32 tag = os->stream_->ReadTag(); + ui32 buffer32; TProtoStringType str; if (tag != 0) { os->stream_->ReadVarint32(&buffer32); @@ -500,7 +500,7 @@ util::Status ProtoStreamObjectSource::RenderStruct( const ProtoStreamObjectSource* os, const google::protobuf::Type& type, StringPiece field_name, ObjectWriter* ow) { const google::protobuf::Field* field = nullptr; - uint32_t tag = os->stream_->ReadTag(); + ui32 tag = os->stream_->ReadTag(); ow->StartObject(field_name); while (tag != 0) { field = os->FindAndVerifyField(type, tag); @@ -523,7 +523,7 @@ util::Status ProtoStreamObjectSource::RenderStructValue( const ProtoStreamObjectSource* os, const google::protobuf::Type& type, StringPiece field_name, ObjectWriter* ow) { const google::protobuf::Field* field = nullptr; - for (uint32_t tag = os->stream_->ReadTag(); tag != 0; + for (ui32 tag = os->stream_->ReadTag(); tag != 0; tag = os->stream_->ReadTag()) { field = os->FindAndVerifyField(type, tag); if (field == nullptr) { @@ -539,7 +539,7 @@ util::Status ProtoStreamObjectSource::RenderStructValue( util::Status ProtoStreamObjectSource::RenderStructListValue( const ProtoStreamObjectSource* os, const google::protobuf::Type& type, StringPiece field_name, ObjectWriter* ow) { - uint32_t tag = os->stream_->ReadTag(); + ui32 tag = os->stream_->ReadTag(); // Render empty list when we find empty ListValue message. if (tag == 0) { @@ -564,7 +564,7 @@ util::Status ProtoStreamObjectSource::RenderAny( const ProtoStreamObjectSource* os, const google::protobuf::Type& type, StringPiece field_name, ObjectWriter* ow) { // An Any is of the form { string type_url = 1; bytes value = 2; } - uint32_t tag; + ui32 tag; TProtoStringType type_url; TProtoStringType value; @@ -579,12 +579,12 @@ util::Status ProtoStreamObjectSource::RenderAny( // //google/protobuf/any.proto if (field->number() == 1) { // read type_url - uint32 type_url_size; + ui32 type_url_size; os->stream_->ReadVarint32(&type_url_size); os->stream_->ReadString(&type_url, type_url_size); } else if (field->number() == 2) { // read value - uint32 value_size; + ui32 value_size; os->stream_->ReadVarint32(&value_size); os->stream_->ReadString(&value, value_size); } @@ -638,9 +638,9 @@ util::Status ProtoStreamObjectSource::RenderFieldMask( const ProtoStreamObjectSource* os, const google::protobuf::Type& type, StringPiece field_name, ObjectWriter* ow) { TProtoStringType combined; - uint32 buffer32; - uint32_t paths_field_tag = 0; - for (uint32_t tag = os->stream_->ReadTag(); tag != 0; + ui32 buffer32; + ui32 paths_field_tag = 0; + for (ui32 tag = os->stream_->ReadTag(); tag != 0; tag = os->stream_->ReadTag()) { if (paths_field_tag == 0) { const google::protobuf::Field* field = os->FindAndVerifyField(type, tag); @@ -727,7 +727,7 @@ util::Status ProtoStreamObjectSource::RenderField( // and ends up using a lot of stack space. Keep the stack usage of this // message small in order to preserve stack space and not crash. if (field->kind() == google::protobuf::Field::TYPE_MESSAGE) { - uint32 buffer32; + ui32 buffer32; stream_->ReadVarint32(&buffer32); // message length int old_limit = stream_->PushLimit(buffer32); // Get the nested message type for this field. @@ -766,8 +766,8 @@ util::Status ProtoStreamObjectSource::RenderNonMessageField( const google::protobuf::Field* field, StringPiece field_name, ObjectWriter* ow) const { // Temporary buffers of different types. - uint32 buffer32 = 0; - uint64 buffer64 = 0; + ui32 buffer32 = 0; + ui64 buffer64 = 0; TProtoStringType strbuffer; switch (field->kind()) { case google::protobuf::Field::TYPE_BOOL: { @@ -777,7 +777,7 @@ util::Status ProtoStreamObjectSource::RenderNonMessageField( } case google::protobuf::Field::TYPE_INT32: { stream_->ReadVarint32(&buffer32); - ow->RenderInt32(field_name, bit_cast<int32_t>(buffer32)); + ow->RenderInt32(field_name, bit_cast<i32>(buffer32)); break; } case google::protobuf::Field::TYPE_INT64: { @@ -787,7 +787,7 @@ util::Status ProtoStreamObjectSource::RenderNonMessageField( } case google::protobuf::Field::TYPE_UINT32: { stream_->ReadVarint32(&buffer32); - ow->RenderUint32(field_name, bit_cast<uint32_t>(buffer32)); + ow->RenderUint32(field_name, bit_cast<ui32>(buffer32)); break; } case google::protobuf::Field::TYPE_UINT64: { @@ -807,7 +807,7 @@ util::Status ProtoStreamObjectSource::RenderNonMessageField( } case google::protobuf::Field::TYPE_SFIXED32: { stream_->ReadLittleEndian32(&buffer32); - ow->RenderInt32(field_name, bit_cast<int32_t>(buffer32)); + ow->RenderInt32(field_name, bit_cast<i32>(buffer32)); break; } case google::protobuf::Field::TYPE_SFIXED64: { @@ -817,7 +817,7 @@ util::Status ProtoStreamObjectSource::RenderNonMessageField( } case google::protobuf::Field::TYPE_FIXED32: { stream_->ReadLittleEndian32(&buffer32); - ow->RenderUint32(field_name, bit_cast<uint32_t>(buffer32)); + ow->RenderUint32(field_name, bit_cast<ui32>(buffer32)); break; } case google::protobuf::Field::TYPE_FIXED64: { @@ -895,85 +895,85 @@ const TProtoStringType ProtoStreamObjectSource::ReadFieldValueAsString( TProtoStringType result; switch (field.kind()) { case google::protobuf::Field::TYPE_BOOL: { - uint64 buffer64; + ui64 buffer64; stream_->ReadVarint64(&buffer64); result = buffer64 != 0 ? "true" : "false"; break; } case google::protobuf::Field::TYPE_INT32: { - uint32 buffer32; + ui32 buffer32; stream_->ReadVarint32(&buffer32); - result = StrCat(bit_cast<int32_t>(buffer32)); + result = StrCat(bit_cast<i32>(buffer32)); break; } case google::protobuf::Field::TYPE_INT64: { - uint64 buffer64; + ui64 buffer64; stream_->ReadVarint64(&buffer64); - result = StrCat(bit_cast<int64_t>(buffer64)); + result = StrCat(bit_cast<i64>(buffer64)); break; } case google::protobuf::Field::TYPE_UINT32: { - uint32 buffer32; + ui32 buffer32; stream_->ReadVarint32(&buffer32); - result = StrCat(bit_cast<uint32_t>(buffer32)); + result = StrCat(bit_cast<ui32>(buffer32)); break; } case google::protobuf::Field::TYPE_UINT64: { - uint64 buffer64; + ui64 buffer64; stream_->ReadVarint64(&buffer64); - result = StrCat(bit_cast<uint64_t>(buffer64)); + result = StrCat(bit_cast<ui64>(buffer64)); break; } case google::protobuf::Field::TYPE_SINT32: { - uint32 buffer32; + ui32 buffer32; stream_->ReadVarint32(&buffer32); result = StrCat(WireFormatLite::ZigZagDecode32(buffer32)); break; } case google::protobuf::Field::TYPE_SINT64: { - uint64 buffer64; + ui64 buffer64; stream_->ReadVarint64(&buffer64); result = StrCat(WireFormatLite::ZigZagDecode64(buffer64)); break; } case google::protobuf::Field::TYPE_SFIXED32: { - uint32 buffer32; + ui32 buffer32; stream_->ReadLittleEndian32(&buffer32); - result = StrCat(bit_cast<int32_t>(buffer32)); + result = StrCat(bit_cast<i32>(buffer32)); break; } case google::protobuf::Field::TYPE_SFIXED64: { - uint64 buffer64; + ui64 buffer64; stream_->ReadLittleEndian64(&buffer64); - result = StrCat(bit_cast<int64_t>(buffer64)); + result = StrCat(bit_cast<i64>(buffer64)); break; } case google::protobuf::Field::TYPE_FIXED32: { - uint32 buffer32; + ui32 buffer32; stream_->ReadLittleEndian32(&buffer32); - result = StrCat(bit_cast<uint32_t>(buffer32)); + result = StrCat(bit_cast<ui32>(buffer32)); break; } case google::protobuf::Field::TYPE_FIXED64: { - uint64 buffer64; + ui64 buffer64; stream_->ReadLittleEndian64(&buffer64); - result = StrCat(bit_cast<uint64_t>(buffer64)); + result = StrCat(bit_cast<ui64>(buffer64)); break; } case google::protobuf::Field::TYPE_FLOAT: { - uint32 buffer32; + ui32 buffer32; stream_->ReadLittleEndian32(&buffer32); result = SimpleFtoa(bit_cast<float>(buffer32)); break; } case google::protobuf::Field::TYPE_DOUBLE: { - uint64 buffer64; + ui64 buffer64; stream_->ReadLittleEndian64(&buffer64); result = SimpleDtoa(bit_cast<double>(buffer64)); break; } case google::protobuf::Field::TYPE_ENUM: { - uint32 buffer32; + ui32 buffer32; stream_->ReadVarint32(&buffer32); // Get the nested enum type for this field. // TODO(skarvaje): Avoid string manipulation. Find ways to speed this @@ -991,13 +991,13 @@ const TProtoStringType ProtoStreamObjectSource::ReadFieldValueAsString( break; } case google::protobuf::Field::TYPE_STRING: { - uint32 buffer32; + ui32 buffer32; stream_->ReadVarint32(&buffer32); // string size. stream_->ReadString(&result, buffer32); break; } case google::protobuf::Field::TYPE_BYTES: { - uint32 buffer32; + ui32 buffer32; stream_->ReadVarint32(&buffer32); // bytes size. stream_->ReadString(&result, buffer32); break; @@ -1018,13 +1018,13 @@ bool ProtoStreamObjectSource::IsMap( util::converter::IsMap(field, *field_type); } -std::pair<int64_t, int32_t> ProtoStreamObjectSource::ReadSecondsAndNanos( +std::pair<i64, i32> ProtoStreamObjectSource::ReadSecondsAndNanos( const google::protobuf::Type& type) const { - uint64 seconds = 0; - uint32 nanos = 0; - uint32_t tag = 0; - int64_t signed_seconds = 0; - int32_t signed_nanos = 0; + ui64 seconds = 0; + ui32 nanos = 0; + ui32 tag = 0; + i64 signed_seconds = 0; + i32 signed_nanos = 0; for (tag = stream_->ReadTag(); tag != 0; tag = stream_->ReadTag()) { const google::protobuf::Field* field = FindAndVerifyField(type, tag); @@ -1037,14 +1037,14 @@ std::pair<int64_t, int32_t> ProtoStreamObjectSource::ReadSecondsAndNanos( if (field->number() == 1) { // read seconds stream_->ReadVarint64(&seconds); - signed_seconds = bit_cast<int64_t>(seconds); + signed_seconds = bit_cast<i64>(seconds); } else if (field->number() == 2) { // read nanos stream_->ReadVarint32(&nanos); - signed_nanos = bit_cast<int32_t>(nanos); + signed_nanos = bit_cast<i32>(nanos); } } - return std::pair<int64_t, int32_t>(signed_seconds, signed_nanos); + return std::pair<i64, i32>(signed_seconds, signed_nanos); } util::Status ProtoStreamObjectSource::IncrementRecursionDepth( @@ -1091,7 +1091,7 @@ const google::protobuf::EnumValue* FindEnumValueByNumber( // TODO(skarvaje): Look into optimizing this by not doing computation on // double. -const TProtoStringType FormatNanos(uint32_t nanos, bool with_trailing_zeros) { +const TProtoStringType FormatNanos(ui32 nanos, bool with_trailing_zeros) { if (nanos == 0) { return with_trailing_zeros ? ".000" : ""; } diff --git a/contrib/libs/protobuf/src/google/protobuf/util/internal/protostream_objectsource.h b/contrib/libs/protobuf/src/google/protobuf/util/internal/protostream_objectsource.h index 32aa500b09..393d0111f3 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/internal/protostream_objectsource.h +++ b/contrib/libs/protobuf/src/google/protobuf/util/internal/protostream_objectsource.h @@ -143,20 +143,20 @@ class PROTOBUF_EXPORT ProtoStreamObjectSource : public ObjectSource { // already inside of an object, and skip calling StartObject and EndObject. virtual util::Status WriteMessage(const google::protobuf::Type& type, StringPiece name, - const uint32_t end_tag, + const ui32 end_tag, bool include_start_and_end, ObjectWriter* ow) const; // Renders a repeating field (packed or unpacked). Returns the next tag after // reading all sequential repeating elements. The caller should use this tag // before reading more tags from the stream. - virtual util::StatusOr<uint32_t> RenderList( + virtual util::StatusOr<ui32> RenderList( const google::protobuf::Field* field, StringPiece name, - uint32_t list_tag, ObjectWriter* ow) const; + ui32 list_tag, ObjectWriter* ow) const; // Looks up a field and verify its consistency with wire type in tag. const google::protobuf::Field* FindAndVerifyField( - const google::protobuf::Type& type, uint32_t tag) const; + const google::protobuf::Type& type, ui32 tag) const; // Renders a field value to the ObjectWriter. virtual util::Status RenderField(const google::protobuf::Field* field, @@ -189,8 +189,8 @@ class PROTOBUF_EXPORT ProtoStreamObjectSource : public ObjectSource { // Renders a NWP map. // Returns the next tag after reading all map entries. The caller should use // this tag before reading more tags from the stream. - util::StatusOr<uint32_t> RenderMap(const google::protobuf::Field* field, - StringPiece name, uint32_t list_tag, + util::StatusOr<ui32> RenderMap(const google::protobuf::Field* field, + StringPiece name, ui32 list_tag, ObjectWriter* ow) const; // Renders a packed repeating field. A packed field is stored as: @@ -283,7 +283,7 @@ class PROTOBUF_EXPORT ProtoStreamObjectSource : public ObjectSource { // Utility to read int64 and int32 values from a message type in stream_. // Used for reading google.protobuf.Timestamp and Duration messages. - std::pair<int64_t, int32_t> ReadSecondsAndNanos( + std::pair<i64, i32> ReadSecondsAndNanos( const google::protobuf::Type& type) const; // Helper function to check recursion depth and increment it. It will return diff --git a/contrib/libs/protobuf/src/google/protobuf/util/internal/protostream_objectwriter.cc b/contrib/libs/protobuf/src/google/protobuf/util/internal/protostream_objectwriter.cc index 5ac24d0ac0..17486baf0d 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/internal/protostream_objectwriter.cc +++ b/contrib/libs/protobuf/src/google/protobuf/util/internal/protostream_objectwriter.cc @@ -129,7 +129,7 @@ void SplitSecondsAndNanos(StringPiece input, StringPiece* seconds, Status GetNanosFromStringPiece(StringPiece s_nanos, const char* parse_failure_message, const char* exceeded_limit_message, - int32_t* nanos) { + i32* nanos) { *nanos = 0; // Count the number of leading 0s and consume them. @@ -137,7 +137,7 @@ Status GetNanosFromStringPiece(StringPiece s_nanos, while (s_nanos.Consume("0")) { num_leading_zeros++; } - int32 i_nanos = 0; + i32 i_nanos = 0; // 's_nanos' contains fractional seconds -- i.e. 'nanos' is equal to // "0." + s_nanos.ToString() seconds. An int32 is used for the // conversion to 'nanos', rather than a double, so that there is no @@ -156,11 +156,11 @@ Status GetNanosFromStringPiece(StringPiece s_nanos, if (i_nanos > 0) { // 'scale' is the number of digits to the right of the decimal // point in "0." + s_nanos.ToString() - int32_t scale = num_leading_zeros + s_nanos.size(); + i32 scale = num_leading_zeros + s_nanos.size(); // 'conversion' converts i_nanos into nanoseconds. // conversion = kNanosPerSecond / static_cast<int32>(std::pow(10, scale)) // For efficiency, we precompute the conversion factor. - int32_t conversion = 0; + i32 conversion = 0; switch (scale) { case 1: conversion = 100000000; @@ -920,7 +920,7 @@ Status ProtoStreamObjectWriter::RenderStructValue(ProtoStreamObjectWriter* ow, switch (data.type()) { case DataPiece::TYPE_INT32: { if (ow->options_.struct_integers_as_strings) { - util::StatusOr<int32_t> int_value = data.ToInt32(); + util::StatusOr<i32> int_value = data.ToInt32(); if (int_value.ok()) { ow->ProtoWriter::RenderDataPiece( "string_value", @@ -933,7 +933,7 @@ Status ProtoStreamObjectWriter::RenderStructValue(ProtoStreamObjectWriter* ow, } case DataPiece::TYPE_UINT32: { if (ow->options_.struct_integers_as_strings) { - util::StatusOr<uint32_t> int_value = data.ToUint32(); + util::StatusOr<ui32> int_value = data.ToUint32(); if (int_value.ok()) { ow->ProtoWriter::RenderDataPiece( "string_value", @@ -948,7 +948,7 @@ Status ProtoStreamObjectWriter::RenderStructValue(ProtoStreamObjectWriter* ow, // If the option to treat integers as strings is set, then render them as // strings. Otherwise, fallback to rendering them as double. if (ow->options_.struct_integers_as_strings) { - util::StatusOr<int64_t> int_value = data.ToInt64(); + util::StatusOr<i64> int_value = data.ToInt64(); if (int_value.ok()) { ow->ProtoWriter::RenderDataPiece( "string_value", DataPiece(StrCat(int_value.value()), true)); @@ -962,7 +962,7 @@ Status ProtoStreamObjectWriter::RenderStructValue(ProtoStreamObjectWriter* ow, // If the option to treat integers as strings is set, then render them as // strings. Otherwise, fallback to rendering them as double. if (ow->options_.struct_integers_as_strings) { - util::StatusOr<uint64_t> int_value = data.ToUint64(); + util::StatusOr<ui64> int_value = data.ToUint64(); if (int_value.ok()) { ow->ProtoWriter::RenderDataPiece( "string_value", DataPiece(StrCat(int_value.value()), true)); @@ -1091,13 +1091,13 @@ Status ProtoStreamObjectWriter::RenderDuration(ProtoStreamObjectWriter* ow, StringPiece s_secs, s_nanos; SplitSecondsAndNanos(value, &s_secs, &s_nanos); - uint64_t unsigned_seconds; + ui64 unsigned_seconds; if (!safe_strtou64(s_secs, &unsigned_seconds)) { return util::InvalidArgumentError( "Invalid duration format, failed to parse seconds"); } - int32_t nanos = 0; + i32 nanos = 0; Status nanos_status = GetNanosFromStringPiece( s_nanos, "Invalid duration format, failed to parse nano seconds", "Duration value exceeds limits", &nanos); @@ -1106,7 +1106,7 @@ Status ProtoStreamObjectWriter::RenderDuration(ProtoStreamObjectWriter* ow, } nanos = sign * nanos; - int64_t seconds = sign * unsigned_seconds; + i64 seconds = sign * unsigned_seconds; if (seconds > kDurationMaxSeconds || seconds < kDurationMinSeconds || nanos <= -kNanosPerSecond || nanos >= kNanosPerSecond) { return util::InvalidArgumentError("Duration value exceeds limits"); diff --git a/contrib/libs/protobuf/src/google/protobuf/util/internal/utility.cc b/contrib/libs/protobuf/src/google/protobuf/util/internal/utility.cc index acceb63347..f7470986b8 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/internal/utility.cc +++ b/contrib/libs/protobuf/src/google/protobuf/util/internal/utility.cc @@ -66,9 +66,9 @@ bool GetBoolOptionOrDefault( return GetBoolFromAny(opt->value()); } -int64_t GetInt64OptionOrDefault( +i64 GetInt64OptionOrDefault( const RepeatedPtrField<google::protobuf::Option>& options, - StringPiece option_name, int64_t default_value) { + StringPiece option_name, i64 default_value) { const google::protobuf::Option* opt = FindOptionOrNull(options, option_name); if (opt == nullptr) { return default_value; @@ -109,7 +109,7 @@ bool GetBoolFromAny(const google::protobuf::Any& any) { return b.value(); } -int64_t GetInt64FromAny(const google::protobuf::Any& any) { +i64 GetInt64FromAny(const google::protobuf::Any& any) { google::protobuf::Int64Value i; ParseFromAny(any.value(), &i); return i.value(); @@ -182,7 +182,7 @@ const google::protobuf::Field* FindJsonFieldInTypeOrNull( } const google::protobuf::Field* FindFieldInTypeByNumberOrNull( - const google::protobuf::Type* type, int32_t number) { + const google::protobuf::Type* type, i32 number) { if (type != nullptr) { for (int i = 0; i < type->fields_size(); ++i) { const google::protobuf::Field& field = type->fields(i); @@ -208,7 +208,7 @@ const google::protobuf::EnumValue* FindEnumValueByNameOrNull( } const google::protobuf::EnumValue* FindEnumValueByNumberOrNull( - const google::protobuf::Enum* enum_type, int32_t value) { + const google::protobuf::Enum* enum_type, i32 value) { if (enum_type != nullptr) { for (int i = 0; i < enum_type->enumvalue_size(); ++i) { const google::protobuf::EnumValue& enum_value = enum_type->enumvalue(i); diff --git a/contrib/libs/protobuf/src/google/protobuf/util/internal/utility.h b/contrib/libs/protobuf/src/google/protobuf/util/internal/utility.h index f1a1cf44d4..b1ef54c2f6 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/internal/utility.h +++ b/contrib/libs/protobuf/src/google/protobuf/util/internal/utility.h @@ -54,7 +54,7 @@ namespace util { namespace converter { // Size of "type.googleapis.com" -static const int64_t kTypeUrlSize = 19; +static const i64 kTypeUrlSize = 19; // Finds the tech option identified by option_name. Parses the boolean value and // returns it. @@ -65,9 +65,9 @@ PROTOBUF_EXPORT bool GetBoolOptionOrDefault( // Returns int64 option value. If the option isn't found, returns the // default_value. -PROTOBUF_EXPORT int64_t GetInt64OptionOrDefault( +PROTOBUF_EXPORT i64 GetInt64OptionOrDefault( const RepeatedPtrField<google::protobuf::Option>& options, - StringPiece option_name, int64_t default_value); + StringPiece option_name, i64 default_value); // Returns double option value. If the option isn't found, returns the // default_value. @@ -88,7 +88,7 @@ PROTOBUF_EXPORT TProtoStringType GetStringOptionOrDefault( PROTOBUF_EXPORT bool GetBoolFromAny(const google::protobuf::Any& any); // Returns int64 value contained in Any type. -PROTOBUF_EXPORT int64_t GetInt64FromAny(const google::protobuf::Any& any); +PROTOBUF_EXPORT i64 GetInt64FromAny(const google::protobuf::Any& any); // Returns double value contained in Any type. PROTOBUF_EXPORT double GetDoubleFromAny(const google::protobuf::Any& any); @@ -128,7 +128,7 @@ const google::protobuf::Field* FindJsonFieldInTypeOrNull( // Similar to FindFieldInTypeOrNull, but this looks up fields by number. const google::protobuf::Field* FindFieldInTypeByNumberOrNull( - const google::protobuf::Type* type, int32_t number); + const google::protobuf::Type* type, i32 number); // Finds and returns the EnumValue identified by enum_name in the passed tech // Enum object. Returns nullptr if none found. @@ -138,7 +138,7 @@ const google::protobuf::EnumValue* FindEnumValueByNameOrNull( // Finds and returns the EnumValue identified by value in the passed tech // Enum object. Returns nullptr if none found. const google::protobuf::EnumValue* FindEnumValueByNumberOrNull( - const google::protobuf::Enum* enum_type, int32_t value); + const google::protobuf::Enum* enum_type, i32 value); // Finds and returns the EnumValue identified by enum_name without underscore in // the passed tech Enum object. Returns nullptr if none found. diff --git a/contrib/libs/protobuf/src/google/protobuf/util/message_differencer.cc b/contrib/libs/protobuf/src/google/protobuf/util/message_differencer.cc index 2599359ac1..32385c6173 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/message_differencer.cc +++ b/contrib/libs/protobuf/src/google/protobuf/util/message_differencer.cc @@ -73,7 +73,7 @@ class NumDiffsReporter : public google::protobuf::util::MessageDifferencer::Repo NumDiffsReporter() : num_diffs_(0) {} // Returns the total number of diffs. - int32_t GetNumDiffs() const { return num_diffs_; } + i32 GetNumDiffs() const { return num_diffs_; } void Reset() { num_diffs_ = 0; } // Report that a field has been added into Message2. @@ -101,7 +101,7 @@ class NumDiffsReporter : public google::protobuf::util::MessageDifferencer::Repo } private: - int32_t num_diffs_; + i32 num_diffs_; }; // When comparing a repeated field as map, MultipleFieldMapKeyComparator can @@ -147,7 +147,7 @@ class MessageDifferencer::MultipleFieldsMapKeyComparator int path_index) const { const FieldDescriptor* field = key_field_path[path_index]; std::vector<SpecificField> current_parent_fields(parent_fields); - if (path_index == static_cast<int64_t>(key_field_path.size() - 1)) { + if (path_index == static_cast<i64>(key_field_path.size() - 1)) { if (field->is_map()) { return message_differencer_->CompareMapField(message1, message2, field, ¤t_parent_fields); @@ -1780,9 +1780,9 @@ bool MessageDifferencer::MatchRepeatedFieldIndices( Reporter* reporter = reporter_; reporter_ = NULL; NumDiffsReporter num_diffs_reporter; - std::vector<int32_t> num_diffs_list1; + std::vector<i32> num_diffs_list1; if (is_treated_as_smart_set) { - num_diffs_list1.assign(count1, std::numeric_limits<int32_t>::max()); + num_diffs_list1.assign(count1, std::numeric_limits<i32>::max()); } bool success = true; @@ -1850,7 +1850,7 @@ bool MessageDifferencer::MatchRepeatedFieldIndices( } else if (repeated_field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { // Replace with the one with fewer diffs. - const int32_t num_diffs = num_diffs_reporter.GetNumDiffs(); + const i32 num_diffs = num_diffs_reporter.GetNumDiffs(); if (num_diffs < num_diffs_list1[i]) { // If j has been already matched to some element, ensure the // current num_diffs is smaller. diff --git a/contrib/libs/protobuf/src/google/protobuf/util/time_util.cc b/contrib/libs/protobuf/src/google/protobuf/util/time_util.cc index 1b2056a785..5a09bee943 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/time_util.cc +++ b/contrib/libs/protobuf/src/google/protobuf/util/time_util.cc @@ -59,10 +59,10 @@ static const int kSecondsPerMinute = 60; // Note that we ignore leap seconds. static const int kSecondsPerHour = 3600; template <typename T> -T CreateNormalized(int64_t seconds, int64_t nanos); +T CreateNormalized(i64 seconds, i64 nanos); template <> -Timestamp CreateNormalized(int64_t seconds, int64_t nanos) { +Timestamp CreateNormalized(i64 seconds, i64 nanos) { // Make sure nanos is in the range. if (nanos <= -kNanosPerSecond || nanos >= kNanosPerSecond) { seconds += nanos / kNanosPerSecond; @@ -77,12 +77,12 @@ Timestamp CreateNormalized(int64_t seconds, int64_t nanos) { seconds <= TimeUtil::kTimestampMaxSeconds); Timestamp result; result.set_seconds(seconds); - result.set_nanos(static_cast<int32_t>(nanos)); + result.set_nanos(static_cast<i32>(nanos)); return result; } template <> -Duration CreateNormalized(int64_t seconds, int64_t nanos) { +Duration CreateNormalized(i64 seconds, i64 nanos) { // Make sure nanos is in the range. if (nanos <= -kNanosPerSecond || nanos >= kNanosPerSecond) { seconds += nanos / kNanosPerSecond; @@ -100,13 +100,13 @@ Duration CreateNormalized(int64_t seconds, int64_t nanos) { seconds <= TimeUtil::kDurationMaxSeconds); Duration result; result.set_seconds(seconds); - result.set_nanos(static_cast<int32_t>(nanos)); + result.set_nanos(static_cast<i32>(nanos)); return result; } // Format nanoseconds with either 3, 6, or 9 digits depending on the required // precision to represent the exact value. -TProtoStringType FormatNanos(int32_t nanos) { +TProtoStringType FormatNanos(i32 nanos) { if (nanos % kNanosPerMillisecond == 0) { return StringPrintf("%03d", nanos / kNanosPerMillisecond); } else if (nanos % kNanosPerMicrosecond == 0) { @@ -129,9 +129,9 @@ void CurrentTime(int64* seconds, int32* nanos) { } // Truncates the remainder part after division. -int64_t RoundTowardZero(int64_t value, int64_t divider) { - int64_t result = value / divider; - int64_t remainder = value % divider; +i64 RoundTowardZero(i64 value, i64 divider) { + i64 result = value / divider; + i64 remainder = value % divider; // Before C++11, the sign of the remainder is implementation dependent if // any of the operands is negative. Here we try to enforce C++11's "rounded // toward zero" semantics. For example, for (-5) / 2 an implementation may @@ -148,10 +148,10 @@ int64_t RoundTowardZero(int64_t value, int64_t divider) { // Actually define these static const integers. Required by C++ standard (but // some compilers don't like it). #ifndef _MSC_VER -const int64_t TimeUtil::kTimestampMinSeconds; -const int64_t TimeUtil::kTimestampMaxSeconds; -const int64_t TimeUtil::kDurationMaxSeconds; -const int64_t TimeUtil::kDurationMinSeconds; +const i64 TimeUtil::kTimestampMinSeconds; +const i64 TimeUtil::kTimestampMaxSeconds; +const i64 TimeUtil::kDurationMaxSeconds; +const i64 TimeUtil::kDurationMinSeconds; #endif // !_MSC_VER TProtoStringType TimeUtil::ToString(const Timestamp& timestamp) { @@ -159,8 +159,8 @@ TProtoStringType TimeUtil::ToString(const Timestamp& timestamp) { } bool TimeUtil::FromString(const TProtoStringType& value, Timestamp* timestamp) { - int64 seconds; - int32 nanos; + i64 seconds; + i32 nanos; if (!ParseTime(value, &seconds, &nanos)) { return false; } @@ -169,8 +169,8 @@ bool TimeUtil::FromString(const TProtoStringType& value, Timestamp* timestamp) { } Timestamp TimeUtil::GetCurrentTime() { - int64 seconds; - int32 nanos; + i64 seconds; + i32 nanos; CurrentTime(&seconds, &nanos); return CreateNormalized<Timestamp>(seconds, nanos); } @@ -179,8 +179,8 @@ Timestamp TimeUtil::GetEpoch() { return Timestamp(); } TProtoStringType TimeUtil::ToString(const Duration& duration) { TProtoStringType result; - int64_t seconds = duration.seconds(); - int32_t nanos = duration.nanos(); + i64 seconds = duration.seconds(); + i32 nanos = duration.nanos(); if (seconds < 0 || nanos < 0) { result += "-"; seconds = -seconds; @@ -194,8 +194,8 @@ TProtoStringType TimeUtil::ToString(const Duration& duration) { return result; } -static int64_t Pow(int64_t x, int y) { - int64_t result = 1; +static i64 Pow(i64 x, int y) { + i64 result = 1; for (int i = 0; i < y; ++i) { result *= x; } @@ -220,11 +220,11 @@ bool TimeUtil::FromString(const TProtoStringType& value, Duration* duration) { nanos_part = value.substr(pos + 1, value.length() - pos - 2); } char* end; - int64_t seconds = strto64(seconds_part.c_str(), &end, 10); + i64 seconds = strto64(seconds_part.c_str(), &end, 10); if (end != seconds_part.c_str() + seconds_part.length()) { return false; } - int64_t nanos = strto64(nanos_part.c_str(), &end, 10); + i64 nanos = strto64(nanos_part.c_str(), &end, 10); if (end != nanos_part.c_str() + nanos_part.length()) { return false; } @@ -235,106 +235,106 @@ bool TimeUtil::FromString(const TProtoStringType& value, Duration* duration) { nanos = -nanos; } duration->set_seconds(seconds); - duration->set_nanos(static_cast<int32_t>(nanos)); + duration->set_nanos(static_cast<i32>(nanos)); return true; } -Duration TimeUtil::NanosecondsToDuration(int64_t nanos) { +Duration TimeUtil::NanosecondsToDuration(i64 nanos) { return CreateNormalized<Duration>(nanos / kNanosPerSecond, nanos % kNanosPerSecond); } -Duration TimeUtil::MicrosecondsToDuration(int64_t micros) { +Duration TimeUtil::MicrosecondsToDuration(i64 micros) { return CreateNormalized<Duration>( micros / kMicrosPerSecond, (micros % kMicrosPerSecond) * kNanosPerMicrosecond); } -Duration TimeUtil::MillisecondsToDuration(int64_t millis) { +Duration TimeUtil::MillisecondsToDuration(i64 millis) { return CreateNormalized<Duration>( millis / kMillisPerSecond, (millis % kMillisPerSecond) * kNanosPerMillisecond); } -Duration TimeUtil::SecondsToDuration(int64_t seconds) { +Duration TimeUtil::SecondsToDuration(i64 seconds) { return CreateNormalized<Duration>(seconds, 0); } -Duration TimeUtil::MinutesToDuration(int64_t minutes) { +Duration TimeUtil::MinutesToDuration(i64 minutes) { return CreateNormalized<Duration>(minutes * kSecondsPerMinute, 0); } -Duration TimeUtil::HoursToDuration(int64_t hours) { +Duration TimeUtil::HoursToDuration(i64 hours) { return CreateNormalized<Duration>(hours * kSecondsPerHour, 0); } -int64_t TimeUtil::DurationToNanoseconds(const Duration& duration) { +i64 TimeUtil::DurationToNanoseconds(const Duration& duration) { return duration.seconds() * kNanosPerSecond + duration.nanos(); } -int64_t TimeUtil::DurationToMicroseconds(const Duration& duration) { +i64 TimeUtil::DurationToMicroseconds(const Duration& duration) { return duration.seconds() * kMicrosPerSecond + RoundTowardZero(duration.nanos(), kNanosPerMicrosecond); } -int64_t TimeUtil::DurationToMilliseconds(const Duration& duration) { +i64 TimeUtil::DurationToMilliseconds(const Duration& duration) { return duration.seconds() * kMillisPerSecond + RoundTowardZero(duration.nanos(), kNanosPerMillisecond); } -int64_t TimeUtil::DurationToSeconds(const Duration& duration) { +i64 TimeUtil::DurationToSeconds(const Duration& duration) { return duration.seconds(); } -int64_t TimeUtil::DurationToMinutes(const Duration& duration) { +i64 TimeUtil::DurationToMinutes(const Duration& duration) { return RoundTowardZero(duration.seconds(), kSecondsPerMinute); } -int64_t TimeUtil::DurationToHours(const Duration& duration) { +i64 TimeUtil::DurationToHours(const Duration& duration) { return RoundTowardZero(duration.seconds(), kSecondsPerHour); } -Timestamp TimeUtil::NanosecondsToTimestamp(int64_t nanos) { +Timestamp TimeUtil::NanosecondsToTimestamp(i64 nanos) { return CreateNormalized<Timestamp>(nanos / kNanosPerSecond, nanos % kNanosPerSecond); } -Timestamp TimeUtil::MicrosecondsToTimestamp(int64_t micros) { +Timestamp TimeUtil::MicrosecondsToTimestamp(i64 micros) { return CreateNormalized<Timestamp>( micros / kMicrosPerSecond, micros % kMicrosPerSecond * kNanosPerMicrosecond); } -Timestamp TimeUtil::MillisecondsToTimestamp(int64_t millis) { +Timestamp TimeUtil::MillisecondsToTimestamp(i64 millis) { return CreateNormalized<Timestamp>( millis / kMillisPerSecond, millis % kMillisPerSecond * kNanosPerMillisecond); } -Timestamp TimeUtil::SecondsToTimestamp(int64_t seconds) { +Timestamp TimeUtil::SecondsToTimestamp(i64 seconds) { return CreateNormalized<Timestamp>(seconds, 0); } -int64_t TimeUtil::TimestampToNanoseconds(const Timestamp& timestamp) { +i64 TimeUtil::TimestampToNanoseconds(const Timestamp& timestamp) { return timestamp.seconds() * kNanosPerSecond + timestamp.nanos(); } -int64_t TimeUtil::TimestampToMicroseconds(const Timestamp& timestamp) { +i64 TimeUtil::TimestampToMicroseconds(const Timestamp& timestamp) { return timestamp.seconds() * kMicrosPerSecond + RoundTowardZero(timestamp.nanos(), kNanosPerMicrosecond); } -int64_t TimeUtil::TimestampToMilliseconds(const Timestamp& timestamp) { +i64 TimeUtil::TimestampToMilliseconds(const Timestamp& timestamp) { return timestamp.seconds() * kMillisPerSecond + RoundTowardZero(timestamp.nanos(), kNanosPerMillisecond); } -int64_t TimeUtil::TimestampToSeconds(const Timestamp& timestamp) { +i64 TimeUtil::TimestampToSeconds(const Timestamp& timestamp) { return timestamp.seconds(); } Timestamp TimeUtil::TimeTToTimestamp(time_t value) { - return CreateNormalized<Timestamp>(static_cast<int64_t>(value), 0); + return CreateNormalized<Timestamp>(static_cast<i64>(value), 0); } time_t TimeUtil::TimestampToTimeT(const Timestamp& value) { @@ -384,20 +384,20 @@ using ::PROTOBUF_NAMESPACE_ID::util::kNanosPerSecond; void ToUint128(const Duration& value, uint128* result, bool* negative) { if (value.seconds() < 0 || value.nanos() < 0) { *negative = true; - *result = static_cast<uint64>(-value.seconds()); - *result = *result * kNanosPerSecond + static_cast<uint32>(-value.nanos()); + *result = static_cast<ui64>(-value.seconds()); + *result = *result * kNanosPerSecond + static_cast<ui32>(-value.nanos()); } else { *negative = false; - *result = static_cast<uint64>(value.seconds()); - *result = *result * kNanosPerSecond + static_cast<uint32>(value.nanos()); + *result = static_cast<ui64>(value.seconds()); + *result = *result * kNanosPerSecond + static_cast<ui32>(value.nanos()); } } void ToDuration(const uint128& value, bool negative, Duration* duration) { - int64_t seconds = - static_cast<int64_t>(Uint128Low64(value / kNanosPerSecond)); - int32_t nanos = - static_cast<int32_t>(Uint128Low64(value % kNanosPerSecond)); + i64 seconds = + static_cast<i64>(Uint128Low64(value / kNanosPerSecond)); + i32 nanos = + static_cast<i32>(Uint128Low64(value % kNanosPerSecond)); if (negative) { seconds = -seconds; nanos = -nanos; @@ -419,15 +419,15 @@ Duration& operator-=(Duration& d1, const Duration& d2) { // NOLINT return d1; } -Duration& operator*=(Duration& d, int64_t r) { // NOLINT +Duration& operator*=(Duration& d, i64 r) { // NOLINT bool negative; uint128 value; ToUint128(d, &value, &negative); if (r > 0) { - value *= static_cast<uint64>(r); + value *= static_cast<ui64>(r); } else { negative = !negative; - value *= static_cast<uint64>(-r); + value *= static_cast<ui64>(-r); } ToDuration(value, negative, &d); return d; @@ -435,8 +435,8 @@ Duration& operator*=(Duration& d, int64_t r) { // NOLINT Duration& operator*=(Duration& d, double r) { // NOLINT double result = (d.seconds() * 1.0 + 1.0 * d.nanos() / kNanosPerSecond) * r; - int64_t seconds = static_cast<int64_t>(result); - int32_t nanos = static_cast<int32_t>((result - seconds) * kNanosPerSecond); + i64 seconds = static_cast<i64>(result); + i32 nanos = static_cast<i32>((result - seconds) * kNanosPerSecond); // Note that we normalize here not just because nanos can have a different // sign from seconds but also that nanos can be any arbitrary value when // overflow happens (i.e., the result is a much larger value than what @@ -445,15 +445,15 @@ Duration& operator*=(Duration& d, double r) { // NOLINT return d; } -Duration& operator/=(Duration& d, int64_t r) { // NOLINT +Duration& operator/=(Duration& d, i64 r) { // NOLINT bool negative; uint128 value; ToUint128(d, &value, &negative); if (r > 0) { - value /= static_cast<uint64>(r); + value /= static_cast<ui64>(r); } else { negative = !negative; - value /= static_cast<uint64>(-r); + value /= static_cast<ui64>(-r); } ToDuration(value, negative, &d); return d; @@ -479,12 +479,12 @@ Duration& operator%=(Duration& d1, const Duration& d2) { // NOLINT return d1; } -int64_t operator/(const Duration& d1, const Duration& d2) { +i64 operator/(const Duration& d1, const Duration& d2) { bool negative1, negative2; uint128 value1, value2; ToUint128(d1, &value1, &negative1); ToUint128(d2, &value2, &negative2); - int64_t result = Uint128Low64(value1 / value2); + i64 result = Uint128Low64(value1 / value2); if (negative1 != negative2) { result = -result; } diff --git a/contrib/libs/protobuf/src/google/protobuf/util/time_util.h b/contrib/libs/protobuf/src/google/protobuf/util/time_util.h index 0a297e9e64..c3f4f60aff 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/time_util.h +++ b/contrib/libs/protobuf/src/google/protobuf/util/time_util.h @@ -68,11 +68,11 @@ class PROTOBUF_EXPORT TimeUtil { // The min/max Timestamp/Duration values we support. // // For "0001-01-01T00:00:00Z". - static const int64_t kTimestampMinSeconds = -62135596800LL; + static const i64 kTimestampMinSeconds = -62135596800LL; // For "9999-12-31T23:59:59.999999999Z". - static const int64_t kTimestampMaxSeconds = 253402300799LL; - static const int64_t kDurationMinSeconds = -315576000000LL; - static const int64_t kDurationMaxSeconds = 315576000000LL; + static const i64 kTimestampMaxSeconds = 253402300799LL; + static const i64 kDurationMinSeconds = -315576000000LL; + static const i64 kDurationMaxSeconds = 315576000000LL; // Converts Timestamp to/from RFC 3339 date string format. // Generated output will always be Z-normalized and uses 3, 6 or 9 @@ -111,12 +111,12 @@ class PROTOBUF_EXPORT TimeUtil { // Converts between Duration and integer types. The behavior is undefined if // the input value is not in the valid range of Duration. - static Duration NanosecondsToDuration(int64_t nanos); - static Duration MicrosecondsToDuration(int64_t micros); - static Duration MillisecondsToDuration(int64_t millis); - static Duration SecondsToDuration(int64_t seconds); - static Duration MinutesToDuration(int64_t minutes); - static Duration HoursToDuration(int64_t hours); + static Duration NanosecondsToDuration(i64 nanos); + static Duration MicrosecondsToDuration(i64 micros); + static Duration MillisecondsToDuration(i64 millis); + static Duration SecondsToDuration(i64 seconds); + static Duration MinutesToDuration(i64 minutes); + static Duration HoursToDuration(i64 hours); // Result will be truncated towards zero. For example, "-1.5s" will be // truncated to "-1s", and "1.5s" to "1s" when converting to seconds. // It's undefined behavior if the input duration is not valid or the result @@ -124,28 +124,28 @@ class PROTOBUF_EXPORT TimeUtil { // valid range of Duration, or have an invalid nanos value (i.e., larger // than 999999999, less than -999999999, or have a different sign from the // seconds part). - static int64_t DurationToNanoseconds(const Duration& duration); - static int64_t DurationToMicroseconds(const Duration& duration); - static int64_t DurationToMilliseconds(const Duration& duration); - static int64_t DurationToSeconds(const Duration& duration); - static int64_t DurationToMinutes(const Duration& duration); - static int64_t DurationToHours(const Duration& duration); + static i64 DurationToNanoseconds(const Duration& duration); + static i64 DurationToMicroseconds(const Duration& duration); + static i64 DurationToMilliseconds(const Duration& duration); + static i64 DurationToSeconds(const Duration& duration); + static i64 DurationToMinutes(const Duration& duration); + static i64 DurationToHours(const Duration& duration); // Creates Timestamp from integer types. The integer value indicates the // time elapsed from Epoch time. The behavior is undefined if the input // value is not in the valid range of Timestamp. - static Timestamp NanosecondsToTimestamp(int64_t nanos); - static Timestamp MicrosecondsToTimestamp(int64_t micros); - static Timestamp MillisecondsToTimestamp(int64_t millis); - static Timestamp SecondsToTimestamp(int64_t seconds); + static Timestamp NanosecondsToTimestamp(i64 nanos); + static Timestamp MicrosecondsToTimestamp(i64 micros); + static Timestamp MillisecondsToTimestamp(i64 millis); + static Timestamp SecondsToTimestamp(i64 seconds); // Result will be truncated down to the nearest integer value. For example, // with "1969-12-31T23:59:59.9Z", TimestampToMilliseconds() returns -100 // and TimestampToSeconds() returns -1. It's undefined behavior if the input // Timestamp is not valid (i.e., its seconds part or nanos part does not fall // in the valid range) or the return value doesn't fit into int64. - static int64_t TimestampToNanoseconds(const Timestamp& timestamp); - static int64_t TimestampToMicroseconds(const Timestamp& timestamp); - static int64_t TimestampToMilliseconds(const Timestamp& timestamp); - static int64_t TimestampToSeconds(const Timestamp& timestamp); + static i64 TimestampToNanoseconds(const Timestamp& timestamp); + static i64 TimestampToMicroseconds(const Timestamp& timestamp); + static i64 TimestampToMilliseconds(const Timestamp& timestamp); + static i64 TimestampToSeconds(const Timestamp& timestamp); // Conversion to/from other time/date types. Note that these types may // have a different precision and time range from Timestamp/Duration. @@ -177,19 +177,19 @@ PROTOBUF_EXPORT Duration& operator+=(Duration& d1, const Duration& d2); // NOLINT PROTOBUF_EXPORT Duration& operator-=(Duration& d1, const Duration& d2); // NOLINT -PROTOBUF_EXPORT Duration& operator*=(Duration& d, int64_t r); // NOLINT +PROTOBUF_EXPORT Duration& operator*=(Duration& d, i64 r); // NOLINT PROTOBUF_EXPORT Duration& operator*=(Duration& d, double r); // NOLINT -PROTOBUF_EXPORT Duration& operator/=(Duration& d, int64_t r); // NOLINT +PROTOBUF_EXPORT Duration& operator/=(Duration& d, i64 r); // NOLINT PROTOBUF_EXPORT Duration& operator/=(Duration& d, double r); // NOLINT // Overload for other integer types. template <typename T> Duration& operator*=(Duration& d, T r) { // NOLINT - int64_t x = r; + i64 x = r; return d *= x; } template <typename T> Duration& operator/=(Duration& d, T r) { // NOLINT - int64_t x = r; + i64 x = r; return d /= x; } PROTOBUF_EXPORT Duration& operator%=(Duration& d1, @@ -244,7 +244,7 @@ template <typename T> inline Duration operator/(Duration d, T r) { return d /= r; } -PROTOBUF_EXPORT int64_t operator/(const Duration& d1, const Duration& d2); +PROTOBUF_EXPORT i64 operator/(const Duration& d1, const Duration& d2); inline Duration operator%(const Duration& d1, const Duration& d2) { Duration result = d1; diff --git a/contrib/libs/protobuf/src/google/protobuf/wire_format.cc b/contrib/libs/protobuf/src/google/protobuf/wire_format.cc index 0f265b2eb7..27d21dd613 100644 --- a/contrib/libs/protobuf/src/google/protobuf/wire_format.cc +++ b/contrib/libs/protobuf/src/google/protobuf/wire_format.cc @@ -70,7 +70,7 @@ static size_t MapValueRefDataOnlyByteSize(const FieldDescriptor* field, // =================================================================== bool UnknownFieldSetFieldSkipper::SkipField(io::CodedInputStream* input, - uint32_t tag) { + ui32 tag) { return WireFormat::SkipField(input, tag, unknown_fields_); } @@ -82,7 +82,7 @@ void UnknownFieldSetFieldSkipper::SkipUnknownEnum(int field_number, int value) { unknown_fields_->AddVarint(field_number, value); } -bool WireFormat::SkipField(io::CodedInputStream* input, uint32_t tag, +bool WireFormat::SkipField(io::CodedInputStream* input, ui32 tag, UnknownFieldSet* unknown_fields) { int number = WireFormatLite::GetTagFieldNumber(tag); // Field number 0 is illegal. @@ -90,19 +90,19 @@ bool WireFormat::SkipField(io::CodedInputStream* input, uint32_t tag, switch (WireFormatLite::GetTagWireType(tag)) { case WireFormatLite::WIRETYPE_VARINT: { - uint64_t value; + ui64 value; if (!input->ReadVarint64(&value)) return false; if (unknown_fields != NULL) unknown_fields->AddVarint(number, value); return true; } case WireFormatLite::WIRETYPE_FIXED64: { - uint64_t value; + ui64 value; if (!input->ReadLittleEndian64(&value)) return false; if (unknown_fields != NULL) unknown_fields->AddFixed64(number, value); return true; } case WireFormatLite::WIRETYPE_LENGTH_DELIMITED: { - uint32_t length; + ui32 length; if (!input->ReadVarint32(&length)) return false; if (unknown_fields == NULL) { if (!input->Skip(length)) return false; @@ -134,7 +134,7 @@ bool WireFormat::SkipField(io::CodedInputStream* input, uint32_t tag, return false; } case WireFormatLite::WIRETYPE_FIXED32: { - uint32_t value; + ui32 value; if (!input->ReadLittleEndian32(&value)) return false; if (unknown_fields != NULL) unknown_fields->AddFixed32(number, value); return true; @@ -148,7 +148,7 @@ bool WireFormat::SkipField(io::CodedInputStream* input, uint32_t tag, bool WireFormat::SkipMessage(io::CodedInputStream* input, UnknownFieldSet* unknown_fields) { while (true) { - uint32_t tag = input->ReadTag(); + ui32 tag = input->ReadTag(); if (tag == 0) { // End of input. This is a valid place to end, so return true. return true; @@ -166,11 +166,11 @@ bool WireFormat::SkipMessage(io::CodedInputStream* input, } bool WireFormat::ReadPackedEnumPreserveUnknowns(io::CodedInputStream* input, - uint32_t field_number, + ui32 field_number, bool (*is_valid)(int), UnknownFieldSet* unknown_fields, RepeatedField<int>* values) { - uint32_t length; + ui32 length; if (!input->ReadVarint32(&length)) return false; io::CodedInputStream::Limit limit = input->PushLimit(length); while (input->BytesUntilLimit() > 0) { @@ -278,12 +278,12 @@ size_t WireFormat::ComputeUnknownFieldsSize( case UnknownField::TYPE_FIXED32: size += io::CodedOutputStream::VarintSize32(WireFormatLite::MakeTag( field.number(), WireFormatLite::WIRETYPE_FIXED32)); - size += sizeof(int32_t); + size += sizeof(i32); break; case UnknownField::TYPE_FIXED64: size += io::CodedOutputStream::VarintSize32(WireFormatLite::MakeTag( field.number(), WireFormatLite::WIRETYPE_FIXED64)); - size += sizeof(int64); + size += sizeof(i64); break; case UnknownField::TYPE_LENGTH_DELIMITED: size += io::CodedOutputStream::VarintSize32(WireFormatLite::MakeTag( @@ -334,7 +334,7 @@ bool WireFormat::ParseAndMergePartial(io::CodedInputStream* input, const Reflection* message_reflection = message->GetReflection(); while (true) { - uint32_t tag = input->ReadTag(); + ui32 tag = input->ReadTag(); if (tag == 0) { // End of input. This is a valid place to end, so return true. return true; @@ -380,15 +380,15 @@ bool WireFormat::ParseAndMergePartial(io::CodedInputStream* input, } bool WireFormat::SkipMessageSetField(io::CodedInputStream* input, - uint32_t field_number, + ui32 field_number, UnknownFieldSet* unknown_fields) { - uint32_t length; + ui32 length; if (!input->ReadVarint32(&length)) return false; return input->ReadString(unknown_fields->AddLengthDelimited(field_number), length); } -bool WireFormat::ParseAndMergeMessageSetField(uint32_t field_number, +bool WireFormat::ParseAndMergeMessageSetField(ui32 field_number, const FieldDescriptor* field, Message* message, io::CodedInputStream* input) { @@ -415,7 +415,7 @@ static bool StrictUtf8Check(const FieldDescriptor* field) { } bool WireFormat::ParseAndMergeField( - uint32_t tag, + ui32 tag, const FieldDescriptor* field, // May be NULL for unknown Message* message, io::CodedInputStream* input) { const Reflection* message_reflection = message->GetReflection(); @@ -441,7 +441,7 @@ bool WireFormat::ParseAndMergeField( return SkipField(input, tag, message_reflection->MutableUnknownFields(message)); } else if (value_format == PACKED_FORMAT) { - uint32_t length; + ui32 length; if (!input->ReadVarint32(&length)) return false; io::CodedInputStream::Limit limit = input->PushLimit(length); @@ -459,17 +459,17 @@ bool WireFormat::ParseAndMergeField( break; \ } - HANDLE_PACKED_TYPE(INT32, int32_t, Int32) - HANDLE_PACKED_TYPE(INT64, int64, Int64) - HANDLE_PACKED_TYPE(SINT32, int32_t, Int32) - HANDLE_PACKED_TYPE(SINT64, int64, Int64) - HANDLE_PACKED_TYPE(UINT32, uint32_t, UInt32) - HANDLE_PACKED_TYPE(UINT64, uint64, UInt64) + HANDLE_PACKED_TYPE(INT32, i32, Int32) + HANDLE_PACKED_TYPE(INT64, i64, Int64) + HANDLE_PACKED_TYPE(SINT32, i32, Int32) + HANDLE_PACKED_TYPE(SINT64, i64, Int64) + HANDLE_PACKED_TYPE(UINT32, ui32, UInt32) + HANDLE_PACKED_TYPE(UINT64, ui64, UInt64) - HANDLE_PACKED_TYPE(FIXED32, uint32_t, UInt32) - HANDLE_PACKED_TYPE(FIXED64, uint64, UInt64) - HANDLE_PACKED_TYPE(SFIXED32, int32_t, Int32) - HANDLE_PACKED_TYPE(SFIXED64, int64, Int64) + HANDLE_PACKED_TYPE(FIXED32, ui32, UInt32) + HANDLE_PACKED_TYPE(FIXED64, ui64, UInt64) + HANDLE_PACKED_TYPE(SFIXED32, i32, Int32) + HANDLE_PACKED_TYPE(SFIXED64, i64, Int64) HANDLE_PACKED_TYPE(FLOAT, float, Float) HANDLE_PACKED_TYPE(DOUBLE, double, Double) @@ -494,7 +494,7 @@ bool WireFormat::ParseAndMergeField( } else { // The enum value is not one of the known values. Add it to the // UnknownFieldSet. - int64_t sign_extended_value = static_cast<int64_t>(value); + i64 sign_extended_value = static_cast<i64>(value); message_reflection->MutableUnknownFields(message)->AddVarint( WireFormatLite::GetTagFieldNumber(tag), sign_extended_value); } @@ -532,17 +532,17 @@ bool WireFormat::ParseAndMergeField( break; \ } - HANDLE_TYPE(INT32, int32_t, Int32) - HANDLE_TYPE(INT64, int64, Int64) - HANDLE_TYPE(SINT32, int32_t, Int32) - HANDLE_TYPE(SINT64, int64, Int64) - HANDLE_TYPE(UINT32, uint32_t, UInt32) - HANDLE_TYPE(UINT64, uint64, UInt64) + HANDLE_TYPE(INT32, i32, Int32) + HANDLE_TYPE(INT64, i64, Int64) + HANDLE_TYPE(SINT32, i32, Int32) + HANDLE_TYPE(SINT64, i64, Int64) + HANDLE_TYPE(UINT32, ui32, UInt32) + HANDLE_TYPE(UINT64, ui64, UInt64) - HANDLE_TYPE(FIXED32, uint32_t, UInt32) - HANDLE_TYPE(FIXED64, uint64, UInt64) - HANDLE_TYPE(SFIXED32, int32_t, Int32) - HANDLE_TYPE(SFIXED64, int64, Int64) + HANDLE_TYPE(FIXED32, ui32, UInt32) + HANDLE_TYPE(FIXED64, ui64, UInt64) + HANDLE_TYPE(SFIXED32, i32, Int32) + HANDLE_TYPE(SFIXED64, i64, Int64) HANDLE_TYPE(FLOAT, float, Float) HANDLE_TYPE(DOUBLE, double, Double) @@ -641,7 +641,7 @@ bool WireFormat::ParseAndMergeMessageSetItem(io::CodedInputStream* input, return ParseAndMergeMessageSetField(type_id, field, message, input); } - bool SkipField(uint32_t tag, io::CodedInputStream* input) { + bool SkipField(ui32 tag, io::CodedInputStream* input) { return WireFormat::SkipField(input, tag, NULL); } @@ -661,13 +661,13 @@ struct WireFormat::MessageSetParser { State state = State::kNoTag; TProtoStringType payload; - uint32_t type_id = 0; + ui32 type_id = 0; while (!ctx->Done(&ptr)) { // We use 64 bit tags in order to allow typeid's that span the whole // range of 32 bit numbers. - uint32_t tag = static_cast<uint8_t>(*ptr++); + ui32 tag = static_cast<uint8_t>(*ptr++); if (tag == WireFormatLite::kMessageSetTypeIdTag) { - uint64_t tmp; + ui64 tmp; ptr = ParseBigVarint(ptr, &tmp); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); if (state == State::kNoTag) { @@ -706,7 +706,7 @@ struct WireFormat::MessageSetParser { continue; } else if (tag == WireFormatLite::kMessageSetMessageTag) { if (state == State::kNoTag) { - int32_t size = ReadSize(&ptr); + i32 size = ReadSize(&ptr); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); ptr = ctx->ReadString(ptr, size, &payload); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); @@ -723,11 +723,11 @@ struct WireFormat::MessageSetParser { } } ptr = WireFormat::_InternalParseAndMergeField( - msg, ptr, ctx, static_cast<uint64_t>(type_id) * 8 + 2, reflection, + msg, ptr, ctx, static_cast<ui64>(type_id) * 8 + 2, reflection, field); state = State::kDone; } else { - int32_t size = ReadSize(&ptr); + i32 size = ReadSize(&ptr); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); ptr = ctx->Skip(ptr, size); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); @@ -750,7 +750,7 @@ struct WireFormat::MessageSetParser { const char* ParseMessageSet(const char* ptr, internal::ParseContext* ctx) { while (!ctx->Done(&ptr)) { - uint32_t tag; + ui32 tag; ptr = ReadTag(ptr, &tag); if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) return nullptr; if (tag == 0 || (tag & 7) == WireFormatLite::WIRETYPE_END_GROUP) { @@ -796,7 +796,7 @@ const char* WireFormat::_InternalParse(Message* msg, const char* ptr, return message_set.ParseMessageSet(ptr, ctx); } while (!ctx->Done(&ptr)) { - uint32_t tag; + ui32 tag; ptr = ReadTag(ptr, &tag); if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) return nullptr; if (tag == 0 || (tag & 7) == WireFormatLite::WIRETYPE_END_GROUP) { @@ -825,7 +825,7 @@ const char* WireFormat::_InternalParse(Message* msg, const char* ptr, } const char* WireFormat::_InternalParseAndMergeField( - Message* msg, const char* ptr, internal::ParseContext* ctx, uint64_t tag, + Message* msg, const char* ptr, internal::ParseContext* ctx, ui64 tag, const Reflection* reflection, const FieldDescriptor* field) { if (field == nullptr) { // unknown field set parser takes 64bit tags, because message set type ids @@ -846,17 +846,17 @@ const char* WireFormat::_InternalParseAndMergeField( return ptr; \ } - HANDLE_PACKED_TYPE(INT32, int32_t, Int32) - HANDLE_PACKED_TYPE(INT64, int64, Int64) - HANDLE_PACKED_TYPE(SINT32, int32_t, SInt32) - HANDLE_PACKED_TYPE(SINT64, int64, SInt64) - HANDLE_PACKED_TYPE(UINT32, uint32_t, UInt32) - HANDLE_PACKED_TYPE(UINT64, uint64, UInt64) + HANDLE_PACKED_TYPE(INT32, i32, Int32) + HANDLE_PACKED_TYPE(INT64, i64, Int64) + HANDLE_PACKED_TYPE(SINT32, i32, SInt32) + HANDLE_PACKED_TYPE(SINT64, i64, SInt64) + HANDLE_PACKED_TYPE(UINT32, ui32, UInt32) + HANDLE_PACKED_TYPE(UINT64, ui64, UInt64) - HANDLE_PACKED_TYPE(FIXED32, uint32_t, Fixed32) - HANDLE_PACKED_TYPE(FIXED64, uint64, Fixed64) - HANDLE_PACKED_TYPE(SFIXED32, int32_t, SFixed32) - HANDLE_PACKED_TYPE(SFIXED64, int64, SFixed64) + HANDLE_PACKED_TYPE(FIXED32, ui32, Fixed32) + HANDLE_PACKED_TYPE(FIXED64, ui64, Fixed64) + HANDLE_PACKED_TYPE(SFIXED32, i32, SFixed32) + HANDLE_PACKED_TYPE(SFIXED64, i64, SFixed64) HANDLE_PACKED_TYPE(FLOAT, float, Float) HANDLE_PACKED_TYPE(DOUBLE, double, Double) @@ -866,14 +866,14 @@ const char* WireFormat::_InternalParseAndMergeField( case FieldDescriptor::TYPE_ENUM: { auto rep_enum = - reflection->MutableRepeatedFieldInternal<int32>(msg, field); + reflection->MutableRepeatedFieldInternal<int>(msg, field); bool open_enum = false; if (field->file()->syntax() == FileDescriptor::SYNTAX_PROTO3 || open_enum) { ptr = internal::PackedEnumParser(rep_enum, ptr, ctx); } else { return ctx->ReadPackedVarint( - ptr, [rep_enum, field, reflection, msg](uint64_t val) { + ptr, [rep_enum, field, reflection, msg](ui64 val) { if (field->enum_type()->FindValueByNumber(val) != nullptr) { rep_enum->Add(val); } else { @@ -916,14 +916,14 @@ const char* WireFormat::_InternalParseAndMergeField( return ptr; \ } - HANDLE_TYPE(BOOL, uint64_t, Bool) - HANDLE_TYPE(INT32, uint32_t, Int32) - HANDLE_TYPE(INT64, uint64, Int64) - HANDLE_TYPE(UINT32, uint32_t, UInt32) - HANDLE_TYPE(UINT64, uint64, UInt64) + HANDLE_TYPE(BOOL, ui64, Bool) + HANDLE_TYPE(INT32, ui32, Int32) + HANDLE_TYPE(INT64, ui64, Int64) + HANDLE_TYPE(UINT32, ui32, UInt32) + HANDLE_TYPE(UINT64, ui64, UInt64) case FieldDescriptor::TYPE_SINT32: { - int32_t value = ReadVarintZigZag32(&ptr); + i32 value = ReadVarintZigZag32(&ptr); if (ptr == nullptr) return nullptr; if (field->is_repeated()) { reflection->AddInt32(msg, field, value); @@ -933,7 +933,7 @@ const char* WireFormat::_InternalParseAndMergeField( return ptr; } case FieldDescriptor::TYPE_SINT64: { - int64_t value = ReadVarintZigZag64(&ptr); + i64 value = ReadVarintZigZag64(&ptr); if (ptr == nullptr) return nullptr; if (field->is_repeated()) { reflection->AddInt64(msg, field, value); @@ -956,10 +956,10 @@ const char* WireFormat::_InternalParseAndMergeField( return ptr; \ } - HANDLE_TYPE(FIXED32, uint32_t, UInt32) - HANDLE_TYPE(FIXED64, uint64, UInt64) - HANDLE_TYPE(SFIXED32, int32_t, Int32) - HANDLE_TYPE(SFIXED64, int64, Int64) + HANDLE_TYPE(FIXED32, ui32, UInt32) + HANDLE_TYPE(FIXED64, ui64, UInt64) + HANDLE_TYPE(SFIXED32, i32, Int32) + HANDLE_TYPE(SFIXED64, i64, Int64) HANDLE_TYPE(FLOAT, float, Float) HANDLE_TYPE(DOUBLE, double, Double) @@ -967,7 +967,7 @@ const char* WireFormat::_InternalParseAndMergeField( #undef HANDLE_TYPE case FieldDescriptor::TYPE_ENUM: { - uint32_t value; + ui32 value; ptr = VarintParse(ptr, &value); if (ptr == nullptr) return nullptr; if (field->is_repeated()) { @@ -1297,13 +1297,13 @@ uint8_t* WireFormat::InternalSerializeField(const FieldDescriptor* field, break; \ } - HANDLE_PRIMITIVE_TYPE(INT32, int32_t, Int32, Int32) - HANDLE_PRIMITIVE_TYPE(INT64, int64, Int64, Int64) - HANDLE_PRIMITIVE_TYPE(SINT32, int32_t, SInt32, Int32) - HANDLE_PRIMITIVE_TYPE(SINT64, int64, SInt64, Int64) - HANDLE_PRIMITIVE_TYPE(UINT32, uint32_t, UInt32, UInt32) - HANDLE_PRIMITIVE_TYPE(UINT64, uint64, UInt64, UInt64) - HANDLE_PRIMITIVE_TYPE(ENUM, int32, Enum, Enum) + HANDLE_PRIMITIVE_TYPE(INT32, i32, Int32, Int32) + HANDLE_PRIMITIVE_TYPE(INT64, i64, Int64, Int64) + HANDLE_PRIMITIVE_TYPE(SINT32, i32, SInt32, Int32) + HANDLE_PRIMITIVE_TYPE(SINT64, i64, SInt64, Int64) + HANDLE_PRIMITIVE_TYPE(UINT32, ui32, UInt32, UInt32) + HANDLE_PRIMITIVE_TYPE(UINT64, ui64, UInt64, UInt64) + HANDLE_PRIMITIVE_TYPE(ENUM, int, Enum, Enum) #undef HANDLE_PRIMITIVE_TYPE #define HANDLE_PRIMITIVE_TYPE(TYPE, CPPTYPE, TYPE_METHOD, CPPTYPE_METHOD) \ @@ -1314,10 +1314,10 @@ uint8_t* WireFormat::InternalSerializeField(const FieldDescriptor* field, break; \ } - HANDLE_PRIMITIVE_TYPE(FIXED32, uint32_t, Fixed32, UInt32) - HANDLE_PRIMITIVE_TYPE(FIXED64, uint64, Fixed64, UInt64) - HANDLE_PRIMITIVE_TYPE(SFIXED32, int32_t, SFixed32, Int32) - HANDLE_PRIMITIVE_TYPE(SFIXED64, int64, SFixed64, Int64) + HANDLE_PRIMITIVE_TYPE(FIXED32, ui32, Fixed32, UInt32) + HANDLE_PRIMITIVE_TYPE(FIXED64, ui64, Fixed64, UInt64) + HANDLE_PRIMITIVE_TYPE(SFIXED32, i32, SFixed32, Int32) + HANDLE_PRIMITIVE_TYPE(SFIXED64, i64, SFixed64, Int64) HANDLE_PRIMITIVE_TYPE(FLOAT, float, Float, Float) HANDLE_PRIMITIVE_TYPE(DOUBLE, double, Double, Double) @@ -1345,17 +1345,17 @@ uint8_t* WireFormat::InternalSerializeField(const FieldDescriptor* field, break; \ } - HANDLE_PRIMITIVE_TYPE(INT32, int32_t, Int32, Int32) - HANDLE_PRIMITIVE_TYPE(INT64, int64, Int64, Int64) - HANDLE_PRIMITIVE_TYPE(SINT32, int32_t, SInt32, Int32) - HANDLE_PRIMITIVE_TYPE(SINT64, int64, SInt64, Int64) - HANDLE_PRIMITIVE_TYPE(UINT32, uint32_t, UInt32, UInt32) - HANDLE_PRIMITIVE_TYPE(UINT64, uint64, UInt64, UInt64) - - HANDLE_PRIMITIVE_TYPE(FIXED32, uint32_t, Fixed32, UInt32) - HANDLE_PRIMITIVE_TYPE(FIXED64, uint64, Fixed64, UInt64) - HANDLE_PRIMITIVE_TYPE(SFIXED32, int32_t, SFixed32, Int32) - HANDLE_PRIMITIVE_TYPE(SFIXED64, int64, SFixed64, Int64) + HANDLE_PRIMITIVE_TYPE(INT32, i32, Int32, Int32) + HANDLE_PRIMITIVE_TYPE(INT64, i64, Int64, Int64) + HANDLE_PRIMITIVE_TYPE(SINT32, i32, SInt32, Int32) + HANDLE_PRIMITIVE_TYPE(SINT64, i64, SInt64, Int64) + HANDLE_PRIMITIVE_TYPE(UINT32, ui32, UInt32, UInt32) + HANDLE_PRIMITIVE_TYPE(UINT64, ui64, UInt64, UInt64) + + HANDLE_PRIMITIVE_TYPE(FIXED32, ui32, Fixed32, UInt32) + HANDLE_PRIMITIVE_TYPE(FIXED64, ui64, Fixed64, UInt64) + HANDLE_PRIMITIVE_TYPE(SFIXED32, i32, SFixed32, Int32) + HANDLE_PRIMITIVE_TYPE(SFIXED64, i64, SFixed64, Int64) HANDLE_PRIMITIVE_TYPE(FLOAT, float, Float, Float) HANDLE_PRIMITIVE_TYPE(DOUBLE, double, Double, Double) diff --git a/contrib/libs/protobuf/src/google/protobuf/wire_format.h b/contrib/libs/protobuf/src/google/protobuf/wire_format.h index 7ca217a11b..7089087441 100644 --- a/contrib/libs/protobuf/src/google/protobuf/wire_format.h +++ b/contrib/libs/protobuf/src/google/protobuf/wire_format.h @@ -148,7 +148,7 @@ class PROTOBUF_EXPORT WireFormat { // Skips a field value of the given WireType. The input should start // positioned immediately after the tag. If unknown_fields is non-NULL, // the contents of the field will be added to it. - static bool SkipField(io::CodedInputStream* input, uint32_t tag, + static bool SkipField(io::CodedInputStream* input, ui32 tag, UnknownFieldSet* unknown_fields); // Reads and ignores a message from the input. If unknown_fields is @@ -160,7 +160,7 @@ class PROTOBUF_EXPORT WireFormat { // for which is_valid(value) returns false are appended to // unknown_fields_stream. static bool ReadPackedEnumPreserveUnknowns(io::CodedInputStream* input, - uint32_t field_number, + ui32 field_number, bool (*is_valid)(int), UnknownFieldSet* unknown_fields, RepeatedField<int>* values); @@ -219,12 +219,12 @@ class PROTOBUF_EXPORT WireFormat { // // This is different from MakeTag(field->number(), field->type()) in the // case of packed repeated fields. - static uint32_t MakeTag(const FieldDescriptor* field); + static ui32 MakeTag(const FieldDescriptor* field); // Parse a single field. The input should start out positioned immediately // after the tag. static bool ParseAndMergeField( - uint32_t tag, + ui32 tag, const FieldDescriptor* field, // May be NULL for unknown Message* message, io::CodedInputStream* input); @@ -287,18 +287,18 @@ class PROTOBUF_EXPORT WireFormat { struct MessageSetParser; // Skip a MessageSet field. static bool SkipMessageSetField(io::CodedInputStream* input, - uint32_t field_number, + ui32 field_number, UnknownFieldSet* unknown_fields); // Parse a MessageSet field. - static bool ParseAndMergeMessageSetField(uint32_t field_number, + static bool ParseAndMergeMessageSetField(ui32 field_number, const FieldDescriptor* field, Message* message, io::CodedInputStream* input); // Parses the value from the wire that belongs to tag. static const char* _InternalParseAndMergeField(Message* msg, const char* ptr, internal::ParseContext* ctx, - uint64_t tag, + ui64 tag, const Reflection* reflection, const FieldDescriptor* field); @@ -313,7 +313,7 @@ class PROTOBUF_EXPORT UnknownFieldSetFieldSkipper : public FieldSkipper { ~UnknownFieldSetFieldSkipper() override {} // implements FieldSkipper ----------------------------------------- - bool SkipField(io::CodedInputStream* input, uint32_t tag) override; + bool SkipField(io::CodedInputStream* input, ui32 tag) override; bool SkipMessage(io::CodedInputStream* input) override; void SkipUnknownEnum(int field_number, int value) override; @@ -340,7 +340,7 @@ inline WireFormatLite::WireType WireFormat::WireTypeForFieldType( static_cast<WireFormatLite::FieldType>(implicit_cast<int>(type))); } -inline uint32_t WireFormat::MakeTag(const FieldDescriptor* field) { +inline ui32 WireFormat::MakeTag(const FieldDescriptor* field) { return WireFormatLite::MakeTag(field->number(), WireTypeForField(field)); } diff --git a/contrib/libs/protobuf/src/google/protobuf/wire_format_lite.cc b/contrib/libs/protobuf/src/google/protobuf/wire_format_lite.cc index 7661c9d27e..510aee31b8 100644 --- a/contrib/libs/protobuf/src/google/protobuf/wire_format_lite.cc +++ b/contrib/libs/protobuf/src/google/protobuf/wire_format_lite.cc @@ -120,22 +120,22 @@ const WireFormatLite::WireType WireFormatLite::WIRETYPE_VARINT, // TYPE_SINT64 }; -bool WireFormatLite::SkipField(io::CodedInputStream* input, uint32_t tag) { +bool WireFormatLite::SkipField(io::CodedInputStream* input, ui32 tag) { // Field number 0 is illegal. if (WireFormatLite::GetTagFieldNumber(tag) == 0) return false; switch (WireFormatLite::GetTagWireType(tag)) { case WireFormatLite::WIRETYPE_VARINT: { - uint64_t value; + ui64 value; if (!input->ReadVarint64(&value)) return false; return true; } case WireFormatLite::WIRETYPE_FIXED64: { - uint64_t value; + ui64 value; if (!input->ReadLittleEndian64(&value)) return false; return true; } case WireFormatLite::WIRETYPE_LENGTH_DELIMITED: { - uint32_t length; + ui32 length; if (!input->ReadVarint32(&length)) return false; if (!input->Skip(length)) return false; return true; @@ -156,7 +156,7 @@ bool WireFormatLite::SkipField(io::CodedInputStream* input, uint32_t tag) { return false; } case WireFormatLite::WIRETYPE_FIXED32: { - uint32_t value; + ui32 value; if (!input->ReadLittleEndian32(&value)) return false; return true; } @@ -166,27 +166,27 @@ bool WireFormatLite::SkipField(io::CodedInputStream* input, uint32_t tag) { } } -bool WireFormatLite::SkipField(io::CodedInputStream* input, uint32_t tag, +bool WireFormatLite::SkipField(io::CodedInputStream* input, ui32 tag, io::CodedOutputStream* output) { // Field number 0 is illegal. if (WireFormatLite::GetTagFieldNumber(tag) == 0) return false; switch (WireFormatLite::GetTagWireType(tag)) { case WireFormatLite::WIRETYPE_VARINT: { - uint64_t value; + ui64 value; if (!input->ReadVarint64(&value)) return false; output->WriteVarint32(tag); output->WriteVarint64(value); return true; } case WireFormatLite::WIRETYPE_FIXED64: { - uint64_t value; + ui64 value; if (!input->ReadLittleEndian64(&value)) return false; output->WriteVarint32(tag); output->WriteLittleEndian64(value); return true; } case WireFormatLite::WIRETYPE_LENGTH_DELIMITED: { - uint32_t length; + ui32 length; if (!input->ReadVarint32(&length)) return false; output->WriteVarint32(tag); output->WriteVarint32(length); @@ -213,7 +213,7 @@ bool WireFormatLite::SkipField(io::CodedInputStream* input, uint32_t tag, return false; } case WireFormatLite::WIRETYPE_FIXED32: { - uint32_t value; + ui32 value; if (!input->ReadLittleEndian32(&value)) return false; output->WriteVarint32(tag); output->WriteLittleEndian32(value); @@ -227,7 +227,7 @@ bool WireFormatLite::SkipField(io::CodedInputStream* input, uint32_t tag, bool WireFormatLite::SkipMessage(io::CodedInputStream* input) { while (true) { - uint32_t tag = input->ReadTag(); + ui32 tag = input->ReadTag(); if (tag == 0) { // End of input. This is a valid place to end, so return true. return true; @@ -247,7 +247,7 @@ bool WireFormatLite::SkipMessage(io::CodedInputStream* input) { bool WireFormatLite::SkipMessage(io::CodedInputStream* input, io::CodedOutputStream* output) { while (true) { - uint32_t tag = input->ReadTag(); + ui32 tag = input->ReadTag(); if (tag == 0) { // End of input. This is a valid place to end, so return true. return true; @@ -265,7 +265,7 @@ bool WireFormatLite::SkipMessage(io::CodedInputStream* input, } } -bool FieldSkipper::SkipField(io::CodedInputStream* input, uint32_t tag) { +bool FieldSkipper::SkipField(io::CodedInputStream* input, ui32 tag) { return WireFormatLite::SkipField(input, tag); } @@ -278,7 +278,7 @@ void FieldSkipper::SkipUnknownEnum(int /* field_number */, int /* value */) { } bool CodedOutputStreamFieldSkipper::SkipField(io::CodedInputStream* input, - uint32_t tag) { + ui32 tag) { return WireFormatLite::SkipField(input, tag, unknown_fields_); } @@ -295,7 +295,7 @@ void CodedOutputStreamFieldSkipper::SkipUnknownEnum(int field_number, bool WireFormatLite::ReadPackedEnumPreserveUnknowns( io::CodedInputStream* input, int field_number, bool (*is_valid)(int), io::CodedOutputStream* unknown_fields_stream, RepeatedField<int>* values) { - uint32_t length; + ui32 length; if (!input->ReadVarint32(&length)) return false; io::CodedInputStream::Limit limit = input->PushLimit(length); while (input->BytesUntilLimit() > 0) { @@ -306,7 +306,7 @@ bool WireFormatLite::ReadPackedEnumPreserveUnknowns( if (is_valid == NULL || is_valid(value)) { values->Add(value); } else { - uint32_t tag = WireFormatLite::MakeTag(field_number, + ui32 tag = WireFormatLite::MakeTag(field_number, WireFormatLite::WIRETYPE_VARINT); unknown_fields_stream->WriteVarint32(tag); unknown_fields_stream->WriteVarint32(value); @@ -327,19 +327,19 @@ void EncodeFixedSizeValue(double v, uint8_t* dest) { WireFormatLite::WriteDoubleNoTagToArray(v, dest); } -void EncodeFixedSizeValue(uint32_t v, uint8_t* dest) { +void EncodeFixedSizeValue(ui32 v, uint8_t* dest) { WireFormatLite::WriteFixed32NoTagToArray(v, dest); } -void EncodeFixedSizeValue(uint64_t v, uint8_t* dest) { +void EncodeFixedSizeValue(ui64 v, uint8_t* dest) { WireFormatLite::WriteFixed64NoTagToArray(v, dest); } -void EncodeFixedSizeValue(int32_t v, uint8_t* dest) { +void EncodeFixedSizeValue(i32 v, uint8_t* dest) { WireFormatLite::WriteSFixed32NoTagToArray(v, dest); } -void EncodeFixedSizeValue(int64_t v, uint8_t* dest) { +void EncodeFixedSizeValue(i64 v, uint8_t* dest) { WireFormatLite::WriteSFixed64NoTagToArray(v, dest); } @@ -379,24 +379,24 @@ void WireFormatLite::WriteDoubleArray(const double* a, int n, WriteArray<double>(a, n, output); } -void WireFormatLite::WriteFixed32Array(const uint32_t* a, int n, +void WireFormatLite::WriteFixed32Array(const ui32* a, int n, io::CodedOutputStream* output) { - WriteArray<uint32_t>(a, n, output); + WriteArray<ui32>(a, n, output); } -void WireFormatLite::WriteFixed64Array(const uint64_t* a, int n, +void WireFormatLite::WriteFixed64Array(const ui64* a, int n, io::CodedOutputStream* output) { - WriteArray<uint64_t>(a, n, output); + WriteArray<ui64>(a, n, output); } -void WireFormatLite::WriteSFixed32Array(const int32_t* a, int n, +void WireFormatLite::WriteSFixed32Array(const i32* a, int n, io::CodedOutputStream* output) { - WriteArray<int32_t>(a, n, output); + WriteArray<i32>(a, n, output); } -void WireFormatLite::WriteSFixed64Array(const int64_t* a, int n, +void WireFormatLite::WriteSFixed64Array(const i64* a, int n, io::CodedOutputStream* output) { - WriteArray<int64_t>(a, n, output); + WriteArray<i64>(a, n, output); } void WireFormatLite::WriteBoolArray(const bool* a, int n, @@ -404,52 +404,52 @@ void WireFormatLite::WriteBoolArray(const bool* a, int n, WriteArray<bool>(a, n, output); } -void WireFormatLite::WriteInt32(int field_number, int32_t value, +void WireFormatLite::WriteInt32(int field_number, i32 value, io::CodedOutputStream* output) { WriteTag(field_number, WIRETYPE_VARINT, output); WriteInt32NoTag(value, output); } -void WireFormatLite::WriteInt64(int field_number, int64_t value, +void WireFormatLite::WriteInt64(int field_number, i64 value, io::CodedOutputStream* output) { WriteTag(field_number, WIRETYPE_VARINT, output); WriteInt64NoTag(value, output); } -void WireFormatLite::WriteUInt32(int field_number, uint32_t value, +void WireFormatLite::WriteUInt32(int field_number, ui32 value, io::CodedOutputStream* output) { WriteTag(field_number, WIRETYPE_VARINT, output); WriteUInt32NoTag(value, output); } -void WireFormatLite::WriteUInt64(int field_number, uint64_t value, +void WireFormatLite::WriteUInt64(int field_number, ui64 value, io::CodedOutputStream* output) { WriteTag(field_number, WIRETYPE_VARINT, output); WriteUInt64NoTag(value, output); } -void WireFormatLite::WriteSInt32(int field_number, int32_t value, +void WireFormatLite::WriteSInt32(int field_number, i32 value, io::CodedOutputStream* output) { WriteTag(field_number, WIRETYPE_VARINT, output); WriteSInt32NoTag(value, output); } -void WireFormatLite::WriteSInt64(int field_number, int64_t value, +void WireFormatLite::WriteSInt64(int field_number, i64 value, io::CodedOutputStream* output) { WriteTag(field_number, WIRETYPE_VARINT, output); WriteSInt64NoTag(value, output); } -void WireFormatLite::WriteFixed32(int field_number, uint32_t value, +void WireFormatLite::WriteFixed32(int field_number, ui32 value, io::CodedOutputStream* output) { WriteTag(field_number, WIRETYPE_FIXED32, output); WriteFixed32NoTag(value, output); } -void WireFormatLite::WriteFixed64(int field_number, uint64_t value, +void WireFormatLite::WriteFixed64(int field_number, ui64 value, io::CodedOutputStream* output) { WriteTag(field_number, WIRETYPE_FIXED64, output); WriteFixed64NoTag(value, output); } -void WireFormatLite::WriteSFixed32(int field_number, int32_t value, +void WireFormatLite::WriteSFixed32(int field_number, i32 value, io::CodedOutputStream* output) { WriteTag(field_number, WIRETYPE_FIXED32, output); WriteSFixed32NoTag(value, output); } -void WireFormatLite::WriteSFixed64(int field_number, int64_t value, +void WireFormatLite::WriteSFixed64(int field_number, i64 value, io::CodedOutputStream* output) { WriteTag(field_number, WIRETYPE_FIXED64, output); WriteSFixed64NoTag(value, output); @@ -551,7 +551,7 @@ PROTOBUF_NDEBUG_INLINE static bool ReadBytesToString( io::CodedInputStream* input, TProtoStringType* value); inline static bool ReadBytesToString(io::CodedInputStream* input, TProtoStringType* value) { - uint32_t length; + ui32 length; return input->ReadVarint32(&length) && input->ReadString(value, length); } @@ -614,10 +614,10 @@ static size_t VarintSize(const T* data, const int n) { "Cannot SignExtended unsigned types"); static_assert(!(SignExtended && ZigZag), "Cannot SignExtended and ZigZag on the same type"); - uint32_t sum = n; - uint32_t msb_sum = 0; + ui32 sum = n; + ui32 msb_sum = 0; for (int i = 0; i < n; i++) { - uint32_t x = data[i]; + ui32 x = data[i]; if (ZigZag) { x = WireFormatLite::ZigZagEncode32(x); } else if (SignExtended) { @@ -642,16 +642,16 @@ static size_t VarintSize64(const T* data, const int n) { // is_unsigned<T> => !ZigZag static_assert(!ZigZag || !std::is_unsigned<T>::value, "Cannot ZigZag encode unsigned types"); - uint64_t sum = n; + ui64 sum = n; for (int i = 0; i < n; i++) { - uint64_t x = data[i]; + ui64 x = data[i]; if (ZigZag) { x = WireFormatLite::ZigZagEncode64(x); } // First step is a binary search, we can't branch in sse so we use the // result of the compare to adjust sum and appropriately. This code is // written to make clang recognize the vectorization. - uint64_t tmp = x >= (static_cast<uint64_t>(1) << 35) ? -1 : 0; + ui64 tmp = x >= (static_cast<ui64>(1) << 35) ? -1 : 0; sum += 5 & tmp; x >>= 35 & tmp; if (x > 0x7F) sum++; @@ -667,15 +667,15 @@ static size_t VarintSize64(const T* data, const int n) { // varint size routine for each element is faster. // Hence we enable it only for clang #if defined(__SSE__) && defined(__clang__) -size_t WireFormatLite::Int32Size(const RepeatedField<int32_t>& value) { +size_t WireFormatLite::Int32Size(const RepeatedField<i32>& value) { return VarintSize<false, true>(value.data(), value.size()); } -size_t WireFormatLite::UInt32Size(const RepeatedField<uint32_t>& value) { +size_t WireFormatLite::UInt32Size(const RepeatedField<ui32>& value) { return VarintSize<false, false>(value.data(), value.size()); } -size_t WireFormatLite::SInt32Size(const RepeatedField<int32_t>& value) { +size_t WireFormatLite::SInt32Size(const RepeatedField<i32>& value) { return VarintSize<true, false>(value.data(), value.size()); } @@ -686,7 +686,7 @@ size_t WireFormatLite::EnumSize(const RepeatedField<int>& value) { #else // !(defined(__SSE4_1__) && defined(__clang__)) -size_t WireFormatLite::Int32Size(const RepeatedField<int32_t>& value) { +size_t WireFormatLite::Int32Size(const RepeatedField<i32>& value) { size_t out = 0; const int n = value.size(); for (int i = 0; i < n; i++) { @@ -695,7 +695,7 @@ size_t WireFormatLite::Int32Size(const RepeatedField<int32_t>& value) { return out; } -size_t WireFormatLite::UInt32Size(const RepeatedField<uint32_t>& value) { +size_t WireFormatLite::UInt32Size(const RepeatedField<ui32>& value) { size_t out = 0; const int n = value.size(); for (int i = 0; i < n; i++) { @@ -704,7 +704,7 @@ size_t WireFormatLite::UInt32Size(const RepeatedField<uint32_t>& value) { return out; } -size_t WireFormatLite::SInt32Size(const RepeatedField<int32_t>& value) { +size_t WireFormatLite::SInt32Size(const RepeatedField<i32>& value) { size_t out = 0; const int n = value.size(); for (int i = 0; i < n; i++) { @@ -730,35 +730,21 @@ size_t WireFormatLite::EnumSize(const RepeatedField<int>& value) { // enable this. #define USE_SSE_FOR_64_BIT_INTEGER_ARRAYS 0 #if USE_SSE_FOR_64_BIT_INTEGER_ARRAYS -size_t WireFormatLite::Int64Size(const RepeatedField<int64>& value) { +size_t WireFormatLite::Int64Size(const RepeatedField<i64>& value) { return VarintSize64<false>(value.data(), value.size()); } -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -size_t WireFormatLite::Int64Size(const RepeatedField<int64_t>& value) { - return VarintSize64<false>(value.data(), value.size()); -} -#endif -size_t WireFormatLite::UInt64Size(const RepeatedField<uint64>& value) { - return VarintSize64<false>(value.data(), value.size()); -} -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -size_t WireFormatLite::UInt64Size(const RepeatedField<uint64_t>& value) { +size_t WireFormatLite::UInt64Size(const RepeatedField<ui64>& value) { return VarintSize64<false>(value.data(), value.size()); } -#endif -size_t WireFormatLite::SInt64Size(const RepeatedField<int64>& value) { - return VarintSize64<true>(value.data(), value.size()); -} -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -size_t WireFormatLite::SInt64Size(const RepeatedField<int64_t>& value) { + +size_t WireFormatLite::SInt64Size(const RepeatedField<i64>& value) { return VarintSize64<true>(value.data(), value.size()); } -#endif #else -size_t WireFormatLite::Int64Size(const RepeatedField<int64>& value) { +size_t WireFormatLite::Int64Size(const RepeatedField<i64>& value) { size_t out = 0; const int n = value.size(); for (int i = 0; i < n; i++) { @@ -767,18 +753,7 @@ size_t WireFormatLite::Int64Size(const RepeatedField<int64>& value) { return out; } -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -size_t WireFormatLite::Int64Size(const RepeatedField<int64_t>& value) { - size_t out = 0; - const int n = value.size(); - for (int i = 0; i < n; i++) { - out += Int64Size(value.Get(i)); - } - return out; -} -#endif - -size_t WireFormatLite::UInt64Size(const RepeatedField<uint64>& value) { +size_t WireFormatLite::UInt64Size(const RepeatedField<ui64>& value) { size_t out = 0; const int n = value.size(); for (int i = 0; i < n; i++) { @@ -786,18 +761,8 @@ size_t WireFormatLite::UInt64Size(const RepeatedField<uint64>& value) { } return out; } -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -size_t WireFormatLite::UInt64Size(const RepeatedField<uint64_t>& value) { - size_t out = 0; - const int n = value.size(); - for (int i = 0; i < n; i++) { - out += UInt64Size(value.Get(i)); - } - return out; -} -#endif -size_t WireFormatLite::SInt64Size(const RepeatedField<int64>& value) { +size_t WireFormatLite::SInt64Size(const RepeatedField<i64>& value) { size_t out = 0; const int n = value.size(); for (int i = 0; i < n; i++) { @@ -805,16 +770,6 @@ size_t WireFormatLite::SInt64Size(const RepeatedField<int64>& value) { } return out; } -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -size_t WireFormatLite::SInt64Size(const RepeatedField<int64_t>& value) { - size_t out = 0; - const int n = value.size(); - for (int i = 0; i < n; i++) { - out += SInt64Size(value.Get(i)); - } - return out; -} -#endif #endif diff --git a/contrib/libs/protobuf/src/google/protobuf/wire_format_lite.h b/contrib/libs/protobuf/src/google/protobuf/wire_format_lite.h index 7412457369..2b560919a7 100644 --- a/contrib/libs/protobuf/src/google/protobuf/wire_format_lite.h +++ b/contrib/libs/protobuf/src/google/protobuf/wire_format_lite.h @@ -153,16 +153,16 @@ class PROTOBUF_EXPORT WireFormatLite { // Number of bits in a tag which identify the wire type. static constexpr int kTagTypeBits = 3; // Mask for those bits. - static constexpr uint32_t kTagTypeMask = (1 << kTagTypeBits) - 1; + static constexpr ui32 kTagTypeMask = (1 << kTagTypeBits) - 1; // Helper functions for encoding and decoding tags. (Inlined below and in // _inl.h) // // This is different from MakeTag(field->number(), field->type()) in the // case of packed repeated fields. - constexpr static uint32_t MakeTag(int field_number, WireType type); - static WireType GetTagWireType(uint32_t tag); - static int GetTagFieldNumber(uint32_t tag); + constexpr static ui32 MakeTag(int field_number, WireType type); + static WireType GetTagWireType(ui32 tag); + static int GetTagFieldNumber(ui32 tag); // Compute the byte size of a tag. For groups, this includes both the start // and end tags. @@ -173,12 +173,12 @@ class PROTOBUF_EXPORT WireFormatLite { // positioned immediately after the tag. Skipped values are simply // discarded, not recorded anywhere. See WireFormat::SkipField() for a // version that records to an UnknownFieldSet. - static bool SkipField(io::CodedInputStream* input, uint32_t tag); + static bool SkipField(io::CodedInputStream* input, ui32 tag); // Skips a field value with the given tag. The input should start // positioned immediately after the tag. Skipped values are recorded to a // CodedOutputStream. - static bool SkipField(io::CodedInputStream* input, uint32_t tag, + static bool SkipField(io::CodedInputStream* input, ui32 tag, io::CodedOutputStream* output); // Reads and ignores a message from the input. Skipped values are simply @@ -196,7 +196,7 @@ class PROTOBUF_EXPORT WireFormatLite { // as a switch case or a template input. WireFormatLite::MakeTag() is more // type-safe, though, so prefer it if possible. #define GOOGLE_PROTOBUF_WIRE_FORMAT_MAKE_TAG(FIELD_NUMBER, TYPE) \ - static_cast<uint32_t>((static_cast<uint32_t>(FIELD_NUMBER) << 3) | (TYPE)) + static_cast<ui32>((static_cast<ui32>(FIELD_NUMBER) << 3) | (TYPE)) // These are the tags for the old MessageSet format, which was defined as: // message MessageSet { @@ -223,10 +223,10 @@ class PROTOBUF_EXPORT WireFormatLite { // Helper functions for converting between floats/doubles and IEEE-754 // uint32s/uint64s so that they can be written. (Assumes your platform // uses IEEE-754 floats.) - static uint32_t EncodeFloat(float value); - static float DecodeFloat(uint32_t value); - static uint64_t EncodeDouble(double value); - static double DecodeDouble(uint64_t value); + static ui32 EncodeFloat(float value); + static float DecodeFloat(ui32 value); + static ui64 EncodeDouble(double value); + static double DecodeDouble(ui64 value); // Helper functions for mapping signed integers to unsigned integers in // such a way that numbers with small magnitudes will encode to smaller @@ -234,10 +234,10 @@ class PROTOBUF_EXPORT WireFormatLite { // number and varint-encode it, it will always take 10 bytes, defeating // the purpose of varint. So, for the "sint32" and "sint64" field types, // we ZigZag-encode the values. - static uint32_t ZigZagEncode32(int32_t n); - static int32_t ZigZagDecode32(uint32_t n); - static uint64_t ZigZagEncode64(int64_t n); - static int64_t ZigZagDecode64(uint64_t n); + static ui32 ZigZagEncode32(i32 n); + static i32 ZigZagDecode32(ui32 n); + static ui64 ZigZagEncode64(i64 n); + static i64 ZigZagDecode64(ui64 n); // ================================================================= // Methods for reading/writing individual field. @@ -257,13 +257,13 @@ class PROTOBUF_EXPORT WireFormatLite { // protocol compiler. template <typename CType, enum FieldType DeclaredType> PROTOBUF_NDEBUG_INLINE static bool ReadRepeatedPrimitive( - int tag_size, uint32_t tag, io::CodedInputStream* input, + int tag_size, ui32 tag, io::CodedInputStream* input, RepeatedField<CType>* value); // Identical to ReadRepeatedPrimitive, except will not inline the // implementation. template <typename CType, enum FieldType DeclaredType> - static bool ReadRepeatedPrimitiveNoInline(int tag_size, uint32_t tag, + static bool ReadRepeatedPrimitiveNoInline(int tag_size, ui32 tag, io::CodedInputStream* input, RepeatedField<CType>* value); @@ -346,45 +346,25 @@ class PROTOBUF_EXPORT WireFormatLite { // Write fields, without tags. PROTOBUF_NDEBUG_INLINE static void WriteInt32NoTag( - int32_t value, io::CodedOutputStream* output); + i32 value, io::CodedOutputStream* output); PROTOBUF_NDEBUG_INLINE static void WriteInt64NoTag( - int64 value, io::CodedOutputStream* output); -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) - PROTOBUF_NDEBUG_INLINE static void WriteInt64NoTag( - int64_t value, io::CodedOutputStream* output); -#endif + i64 value, io::CodedOutputStream* output); PROTOBUF_NDEBUG_INLINE static void WriteUInt32NoTag( - uint32_t value, io::CodedOutputStream* output); - PROTOBUF_NDEBUG_INLINE static void WriteUInt64NoTag( - uint64 value, io::CodedOutputStream* output); -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) + ui32 value, io::CodedOutputStream* output); PROTOBUF_NDEBUG_INLINE static void WriteUInt64NoTag( - uint64_t value, io::CodedOutputStream* output); -#endif + ui64 value, io::CodedOutputStream* output); PROTOBUF_NDEBUG_INLINE static void WriteSInt32NoTag( - int32_t value, io::CodedOutputStream* output); + i32 value, io::CodedOutputStream* output); PROTOBUF_NDEBUG_INLINE static void WriteSInt64NoTag( - int64 value, io::CodedOutputStream* output); -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) - PROTOBUF_NDEBUG_INLINE static void WriteSInt64NoTag( - int64_t value, io::CodedOutputStream* output); -#endif + i64 value, io::CodedOutputStream* output); PROTOBUF_NDEBUG_INLINE static void WriteFixed32NoTag( - uint32_t value, io::CodedOutputStream* output); + ui32 value, io::CodedOutputStream* output); PROTOBUF_NDEBUG_INLINE static void WriteFixed64NoTag( - uint64 value, io::CodedOutputStream* output); -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) - PROTOBUF_NDEBUG_INLINE static void WriteFixed64NoTag( - uint64_t value, io::CodedOutputStream* output); -#endif + ui64 value, io::CodedOutputStream* output); PROTOBUF_NDEBUG_INLINE static void WriteSFixed32NoTag( - int32_t value, io::CodedOutputStream* output); + i32 value, io::CodedOutputStream* output); PROTOBUF_NDEBUG_INLINE static void WriteSFixed64NoTag( - int64 value, io::CodedOutputStream* output); -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) - PROTOBUF_NDEBUG_INLINE static void WriteSFixed64NoTag( - int64_t value, io::CodedOutputStream* output); -#endif + i64 value, io::CodedOutputStream* output); PROTOBUF_NDEBUG_INLINE static void WriteFloatNoTag( float value, io::CodedOutputStream* output); PROTOBUF_NDEBUG_INLINE static void WriteDoubleNoTag( @@ -399,37 +379,37 @@ class PROTOBUF_EXPORT WireFormatLite { io::CodedOutputStream* output); static void WriteDoubleArray(const double* a, int n, io::CodedOutputStream* output); - static void WriteFixed32Array(const uint32_t* a, int n, + static void WriteFixed32Array(const ui32* a, int n, io::CodedOutputStream* output); - static void WriteFixed64Array(const uint64_t* a, int n, + static void WriteFixed64Array(const ui64* a, int n, io::CodedOutputStream* output); - static void WriteSFixed32Array(const int32_t* a, int n, + static void WriteSFixed32Array(const i32* a, int n, io::CodedOutputStream* output); - static void WriteSFixed64Array(const int64_t* a, int n, + static void WriteSFixed64Array(const i64* a, int n, io::CodedOutputStream* output); static void WriteBoolArray(const bool* a, int n, io::CodedOutputStream* output); // Write fields, including tags. - static void WriteInt32(int field_number, int32_t value, + static void WriteInt32(int field_number, i32 value, io::CodedOutputStream* output); - static void WriteInt64(int field_number, int64_t value, + static void WriteInt64(int field_number, i64 value, io::CodedOutputStream* output); - static void WriteUInt32(int field_number, uint32_t value, + static void WriteUInt32(int field_number, ui32 value, io::CodedOutputStream* output); - static void WriteUInt64(int field_number, uint64_t value, + static void WriteUInt64(int field_number, ui64 value, io::CodedOutputStream* output); - static void WriteSInt32(int field_number, int32_t value, + static void WriteSInt32(int field_number, i32 value, io::CodedOutputStream* output); - static void WriteSInt64(int field_number, int64_t value, + static void WriteSInt64(int field_number, i64 value, io::CodedOutputStream* output); - static void WriteFixed32(int field_number, uint32_t value, + static void WriteFixed32(int field_number, ui32 value, io::CodedOutputStream* output); - static void WriteFixed64(int field_number, uint64_t value, + static void WriteFixed64(int field_number, ui64 value, io::CodedOutputStream* output); - static void WriteSFixed32(int field_number, int32_t value, + static void WriteSFixed32(int field_number, i32 value, io::CodedOutputStream* output); - static void WriteSFixed64(int field_number, int64_t value, + static void WriteSFixed64(int field_number, i64 value, io::CodedOutputStream* output); static void WriteFloat(int field_number, float value, io::CodedOutputStream* output); @@ -481,45 +461,25 @@ class PROTOBUF_EXPORT WireFormatLite { // Write fields, without tags. PROTOBUF_NDEBUG_INLINE static uint8_t* WriteInt32NoTagToArray( - int32_t value, uint8_t* target); + i32 value, uint8_t* target); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteInt64NoTagToArray( - int64 value, uint8_t* target); -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) - PROTOBUF_NDEBUG_INLINE static uint8_t* WriteInt64NoTagToArray( - int64_t value, uint8_t* target); -#endif + i64 value, uint8_t* target); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteUInt32NoTagToArray( - uint32_t value, uint8_t* target); + ui32 value, uint8_t* target); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteUInt64NoTagToArray( - uint64 value, uint8_t* target); -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) - PROTOBUF_NDEBUG_INLINE static uint8_t* WriteUInt64NoTagToArray( - uint64_t value, uint8_t* target); -#endif + ui64 value, uint8_t* target); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSInt32NoTagToArray( - int32_t value, uint8_t* target); + i32 value, uint8_t* target); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSInt64NoTagToArray( - int64 value, uint8_t* target); -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) - PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSInt64NoTagToArray( - int64_t value, uint8_t* target); -#endif + i64 value, uint8_t* target); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteFixed32NoTagToArray( - uint32_t value, uint8_t* target); + ui32 value, uint8_t* target); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteFixed64NoTagToArray( - uint64 value, uint8_t* target); -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) - PROTOBUF_NDEBUG_INLINE static uint8_t* WriteFixed64NoTagToArray( - uint64_t value, uint8_t* target); -#endif + ui64 value, uint8_t* target); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSFixed32NoTagToArray( - int32_t value, uint8_t* target); + i32 value, uint8_t* target); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSFixed64NoTagToArray( - int64 value, uint8_t* target); -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) - PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSFixed64NoTagToArray( - int64_t value, uint8_t* target); -#endif + i64 value, uint8_t* target); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteFloatNoTagToArray( float value, uint8_t* target); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteDoubleNoTagToArray( @@ -540,45 +500,25 @@ class PROTOBUF_EXPORT WireFormatLite { uint8_t* target); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteInt32NoTagToArray( - const RepeatedField<int32_t>& value, uint8_t* output); - PROTOBUF_NDEBUG_INLINE static uint8_t* WriteInt64NoTagToArray( - const RepeatedField<int64>& value, uint8_t* output); -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) + const RepeatedField<i32>& value, uint8_t* output); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteInt64NoTagToArray( - const RepeatedField<int64_t>& value, uint8_t* output); -#endif + const RepeatedField<i64>& value, uint8_t* output); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteUInt32NoTagToArray( - const RepeatedField<uint32_t>& value, uint8_t* output); - PROTOBUF_NDEBUG_INLINE static uint8_t* WriteUInt64NoTagToArray( - const RepeatedField<uint64>& value, uint8_t* output); -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) + const RepeatedField<ui32>& value, uint8_t* output); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteUInt64NoTagToArray( - const RepeatedField<uint64_t>& value, uint8_t* output); -#endif + const RepeatedField<ui64>& value, uint8_t* output); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSInt32NoTagToArray( - const RepeatedField<int32_t>& value, uint8_t* output); - PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSInt64NoTagToArray( - const RepeatedField<int64>& value, uint8_t* output); -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) + const RepeatedField<i32>& value, uint8_t* output); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSInt64NoTagToArray( - const RepeatedField<int64_t>& value, uint8_t* output); -#endif + const RepeatedField<i64>& value, uint8_t* output); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteFixed32NoTagToArray( - const RepeatedField<uint32_t>& value, uint8_t* output); - PROTOBUF_NDEBUG_INLINE static uint8_t* WriteFixed64NoTagToArray( - const RepeatedField<uint64>& value, uint8_t* output); -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) + const RepeatedField<ui32>& value, uint8_t* output); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteFixed64NoTagToArray( - const RepeatedField<uint64_t>& value, uint8_t* output); -#endif + const RepeatedField<ui64>& value, uint8_t* output); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSFixed32NoTagToArray( - const RepeatedField<int32_t>& value, uint8_t* output); - PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSFixed64NoTagToArray( - const RepeatedField<int64>& value, uint8_t* output); -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) + const RepeatedField<i32>& value, uint8_t* output); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSFixed64NoTagToArray( - const RepeatedField<int64_t>& value, uint8_t* output); -#endif + const RepeatedField<i64>& value, uint8_t* output); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteFloatNoTagToArray( const RepeatedField<float>& value, uint8_t* output); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteDoubleNoTagToArray( @@ -590,34 +530,34 @@ class PROTOBUF_EXPORT WireFormatLite { // Write fields, including tags. PROTOBUF_NDEBUG_INLINE static uint8_t* WriteInt32ToArray(int field_number, - int32_t value, + i32 value, uint8_t* target); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteInt64ToArray(int field_number, - int64_t value, + i64 value, uint8_t* target); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteUInt32ToArray(int field_number, - uint32_t value, + ui32 value, uint8_t* target); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteUInt64ToArray(int field_number, - uint64_t value, + ui64 value, uint8_t* target); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSInt32ToArray(int field_number, - int32_t value, + i32 value, uint8_t* target); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSInt64ToArray(int field_number, - int64_t value, + i64 value, uint8_t* target); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteFixed32ToArray(int field_number, - uint32_t value, + ui32 value, uint8_t* target); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteFixed64ToArray(int field_number, - uint64_t value, + ui64 value, uint8_t* target); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSFixed32ToArray(int field_number, - int32_t value, + i32 value, uint8_t* target); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSFixed64ToArray(int field_number, - int64_t value, + i64 value, uint8_t* target); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteFloatToArray(int field_number, float value, @@ -638,25 +578,25 @@ class PROTOBUF_EXPORT WireFormatLite { uint8_t* (*Writer)(int, T, uint8_t*), uint8_t* target); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteInt32ToArray( - int field_number, const RepeatedField<int32_t>& value, uint8_t* output); + int field_number, const RepeatedField<i32>& value, uint8_t* output); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteInt64ToArray( - int field_number, const RepeatedField<int64_t>& value, uint8_t* output); + int field_number, const RepeatedField<i64>& value, uint8_t* output); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteUInt32ToArray( - int field_number, const RepeatedField<uint32_t>& value, uint8_t* output); + int field_number, const RepeatedField<ui32>& value, uint8_t* output); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteUInt64ToArray( - int field_number, const RepeatedField<uint64_t>& value, uint8_t* output); + int field_number, const RepeatedField<ui64>& value, uint8_t* output); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSInt32ToArray( - int field_number, const RepeatedField<int32_t>& value, uint8_t* output); + int field_number, const RepeatedField<i32>& value, uint8_t* output); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSInt64ToArray( - int field_number, const RepeatedField<int64_t>& value, uint8_t* output); + int field_number, const RepeatedField<i64>& value, uint8_t* output); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteFixed32ToArray( - int field_number, const RepeatedField<uint32_t>& value, uint8_t* output); + int field_number, const RepeatedField<ui32>& value, uint8_t* output); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteFixed64ToArray( - int field_number, const RepeatedField<uint64_t>& value, uint8_t* output); + int field_number, const RepeatedField<ui64>& value, uint8_t* output); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSFixed32ToArray( - int field_number, const RepeatedField<int32_t>& value, uint8_t* output); + int field_number, const RepeatedField<i32>& value, uint8_t* output); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSFixed64ToArray( - int field_number, const RepeatedField<int64_t>& value, uint8_t* output); + int field_number, const RepeatedField<i64>& value, uint8_t* output); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteFloatToArray( int field_number, const RepeatedField<float>& value, uint8_t* output); PROTOBUF_NDEBUG_INLINE static uint8_t* WriteDoubleToArray( @@ -703,7 +643,7 @@ class PROTOBUF_EXPORT WireFormatLite { target, value.GetCachedSize() + static_cast<int>(2 * io::CodedOutputStream::VarintSize32( - static_cast<uint32_t>(field_number) << 3)), + static_cast<ui32>(field_number) << 3)), io::CodedOutputStream::IsDefaultSerializationDeterministic()); return InternalWriteGroup(field_number, value, target, &stream); } @@ -713,7 +653,7 @@ class PROTOBUF_EXPORT WireFormatLite { io::EpsCopyOutputStream stream( target, size + static_cast<int>(io::CodedOutputStream::VarintSize32( - static_cast<uint32_t>(field_number) << 3) + + static_cast<ui32>(field_number) << 3) + io::CodedOutputStream::VarintSize32(size)), io::CodedOutputStream::IsDefaultSerializationDeterministic()); return InternalWriteMessage(field_number, value, target, &stream); @@ -723,42 +663,27 @@ class PROTOBUF_EXPORT WireFormatLite { // the tag, so you must also call TagSize(). (This is because, for repeated // fields, you should only call TagSize() once and multiply it by the element // count, but you may have to call XxSize() for each individual element.) - static inline size_t Int32Size(int32_t value); - static inline size_t Int64Size(int64 value); -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) - static inline size_t Int64Size(int64_t value); -#endif - static inline size_t UInt32Size(uint32_t value); - static inline size_t UInt64Size(uint64 value); - static inline size_t SInt32Size(int32_t value); - static inline size_t SInt64Size(int64 value); -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) - static inline size_t SInt64Size(int64_t value); -#endif + static inline size_t Int32Size(i32 value); + static inline size_t Int64Size(i64 value); + static inline size_t UInt32Size(ui32 value); + static inline size_t UInt64Size(ui64 value); + static inline size_t SInt32Size(i32 value); + static inline size_t SInt64Size(i64 value); static inline size_t EnumSize(int value); - static inline size_t Int32SizePlusOne(int32_t value); - static inline size_t Int64SizePlusOne(int64_t value); - static inline size_t UInt32SizePlusOne(uint32_t value); - static inline size_t UInt64SizePlusOne(uint64_t value); - static inline size_t SInt32SizePlusOne(int32_t value); - static inline size_t SInt64SizePlusOne(int64_t value); + static inline size_t Int32SizePlusOne(i32 value); + static inline size_t Int64SizePlusOne(i64 value); + static inline size_t UInt32SizePlusOne(ui32 value); + static inline size_t UInt64SizePlusOne(ui64 value); + static inline size_t SInt32SizePlusOne(i32 value); + static inline size_t SInt64SizePlusOne(i64 value); static inline size_t EnumSizePlusOne(int value); - static size_t Int32Size(const RepeatedField<int32_t>& value); - static size_t Int64Size(const RepeatedField<int64>& value); -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) - static size_t Int64Size(const RepeatedField<int64_t>& value); -#endif - static size_t UInt32Size(const RepeatedField<uint32_t>& value); - static size_t UInt64Size(const RepeatedField<uint64>& value); -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) - static size_t UInt64Size(const RepeatedField<uint64_t>& value); -#endif - static size_t SInt32Size(const RepeatedField<int32_t>& value); - static size_t SInt64Size(const RepeatedField<int64>& value); -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) - static size_t SInt64Size(const RepeatedField<int64_t>& value); -#endif + static size_t Int32Size(const RepeatedField<i32>& value); + static size_t Int64Size(const RepeatedField<i64>& value); + static size_t UInt32Size(const RepeatedField<ui32>& value); + static size_t UInt64Size(const RepeatedField<ui64>& value); + static size_t SInt32Size(const RepeatedField<i32>& value); + static size_t SInt64Size(const RepeatedField<i64>& value); static size_t EnumSize(const RepeatedField<int>& value); // These types always have the same size. @@ -796,7 +721,7 @@ class PROTOBUF_EXPORT WireFormatLite { // can be read using potentially faster paths. template <typename CType, enum FieldType DeclaredType> PROTOBUF_NDEBUG_INLINE static bool ReadRepeatedFixedSizePrimitive( - int tag_size, uint32_t tag, io::CodedInputStream* input, + int tag_size, ui32 tag, io::CodedInputStream* input, RepeatedField<CType>* value); // Like ReadRepeatedFixedSizePrimitive but for packed primitive fields. @@ -822,7 +747,7 @@ class PROTOBUF_EXPORT FieldSkipper { virtual ~FieldSkipper() {} // Skip a field whose tag has already been consumed. - virtual bool SkipField(io::CodedInputStream* input, uint32_t tag); + virtual bool SkipField(io::CodedInputStream* input, ui32 tag); // Skip an entire message or group, up to an end-group tag (which is consumed) // or end-of-stream. @@ -843,7 +768,7 @@ class PROTOBUF_EXPORT CodedOutputStreamFieldSkipper : public FieldSkipper { ~CodedOutputStreamFieldSkipper() override {} // implements FieldSkipper ----------------------------------------- - bool SkipField(io::CodedInputStream* input, uint32_t tag) override; + bool SkipField(io::CodedInputStream* input, ui32 tag) override; bool SkipMessage(io::CodedInputStream* input) override; void SkipUnknownEnum(int field_number, int value) override; @@ -858,23 +783,23 @@ inline WireFormatLite::CppType WireFormatLite::FieldTypeToCppType( return kFieldTypeToCppTypeMap[type]; } -constexpr inline uint32_t WireFormatLite::MakeTag(int field_number, +constexpr inline ui32 WireFormatLite::MakeTag(int field_number, WireType type) { return GOOGLE_PROTOBUF_WIRE_FORMAT_MAKE_TAG(field_number, type); } -inline WireFormatLite::WireType WireFormatLite::GetTagWireType(uint32_t tag) { +inline WireFormatLite::WireType WireFormatLite::GetTagWireType(ui32 tag) { return static_cast<WireType>(tag & kTagTypeMask); } -inline int WireFormatLite::GetTagFieldNumber(uint32_t tag) { +inline int WireFormatLite::GetTagFieldNumber(ui32 tag) { return static_cast<int>(tag >> kTagTypeBits); } inline size_t WireFormatLite::TagSize(int field_number, WireFormatLite::FieldType type) { size_t result = io::CodedOutputStream::VarintSize32( - static_cast<uint32_t>(field_number << kTagTypeBits)); + static_cast<ui32>(field_number << kTagTypeBits)); if (type == TYPE_GROUP) { // Groups have both a start and an end tag. return result * 2; @@ -883,19 +808,19 @@ inline size_t WireFormatLite::TagSize(int field_number, } } -inline uint32_t WireFormatLite::EncodeFloat(float value) { - return bit_cast<uint32_t>(value); +inline ui32 WireFormatLite::EncodeFloat(float value) { + return bit_cast<ui32>(value); } -inline float WireFormatLite::DecodeFloat(uint32_t value) { +inline float WireFormatLite::DecodeFloat(ui32 value) { return bit_cast<float>(value); } -inline uint64_t WireFormatLite::EncodeDouble(double value) { - return bit_cast<uint64_t>(value); +inline ui64 WireFormatLite::EncodeDouble(double value) { + return bit_cast<ui64>(value); } -inline double WireFormatLite::DecodeDouble(uint64_t value) { +inline double WireFormatLite::DecodeDouble(ui64 value) { return bit_cast<double>(value); } @@ -910,7 +835,7 @@ inline double WireFormatLite::DecodeDouble(uint64_t value) { // in such a way that those with a small absolute value will have smaller // encoded values, making them appropriate for encoding using varint. // -// int32_t -> uint32_t +// i32 -> ui32 // ------------------------- // 0 -> 0 // -1 -> 1 @@ -923,26 +848,26 @@ inline double WireFormatLite::DecodeDouble(uint64_t value) { // >> encode >> // << decode << -inline uint32_t WireFormatLite::ZigZagEncode32(int32_t n) { +inline ui32 WireFormatLite::ZigZagEncode32(i32 n) { // Note: the right-shift must be arithmetic // Note: left shift must be unsigned because of overflow - return (static_cast<uint32_t>(n) << 1) ^ static_cast<uint32_t>(n >> 31); + return (static_cast<ui32>(n) << 1) ^ static_cast<ui32>(n >> 31); } -inline int32_t WireFormatLite::ZigZagDecode32(uint32_t n) { +inline i32 WireFormatLite::ZigZagDecode32(ui32 n) { // Note: Using unsigned types prevent undefined behavior - return static_cast<int32_t>((n >> 1) ^ (~(n & 1) + 1)); + return static_cast<i32>((n >> 1) ^ (~(n & 1) + 1)); } -inline uint64_t WireFormatLite::ZigZagEncode64(int64_t n) { +inline ui64 WireFormatLite::ZigZagEncode64(i64 n) { // Note: the right-shift must be arithmetic // Note: left shift must be unsigned because of overflow - return (static_cast<uint64_t>(n) << 1) ^ static_cast<uint64_t>(n >> 63); + return (static_cast<ui64>(n) << 1) ^ static_cast<ui64>(n >> 63); } -inline int64_t WireFormatLite::ZigZagDecode64(uint64_t n) { +inline i64 WireFormatLite::ZigZagDecode64(ui64 n) { // Note: Using unsigned types prevent undefined behavior - return static_cast<int64_t>((n >> 1) ^ (~(n & 1) + 1)); + return static_cast<i64>((n >> 1) ^ (~(n & 1) + 1)); } // String is for UTF-8 text only, but, even so, ReadString() can simply @@ -973,130 +898,83 @@ inline size_t ComputeUnknownMessageSetItemsSize( // Implementation details of ReadPrimitive. template <> -inline bool WireFormatLite::ReadPrimitive<int32_t, WireFormatLite::TYPE_INT32>( - io::CodedInputStream* input, int32_t* value) { - uint32_t temp; +inline bool WireFormatLite::ReadPrimitive<i32, WireFormatLite::TYPE_INT32>( + io::CodedInputStream* input, i32* value) { + ui32 temp; if (!input->ReadVarint32(&temp)) return false; - *value = static_cast<int32_t>(temp); + *value = static_cast<i32>(temp); return true; } template <> -inline bool WireFormatLite::ReadPrimitive<int64, WireFormatLite::TYPE_INT64>( - io::CodedInputStream* input, int64* value) { - uint64 temp; +inline bool WireFormatLite::ReadPrimitive<i64, WireFormatLite::TYPE_INT64>( + io::CodedInputStream* input, i64* value) { + ui64 temp; if (!input->ReadVarint64(&temp)) return false; - *value = static_cast<int64>(temp); + *value = static_cast<i64>(temp); return true; } -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -template <> -inline bool WireFormatLite::ReadPrimitive<int64_t, WireFormatLite::TYPE_INT64>( - io::CodedInputStream* input, int64_t* value) { - uint64_t temp; - if (!input->ReadVarint64(&temp)) return false; - *value = static_cast<int64_t>(temp); - return true; -} -#endif template <> inline bool -WireFormatLite::ReadPrimitive<uint32_t, WireFormatLite::TYPE_UINT32>( - io::CodedInputStream* input, uint32_t* value) { +WireFormatLite::ReadPrimitive<ui32, WireFormatLite::TYPE_UINT32>( + io::CodedInputStream* input, ui32* value) { return input->ReadVarint32(value); } template <> inline bool -WireFormatLite::ReadPrimitive<uint64, WireFormatLite::TYPE_UINT64>( - io::CodedInputStream* input, uint64* value) { +WireFormatLite::ReadPrimitive<ui64, WireFormatLite::TYPE_UINT64>( + io::CodedInputStream* input, ui64* value) { return input->ReadVarint64(value); } -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) template <> -inline bool -WireFormatLite::ReadPrimitive<uint64_t, WireFormatLite::TYPE_UINT64>( - io::CodedInputStream* input, uint64_t* value) { - return input->ReadVarint64(value); -} -#endif -template <> -inline bool WireFormatLite::ReadPrimitive<int32_t, WireFormatLite::TYPE_SINT32>( - io::CodedInputStream* input, int32_t* value) { - uint32_t temp; +inline bool WireFormatLite::ReadPrimitive<i32, WireFormatLite::TYPE_SINT32>( + io::CodedInputStream* input, i32* value) { + ui32 temp; if (!input->ReadVarint32(&temp)) return false; *value = ZigZagDecode32(temp); return true; } template <> -inline bool WireFormatLite::ReadPrimitive<int64, WireFormatLite::TYPE_SINT64>( - io::CodedInputStream* input, int64* value) { - uint64 temp; - if (!input->ReadVarint64(&temp)) return false; - *value = ZigZagDecode64(temp); - return true; -} -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -template <> -inline bool WireFormatLite::ReadPrimitive<int64_t, WireFormatLite::TYPE_SINT64>( - io::CodedInputStream* input, int64_t* value) { - uint64_t temp; +inline bool WireFormatLite::ReadPrimitive<i64, WireFormatLite::TYPE_SINT64>( + io::CodedInputStream* input, i64* value) { + ui64 temp; if (!input->ReadVarint64(&temp)) return false; *value = ZigZagDecode64(temp); return true; } -#endif template <> inline bool -WireFormatLite::ReadPrimitive<uint32_t, WireFormatLite::TYPE_FIXED32>( - io::CodedInputStream* input, uint32_t* value) { +WireFormatLite::ReadPrimitive<ui32, WireFormatLite::TYPE_FIXED32>( + io::CodedInputStream* input, ui32* value) { return input->ReadLittleEndian32(value); } template <> inline bool -WireFormatLite::ReadPrimitive<uint64, WireFormatLite::TYPE_FIXED64>( - io::CodedInputStream* input, uint64* value) { - return input->ReadLittleEndian64(value); -} -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -template <> -inline bool -WireFormatLite::ReadPrimitive<uint64_t, WireFormatLite::TYPE_FIXED64>( - io::CodedInputStream* input, uint64_t* value) { +WireFormatLite::ReadPrimitive<ui64, WireFormatLite::TYPE_FIXED64>( + io::CodedInputStream* input, ui64* value) { return input->ReadLittleEndian64(value); } -#endif template <> inline bool -WireFormatLite::ReadPrimitive<int32_t, WireFormatLite::TYPE_SFIXED32>( - io::CodedInputStream* input, int32_t* value) { - uint32_t temp; +WireFormatLite::ReadPrimitive<i32, WireFormatLite::TYPE_SFIXED32>( + io::CodedInputStream* input, i32* value) { + ui32 temp; if (!input->ReadLittleEndian32(&temp)) return false; - *value = static_cast<int32_t>(temp); + *value = static_cast<i32>(temp); return true; } template <> inline bool -WireFormatLite::ReadPrimitive<int64, WireFormatLite::TYPE_SFIXED64>( - io::CodedInputStream* input, int64* value) { - uint64 temp; +WireFormatLite::ReadPrimitive<i64, WireFormatLite::TYPE_SFIXED64>( + io::CodedInputStream* input, i64* value) { + ui64 temp; if (!input->ReadLittleEndian64(&temp)) return false; - *value = static_cast<int64>(temp); + *value = static_cast<i64>(temp); return true; } -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -template <> -inline bool -WireFormatLite::ReadPrimitive<int64_t, WireFormatLite::TYPE_SFIXED64>( - io::CodedInputStream* input, int64_t* value) { - uint64_t temp; - if (!input->ReadLittleEndian64(&temp)) return false; - *value = static_cast<int64_t>(temp); - return true; -} -#endif template <> inline bool WireFormatLite::ReadPrimitive<float, WireFormatLite::TYPE_FLOAT>( io::CodedInputStream* input, float* value) { - uint32_t temp; + ui32 temp; if (!input->ReadLittleEndian32(&temp)) return false; *value = DecodeFloat(temp); return true; @@ -1104,7 +982,7 @@ inline bool WireFormatLite::ReadPrimitive<float, WireFormatLite::TYPE_FLOAT>( template <> inline bool WireFormatLite::ReadPrimitive<double, WireFormatLite::TYPE_DOUBLE>( io::CodedInputStream* input, double* value) { - uint64_t temp; + ui64 temp; if (!input->ReadLittleEndian64(&temp)) return false; *value = DecodeDouble(temp); return true; @@ -1112,7 +990,7 @@ inline bool WireFormatLite::ReadPrimitive<double, WireFormatLite::TYPE_DOUBLE>( template <> inline bool WireFormatLite::ReadPrimitive<bool, WireFormatLite::TYPE_BOOL>( io::CodedInputStream* input, bool* value) { - uint64_t temp; + ui64 temp; if (!input->ReadVarint64(&temp)) return false; *value = temp != 0; return true; @@ -1120,7 +998,7 @@ inline bool WireFormatLite::ReadPrimitive<bool, WireFormatLite::TYPE_BOOL>( template <> inline bool WireFormatLite::ReadPrimitive<int, WireFormatLite::TYPE_ENUM>( io::CodedInputStream* input, int* value) { - uint32_t temp; + ui32 temp; if (!input->ReadVarint32(&temp)) return false; *value = static_cast<int>(temp); return true; @@ -1128,58 +1006,39 @@ inline bool WireFormatLite::ReadPrimitive<int, WireFormatLite::TYPE_ENUM>( template <> inline const uint8_t* -WireFormatLite::ReadPrimitiveFromArray<uint32_t, WireFormatLite::TYPE_FIXED32>( - const uint8_t* buffer, uint32_t* value) { +WireFormatLite::ReadPrimitiveFromArray<ui32, WireFormatLite::TYPE_FIXED32>( + const uint8_t* buffer, ui32* value) { return io::CodedInputStream::ReadLittleEndian32FromArray(buffer, value); } template <> inline const uint8_t* -WireFormatLite::ReadPrimitiveFromArray<uint64, WireFormatLite::TYPE_FIXED64>( - const uint8_t* buffer, uint64* value) { - return io::CodedInputStream::ReadLittleEndian64FromArray(buffer, value); -} -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -template <> -inline const uint8_t* -WireFormatLite::ReadPrimitiveFromArray<uint64_t, WireFormatLite::TYPE_FIXED64>( - const uint8_t* buffer, uint64_t* value) { +WireFormatLite::ReadPrimitiveFromArray<ui64, WireFormatLite::TYPE_FIXED64>( + const uint8_t* buffer, ui64* value) { return io::CodedInputStream::ReadLittleEndian64FromArray(buffer, value); } -#endif template <> inline const uint8_t* -WireFormatLite::ReadPrimitiveFromArray<int32_t, WireFormatLite::TYPE_SFIXED32>( - const uint8_t* buffer, int32_t* value) { - uint32_t temp; +WireFormatLite::ReadPrimitiveFromArray<i32, WireFormatLite::TYPE_SFIXED32>( + const uint8_t* buffer, i32* value) { + ui32 temp; buffer = io::CodedInputStream::ReadLittleEndian32FromArray(buffer, &temp); - *value = static_cast<int32_t>(temp); - return buffer; -} -template <> -inline const uint8_t* -WireFormatLite::ReadPrimitiveFromArray<int64, WireFormatLite::TYPE_SFIXED64>( - const uint8_t* buffer, int64* value) { - uint64_t temp; - buffer = io::CodedInputStream::ReadLittleEndian64FromArray(buffer, &temp); - *value = static_cast<int64_t>(temp); + *value = static_cast<i32>(temp); return buffer; } -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) template <> inline const uint8_t* -WireFormatLite::ReadPrimitiveFromArray<int64_t, WireFormatLite::TYPE_SFIXED64>( - const uint8_t* buffer, int64_t* value) { - uint64_t temp; +WireFormatLite::ReadPrimitiveFromArray<i64, WireFormatLite::TYPE_SFIXED64>( + const uint8_t* buffer, i64* value) { + ui64 temp; buffer = io::CodedInputStream::ReadLittleEndian64FromArray(buffer, &temp); - *value = static_cast<int64_t>(temp); + *value = static_cast<i64>(temp); return buffer; } -#endif template <> inline const uint8_t* WireFormatLite::ReadPrimitiveFromArray<float, WireFormatLite::TYPE_FLOAT>( const uint8_t* buffer, float* value) { - uint32_t temp; + ui32 temp; buffer = io::CodedInputStream::ReadLittleEndian32FromArray(buffer, &temp); *value = DecodeFloat(temp); return buffer; @@ -1188,7 +1047,7 @@ template <> inline const uint8_t* WireFormatLite::ReadPrimitiveFromArray<double, WireFormatLite::TYPE_DOUBLE>( const uint8_t* buffer, double* value) { - uint64_t temp; + ui64 temp; buffer = io::CodedInputStream::ReadLittleEndian64FromArray(buffer, &temp); *value = DecodeDouble(temp); return buffer; @@ -1197,7 +1056,7 @@ WireFormatLite::ReadPrimitiveFromArray<double, WireFormatLite::TYPE_DOUBLE>( template <typename CType, enum WireFormatLite::FieldType DeclaredType> inline bool WireFormatLite::ReadRepeatedPrimitive( int, // tag_size, unused. - uint32_t tag, io::CodedInputStream* input, RepeatedField<CType>* values) { + ui32 tag, io::CodedInputStream* input, RepeatedField<CType>* values) { CType value; if (!ReadPrimitive<CType, DeclaredType>(input, &value)) return false; values->Add(value); @@ -1212,7 +1071,7 @@ inline bool WireFormatLite::ReadRepeatedPrimitive( template <typename CType, enum WireFormatLite::FieldType DeclaredType> inline bool WireFormatLite::ReadRepeatedFixedSizePrimitive( - int tag_size, uint32_t tag, io::CodedInputStream* input, + int tag_size, ui32 tag, io::CodedInputStream* input, RepeatedField<CType>* values) { GOOGLE_DCHECK_EQ(UInt32Size(tag), static_cast<size_t>(tag_size)); CType value; @@ -1261,17 +1120,17 @@ inline bool WireFormatLite::ReadRepeatedFixedSizePrimitive( template <> \ inline bool WireFormatLite::ReadRepeatedPrimitive< \ CPPTYPE, WireFormatLite::DECLARED_TYPE>( \ - int tag_size, uint32_t tag, io::CodedInputStream* input, \ + int tag_size, ui32 tag, io::CodedInputStream* input, \ RepeatedField<CPPTYPE>* values) { \ return ReadRepeatedFixedSizePrimitive<CPPTYPE, \ WireFormatLite::DECLARED_TYPE>( \ tag_size, tag, input, values); \ } -READ_REPEATED_FIXED_SIZE_PRIMITIVE(uint32_t, TYPE_FIXED32) -READ_REPEATED_FIXED_SIZE_PRIMITIVE(uint64_t, TYPE_FIXED64) -READ_REPEATED_FIXED_SIZE_PRIMITIVE(int32_t, TYPE_SFIXED32) -READ_REPEATED_FIXED_SIZE_PRIMITIVE(int64_t, TYPE_SFIXED64) +READ_REPEATED_FIXED_SIZE_PRIMITIVE(ui32, TYPE_FIXED32) +READ_REPEATED_FIXED_SIZE_PRIMITIVE(ui64, TYPE_FIXED64) +READ_REPEATED_FIXED_SIZE_PRIMITIVE(i32, TYPE_SFIXED32) +READ_REPEATED_FIXED_SIZE_PRIMITIVE(i64, TYPE_SFIXED64) READ_REPEATED_FIXED_SIZE_PRIMITIVE(float, TYPE_FLOAT) READ_REPEATED_FIXED_SIZE_PRIMITIVE(double, TYPE_DOUBLE) @@ -1279,7 +1138,7 @@ READ_REPEATED_FIXED_SIZE_PRIMITIVE(double, TYPE_DOUBLE) template <typename CType, enum WireFormatLite::FieldType DeclaredType> bool WireFormatLite::ReadRepeatedPrimitiveNoInline( - int tag_size, uint32_t tag, io::CodedInputStream* input, + int tag_size, ui32 tag, io::CodedInputStream* input, RepeatedField<CType>* value) { return ReadRepeatedPrimitive<CType, DeclaredType>(tag_size, tag, input, value); @@ -1321,13 +1180,13 @@ inline bool WireFormatLite::ReadPackedFixedSizePrimitive( // -1 >= 0 Use fast path if length <= Limit. // >= 0 -1 Use slow path. // >= 0 >= 0 Use fast path if length <= min(both limits). - int64_t bytes_limit = input->BytesUntilTotalBytesLimit(); + i64 bytes_limit = input->BytesUntilTotalBytesLimit(); if (bytes_limit == -1) { bytes_limit = input->BytesUntilLimit(); } else { // parentheses around (std::min) prevents macro expansion of min(...) bytes_limit = - (std::min)(bytes_limit, static_cast<int64_t>(input->BytesUntilLimit())); + (std::min)(bytes_limit, static_cast<i64>(input->BytesUntilLimit())); } if (bytes_limit >= new_bytes) { // Fast-path that pre-allocates *values to the final size. @@ -1372,10 +1231,10 @@ inline bool WireFormatLite::ReadPackedFixedSizePrimitive( input, values); \ } -READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(uint32_t, TYPE_FIXED32) -READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(uint64_t, TYPE_FIXED64) -READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(int32_t, TYPE_SFIXED32) -READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(int64_t, TYPE_SFIXED64) +READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(ui32, TYPE_FIXED32) +READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(ui64, TYPE_FIXED64) +READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(i32, TYPE_SFIXED32) +READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(i64, TYPE_SFIXED64) READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(float, TYPE_FLOAT) READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(double, TYPE_DOUBLE) @@ -1421,76 +1280,46 @@ inline void WireFormatLite::WriteTag(int field_number, WireType type, output->WriteTag(MakeTag(field_number, type)); } -inline void WireFormatLite::WriteInt32NoTag(int32_t value, +inline void WireFormatLite::WriteInt32NoTag(i32 value, io::CodedOutputStream* output) { output->WriteVarint32SignExtended(value); } -inline void WireFormatLite::WriteInt64NoTag(int64 value, +inline void WireFormatLite::WriteInt64NoTag(i64 value, io::CodedOutputStream* output) { - output->WriteVarint64(static_cast<uint64>(value)); + output->WriteVarint64(static_cast<ui64>(value)); } -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -inline void WireFormatLite::WriteInt64NoTag(int64_t value, - io::CodedOutputStream* output) { - output->WriteVarint64(static_cast<uint64_t>(value)); -} -#endif -inline void WireFormatLite::WriteUInt32NoTag(uint32_t value, +inline void WireFormatLite::WriteUInt32NoTag(ui32 value, io::CodedOutputStream* output) { output->WriteVarint32(value); } -inline void WireFormatLite::WriteUInt64NoTag(uint64 value, +inline void WireFormatLite::WriteUInt64NoTag(ui64 value, io::CodedOutputStream* output) { output->WriteVarint64(value); } -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -inline void WireFormatLite::WriteUInt64NoTag(uint64_t value, - io::CodedOutputStream* output) { - output->WriteVarint64(value); -} -#endif -inline void WireFormatLite::WriteSInt32NoTag(int32_t value, +inline void WireFormatLite::WriteSInt32NoTag(i32 value, io::CodedOutputStream* output) { output->WriteVarint32(ZigZagEncode32(value)); } -inline void WireFormatLite::WriteSInt64NoTag(int64 value, - io::CodedOutputStream* output) { - output->WriteVarint64(ZigZagEncode64(value)); -} -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -inline void WireFormatLite::WriteSInt64NoTag(int64_t value, +inline void WireFormatLite::WriteSInt64NoTag(i64 value, io::CodedOutputStream* output) { output->WriteVarint64(ZigZagEncode64(value)); } -#endif -inline void WireFormatLite::WriteFixed32NoTag(uint32_t value, +inline void WireFormatLite::WriteFixed32NoTag(ui32 value, io::CodedOutputStream* output) { output->WriteLittleEndian32(value); } -inline void WireFormatLite::WriteFixed64NoTag(uint64 value, - io::CodedOutputStream* output) { - output->WriteLittleEndian64(value); -} -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -inline void WireFormatLite::WriteFixed64NoTag(uint64_t value, +inline void WireFormatLite::WriteFixed64NoTag(ui64 value, io::CodedOutputStream* output) { output->WriteLittleEndian64(value); } -#endif -inline void WireFormatLite::WriteSFixed32NoTag(int32_t value, +inline void WireFormatLite::WriteSFixed32NoTag(i32 value, io::CodedOutputStream* output) { - output->WriteLittleEndian32(static_cast<uint32_t>(value)); + output->WriteLittleEndian32(static_cast<ui32>(value)); } -inline void WireFormatLite::WriteSFixed64NoTag(int64 value, +inline void WireFormatLite::WriteSFixed64NoTag(i64 value, io::CodedOutputStream* output) { - output->WriteLittleEndian64(static_cast<uint64>(value)); + output->WriteLittleEndian64(static_cast<ui64>(value)); } -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -inline void WireFormatLite::WriteSFixed64NoTag(int64_t value, - io::CodedOutputStream* output) { - output->WriteLittleEndian64(static_cast<uint64_t>(value)); -} -#endif inline void WireFormatLite::WriteFloatNoTag(float value, io::CodedOutputStream* output) { output->WriteLittleEndian32(EncodeFloat(value)); @@ -1536,84 +1365,51 @@ inline uint8_t* WireFormatLite::WriteTagToArray(int field_number, WireType type, target); } -inline uint8_t* WireFormatLite::WriteInt32NoTagToArray(int32_t value, +inline uint8_t* WireFormatLite::WriteInt32NoTagToArray(i32 value, uint8_t* target) { return io::CodedOutputStream::WriteVarint32SignExtendedToArray(value, target); } -inline uint8_t* WireFormatLite::WriteInt64NoTagToArray(int64 value, +inline uint8_t* WireFormatLite::WriteInt64NoTagToArray(i64 value, uint8_t* target) { return io::CodedOutputStream::WriteVarint64ToArray( - static_cast<uint64>(value), target); + static_cast<ui64>(value), target); } -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -inline uint8_t* WireFormatLite::WriteInt64NoTagToArray(int64_t value, - uint8_t* target) { - return io::CodedOutputStream::WriteVarint64ToArray( - static_cast<uint64_t>(value), target); -} -#endif -inline uint8_t* WireFormatLite::WriteUInt32NoTagToArray(uint32_t value, +inline uint8_t* WireFormatLite::WriteUInt32NoTagToArray(ui32 value, uint8_t* target) { return io::CodedOutputStream::WriteVarint32ToArray(value, target); } -inline uint8_t* WireFormatLite::WriteUInt64NoTagToArray(uint64 value, +inline uint8_t* WireFormatLite::WriteUInt64NoTagToArray(ui64 value, uint8_t* target) { return io::CodedOutputStream::WriteVarint64ToArray(value, target); } -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -inline uint8_t* WireFormatLite::WriteUInt64NoTagToArray(uint64_t value, - uint8_t* target) { - return io::CodedOutputStream::WriteVarint64ToArray(value, target); -} -#endif -inline uint8_t* WireFormatLite::WriteSInt32NoTagToArray(int32_t value, +inline uint8_t* WireFormatLite::WriteSInt32NoTagToArray(i32 value, uint8_t* target) { return io::CodedOutputStream::WriteVarint32ToArray(ZigZagEncode32(value), target); } -inline uint8_t* WireFormatLite::WriteSInt64NoTagToArray(int64 value, - uint8_t* target) { - return io::CodedOutputStream::WriteVarint64ToArray(ZigZagEncode64(value), - target); -} -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -inline uint8_t* WireFormatLite::WriteSInt64NoTagToArray(int64_t value, +inline uint8_t* WireFormatLite::WriteSInt64NoTagToArray(i64 value, uint8_t* target) { return io::CodedOutputStream::WriteVarint64ToArray(ZigZagEncode64(value), target); } -#endif -inline uint8_t* WireFormatLite::WriteFixed32NoTagToArray(uint32_t value, +inline uint8_t* WireFormatLite::WriteFixed32NoTagToArray(ui32 value, uint8_t* target) { return io::CodedOutputStream::WriteLittleEndian32ToArray(value, target); } -inline uint8_t* WireFormatLite::WriteFixed64NoTagToArray(uint64 value, +inline uint8_t* WireFormatLite::WriteFixed64NoTagToArray(ui64 value, uint8_t* target) { return io::CodedOutputStream::WriteLittleEndian64ToArray(value, target); } -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -inline uint8_t* WireFormatLite::WriteFixed64NoTagToArray(uint64_t value, - uint8_t* target) { - return io::CodedOutputStream::WriteLittleEndian64ToArray(value, target); -} -#endif -inline uint8_t* WireFormatLite::WriteSFixed32NoTagToArray(int32_t value, +inline uint8_t* WireFormatLite::WriteSFixed32NoTagToArray(i32 value, uint8_t* target) { return io::CodedOutputStream::WriteLittleEndian32ToArray( - static_cast<uint32_t>(value), target); + static_cast<ui32>(value), target); } -inline uint8_t* WireFormatLite::WriteSFixed64NoTagToArray(int64 value, +inline uint8_t* WireFormatLite::WriteSFixed64NoTagToArray(i64 value, uint8_t* target) { return io::CodedOutputStream::WriteLittleEndian64ToArray( - static_cast<uint64>(value), target); + static_cast<ui64>(value), target); } -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -inline uint8_t* WireFormatLite::WriteSFixed64NoTagToArray(int64_t value, - uint8_t* target) { - return io::CodedOutputStream::WriteLittleEndian64ToArray( - static_cast<uint64_t>(value), target); -} -#endif inline uint8_t* WireFormatLite::WriteFloatNoTagToArray(float value, uint8_t* target) { return io::CodedOutputStream::WriteLittleEndian32ToArray(EncodeFloat(value), @@ -1669,75 +1465,45 @@ inline uint8_t* WireFormatLite::WriteFixedNoTagToArray( } inline uint8_t* WireFormatLite::WriteInt32NoTagToArray( - const RepeatedField<int32_t>& value, uint8_t* target) { + const RepeatedField<i32>& value, uint8_t* target) { return WritePrimitiveNoTagToArray(value, WriteInt32NoTagToArray, target); } inline uint8_t* WireFormatLite::WriteInt64NoTagToArray( - const RepeatedField<int64>& value, uint8_t* target) { + const RepeatedField<i64>& value, uint8_t* target) { return WritePrimitiveNoTagToArray(value, WriteInt64NoTagToArray, target); } -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -inline uint8_t* WireFormatLite::WriteInt64NoTagToArray( - const RepeatedField<int64_t>& value, uint8_t* target) { - return WritePrimitiveNoTagToArray(value, WriteInt64NoTagToArray, target); -} -#endif inline uint8_t* WireFormatLite::WriteUInt32NoTagToArray( - const RepeatedField<uint32_t>& value, uint8_t* target) { + const RepeatedField<ui32>& value, uint8_t* target) { return WritePrimitiveNoTagToArray(value, WriteUInt32NoTagToArray, target); } inline uint8_t* WireFormatLite::WriteUInt64NoTagToArray( - const RepeatedField<uint64>& value, uint8_t* target) { + const RepeatedField<ui64>& value, uint8_t* target) { return WritePrimitiveNoTagToArray(value, WriteUInt64NoTagToArray, target); } -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -inline uint8_t* WireFormatLite::WriteUInt64NoTagToArray( - const RepeatedField<uint64_t>& value, uint8_t* target) { - return WritePrimitiveNoTagToArray(value, WriteUInt64NoTagToArray, target); -} -#endif inline uint8_t* WireFormatLite::WriteSInt32NoTagToArray( - const RepeatedField<int32_t>& value, uint8_t* target) { + const RepeatedField<i32>& value, uint8_t* target) { return WritePrimitiveNoTagToArray(value, WriteSInt32NoTagToArray, target); } inline uint8_t* WireFormatLite::WriteSInt64NoTagToArray( - const RepeatedField<int64>& value, uint8_t* target) { + const RepeatedField<i64>& value, uint8_t* target) { return WritePrimitiveNoTagToArray(value, WriteSInt64NoTagToArray, target); } -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -inline uint8_t* WireFormatLite::WriteSInt64NoTagToArray( - const RepeatedField<int64_t>& value, uint8_t* target) { - return WritePrimitiveNoTagToArray(value, WriteSInt64NoTagToArray, target); -} -#endif inline uint8_t* WireFormatLite::WriteFixed32NoTagToArray( - const RepeatedField<uint32_t>& value, uint8_t* target) { + const RepeatedField<ui32>& value, uint8_t* target) { return WriteFixedNoTagToArray(value, WriteFixed32NoTagToArray, target); } inline uint8_t* WireFormatLite::WriteFixed64NoTagToArray( - const RepeatedField<uint64>& value, uint8_t* target) { + const RepeatedField<ui64>& value, uint8_t* target) { return WriteFixedNoTagToArray(value, WriteFixed64NoTagToArray, target); } -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -inline uint8_t* WireFormatLite::WriteFixed64NoTagToArray( - const RepeatedField<uint64_t>& value, uint8_t* target) { - return WriteFixedNoTagToArray(value, WriteFixed64NoTagToArray, target); -} -#endif inline uint8_t* WireFormatLite::WriteSFixed32NoTagToArray( - const RepeatedField<int32_t>& value, uint8_t* target) { + const RepeatedField<i32>& value, uint8_t* target) { return WriteFixedNoTagToArray(value, WriteSFixed32NoTagToArray, target); } inline uint8_t* WireFormatLite::WriteSFixed64NoTagToArray( - const RepeatedField<int64>& value, uint8_t* target) { + const RepeatedField<i64>& value, uint8_t* target) { return WriteFixedNoTagToArray(value, WriteSFixed64NoTagToArray, target); } -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -inline uint8_t* WireFormatLite::WriteSFixed64NoTagToArray( - const RepeatedField<int64_t>& value, uint8_t* target) { - return WriteFixedNoTagToArray(value, WriteSFixed64NoTagToArray, target); -} -#endif inline uint8_t* WireFormatLite::WriteFloatNoTagToArray( const RepeatedField<float>& value, uint8_t* target) { return WriteFixedNoTagToArray(value, WriteFloatNoTagToArray, target); @@ -1756,61 +1522,61 @@ inline uint8_t* WireFormatLite::WriteEnumNoTagToArray( } inline uint8_t* WireFormatLite::WriteInt32ToArray(int field_number, - int32_t value, + i32 value, uint8_t* target) { target = WriteTagToArray(field_number, WIRETYPE_VARINT, target); return WriteInt32NoTagToArray(value, target); } inline uint8_t* WireFormatLite::WriteInt64ToArray(int field_number, - int64_t value, + i64 value, uint8_t* target) { target = WriteTagToArray(field_number, WIRETYPE_VARINT, target); return WriteInt64NoTagToArray(value, target); } inline uint8_t* WireFormatLite::WriteUInt32ToArray(int field_number, - uint32_t value, + ui32 value, uint8_t* target) { target = WriteTagToArray(field_number, WIRETYPE_VARINT, target); return WriteUInt32NoTagToArray(value, target); } inline uint8_t* WireFormatLite::WriteUInt64ToArray(int field_number, - uint64_t value, + ui64 value, uint8_t* target) { target = WriteTagToArray(field_number, WIRETYPE_VARINT, target); return WriteUInt64NoTagToArray(value, target); } inline uint8_t* WireFormatLite::WriteSInt32ToArray(int field_number, - int32_t value, + i32 value, uint8_t* target) { target = WriteTagToArray(field_number, WIRETYPE_VARINT, target); return WriteSInt32NoTagToArray(value, target); } inline uint8_t* WireFormatLite::WriteSInt64ToArray(int field_number, - int64_t value, + i64 value, uint8_t* target) { target = WriteTagToArray(field_number, WIRETYPE_VARINT, target); return WriteSInt64NoTagToArray(value, target); } inline uint8_t* WireFormatLite::WriteFixed32ToArray(int field_number, - uint32_t value, + ui32 value, uint8_t* target) { target = WriteTagToArray(field_number, WIRETYPE_FIXED32, target); return WriteFixed32NoTagToArray(value, target); } inline uint8_t* WireFormatLite::WriteFixed64ToArray(int field_number, - uint64_t value, + ui64 value, uint8_t* target) { target = WriteTagToArray(field_number, WIRETYPE_FIXED64, target); return WriteFixed64NoTagToArray(value, target); } inline uint8_t* WireFormatLite::WriteSFixed32ToArray(int field_number, - int32_t value, + i32 value, uint8_t* target) { target = WriteTagToArray(field_number, WIRETYPE_FIXED32, target); return WriteSFixed32NoTagToArray(value, target); } inline uint8_t* WireFormatLite::WriteSFixed64ToArray(int field_number, - int64_t value, + i64 value, uint8_t* target) { target = WriteTagToArray(field_number, WIRETYPE_FIXED64, target); return WriteSFixed64NoTagToArray(value, target); @@ -1856,46 +1622,46 @@ inline uint8_t* WireFormatLite::WritePrimitiveToArray( } inline uint8_t* WireFormatLite::WriteInt32ToArray( - int field_number, const RepeatedField<int32_t>& value, uint8_t* target) { + int field_number, const RepeatedField<i32>& value, uint8_t* target) { return WritePrimitiveToArray(field_number, value, WriteInt32ToArray, target); } inline uint8_t* WireFormatLite::WriteInt64ToArray( - int field_number, const RepeatedField<int64_t>& value, uint8_t* target) { + int field_number, const RepeatedField<i64>& value, uint8_t* target) { return WritePrimitiveToArray(field_number, value, WriteInt64ToArray, target); } inline uint8_t* WireFormatLite::WriteUInt32ToArray( - int field_number, const RepeatedField<uint32_t>& value, uint8_t* target) { + int field_number, const RepeatedField<ui32>& value, uint8_t* target) { return WritePrimitiveToArray(field_number, value, WriteUInt32ToArray, target); } inline uint8_t* WireFormatLite::WriteUInt64ToArray( - int field_number, const RepeatedField<uint64_t>& value, uint8_t* target) { + int field_number, const RepeatedField<ui64>& value, uint8_t* target) { return WritePrimitiveToArray(field_number, value, WriteUInt64ToArray, target); } inline uint8_t* WireFormatLite::WriteSInt32ToArray( - int field_number, const RepeatedField<int32_t>& value, uint8_t* target) { + int field_number, const RepeatedField<i32>& value, uint8_t* target) { return WritePrimitiveToArray(field_number, value, WriteSInt32ToArray, target); } inline uint8_t* WireFormatLite::WriteSInt64ToArray( - int field_number, const RepeatedField<int64_t>& value, uint8_t* target) { + int field_number, const RepeatedField<i64>& value, uint8_t* target) { return WritePrimitiveToArray(field_number, value, WriteSInt64ToArray, target); } inline uint8_t* WireFormatLite::WriteFixed32ToArray( - int field_number, const RepeatedField<uint32_t>& value, uint8_t* target) { + int field_number, const RepeatedField<ui32>& value, uint8_t* target) { return WritePrimitiveToArray(field_number, value, WriteFixed32ToArray, target); } inline uint8_t* WireFormatLite::WriteFixed64ToArray( - int field_number, const RepeatedField<uint64_t>& value, uint8_t* target) { + int field_number, const RepeatedField<ui64>& value, uint8_t* target) { return WritePrimitiveToArray(field_number, value, WriteFixed64ToArray, target); } inline uint8_t* WireFormatLite::WriteSFixed32ToArray( - int field_number, const RepeatedField<int32_t>& value, uint8_t* target) { + int field_number, const RepeatedField<i32>& value, uint8_t* target) { return WritePrimitiveToArray(field_number, value, WriteSFixed32ToArray, target); } inline uint8_t* WireFormatLite::WriteSFixed64ToArray( - int field_number, const RepeatedField<int64_t>& value, uint8_t* target) { + int field_number, const RepeatedField<i64>& value, uint8_t* target) { return WritePrimitiveToArray(field_number, value, WriteSFixed64ToArray, target); } @@ -1948,7 +1714,7 @@ inline uint8_t* WireFormatLite::InternalWriteMessage( io::EpsCopyOutputStream* stream) { target = WriteTagToArray(field_number, WIRETYPE_LENGTH_DELIMITED, target); target = io::CodedOutputStream::WriteVarint32ToArrayOutOfLine( - static_cast<uint32_t>(value.GetCachedSize()), target); + static_cast<ui32>(value.GetCachedSize()), target); return value._InternalSerialize(target, stream); } @@ -1969,7 +1735,7 @@ inline uint8_t* WireFormatLite::InternalWriteMessageNoVirtualToArray( uint8_t* target) { target = WriteTagToArray(field_number, WIRETYPE_LENGTH_DELIMITED, target); target = io::CodedOutputStream::WriteVarint32ToArray( - static_cast<uint32_t>( + static_cast<ui32>( value.MessageType_WorkAroundCppLookupDefect::GetCachedSize()), target); return value @@ -1979,54 +1745,44 @@ inline uint8_t* WireFormatLite::InternalWriteMessageNoVirtualToArray( // =================================================================== -inline size_t WireFormatLite::Int32Size(int32_t value) { +inline size_t WireFormatLite::Int32Size(i32 value) { return io::CodedOutputStream::VarintSize32SignExtended(value); } -inline size_t WireFormatLite::Int64Size(int64 value) { - return io::CodedOutputStream::VarintSize64(static_cast<uint64_t>(value)); -} -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -inline size_t WireFormatLite::Int64Size(int64_t value) { - return io::CodedOutputStream::VarintSize64(static_cast<uint64_t>(value)); +inline size_t WireFormatLite::Int64Size(i64 value) { + return io::CodedOutputStream::VarintSize64(static_cast<ui64>(value)); } -#endif -inline size_t WireFormatLite::UInt32Size(uint32_t value) { +inline size_t WireFormatLite::UInt32Size(ui32 value) { return io::CodedOutputStream::VarintSize32(value); } -inline size_t WireFormatLite::UInt64Size(uint64 value) { +inline size_t WireFormatLite::UInt64Size(ui64 value) { return io::CodedOutputStream::VarintSize64(value); } -inline size_t WireFormatLite::SInt32Size(int32_t value) { +inline size_t WireFormatLite::SInt32Size(i32 value) { return io::CodedOutputStream::VarintSize32(ZigZagEncode32(value)); } -inline size_t WireFormatLite::SInt64Size(int64 value) { - return io::CodedOutputStream::VarintSize64(ZigZagEncode64(value)); -} -#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) -inline size_t WireFormatLite::SInt64Size(int64_t value) { +inline size_t WireFormatLite::SInt64Size(i64 value) { return io::CodedOutputStream::VarintSize64(ZigZagEncode64(value)); } -#endif inline size_t WireFormatLite::EnumSize(int value) { return io::CodedOutputStream::VarintSize32SignExtended(value); } -inline size_t WireFormatLite::Int32SizePlusOne(int32_t value) { +inline size_t WireFormatLite::Int32SizePlusOne(i32 value) { return io::CodedOutputStream::VarintSize32SignExtendedPlusOne(value); } -inline size_t WireFormatLite::Int64SizePlusOne(int64_t value) { +inline size_t WireFormatLite::Int64SizePlusOne(i64 value) { return io::CodedOutputStream::VarintSize64PlusOne( - static_cast<uint64_t>(value)); + static_cast<ui64>(value)); } -inline size_t WireFormatLite::UInt32SizePlusOne(uint32_t value) { +inline size_t WireFormatLite::UInt32SizePlusOne(ui32 value) { return io::CodedOutputStream::VarintSize32PlusOne(value); } -inline size_t WireFormatLite::UInt64SizePlusOne(uint64_t value) { +inline size_t WireFormatLite::UInt64SizePlusOne(ui64 value) { return io::CodedOutputStream::VarintSize64PlusOne(value); } -inline size_t WireFormatLite::SInt32SizePlusOne(int32_t value) { +inline size_t WireFormatLite::SInt32SizePlusOne(i32 value) { return io::CodedOutputStream::VarintSize32PlusOne(ZigZagEncode32(value)); } -inline size_t WireFormatLite::SInt64SizePlusOne(int64_t value) { +inline size_t WireFormatLite::SInt64SizePlusOne(i64 value) { return io::CodedOutputStream::VarintSize64PlusOne(ZigZagEncode64(value)); } inline size_t WireFormatLite::EnumSizePlusOne(int value) { @@ -2066,11 +1822,11 @@ inline size_t WireFormatLite::MessageSizeNoVirtual( inline size_t WireFormatLite::LengthDelimitedSize(size_t length) { // The static_cast here prevents an error in certain compiler configurations - // but is not technically correct--if length is too large to fit in a uint32_t + // but is not technically correct--if length is too large to fit in a ui32 // then it will be silently truncated. We will need to fix this if we ever // decide to start supporting serialized messages greater than 2 GiB in size. return length + - io::CodedOutputStream::VarintSize32(static_cast<uint32_t>(length)); + io::CodedOutputStream::VarintSize32(static_cast<ui32>(length)); } template <typename MS> @@ -2079,7 +1835,7 @@ bool ParseMessageSetItemImpl(io::CodedInputStream* input, MS ms) { // required int32 type_id = 2; // required data message = 3; - uint32_t last_type_id = 0; + ui32 last_type_id = 0; // If we see message data before the type_id, we'll append it to this so // we can parse it later. @@ -2089,12 +1845,12 @@ bool ParseMessageSetItemImpl(io::CodedInputStream* input, MS ms) { State state = State::kNoTag; while (true) { - const uint32_t tag = input->ReadTagNoLastTag(); + const ui32 tag = input->ReadTagNoLastTag(); if (tag == 0) return false; switch (tag) { case WireFormatLite::kMessageSetTypeIdTag: { - uint32_t type_id; + ui32 type_id; if (!input->ReadVarint32(&type_id)) return false; if (state == State::kNoTag) { last_type_id = type_id; @@ -2125,10 +1881,10 @@ bool ParseMessageSetItemImpl(io::CodedInputStream* input, MS ms) { state = State::kDone; } else if (state == State::kNoTag) { // We haven't seen a type_id yet. Append this data to message_data. - uint32_t length; + ui32 length; if (!input->ReadVarint32(&length)) return false; - if (static_cast<int32_t>(length) < 0) return false; - uint32_t size = static_cast<uint32_t>( + if (static_cast<i32>(length) < 0) return false; + ui32 size = static_cast<ui32>( length + io::CodedOutputStream::VarintSize32(length)); message_data.resize(size); auto ptr = reinterpret_cast<uint8_t*>(&message_data[0]); diff --git a/contrib/libs/protobuf/src/google/protobuf/wrappers.pb.cc b/contrib/libs/protobuf/src/google/protobuf/wrappers.pb.cc index d1322e96ab..3b1ad529ef 100644 --- a/contrib/libs/protobuf/src/google/protobuf/wrappers.pb.cc +++ b/contrib/libs/protobuf/src/google/protobuf/wrappers.pb.cc @@ -43,7 +43,7 @@ struct FloatValueDefaultTypeInternal { PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT FloatValueDefaultTypeInternal _FloatValue_default_instance_; constexpr Int64Value::Int64Value( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) - : value_(int64_t{0}){} + : value_(i64{0}){} struct Int64ValueDefaultTypeInternal { constexpr Int64ValueDefaultTypeInternal() : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} @@ -55,7 +55,7 @@ struct Int64ValueDefaultTypeInternal { PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT Int64ValueDefaultTypeInternal _Int64Value_default_instance_; constexpr UInt64Value::UInt64Value( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) - : value_(uint64_t{0u}){} + : value_(ui64{0u}){} struct UInt64ValueDefaultTypeInternal { constexpr UInt64ValueDefaultTypeInternal() : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} @@ -627,7 +627,7 @@ Int64Value::Int64Value(const Int64Value& from) } void Int64Value::SharedCtor() { -value_ = int64_t{0}; +value_ = i64{0}; } Int64Value::~Int64Value() { @@ -657,7 +657,7 @@ void Int64Value::Clear() { // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - value_ = int64_t{0}; + value_ = i64{0}; _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } @@ -805,7 +805,7 @@ UInt64Value::UInt64Value(const UInt64Value& from) } void UInt64Value::SharedCtor() { -value_ = uint64_t{0u}; +value_ = ui64{0u}; } UInt64Value::~UInt64Value() { @@ -835,7 +835,7 @@ void UInt64Value::Clear() { // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - value_ = uint64_t{0u}; + value_ = ui64{0u}; _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } diff --git a/contrib/libs/protobuf/src/google/protobuf/wrappers.pb.h b/contrib/libs/protobuf/src/google/protobuf/wrappers.pb.h index 4027d32865..5299a843fb 100644 --- a/contrib/libs/protobuf/src/google/protobuf/wrappers.pb.h +++ b/contrib/libs/protobuf/src/google/protobuf/wrappers.pb.h @@ -1453,7 +1453,7 @@ inline void FloatValue::set_value(float value) { // int64 value = 1; inline void Int64Value::clear_value() { - value_ = int64_t{0}; + value_ = i64{0}; } inline ::PROTOBUF_NAMESPACE_ID::int64 Int64Value::_internal_value() const { return value_; @@ -1477,7 +1477,7 @@ inline void Int64Value::set_value(::PROTOBUF_NAMESPACE_ID::int64 value) { // uint64 value = 1; inline void UInt64Value::clear_value() { - value_ = uint64_t{0u}; + value_ = ui64{0u}; } inline ::PROTOBUF_NAMESPACE_ID::uint64 UInt64Value::_internal_value() const { return value_; |