Use ::int32_t to avoid confusion with bad field names.

Packed repeated fields without cached_size use static_cast<int32_t> that may be confused
with bad field names. This change fixes it by using ::int32_t.

PiperOrigin-RevId: 693884622
pull/19165/head
Protobuf Team Bot 4 months ago committed by Copybara-Service
parent 294d353a66
commit 9632425c34
  1. 2
      src/google/protobuf/compiler/cpp/field_generators/enum_field.cc
  2. 2
      src/google/protobuf/compiler/cpp/field_generators/primitive_field.cc

@ -535,7 +535,7 @@ void RepeatedEnum::GenerateByteSize(io::Printer* p) const {
data_size == 0
? 0
: $kTagBytes$ + ::_pbi::WireFormatLite::Int32Size(
static_cast<int32_t>(data_size));
static_cast<::int32_t>(data_size));
)cc");
} else {
p->Emit(R"cc(

@ -625,7 +625,7 @@ void RepeatedPrimitive::GenerateByteSize(io::Printer* p) const {
data_size == 0
? 0
: $kTagBytes$ + ::_pbi::WireFormatLite::Int32Size(
static_cast<int32_t>(data_size));
static_cast<::int32_t>(data_size));
)cc");
} else {
p->Emit(R"cc(

Loading…
Cancel
Save