Browse Source

Replace uses of `int64` with `int64_t` and similar integer type aliases (#3345)

pull/3346/head
mandlil 2 years ago
committed by GitHub
parent
commit
51880e5db3
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 17 deletions
  1. +3
    -3
      cpp/src/phonenumbers/geocoding/geocoding_data.h
  2. +9
    -9
      cpp/src/phonenumbers/stringutil.h
  3. +5
    -5
      tools/cpp/src/cpp-build/generate_geocoding_data.cc

+ 3
- 3
cpp/src/phonenumbers/geocoding/geocoding_data.h View File

@ -17,7 +17,7 @@
#ifndef I18N_PHONENUMBERS_GEOCODING_DATA
#define I18N_PHONENUMBERS_GEOCODING_DATA
#include "phonenumbers/base/basictypes.h"
#include <cstdint>
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;


+ 9
- 9
cpp/src/phonenumbers/stringutil.h View File

@ -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 {


+ 5
- 5
tools/cpp/src/cpp-build/generate_geocoding_data.cc View File

@ -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 <cstdint>\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<int> 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<int, string>::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<int>::const_iterator it = possible_lengths.begin();
it != possible_lengths.end(); ++it) {
fprintf(output, " %d,", *it);


Loading…
Cancel
Save