From 51880e5db3beccf73b4d4bd3f7d00323f7054cbd Mon Sep 17 00:00:00 2001 From: mandlil <138015259+mandlil@users.noreply.github.com> Date: Tue, 5 Dec 2023 15:26:15 +0530 Subject: [PATCH] Replace uses of `int64` with `int64_t` and similar integer type aliases (#3345) --- .../phonenumbers/geocoding/geocoding_data.h | 6 +++--- cpp/src/phonenumbers/stringutil.h | 18 +++++++++--------- .../src/cpp-build/generate_geocoding_data.cc | 10 +++++----- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/cpp/src/phonenumbers/geocoding/geocoding_data.h b/cpp/src/phonenumbers/geocoding/geocoding_data.h index 37f1bd653..df2a45d24 100644 --- a/cpp/src/phonenumbers/geocoding/geocoding_data.h +++ b/cpp/src/phonenumbers/geocoding/geocoding_data.h @@ -17,7 +17,7 @@ #ifndef I18N_PHONENUMBERS_GEOCODING_DATA #define I18N_PHONENUMBERS_GEOCODING_DATA -#include "phonenumbers/base/basictypes.h" +#include namespace i18n { namespace phonenumbers { @@ -32,7 +32,7 @@ struct CountryLanguages { struct PrefixDescriptions { // Sorted array of phone number prefixes. - const int32* prefixes; + const int32_t* prefixes; // Number of elements in prefixes. const int prefixes_size; @@ -42,7 +42,7 @@ struct PrefixDescriptions { const char** descriptions; // Sorted array of unique prefix lengths in base 10. - const int32* possible_lengths; + const int32_t* possible_lengths; // Number of elements in possible_lengths. const int possible_lengths_size; diff --git a/cpp/src/phonenumbers/stringutil.h b/cpp/src/phonenumbers/stringutil.h index b84057d79..a86a9502c 100644 --- a/cpp/src/phonenumbers/stringutil.h +++ b/cpp/src/phonenumbers/stringutil.h @@ -35,8 +35,8 @@ using std::vector; string operator+(const string& s, int n); // NOLINT(runtime/string) // Converts integer to string. -string SimpleItoa(uint64 n); -string SimpleItoa(int64 n); +string SimpleItoa(uint64_t n); +string SimpleItoa(int64_t n); string SimpleItoa(int n); // Returns whether the provided string starts with the supplied prefix. @@ -58,14 +58,14 @@ bool TryStripPrefixString(const string& in, const string& prefix, string* out); // Returns true if 's' ends with 'suffix'. bool HasSuffixString(const string& s, const string& suffix); -// Converts string to int32. -void safe_strto32(const string& s, int32 *n); +// Converts string to int32_t. +void safe_strto32(const string& s, int32_t *n); -// Converts string to uint64. -void safe_strtou64(const string& s, uint64 *n); +// Converts string to uint64_t. +void safe_strtou64(const string& s, uint64_t *n); -// Converts string to int64. -void safe_strto64(const string& s, int64* n); +// Converts string to int64_t. +void safe_strto64(const string& s, int64_t* n); // Remove all occurrences of a given set of characters from a string. void strrmm(string* s, const string& chars); @@ -82,7 +82,7 @@ class StringHolder: public absl::AlphaNum { // Don't make the constructors explicit to make the StrCat usage convenient. StringHolder(const string& s); // NOLINT(runtime/explicit) StringHolder(const char* s); // NOLINT(runtime/explicit) - StringHolder(uint64 n); // NOLINT(runtime/explicit) + StringHolder(uint64_t n); // NOLINT(runtime/explicit) ~StringHolder(); const absl::string_view GetString() const { diff --git a/tools/cpp/src/cpp-build/generate_geocoding_data.cc b/tools/cpp/src/cpp-build/generate_geocoding_data.cc index 205947e83..17120b58a 100644 --- a/tools/cpp/src/cpp-build/generate_geocoding_data.cc +++ b/tools/cpp/src/cpp-build/generate_geocoding_data.cc @@ -289,7 +289,7 @@ void WriteCppHeader(const string& base_name, FILE* output) { fprintf(output, "#include \"phonenumbers/geocoding/%s.h\"\n", base_name.c_str()); fprintf(output, "\n"); - fprintf(output, "#include \"phonenumbers/base/basictypes.h\"\n"); + fprintf(output, "#include \n"); fprintf(output, "\n"); } @@ -324,7 +324,7 @@ void WritePrefixDescriptionsDefinition( // phone number prefix to description mapping "prefixes". Binds these arrays // in a single PrefixDescriptions variable named "var_name". // -// const int32 ${var_name}_prefixes[] = { +// const int32_t ${var_name}_prefixes[] = { // 1201, // 1650, // }; @@ -334,7 +334,7 @@ void WritePrefixDescriptionsDefinition( // "Kalifornie", // }; // -// const int32 ${var_name}_possible_lengths[] = { +// const int32_t ${var_name}_possible_lengths[] = { // 4, // }; // @@ -347,7 +347,7 @@ void WritePrefixDescriptions(const string& var_name, FILE* output) { absl::btree_set possible_lengths; const string prefixes_name = var_name + "_prefixes"; - fprintf(output, "const int32 %s[] = {\n", prefixes_name.c_str()); + fprintf(output, "const int32_t %s[] = {\n", prefixes_name.c_str()); for (absl::btree_map::const_iterator it = prefixes.begin(); it != prefixes.end(); ++it) { fprintf(output, " %d,\n", it->first); @@ -370,7 +370,7 @@ void WritePrefixDescriptions(const string& var_name, "\n"); const string possible_lengths_name = var_name + "_possible_lengths"; - fprintf(output, "const int32 %s[] = {\n ", possible_lengths_name.c_str()); + fprintf(output, "const int32_t %s[] = {\n ", possible_lengths_name.c_str()); for (absl::btree_set::const_iterator it = possible_lengths.begin(); it != possible_lengths.end(); ++it) { fprintf(output, " %d,", *it);