Change int* types to int*_t

This commit is contained in:
Ben Merritt 2018-02-12 14:44:36 -08:00
parent 315fba5855
commit d3475b0d83
3 changed files with 12 additions and 11 deletions

View File

@ -274,9 +274,9 @@ extern "C" {
const ShortPhoneNumber* number1 = (ShortPhoneNumber*)PG_GETARG_POINTER(0); const ShortPhoneNumber* number1 = (ShortPhoneNumber*)PG_GETARG_POINTER(0);
const ShortPhoneNumber* number2 = (ShortPhoneNumber*)PG_GETARG_POINTER(1); const ShortPhoneNumber* number2 = (ShortPhoneNumber*)PG_GETARG_POINTER(1);
int64 compared = number1->compare_fast(*number2); int64_t compared = number1->compare_fast(*number2);
PG_RETURN_INT32(clip<int64>(compared, -1, 1)); PG_RETURN_INT32(clip<int64_t>(compared, -1, 1));
} catch(std::exception& e) { } catch(std::exception& e) {
reportException(e); reportException(e);
} }

View File

@ -21,7 +21,7 @@ ShortPhoneNumber::ShortPhoneNumber(i18n::phonenumbers::PhoneNumber number) {
} }
this->country_code(country_code); this->country_code(country_code);
uint64 national_number = number.national_number(); uint64_t national_number = number.national_number();
if(national_number > MAX_NATIONAL_NUMBER) { if(national_number > MAX_NATIONAL_NUMBER) {
throw PhoneNumberTooLongException(number, "National number is too long"); throw PhoneNumberTooLongException(number, "National number is too long");
} }

View File

@ -1,3 +1,4 @@
#include <cstdint>
#include <exception> #include <exception>
#include <string> #include <string>
@ -81,7 +82,7 @@ class ShortPhoneNumber {
* - 0 (if a == b) * - 0 (if a == b)
* - >0 (if a > b) * - >0 (if a > b)
*/ */
google::protobuf::int64 compare_fast(ShortPhoneNumber other) const { int64_t compare_fast(ShortPhoneNumber other) const {
return other._data - this->_data; return other._data - this->_data;
} }
@ -91,32 +92,32 @@ class ShortPhoneNumber {
} }
/// Sets the number's country code /// Sets the number's country code
void country_code(google::protobuf::uint32 value) { void country_code(uint32_t value) {
_data = set_masked(_data, (google::protobuf::uint64)value, COUNTRY_CODE_BITS, COUNTRY_CODE_OFFSET); _data = set_masked(_data, static_cast<uint64_t>(value), COUNTRY_CODE_BITS, COUNTRY_CODE_OFFSET);
} }
/// Returns the national number /// Returns the national number
google::protobuf::uint64 national_number() const { uint64_t national_number() const {
return get_masked(_data, NATIONAL_NUMBER_BITS, NATIONAL_NUMBER_OFFSET); return get_masked(_data, NATIONAL_NUMBER_BITS, NATIONAL_NUMBER_OFFSET);
} }
/// Sets the national number /// Sets the national number
void national_number(google::protobuf::uint64 value) { void national_number(uint64_t value) {
_data = set_masked(_data, value, NATIONAL_NUMBER_BITS, NATIONAL_NUMBER_OFFSET); _data = set_masked(_data, value, NATIONAL_NUMBER_BITS, NATIONAL_NUMBER_OFFSET);
} }
/// Returns the number of leading zeros /// Returns the number of leading zeros
google::protobuf::uint64 leading_zeros() const { uint64_t leading_zeros() const {
return get_masked(_data, LEADING_ZEROS_BITS, LEADING_ZEROS_OFFSET); return get_masked(_data, LEADING_ZEROS_BITS, LEADING_ZEROS_OFFSET);
} }
/// Sets the number of leading zeros /// Sets the number of leading zeros
void leading_zeros(google::protobuf::uint64 value) { void leading_zeros(uint64_t value) {
_data = set_masked(_data, value, LEADING_ZEROS_BITS, LEADING_ZEROS_OFFSET); _data = set_masked(_data, value, LEADING_ZEROS_BITS, LEADING_ZEROS_OFFSET);
} }
private: private:
google::protobuf::uint64 _data; uint64_t _data;
}; };
/* /*