From 57da2b45aef60880fb109fb627c1ff3a50c4ae31 Mon Sep 17 00:00:00 2001 From: Thomas Van Lenten Date: Fri, 24 Sep 2021 10:58:46 -0400 Subject: [PATCH] Update some types to be more current. --- objectivec/DevTools/check_version_stamps.sh | 2 +- .../compiler/objectivec/objectivec_file.cc | 2 +- .../compiler/objectivec/objectivec_helpers.cc | 18 +++++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/objectivec/DevTools/check_version_stamps.sh b/objectivec/DevTools/check_version_stamps.sh index 1acbe2a2b7..a3524cb39d 100755 --- a/objectivec/DevTools/check_version_stamps.sh +++ b/objectivec/DevTools/check_version_stamps.sh @@ -25,7 +25,7 @@ check_constant() { # Collect version from generator sources. local GeneratorVersion=$( \ cat "${GeneratorSrc}" \ - | sed -n -e "s:const int32 ${ConstantName} = \([0-9]*\);:\1:p" + | sed -n -e "s:const int32_t ${ConstantName} = \([0-9]*\);:\1:p" ) if [[ -z "${GeneratorVersion}" ]] ; then die "Failed to find ${ConstantName} in the generator source (${GeneratorSrc})." diff --git a/src/google/protobuf/compiler/objectivec/objectivec_file.cc b/src/google/protobuf/compiler/objectivec/objectivec_file.cc index be2be2cdec..d9f43a55c7 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_file.cc +++ b/src/google/protobuf/compiler/objectivec/objectivec_file.cc @@ -52,7 +52,7 @@ namespace objectivec { namespace { // This is also found in GPBBootstrap.h, and needs to be kept in sync. -const int32 GOOGLE_PROTOBUF_OBJC_VERSION = 30004; +const int32_t GOOGLE_PROTOBUF_OBJC_VERSION = 30004; const char* kHeaderExtension = ".pbobjc.h"; diff --git a/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc b/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc index 169e52f8e5..a90adbad93 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc +++ b/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc @@ -994,7 +994,7 @@ std::string DefaultValue(const FieldDescriptor* field) { // Must convert to a standard byte order for packing length into // a cstring. - uint32 length = ghtonl(default_string.length()); + uint32_t length = ghtonl(default_string.length()); std::string bytes((const char*)&length, sizeof(length)); bytes.append(default_string); return "(NSData*)\"" + EscapeTrigraphs(CEscape(bytes)) + "\""; @@ -1423,7 +1423,7 @@ TextFormatDecodeData::TextFormatDecodeData() { } TextFormatDecodeData::~TextFormatDecodeData() { } -void TextFormatDecodeData::AddString(int32 key, +void TextFormatDecodeData::AddString(int32_t key, const std::string& input_for_decode, const std::string& desired_output) { for (std::vector::const_iterator i = entries_.begin(); @@ -1479,12 +1479,12 @@ class DecodeDataBuilder { } private: - static constexpr uint8 kAddUnderscore = 0x80; + static constexpr uint8_t kAddUnderscore = 0x80; - static constexpr uint8 kOpAsIs = 0x00; - static constexpr uint8 kOpFirstUpper = 0x40; - static constexpr uint8 kOpFirstLower = 0x20; - static constexpr uint8 kOpAllUpper = 0x60; + static constexpr uint8_t kOpAsIs = 0x00; + static constexpr uint8_t kOpFirstUpper = 0x40; + static constexpr uint8_t kOpFirstLower = 0x20; + static constexpr uint8_t kOpAllUpper = 0x60; static constexpr int kMaxSegmentLen = 0x1f; @@ -1494,7 +1494,7 @@ class DecodeDataBuilder { } void Push() { - uint8 op = (op_ | segment_len_); + uint8_t op = (op_ | segment_len_); if (need_underscore_) op |= kAddUnderscore; if (op != 0) { decode_data_ += (char)op; @@ -1526,7 +1526,7 @@ class DecodeDataBuilder { bool need_underscore_; bool is_all_upper_; - uint8 op_; + uint8_t op_; int segment_len_; std::string decode_data_;