diff options
author | wtc <wtc@chromium.org> | 2015-06-03 17:08:13 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-04 00:08:59 +0000 |
commit | 69f8ea8811eabe16f4793d15c8e211805d29dbe7 (patch) | |
tree | f94c27650430f999b4da31289b46680ceec36d13 | |
parent | c23a3e54501532ebb2b17da05639aea7d7b35604 (diff) | |
download | chromium_src-69f8ea8811eabe16f4793d15c8e211805d29dbe7.zip chromium_src-69f8ea8811eabe16f4793d15c8e211805d29dbe7.tar.gz chromium_src-69f8ea8811eabe16f4793d15c8e211805d29dbe7.tar.bz2 |
Use the exact-width integer types defined in <stdint.h> rather than
"base/basictypes.h" in net/android, net/base, and net/cert.
R=eroman@chromium.org
BUG=488550
TEST=none
Review URL: https://codereview.chromium.org/1158923005
Cr-Commit-Position: refs/heads/master@{#332742}
114 files changed, 454 insertions, 469 deletions
diff --git a/net/android/android_private_key.h b/net/android/android_private_key.h index 9782a2d..24f4f45 100644 --- a/net/android/android_private_key.h +++ b/net/android/android_private_key.h @@ -8,7 +8,6 @@ #include <jni.h> #include "base/android/scoped_java_ref.h" -#include "base/basictypes.h" #include "net/base/net_export.h" diff --git a/net/android/cert_verify_result_android.h b/net/android/cert_verify_result_android.h index e1cd3ce..1bc9a1f 100644 --- a/net/android/cert_verify_result_android.h +++ b/net/android/cert_verify_result_android.h @@ -10,8 +10,6 @@ #include <string> #include <vector> -#include "base/basictypes.h" - namespace net { namespace android { diff --git a/net/android/keystore.cc b/net/android/keystore.cc index 3a2948a..dd37939 100644 --- a/net/android/keystore.cc +++ b/net/android/keystore.cc @@ -22,9 +22,7 @@ using base::android::JavaArrayOfByteArrayToStringVector; namespace net { namespace android { -bool GetRSAKeyModulus( - jobject private_key_ref, - std::vector<uint8>* result) { +bool GetRSAKeyModulus(jobject private_key_ref, std::vector<uint8_t>* result) { JNIEnv* env = AttachCurrentThread(); ScopedJavaLocalRef<jbyteArray> modulus_ref = @@ -38,8 +36,7 @@ bool GetRSAKeyModulus( return true; } -bool GetDSAKeyParamQ(jobject private_key_ref, - std::vector<uint8>* result) { +bool GetDSAKeyParamQ(jobject private_key_ref, std::vector<uint8_t>* result) { JNIEnv* env = AttachCurrentThread(); ScopedJavaLocalRef<jbyteArray> q_ref = @@ -54,8 +51,7 @@ bool GetDSAKeyParamQ(jobject private_key_ref, return true; } -bool GetECKeyOrder(jobject private_key_ref, - std::vector<uint8>* result) { +bool GetECKeyOrder(jobject private_key_ref, std::vector<uint8_t>* result) { JNIEnv* env = AttachCurrentThread(); ScopedJavaLocalRef<jbyteArray> order_ref = @@ -72,7 +68,7 @@ bool GetECKeyOrder(jobject private_key_ref, } bool GetPrivateKeyEncodedBytes(jobject private_key_ref, - std::vector<uint8>* result) { + std::vector<uint8_t>* result) { JNIEnv* env = AttachCurrentThread(); ScopedJavaLocalRef<jbyteArray> encoded_ref = @@ -87,17 +83,14 @@ bool GetPrivateKeyEncodedBytes(jobject private_key_ref, return true; } -bool RawSignDigestWithPrivateKey( - jobject private_key_ref, - const base::StringPiece& digest, - std::vector<uint8>* signature) { +bool RawSignDigestWithPrivateKey(jobject private_key_ref, + const base::StringPiece& digest, + std::vector<uint8_t>* signature) { JNIEnv* env = AttachCurrentThread(); // Convert message to byte[] array. - ScopedJavaLocalRef<jbyteArray> digest_ref = - ToJavaByteArray(env, - reinterpret_cast<const uint8*>(digest.data()), - digest.length()); + ScopedJavaLocalRef<jbyteArray> digest_ref = ToJavaByteArray( + env, reinterpret_cast<const uint8_t*>(digest.data()), digest.length()); DCHECK(!digest_ref.is_null()); // Invoke platform API diff --git a/net/android/keystore.h b/net/android/keystore.h index 8274229..1186ef6d 100644 --- a/net/android/keystore.h +++ b/net/android/keystore.h @@ -6,12 +6,12 @@ #define NET_ANDROID_KEYSTORE_H #include <jni.h> +#include <stdint.h> #include <string> #include <vector> #include "base/android/scoped_java_ref.h" -#include "base/basictypes.h" #include "base/strings/string_piece.h" #include "net/base/net_export.h" #include "net/ssl/ssl_client_cert_type.h" @@ -45,7 +45,7 @@ enum PrivateKeyType { // Returns true on success, or false on failure (e.g. if the key // is not RSA). NET_EXPORT bool GetRSAKeyModulus(jobject private_key, - std::vector<uint8>* modulus); + std::vector<uint8_t>* modulus); // Returns the Q parameter of a given DSAPrivateKey platform object, // as a series of bytes, in big-endian representation. This can be used @@ -54,8 +54,7 @@ NET_EXPORT bool GetRSAKeyModulus(jobject private_key, // |q| will receive the result bytes on success. // Returns true on success, or false on failure (e.g. if the key is // not DSA). -NET_EXPORT bool GetDSAKeyParamQ(jobject private_key, - std::vector<uint8>* q); +NET_EXPORT bool GetDSAKeyParamQ(jobject private_key, std::vector<uint8_t>* q); // Returns the order parameter of a given ECPrivateKey platform object, // as a series of bytes, in big-endian representation. This can be used @@ -64,8 +63,7 @@ NET_EXPORT bool GetDSAKeyParamQ(jobject private_key, // |order| will receive the result bytes on success. // Returns true on success, or false on failure (e.g. if the key is // not EC). -bool GetECKeyOrder(jobject private_key, - std::vector<uint8>* order); +bool GetECKeyOrder(jobject private_key, std::vector<uint8_t>* order); // Returns the encoded PKCS#8 representation of a private key. // This only works on Android 4.0.3 and older releases for platform keys @@ -74,7 +72,7 @@ bool GetECKeyOrder(jobject private_key, // |encoded| will receive the encoded data on success. // Returns true on success, or false on failure (e.g. on 4.0.4 or higher). bool GetPrivateKeyEncodedBytes(jobject private_key, - std::vector<uint8>* encoded); + std::vector<uint8_t>* encoded); // Compute the signature of a given message, which is actually a hash, // using a private key. For more details, please read the comments for the @@ -85,11 +83,9 @@ bool GetPrivateKeyEncodedBytes(jobject private_key, // |signature| will receive the signature on success. // Returns true on success, false on failure. // -NET_EXPORT bool RawSignDigestWithPrivateKey( - jobject private_key, - const base::StringPiece& digest, - std::vector<uint8>* signature); - +NET_EXPORT bool RawSignDigestWithPrivateKey(jobject private_key, + const base::StringPiece& digest, + std::vector<uint8_t>* signature); // Return the PrivateKeyType of a given private key. // |private_key| is a JNI reference for the private key. diff --git a/net/android/keystore_openssl.cc b/net/android/keystore_openssl.cc index ff794db..dfd3b1f 100644 --- a/net/android/keystore_openssl.cc +++ b/net/android/keystore_openssl.cc @@ -13,11 +13,11 @@ #include <openssl/evp.h> #include <openssl/rsa.h> #include <openssl/x509.h> +#include <stdint.h> #include "base/android/build_info.h" #include "base/android/jni_android.h" #include "base/android/scoped_java_ref.h" -#include "base/basictypes.h" #include "base/lazy_instance.h" #include "base/logging.h" #include "crypto/openssl_util.h" @@ -152,7 +152,7 @@ base::LazyInstance<BoringSSLEngine>::Leaky global_boringssl_engine = // VectorBignumSize returns the number of bytes needed to represent the bignum // given in |v|, i.e. the length of |v| less any leading zero bytes. -size_t VectorBignumSize(const std::vector<uint8>& v) { +size_t VectorBignumSize(const std::vector<uint8_t>& v) { size_t size = v.size(); // Ignore any leading zero bytes. for (size_t i = 0; i < v.size() && v[i] == 0; i++) { @@ -232,7 +232,7 @@ int RsaMethodSignRaw(RSA* rsa, } base::StringPiece from_piece(reinterpret_cast<const char*>(in), in_len); - std::vector<uint8> result; + std::vector<uint8_t> result; // For RSA keys, this function behaves as RSA_private_encrypt with // PKCS#1 padding. if (!RawSignDigestWithPrivateKey(ex_data->private_key, from_piece, &result)) { @@ -334,7 +334,7 @@ crypto::ScopedEVP_PKEY CreateRsaPkeyWrapper( return crypto::ScopedEVP_PKEY(); } - std::vector<uint8> modulus; + std::vector<uint8_t> modulus; if (!GetRSAKeyModulus(private_key, &modulus)) { LOG(ERROR) << "Failed to get private key modulus"; return crypto::ScopedEVP_PKEY(); @@ -479,7 +479,7 @@ int EcdsaMethodSign(const uint8_t* digest, return 0; } // Sign message with it through JNI. - std::vector<uint8> signature; + std::vector<uint8_t> signature; base::StringPiece digest_sp(reinterpret_cast<const char*>(digest), digest_len); if (!RawSignDigestWithPrivateKey(private_key, digest_sp, &signature)) { @@ -530,7 +530,7 @@ crypto::ScopedEVP_PKEY GetEcdsaPkeyWrapper(jobject private_key) { return crypto::ScopedEVP_PKEY(); } - std::vector<uint8> order; + std::vector<uint8_t> order; if (!GetECKeyOrder(private_key, &order)) { LOG(ERROR) << "Can't extract order parameter from EC private key"; return crypto::ScopedEVP_PKEY(); diff --git a/net/android/keystore_unittest.cc b/net/android/keystore_unittest.cc index ae03b3e..271016f 100644 --- a/net/android/keystore_unittest.cc +++ b/net/android/keystore_unittest.cc @@ -15,7 +15,6 @@ #include "base/android/jni_android.h" #include "base/android/jni_array.h" #include "base/android/scoped_java_ref.h" -#include "base/basictypes.h" #include "base/bind.h" #include "base/callback.h" #include "base/compiler_specific.h" @@ -177,8 +176,7 @@ ScopedJava GetPKCS8PrivateKeyJava(PrivateKeyType key_type, JNIEnv* env = InitEnv(); base::android::ScopedJavaLocalRef<jbyteArray> bytes( base::android::ToJavaByteArray( - env, - reinterpret_cast<const uint8*>(pkcs8_key.data()), + env, reinterpret_cast<const uint8_t*>(pkcs8_key.data()), pkcs8_key.size())); ScopedJava key( @@ -375,7 +373,7 @@ void DoKeySigning(jobject android_key, const base::StringPiece& message, std::string* result) { // First, get the platform signature. - std::vector<uint8> android_signature; + std::vector<uint8_t> android_signature; ASSERT_TRUE( RawSignDigestWithPrivateKey(android_key, message, @@ -428,7 +426,7 @@ TEST(AndroidKeyStore,GetRSAKeyModulus) { ASSERT_FALSE(key_java.is_null()); // Retrieve the corresponding modulus through JNI - std::vector<uint8> modulus_java; + std::vector<uint8_t> modulus_java; ASSERT_TRUE(GetRSAKeyModulus(key_java.obj(), &modulus_java)); // Create an OpenSSL BIGNUM from it. diff --git a/net/android/net_jni_registrar.cc b/net/android/net_jni_registrar.cc index 586f018..1175d96 100644 --- a/net/android/net_jni_registrar.cc +++ b/net/android/net_jni_registrar.cc @@ -4,7 +4,6 @@ #include "net/android/net_jni_registrar.h" -#include "base/basictypes.h" #include "base/android/jni_android.h" #include "base/android/jni_registrar.h" #include "net/android/android_private_key.h" diff --git a/net/android/network_change_notifier_android.h b/net/android/network_change_notifier_android.h index bb46693..1acb840 100644 --- a/net/android/network_change_notifier_android.h +++ b/net/android/network_change_notifier_android.h @@ -6,8 +6,8 @@ #define NET_ANDROID_NETWORK_CHANGE_NOTIFIER_ANDROID_H_ #include "base/android/jni_android.h" -#include "base/basictypes.h" #include "base/compiler_specific.h" +#include "base/macros.h" #include "net/android/network_change_notifier_delegate_android.h" #include "net/base/network_change_notifier.h" diff --git a/net/android/network_change_notifier_android_unittest.cc b/net/android/network_change_notifier_android_unittest.cc index 8c63d81..933e0a3 100644 --- a/net/android/network_change_notifier_android_unittest.cc +++ b/net/android/network_change_notifier_android_unittest.cc @@ -4,7 +4,6 @@ // See network_change_notifier_android.h for design explanations. -#include "base/basictypes.h" #include "base/bind.h" #include "base/callback.h" #include "base/compiler_specific.h" diff --git a/net/android/network_change_notifier_delegate_android.h b/net/android/network_change_notifier_delegate_android.h index cf8390f..93133f3 100644 --- a/net/android/network_change_notifier_delegate_android.h +++ b/net/android/network_change_notifier_delegate_android.h @@ -6,7 +6,7 @@ #define NET_ANDROID_NETWORK_CHANGE_NOTIFIER_DELEGATE_ANDROID_H_ #include "base/android/jni_android.h" -#include "base/basictypes.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/observer_list_threadsafe.h" #include "base/synchronization/lock.h" diff --git a/net/android/network_change_notifier_factory_android.h b/net/android/network_change_notifier_factory_android.h index 035a84e..ab4d169 100644 --- a/net/android/network_change_notifier_factory_android.h +++ b/net/android/network_change_notifier_factory_android.h @@ -5,8 +5,8 @@ #ifndef NET_ANDROID_NETWORK_CHANGE_NOTIFIER_FACTORY_ANDROID_H_ #define NET_ANDROID_NETWORK_CHANGE_NOTIFIER_FACTORY_ANDROID_H_ -#include "base/basictypes.h" #include "base/compiler_specific.h" +#include "base/macros.h" #include "net/android/network_change_notifier_delegate_android.h" #include "net/base/net_export.h" #include "net/base/network_change_notifier_factory.h" diff --git a/net/android/network_library.cc b/net/android/network_library.cc index 0544395..83d43ff 100644 --- a/net/android/network_library.cc +++ b/net/android/network_library.cc @@ -50,7 +50,7 @@ void VerifyX509CertChain(const std::vector<std::string>& cert_chain, status, is_issued_by_known_root, verified_chain); } -void AddTestRootCertificate(const uint8* cert, size_t len) { +void AddTestRootCertificate(const uint8_t* cert, size_t len) { JNIEnv* env = AttachCurrentThread(); ScopedJavaLocalRef<jbyteArray> cert_array = ToJavaByteArray(env, cert, len); DCHECK(!cert_array.is_null()); @@ -62,9 +62,9 @@ void ClearTestRootCertificates() { Java_AndroidNetworkLibrary_clearTestRootCertificates(env); } -bool StoreKeyPair(const uint8* public_key, +bool StoreKeyPair(const uint8_t* public_key, size_t public_len, - const uint8* private_key, + const uint8_t* private_key, size_t private_len) { JNIEnv* env = AttachCurrentThread(); ScopedJavaLocalRef<jbyteArray> public_array = @@ -83,7 +83,7 @@ void StoreCertificate(net::CertificateMimeType cert_type, size_t data_len) { JNIEnv* env = AttachCurrentThread(); ScopedJavaLocalRef<jbyteArray> data_array = - ToJavaByteArray(env, reinterpret_cast<const uint8*>(data), data_len); + ToJavaByteArray(env, reinterpret_cast<const uint8_t*>(data), data_len); jboolean ret = Java_AndroidNetworkLibrary_storeCertificate(env, GetApplicationContext(), cert_type, data_array.obj()); LOG_IF(WARNING, !ret) << diff --git a/net/android/network_library.h b/net/android/network_library.h index f18ee19..3f1d44e 100644 --- a/net/android/network_library.h +++ b/net/android/network_library.h @@ -6,11 +6,11 @@ #define NET_ANDROID_NETWORK_LIBRARY_H_ #include <jni.h> +#include <stdint.h> #include <string> #include <vector> -#include "base/basictypes.h" #include "net/android/cert_verify_result_android.h" #include "net/base/mime_util.h" #include "net/base/net_export.h" @@ -30,7 +30,7 @@ void VerifyX509CertChain(const std::vector<std::string>& cert_chain, // Adds a certificate as a root trust certificate to the trust manager. // |cert| is DER encoded certificate, |len| is its length in bytes. -void AddTestRootCertificate(const uint8* cert, size_t len); +void AddTestRootCertificate(const uint8_t* cert, size_t len); // Removes all root certificates added by |AddTestRootCertificate| calls. void ClearTestRootCertificates(); @@ -44,9 +44,9 @@ void ClearTestRootCertificates(); // i2d_PKCS8_PRIV_KEY_INFO(EVP_PKEY2PKCS8(pkey)), which is a different // format than what i2d_PrivateKey() returns, so don't use it either. // -bool StoreKeyPair(const uint8* public_key, +bool StoreKeyPair(const uint8_t* public_key, size_t public_len, - const uint8* private_key, + const uint8_t* private_key, size_t private_len); // Helper used to pass the DER-encoded bytes of an X.509 certificate or diff --git a/net/base/address_list.cc b/net/base/address_list.cc index e4b25a0..98704ed 100644 --- a/net/base/address_list.cc +++ b/net/base/address_list.cc @@ -41,7 +41,7 @@ AddressList::AddressList(const IPEndPoint& endpoint) { // static AddressList AddressList::CreateFromIPAddress(const IPAddressNumber& address, - uint16 port) { + uint16_t port) { return AddressList(IPEndPoint(address, port)); } @@ -76,7 +76,7 @@ AddressList AddressList::CreateFromAddrinfo(const struct addrinfo* head) { } // static -AddressList AddressList::CopyWithPort(const AddressList& list, uint16 port) { +AddressList AddressList::CopyWithPort(const AddressList& list, uint16_t port) { AddressList out; out.set_canonical_name(list.canonical_name()); for (size_t i = 0; i < list.size(); ++i) diff --git a/net/base/address_list.h b/net/base/address_list.h index 206a92b..0f90800 100644 --- a/net/base/address_list.h +++ b/net/base/address_list.h @@ -29,7 +29,7 @@ class NET_EXPORT AddressList explicit AddressList(const IPEndPoint& endpoint); static AddressList CreateFromIPAddress(const IPAddressNumber& address, - uint16 port); + uint16_t port); static AddressList CreateFromIPAddressList( const IPAddressList& addresses, @@ -39,7 +39,7 @@ class NET_EXPORT AddressList static AddressList CreateFromAddrinfo(const struct addrinfo* head); // Returns a copy of |list| with port on each element set to |port|. - static AddressList CopyWithPort(const AddressList& list, uint16 port); + static AddressList CopyWithPort(const AddressList& list, uint16_t port); // TODO(szym): Remove all three. http://crbug.com/126134 const std::string& canonical_name() const { diff --git a/net/base/address_list_unittest.cc b/net/base/address_list_unittest.cc index 4f70b67..cdf7fa8 100644 --- a/net/base/address_list_unittest.cc +++ b/net/base/address_list_unittest.cc @@ -54,7 +54,7 @@ TEST(AddressListTest, CreateFromAddrinfo) { memset(&addr->sin_addr, i, kIPv4AddressSize); addr->sin_family = AF_INET; // Set port to i << 2; - addr->sin_port = base::HostToNet16(static_cast<uint16>(i << 2)); + addr->sin_port = base::HostToNet16(static_cast<uint16_t>(i << 2)); memset(&ai[i], 0x0, sizeof(ai[i])); ai[i].ai_family = addr->sin_family; ai[i].ai_socktype = SOCK_STREAM; diff --git a/net/base/address_tracker_linux_unittest.cc b/net/base/address_tracker_linux_unittest.cc index 2e853ae..ad81517 100644 --- a/net/base/address_tracker_linux_unittest.cc +++ b/net/base/address_tracker_linux_unittest.cc @@ -113,7 +113,7 @@ namespace { class NetlinkMessage { public: - explicit NetlinkMessage(uint16 type) : buffer_(NLMSG_HDRLEN) { + explicit NetlinkMessage(uint16_t type) : buffer_(NLMSG_HDRLEN) { header()->nlmsg_type = type; Align(); } @@ -125,7 +125,7 @@ class NetlinkMessage { Align(); } - void AddAttribute(uint16 type, const void* data, size_t length) { + void AddAttribute(uint16_t type, const void* data, size_t length) { struct nlattr attr; attr.nla_len = NLA_HDRLEN + length; attr.nla_type = type; @@ -163,13 +163,13 @@ class NetlinkMessage { #define INFINITY_LIFE_TIME 0xFFFFFFFF -void MakeAddrMessageWithCacheInfo(uint16 type, - uint8 flags, - uint8 family, +void MakeAddrMessageWithCacheInfo(uint16_t type, + uint8_t flags, + uint8_t family, int index, const IPAddressNumber& address, const IPAddressNumber& local, - uint32 preferred_lifetime, + uint32_t preferred_lifetime, Buffer* output) { NetlinkMessage nlmsg(type); struct ifaddrmsg msg = {}; @@ -188,9 +188,9 @@ void MakeAddrMessageWithCacheInfo(uint16 type, nlmsg.AppendTo(output); } -void MakeAddrMessage(uint16 type, - uint8 flags, - uint8 family, +void MakeAddrMessage(uint16_t type, + uint8_t flags, + uint8_t family, int index, const IPAddressNumber& address, const IPAddressNumber& local, @@ -199,7 +199,10 @@ void MakeAddrMessage(uint16 type, INFINITY_LIFE_TIME, output); } -void MakeLinkMessage(uint16 type, uint32 flags, uint32 index, Buffer* output) { +void MakeLinkMessage(uint16_t type, + uint32_t flags, + uint32_t index, + Buffer* output) { NetlinkMessage nlmsg(type); struct ifinfomsg msg = {}; msg.ifi_index = index; diff --git a/net/base/backoff_entry.cc b/net/base/backoff_entry.cc index 870d6a1..ac4882c 100644 --- a/net/base/backoff_entry.cc +++ b/net/base/backoff_entry.cc @@ -87,7 +87,7 @@ bool BackoffEntry::CanDiscard() const { base::TimeTicks now = GetTimeTicksNow(); - int64 unused_since_ms = + int64_t unused_since_ms = (now - exponential_backoff_release_time_).InMilliseconds(); // Release time is further than now, we are managing it. @@ -135,14 +135,14 @@ base::TimeTicks BackoffEntry::CalculateReleaseTime() const { // effective_failure_count - 1) * Uniform(1 - jitter_factor, 1] // Note: if the failure count is too high, |delay_ms| will become infinity // after the exponential calculation, and then NaN after the jitter is - // accounted for. Both cases are handled by using CheckedNumeric<int64> to + // accounted for. Both cases are handled by using CheckedNumeric<int64_t> to // perform the conversion to integers. double delay_ms = policy_->initial_delay_ms; delay_ms *= pow(policy_->multiply_factor, effective_failure_count - 1); delay_ms -= base::RandDouble() * policy_->jitter_factor * delay_ms; // Do overflow checking in microseconds, the internal unit of TimeTicks. - base::internal::CheckedNumeric<int64> backoff_duration_us = delay_ms + 0.5; + base::internal::CheckedNumeric<int64_t> backoff_duration_us = delay_ms + 0.5; backoff_duration_us *= base::Time::kMicrosecondsPerMillisecond; base::TimeDelta backoff_duration = base::TimeDelta::FromMicroseconds( backoff_duration_us.ValueOrDefault(kint64max)); @@ -155,14 +155,14 @@ base::TimeTicks BackoffEntry::CalculateReleaseTime() const { base::TimeTicks BackoffEntry::BackoffDurationToReleaseTime( base::TimeDelta backoff_duration) const { - const int64 kTimeTicksNowUs = + const int64_t kTimeTicksNowUs = (GetTimeTicksNow() - base::TimeTicks()).InMicroseconds(); // Do overflow checking in microseconds, the internal unit of TimeTicks. - base::internal::CheckedNumeric<int64> calculated_release_time_us = + base::internal::CheckedNumeric<int64_t> calculated_release_time_us = backoff_duration.InMicroseconds(); calculated_release_time_us += kTimeTicksNowUs; - base::internal::CheckedNumeric<int64> maximum_release_time_us = kint64max; + base::internal::CheckedNumeric<int64_t> maximum_release_time_us = kint64max; if (policy_->maximum_backoff_ms >= 0) { maximum_release_time_us = policy_->maximum_backoff_ms; maximum_release_time_us *= base::Time::kMicrosecondsPerMillisecond; @@ -171,9 +171,9 @@ base::TimeTicks BackoffEntry::BackoffDurationToReleaseTime( // Decide between maximum release time and calculated release time, accounting // for overflow with both. - int64 release_time_us = std::min( - calculated_release_time_us.ValueOrDefault(kint64max), - maximum_release_time_us.ValueOrDefault(kint64max)); + int64_t release_time_us = + std::min(calculated_release_time_us.ValueOrDefault(kint64max), + maximum_release_time_us.ValueOrDefault(kint64max)); return base::TimeTicks() + base::TimeDelta::FromMicroseconds(release_time_us); } diff --git a/net/base/backoff_entry.h b/net/base/backoff_entry.h index be9d510..2aa3a96 100644 --- a/net/base/backoff_entry.h +++ b/net/base/backoff_entry.h @@ -45,11 +45,11 @@ class NET_EXPORT BackoffEntry : NON_EXPORTED_BASE(public base::NonThreadSafe) { // Maximum amount of time we are willing to delay our request, -1 // for no maximum. - int64 maximum_backoff_ms; + int64_t maximum_backoff_ms; // Time to keep an entry from being discarded even when it // has no significant state, -1 to never discard. - int64 entry_lifetime_ms; + int64_t entry_lifetime_ms; // If true, we always use a delay of initial_delay_ms, even before // we've seen num_errors_to_ignore errors. Otherwise, initial_delay_ms diff --git a/net/base/backoff_entry_serializer.cc b/net/base/backoff_entry_serializer.cc index a4ce27d6..1467553 100644 --- a/net/base/backoff_entry_serializer.cc +++ b/net/base/backoff_entry_serializer.cc @@ -60,7 +60,7 @@ scoped_ptr<BackoffEntry> BackoffEntrySerializer::DeserializeFromValue( std::string absolute_release_time_string; if (!serialized_list->GetString(3, &absolute_release_time_string)) return nullptr; - int64 absolute_release_time_us; + int64_t absolute_release_time_us; if (!base::StringToInt64(absolute_release_time_string, &absolute_release_time_us) || absolute_release_time_us < 0) { diff --git a/net/base/chunked_upload_data_stream.cc b/net/base/chunked_upload_data_stream.cc index f1fbf08..6ba40c5 100644 --- a/net/base/chunked_upload_data_stream.cc +++ b/net/base/chunked_upload_data_stream.cc @@ -11,7 +11,7 @@ namespace net { -ChunkedUploadDataStream::ChunkedUploadDataStream(int64 identifier) +ChunkedUploadDataStream::ChunkedUploadDataStream(int64_t identifier) : UploadDataStream(true, identifier), read_index_(0), read_offset_(0), diff --git a/net/base/chunked_upload_data_stream.h b/net/base/chunked_upload_data_stream.h index 0db5b97..b79108c 100644 --- a/net/base/chunked_upload_data_stream.h +++ b/net/base/chunked_upload_data_stream.h @@ -23,7 +23,7 @@ class IOBuffer; // seekable data, due to this buffering behavior. class NET_EXPORT ChunkedUploadDataStream : public UploadDataStream { public: - explicit ChunkedUploadDataStream(int64 identifier); + explicit ChunkedUploadDataStream(int64_t identifier); ~ChunkedUploadDataStream() override; diff --git a/net/base/completion_callback.h b/net/base/completion_callback.h index 7e5c90e..3b3e605 100644 --- a/net/base/completion_callback.h +++ b/net/base/completion_callback.h @@ -14,9 +14,10 @@ namespace net { // used to report a byte count or network error code. typedef base::Callback<void(int)> CompletionCallback; -// 64bit version of callback specialization that takes a single int64 parameter. -// Usually this is used to report a file offset, size or network error code. -typedef base::Callback<void(int64)> Int64CompletionCallback; +// 64bit version of callback specialization that takes a single int64_t +// parameter. Usually this is used to report a file offset, size or network +// error code. +typedef base::Callback<void(int64_t)> Int64CompletionCallback; typedef base::CancelableCallback<void(int)> CancelableCompletionCallback; diff --git a/net/base/elements_upload_data_stream.cc b/net/base/elements_upload_data_stream.cc index 06c3e3e..e23f632 100644 --- a/net/base/elements_upload_data_stream.cc +++ b/net/base/elements_upload_data_stream.cc @@ -16,7 +16,7 @@ namespace net { ElementsUploadDataStream::ElementsUploadDataStream( ScopedVector<UploadElementReader> element_readers, - int64 identifier) + int64_t identifier) : UploadDataStream(false, identifier), element_readers_(element_readers.Pass()), element_index_(0), @@ -29,7 +29,7 @@ ElementsUploadDataStream::~ElementsUploadDataStream() { scoped_ptr<UploadDataStream> ElementsUploadDataStream::CreateWithReader( scoped_ptr<UploadElementReader> reader, - int64 identifier) { + int64_t identifier) { ScopedVector<UploadElementReader> readers; readers.push_back(reader.Pass()); return scoped_ptr<UploadDataStream>( @@ -82,7 +82,7 @@ int ElementsUploadDataStream::InitElements(size_t start_index) { return result; } - uint64 total_size = 0; + uint64_t total_size = 0; for (size_t i = 0; i < element_readers_.size(); ++i) { total_size += element_readers_[i]->GetContentLength(); } @@ -129,9 +129,9 @@ int ElementsUploadDataStream::ReadElements( if (read_failed_) { // If an error occured during read operation, then pad with zero. // Otherwise the server will hang waiting for the rest of the data. - int num_bytes_to_fill = static_cast<int>(std::min( - static_cast<uint64>(buf->BytesRemaining()), - size() - position() - buf->BytesConsumed())); + int num_bytes_to_fill = + static_cast<int>(std::min(static_cast<uint64_t>(buf->BytesRemaining()), + size() - position() - buf->BytesConsumed())); DCHECK_GE(num_bytes_to_fill, 0); memset(buf->data(), 0, num_bytes_to_fill); buf->DidConsume(num_bytes_to_fill); diff --git a/net/base/elements_upload_data_stream.h b/net/base/elements_upload_data_stream.h index 5101114..c65c3c6 100644 --- a/net/base/elements_upload_data_stream.h +++ b/net/base/elements_upload_data_stream.h @@ -24,7 +24,7 @@ class UploadElementReader; class NET_EXPORT ElementsUploadDataStream : public UploadDataStream { public: ElementsUploadDataStream(ScopedVector<UploadElementReader> element_readers, - int64 identifier); + int64_t identifier); ~ElementsUploadDataStream() override; @@ -32,7 +32,7 @@ class NET_EXPORT ElementsUploadDataStream : public UploadDataStream { // scoped_ptr<UploadDataStream> for ease of use. static scoped_ptr<UploadDataStream> CreateWithReader( scoped_ptr<UploadElementReader> reader, - int64 identifier); + int64_t identifier); private: // UploadDataStream implementation. diff --git a/net/base/elements_upload_data_stream_unittest.cc b/net/base/elements_upload_data_stream_unittest.cc index 78229d2..1061bbf 100644 --- a/net/base/elements_upload_data_stream_unittest.cc +++ b/net/base/elements_upload_data_stream_unittest.cc @@ -68,8 +68,8 @@ class MockUploadElementReader : public UploadElementReader { // UploadElementReader overrides. MOCK_METHOD1(Init, int(const CompletionCallback& callback)); - uint64 GetContentLength() const override { return content_length_; } - uint64 BytesRemaining() const override { return bytes_remaining_; } + uint64_t GetContentLength() const override { return content_length_; } + uint64_t BytesRemaining() const override { return bytes_remaining_; } bool IsInMemory() const override { return is_in_memory_; } MOCK_METHOD3(Read, int(IOBuffer* buf, int buf_length, @@ -213,7 +213,7 @@ TEST_F(ElementsUploadDataStreamTest, FileSmallerThanLength) { &temp_file_path)); ASSERT_EQ(static_cast<int>(kTestDataSize), base::WriteFile(temp_file_path, kTestData, kTestDataSize)); - const uint64 kFakeSize = kTestDataSize*2; + const uint64_t kFakeSize = kTestDataSize * 2; UploadFileElementReader::ScopedOverridingContentLengthForTests overriding_content_length(kFakeSize); @@ -234,7 +234,7 @@ TEST_F(ElementsUploadDataStreamTest, FileSmallerThanLength) { EXPECT_EQ(kFakeSize, stream->size()); EXPECT_EQ(0U, stream->position()); EXPECT_FALSE(stream->IsEOF()); - uint64 read_counter = 0; + uint64_t read_counter = 0; scoped_refptr<IOBuffer> buf = new IOBuffer(kTestBufferSize); while (!stream->IsEOF()) { TestCompletionCallback read_callback; @@ -335,8 +335,8 @@ TEST_F(ElementsUploadDataStreamTest, FileAndBytes) { ASSERT_EQ(static_cast<int>(kTestDataSize), base::WriteFile(temp_file_path, kTestData, kTestDataSize)); - const uint64 kFileRangeOffset = 1; - const uint64 kFileRangeLength = 4; + const uint64_t kFileRangeOffset = 1; + const uint64_t kFileRangeLength = 4; element_readers_.push_back( new UploadFileElementReader(base::MessageLoopProxy::current().get(), temp_file_path, @@ -347,7 +347,7 @@ TEST_F(ElementsUploadDataStreamTest, FileAndBytes) { element_readers_.push_back(new UploadBytesElementReader( kTestData, kTestDataSize)); - const uint64 kStreamSize = kTestDataSize + kFileRangeLength; + const uint64_t kStreamSize = kTestDataSize + kFileRangeLength; TestCompletionCallback init_callback; scoped_ptr<UploadDataStream> stream( new ElementsUploadDataStream(element_readers_.Pass(), 0)); diff --git a/net/base/escape.cc b/net/base/escape.cc index 05cc2b5..8e6f870 100644 --- a/net/base/escape.cc +++ b/net/base/escape.cc @@ -33,7 +33,7 @@ struct Charmap { return ((map[c >> 5] & (1 << (c & 31))) != 0); } - uint32 map[8]; + uint32_t map[8]; }; // Given text to escape and a Charmap defining which values to escape, diff --git a/net/base/escape.h b/net/base/escape.h index c11df08..c4abe14 100644 --- a/net/base/escape.h +++ b/net/base/escape.h @@ -66,7 +66,7 @@ class UnescapeRule { public: // A combination of the following flags that is passed to the unescaping // functions. - typedef uint32 Type; + typedef uint32_t Type; enum { // Don't unescape anything at all. diff --git a/net/base/file_stream.cc b/net/base/file_stream.cc index a97d50b..ab0a3be 100644 --- a/net/base/file_stream.cc +++ b/net/base/file_stream.cc @@ -45,7 +45,7 @@ bool FileStream::IsOpen() const { } int FileStream::Seek(base::File::Whence whence, - int64 offset, + int64_t offset, const Int64CompletionCallback& callback) { if (!IsOpen()) return ERR_UNEXPECTED; diff --git a/net/base/file_stream.h b/net/base/file_stream.h index 89db65e..1524da5 100644 --- a/net/base/file_stream.h +++ b/net/base/file_stream.h @@ -68,7 +68,8 @@ class NET_EXPORT FileStream { // relative to the start of the file. Otherwise, an error code is returned. // It is invalid to request any asynchronous operations while there is an // in-flight asynchronous operation. - virtual int Seek(base::File::Whence whence, int64 offset, + virtual int Seek(base::File::Whence whence, + int64_t offset, const Int64CompletionCallback& callback); // Call this method to read data from the current stream position diff --git a/net/base/file_stream_context.cc b/net/base/file_stream_context.cc index eeb6893..b152a99 100644 --- a/net/base/file_stream_context.cc +++ b/net/base/file_stream_context.cc @@ -22,7 +22,7 @@ namespace net { namespace { -void CallInt64ToInt(const CompletionCallback& callback, int64 result) { +void CallInt64ToInt(const CompletionCallback& callback, int64_t result) { callback.Run(static_cast<int>(result)); } @@ -33,10 +33,9 @@ FileStream::Context::IOResult::IOResult() os_error(0) { } -FileStream::Context::IOResult::IOResult(int64 result, +FileStream::Context::IOResult::IOResult(int64_t result, logging::SystemErrorCode os_error) - : result(result), - os_error(os_error) { + : result(result), os_error(os_error) { } // static @@ -117,7 +116,7 @@ void FileStream::Context::Close(const CompletionCallback& callback) { } void FileStream::Context::Seek(base::File::Whence whence, - int64 offset, + int64_t offset, const Int64CompletionCallback& callback) { DCHECK(!async_in_progress_); diff --git a/net/base/file_stream_context.h b/net/base/file_stream_context.h index 74677fe..f49e5bc 100644 --- a/net/base/file_stream_context.h +++ b/net/base/file_stream_context.h @@ -93,7 +93,7 @@ class FileStream::Context { void Close(const CompletionCallback& callback); void Seek(base::File::Whence whence, - int64 offset, + int64_t offset, const Int64CompletionCallback& callback); void Flush(const CompletionCallback& callback); @@ -101,10 +101,10 @@ class FileStream::Context { private: struct IOResult { IOResult(); - IOResult(int64 result, logging::SystemErrorCode os_error); + IOResult(int64_t result, logging::SystemErrorCode os_error); static IOResult FromOSError(logging::SystemErrorCode os_error); - int64 result; + int64_t result; logging::SystemErrorCode os_error; // Set only when result < 0. }; @@ -149,7 +149,7 @@ class FileStream::Context { //////////////////////////////////////////////////////////////////////////// // Adjusts the position from where the data is read. - IOResult SeekFileImpl(base::File::Whence whence, int64 offset); + IOResult SeekFileImpl(base::File::Whence whence, int64_t offset); void OnFileOpened(); diff --git a/net/base/file_stream_context_posix.cc b/net/base/file_stream_context_posix.cc index 489216f..dd62ebb 100644 --- a/net/base/file_stream_context_posix.cc +++ b/net/base/file_stream_context_posix.cc @@ -80,8 +80,8 @@ int FileStream::Context::Write(IOBuffer* in_buf, FileStream::Context::IOResult FileStream::Context::SeekFileImpl( base::File::Whence whence, - int64 offset) { - int64 res = file_.Seek(whence, offset); + int64_t offset) { + int64_t res = file_.Seek(whence, offset); if (res == -1) return IOResult::FromOSError(errno); diff --git a/net/base/file_stream_context_win.cc b/net/base/file_stream_context_win.cc index 1a39384..5344e68 100644 --- a/net/base/file_stream_context_win.cc +++ b/net/base/file_stream_context_win.cc @@ -116,7 +116,7 @@ int FileStream::Context::Write(IOBuffer* buf, FileStream::Context::IOResult FileStream::Context::SeekFileImpl( base::File::Whence whence, - int64 offset) { + int64_t offset) { LARGE_INTEGER result; result.QuadPart = file_.Seek(whence, offset); if (result.QuadPart >= 0) { diff --git a/net/base/file_stream_unittest.cc b/net/base/file_stream_unittest.cc index 1e6e6db..1c67b4b 100644 --- a/net/base/file_stream_unittest.cc +++ b/net/base/file_stream_unittest.cc @@ -177,7 +177,7 @@ TEST_F(FileStreamTest, UseClosedStream) { } TEST_F(FileStreamTest, Read) { - int64 file_size; + int64_t file_size; EXPECT_TRUE(base::GetFileSize(temp_file_path(), &file_size)); FileStream stream(base::MessageLoopProxy::current()); @@ -205,7 +205,7 @@ TEST_F(FileStreamTest, Read) { } TEST_F(FileStreamTest, Read_EarlyDelete) { - int64 file_size; + int64_t file_size; EXPECT_TRUE(base::GetFileSize(temp_file_path(), &file_size)); scoped_ptr<FileStream> stream( @@ -231,7 +231,7 @@ TEST_F(FileStreamTest, Read_EarlyDelete) { } TEST_F(FileStreamTest, Read_FromOffset) { - int64 file_size; + int64_t file_size; EXPECT_TRUE(base::GetFileSize(temp_file_path(), &file_size)); FileStream stream(base::MessageLoopProxy::current()); @@ -243,10 +243,10 @@ TEST_F(FileStreamTest, Read_FromOffset) { EXPECT_EQ(OK, callback.WaitForResult()); TestInt64CompletionCallback callback64; - const int64 kOffset = 3; + const int64_t kOffset = 3; rv = stream.Seek(base::File::FROM_BEGIN, kOffset, callback64.callback()); ASSERT_EQ(ERR_IO_PENDING, rv); - int64 new_offset = callback64.WaitForResult(); + int64_t new_offset = callback64.WaitForResult(); EXPECT_EQ(kOffset, new_offset); int total_bytes_read = 0; @@ -278,10 +278,10 @@ TEST_F(FileStreamTest, SeekAround) { TestInt64CompletionCallback callback64; - const int64 kOffset = 3; + const int64_t kOffset = 3; rv = stream.Seek(base::File::FROM_BEGIN, kOffset, callback64.callback()); ASSERT_EQ(ERR_IO_PENDING, rv); - int64 new_offset = callback64.WaitForResult(); + int64_t new_offset = callback64.WaitForResult(); EXPECT_EQ(kOffset, new_offset); rv = stream.Seek(base::File::FROM_CURRENT, kOffset, callback64.callback()); @@ -310,7 +310,7 @@ TEST_F(FileStreamTest, Write) { int rv = stream.Open(temp_file_path(), flags, callback.callback()); EXPECT_EQ(OK, callback.GetResult(rv)); - int64 file_size; + int64_t file_size; EXPECT_TRUE(base::GetFileSize(temp_file_path(), &file_size)); EXPECT_EQ(0, file_size); @@ -337,7 +337,7 @@ TEST_F(FileStreamTest, Write_EarlyDelete) { EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(OK, callback.WaitForResult()); - int64 file_size; + int64_t file_size; EXPECT_TRUE(base::GetFileSize(temp_file_path(), &file_size)); EXPECT_EQ(0, file_size); @@ -356,7 +356,7 @@ TEST_F(FileStreamTest, Write_EarlyDelete) { } TEST_F(FileStreamTest, Write_FromOffset) { - int64 file_size; + int64_t file_size; EXPECT_TRUE(base::GetFileSize(temp_file_path(), &file_size)); FileStream stream(base::MessageLoopProxy::current()); @@ -368,10 +368,10 @@ TEST_F(FileStreamTest, Write_FromOffset) { EXPECT_EQ(OK, callback.WaitForResult()); TestInt64CompletionCallback callback64; - const int64 kOffset = 0; + const int64_t kOffset = 0; rv = stream.Seek(base::File::FROM_END, kOffset, callback64.callback()); ASSERT_EQ(ERR_IO_PENDING, rv); - int64 new_offset = callback64.WaitForResult(); + int64_t new_offset = callback64.WaitForResult(); EXPECT_EQ(kTestDataSize, new_offset); int total_bytes_written = 0; @@ -395,7 +395,7 @@ TEST_F(FileStreamTest, Write_FromOffset) { } TEST_F(FileStreamTest, BasicReadWrite) { - int64 file_size; + int64_t file_size; EXPECT_TRUE(base::GetFileSize(temp_file_path(), &file_size)); scoped_ptr<FileStream> stream( @@ -407,7 +407,7 @@ TEST_F(FileStreamTest, BasicReadWrite) { EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(OK, callback.WaitForResult()); - int64 total_bytes_read = 0; + int64_t total_bytes_read = 0; std::string data_read; for (;;) { @@ -448,7 +448,7 @@ TEST_F(FileStreamTest, BasicReadWrite) { } TEST_F(FileStreamTest, BasicWriteRead) { - int64 file_size; + int64_t file_size; EXPECT_TRUE(base::GetFileSize(temp_file_path(), &file_size)); scoped_ptr<FileStream> stream( @@ -463,7 +463,7 @@ TEST_F(FileStreamTest, BasicWriteRead) { TestInt64CompletionCallback callback64; rv = stream->Seek(base::File::FROM_END, 0, callback64.callback()); ASSERT_EQ(ERR_IO_PENDING, rv); - int64 offset = callback64.WaitForResult(); + int64_t offset = callback64.WaitForResult(); EXPECT_EQ(offset, file_size); int total_bytes_written = 0; @@ -619,7 +619,7 @@ class TestWriteReadCompletionCallback { }; TEST_F(FileStreamTest, WriteRead) { - int64 file_size; + int64_t file_size; EXPECT_TRUE(base::GetFileSize(temp_file_path(), &file_size)); scoped_ptr<FileStream> stream( @@ -726,7 +726,7 @@ class TestWriteCloseCompletionCallback { }; TEST_F(FileStreamTest, WriteClose) { - int64 file_size; + int64_t file_size; EXPECT_TRUE(base::GetFileSize(temp_file_path(), &file_size)); scoped_ptr<FileStream> stream( @@ -793,8 +793,8 @@ TEST_F(FileStreamTest, OpenAndDelete) { // Verify that Write() errors are mapped correctly. TEST_F(FileStreamTest, WriteError) { // Try opening file as read-only and then writing to it using FileStream. - uint32 flags = base::File::FLAG_OPEN | base::File::FLAG_READ | - base::File::FLAG_ASYNC; + uint32_t flags = + base::File::FLAG_OPEN | base::File::FLAG_READ | base::File::FLAG_ASYNC; base::File file(temp_file_path(), flags); ASSERT_TRUE(file.IsValid()); @@ -818,8 +818,8 @@ TEST_F(FileStreamTest, WriteError) { // Verify that Read() errors are mapped correctly. TEST_F(FileStreamTest, ReadError) { // Try opening file for write and then reading from it using FileStream. - uint32 flags = base::File::FLAG_OPEN | base::File::FLAG_WRITE | - base::File::FLAG_ASYNC; + uint32_t flags = + base::File::FLAG_OPEN | base::File::FLAG_WRITE | base::File::FLAG_ASYNC; base::File file(temp_file_path(), flags); ASSERT_TRUE(file.IsValid()); @@ -853,7 +853,7 @@ TEST_F(FileStreamTest, ContentUriRead) { base::FilePath path = base::InsertImageIntoMediaStore(image_file); EXPECT_TRUE(path.IsContentUri()); EXPECT_TRUE(base::PathExists(path)); - int64 file_size; + int64_t file_size; EXPECT_TRUE(base::GetFileSize(path, &file_size)); EXPECT_LT(0, file_size); diff --git a/net/base/hash_value.cc b/net/base/hash_value.cc index 9ae1412..2a751cd 100644 --- a/net/base/hash_value.cc +++ b/net/base/hash_value.cc @@ -112,7 +112,7 @@ const unsigned char* HashValue::data() const { } bool IsSHA1HashInSortedArray(const SHA1HashValue& hash, - const uint8* array, + const uint8_t* array, size_t array_byte_len) { DCHECK_EQ(0u, array_byte_len % base::kSHA1Length); const size_t arraylen = array_byte_len / base::kSHA1Length; diff --git a/net/base/hash_value.h b/net/base/hash_value.h index aa0b9f6..d45afca 100644 --- a/net/base/hash_value.h +++ b/net/base/hash_value.h @@ -117,7 +117,7 @@ class HashValuesEqual { // IsSHA1HashInSortedArray returns true iff |hash| is in |array|, a sorted // array of SHA1 hashes. bool IsSHA1HashInSortedArray(const SHA1HashValue& hash, - const uint8* array, + const uint8_t* array, size_t array_byte_len); } // namespace net diff --git a/net/base/host_mapping_rules.cc b/net/base/host_mapping_rules.cc index 01b98b7..a2789c0 100644 --- a/net/base/host_mapping_rules.cc +++ b/net/base/host_mapping_rules.cc @@ -58,7 +58,7 @@ bool HostMappingRules::RewriteHost(HostPortPair* host_port) const { host_port->set_host(rule.replacement_hostname); if (rule.replacement_port != -1) - host_port->set_port(static_cast<uint16>(rule.replacement_port)); + host_port->set_port(static_cast<uint16_t>(rule.replacement_port)); return true; } diff --git a/net/base/host_port_pair.cc b/net/base/host_port_pair.cc index 1550c36..816bbac 100644 --- a/net/base/host_port_pair.cc +++ b/net/base/host_port_pair.cc @@ -16,13 +16,14 @@ namespace net { HostPortPair::HostPortPair() : port_(0) {} -HostPortPair::HostPortPair(const std::string& in_host, uint16 in_port) - : host_(in_host), port_(in_port) {} +HostPortPair::HostPortPair(const std::string& in_host, uint16_t in_port) + : host_(in_host), port_(in_port) { +} // static HostPortPair HostPortPair::FromURL(const GURL& url) { return HostPortPair(url.HostNoBrackets(), - static_cast<uint16>(url.EffectiveIntPort())); + static_cast<uint16_t>(url.EffectiveIntPort())); } // static @@ -42,7 +43,7 @@ HostPortPair HostPortPair::FromString(const std::string& str) { return HostPortPair(); HostPortPair host_port_pair; host_port_pair.set_host(key_port[0]); - host_port_pair.set_port(static_cast<uint16>(port)); + host_port_pair.set_port(static_cast<uint16_t>(port)); return host_port_pair; } diff --git a/net/base/host_port_pair.h b/net/base/host_port_pair.h index a4e5761..9b1df56 100644 --- a/net/base/host_port_pair.h +++ b/net/base/host_port_pair.h @@ -19,7 +19,7 @@ class NET_EXPORT HostPortPair { public: HostPortPair(); // If |in_host| represents an IPv6 address, it should not bracket the address. - HostPortPair(const std::string& in_host, uint16 in_port); + HostPortPair(const std::string& in_host, uint16_t in_port); // Creates a HostPortPair for the origin of |url|. static HostPortPair FromURL(const GURL& url); @@ -52,17 +52,13 @@ class NET_EXPORT HostPortPair { return host_; } - uint16 port() const { - return port_; - } + uint16_t port() const { return port_; } void set_host(const std::string& in_host) { host_ = in_host; } - void set_port(uint16 in_port) { - port_ = in_port; - } + void set_port(uint16_t in_port) { port_ = in_port; } // ToString() will convert the HostPortPair to "host:port". If |host_| is an // IPv6 literal, it will add brackets around |host_|. @@ -75,7 +71,7 @@ class NET_EXPORT HostPortPair { // If |host_| represents an IPv6 address, this string will not contain // brackets around the address. std::string host_; - uint16 port_; + uint16_t port_; }; } // namespace net diff --git a/net/base/host_port_pair_unittest.cc b/net/base/host_port_pair_unittest.cc index 2c97e946..8047cc3 100644 --- a/net/base/host_port_pair_unittest.cc +++ b/net/base/host_port_pair_unittest.cc @@ -16,7 +16,7 @@ namespace { struct TestData { string host; - uint16 port; + uint16_t port; string to_string; string host_for_url; } tests[] = { diff --git a/net/base/ip_address_number.cc b/net/base/ip_address_number.cc index 1cbf5d4..06fc3ac 100644 --- a/net/base/ip_address_number.cc +++ b/net/base/ip_address_number.cc @@ -92,8 +92,7 @@ bool IsIPAddressReserved(const IPAddressNumber& host_addr) { return false; } -std::string IPAddressToString(const uint8* address, - size_t address_len) { +std::string IPAddressToString(const uint8_t* address, size_t address_len) { std::string str; url::StdStringCanonOutput output(&str); @@ -109,9 +108,9 @@ std::string IPAddressToString(const uint8* address, return str; } -std::string IPAddressToStringWithPort(const uint8* address, +std::string IPAddressToStringWithPort(const uint8_t* address, size_t address_len, - uint16 port) { + uint16_t port) { std::string address_str = IPAddressToString(address, address_len); if (address_len == kIPv6AddressSize) { @@ -126,7 +125,7 @@ std::string IPAddressToString(const IPAddressNumber& addr) { } std::string IPAddressToStringWithPort(const IPAddressNumber& addr, - uint16 port) { + uint16_t port) { return IPAddressToStringWithPort(&addr.front(), addr.size(), port); } diff --git a/net/base/ip_address_number.h b/net/base/ip_address_number.h index edfcec8..f8adb05 100644 --- a/net/base/ip_address_number.h +++ b/net/base/ip_address_number.h @@ -32,21 +32,21 @@ NET_EXPORT bool IsIPAddressReserved(const IPAddressNumber& address); // Returns the string representation of an IP address. // For example: "192.168.0.1" or "::1". -NET_EXPORT std::string IPAddressToString(const uint8* address, +NET_EXPORT std::string IPAddressToString(const uint8_t* address, size_t address_len); // Returns the string representation of an IP address along with its port. // For example: "192.168.0.1:99" or "[::1]:80". -NET_EXPORT std::string IPAddressToStringWithPort(const uint8* address, +NET_EXPORT std::string IPAddressToStringWithPort(const uint8_t* address, size_t address_len, - uint16 port); + uint16_t port); // Same as IPAddressToString() but for an IPAddressNumber. NET_EXPORT std::string IPAddressToString(const IPAddressNumber& addr); // Same as IPAddressToStringWithPort() but for an IPAddressNumber. -NET_EXPORT std::string IPAddressToStringWithPort( - const IPAddressNumber& addr, uint16 port); +NET_EXPORT std::string IPAddressToStringWithPort(const IPAddressNumber& addr, + uint16_t port); // Returns the address as a sequence of bytes in network-byte-order. NET_EXPORT std::string IPAddressToPackedString(const IPAddressNumber& addr); diff --git a/net/base/ip_address_number_unittest.cc b/net/base/ip_address_number_unittest.cc index bd4e722..2ee7bed 100644 --- a/net/base/ip_address_number_unittest.cc +++ b/net/base/ip_address_number_unittest.cc @@ -26,25 +26,25 @@ std::string DumpIPNumber(const IPAddressNumber& v) { } TEST(IpAddressNumberTest, IPAddressToString) { - uint8 addr1[4] = {0, 0, 0, 0}; + uint8_t addr1[4] = {0, 0, 0, 0}; EXPECT_EQ("0.0.0.0", IPAddressToString(addr1, sizeof(addr1))); - uint8 addr2[4] = {192, 168, 0, 1}; + uint8_t addr2[4] = {192, 168, 0, 1}; EXPECT_EQ("192.168.0.1", IPAddressToString(addr2, sizeof(addr2))); - uint8 addr3[16] = {0xFE, 0xDC, 0xBA, 0x98}; + uint8_t addr3[16] = {0xFE, 0xDC, 0xBA, 0x98}; EXPECT_EQ("fedc:ba98::", IPAddressToString(addr3, sizeof(addr3))); } TEST(IpAddressNumberTest, IPAddressToStringWithPort) { - uint8 addr1[4] = {0, 0, 0, 0}; + uint8_t addr1[4] = {0, 0, 0, 0}; EXPECT_EQ("0.0.0.0:3", IPAddressToStringWithPort(addr1, sizeof(addr1), 3)); - uint8 addr2[4] = {192, 168, 0, 1}; + uint8_t addr2[4] = {192, 168, 0, 1}; EXPECT_EQ("192.168.0.1:99", IPAddressToStringWithPort(addr2, sizeof(addr2), 99)); - uint8 addr3[16] = {0xFE, 0xDC, 0xBA, 0x98}; + uint8_t addr3[16] = {0xFE, 0xDC, 0xBA, 0x98}; EXPECT_EQ("[fedc:ba98::]:8080", IPAddressToStringWithPort(addr3, sizeof(addr3), 8080)); } diff --git a/net/base/ip_endpoint.cc b/net/base/ip_endpoint.cc index 3b947dd..7834849 100644 --- a/net/base/ip_endpoint.cc +++ b/net/base/ip_endpoint.cc @@ -26,9 +26,9 @@ IPEndPoint::IPEndPoint() : port_(0) {} IPEndPoint::~IPEndPoint() {} -IPEndPoint::IPEndPoint(const IPAddressNumber& address, uint16 port) - : address_(address), - port_(port) {} +IPEndPoint::IPEndPoint(const IPAddressNumber& address, uint16_t port) + : address_(address), port_(port) { +} IPEndPoint::IPEndPoint(const IPEndPoint& endpoint) { address_ = endpoint.address_; @@ -89,9 +89,9 @@ bool IPEndPoint::FromSockAddr(const struct sockaddr* sock_addr, socklen_t sock_addr_len) { DCHECK(sock_addr); - const uint8* address; + const uint8_t* address; size_t address_len; - uint16 port; + uint16_t port; if (!GetIPAddressFromSockAddr(sock_addr, sock_addr_len, &address, &address_len, &port)) { return false; diff --git a/net/base/ip_endpoint.h b/net/base/ip_endpoint.h index 1f9fd0e..784ee03 100644 --- a/net/base/ip_endpoint.h +++ b/net/base/ip_endpoint.h @@ -25,11 +25,11 @@ class NET_EXPORT IPEndPoint { public: IPEndPoint(); ~IPEndPoint(); - IPEndPoint(const IPAddressNumber& address, uint16 port); + IPEndPoint(const IPAddressNumber& address, uint16_t port); IPEndPoint(const IPEndPoint& endpoint); const IPAddressNumber& address() const { return address_; } - uint16 port() const { return port_; } + uint16_t port() const { return port_; } // Returns AddressFamily of the address. AddressFamily GetFamily() const; @@ -66,7 +66,7 @@ class NET_EXPORT IPEndPoint { private: IPAddressNumber address_; - uint16 port_; + uint16_t port_; }; } // namespace net diff --git a/net/base/ip_endpoint_unittest.cc b/net/base/ip_endpoint_unittest.cc index 17b325c..2b5b83e 100644 --- a/net/base/ip_endpoint_unittest.cc +++ b/net/base/ip_endpoint_unittest.cc @@ -29,7 +29,7 @@ struct TestData { { "::1", "[::1]", true }, { "2001:db8:0::42", "[2001:db8::42]", true }, }; -uint16 test_count = static_cast<uint16>(arraysize(tests)); +uint16_t test_count = static_cast<uint16_t>(arraysize(tests)); class IPEndPointTest : public PlatformTest { public: @@ -46,7 +46,7 @@ TEST_F(IPEndPointTest, Constructor) { IPEndPoint endpoint; EXPECT_EQ(0, endpoint.port()); - for (uint16 index = 0; index < test_count; ++index) { + for (uint16_t index = 0; index < test_count; ++index) { IPEndPoint endpoint(tests[index].ip_address, 80); EXPECT_EQ(80, endpoint.port()); EXPECT_EQ(tests[index].ip_address, endpoint.address()); @@ -54,7 +54,7 @@ TEST_F(IPEndPointTest, Constructor) { } TEST_F(IPEndPointTest, Assignment) { - for (uint16 index = 0; index < test_count; ++index) { + for (uint16_t index = 0; index < test_count; ++index) { IPEndPoint src(tests[index].ip_address, index); IPEndPoint dest = src; @@ -64,7 +64,7 @@ TEST_F(IPEndPointTest, Assignment) { } TEST_F(IPEndPointTest, Copy) { - for (uint16 index = 0; index < test_count; ++index) { + for (uint16_t index = 0; index < test_count; ++index) { IPEndPoint src(tests[index].ip_address, index); IPEndPoint dest(src); @@ -74,7 +74,7 @@ TEST_F(IPEndPointTest, Copy) { } TEST_F(IPEndPointTest, ToFromSockAddr) { - for (uint16 index = 0; index < test_count; ++index) { + for (uint16_t index = 0; index < test_count; ++index) { IPEndPoint ip_endpoint(tests[index].ip_address, index); // Convert to a sockaddr. @@ -97,7 +97,7 @@ TEST_F(IPEndPointTest, ToFromSockAddr) { } TEST_F(IPEndPointTest, ToSockAddrBufTooSmall) { - for (uint16 index = 0; index < test_count; ++index) { + for (uint16_t index = 0; index < test_count; ++index) { IPEndPoint ip_endpoint(tests[index].ip_address, index); SockaddrStorage storage; @@ -116,7 +116,7 @@ TEST_F(IPEndPointTest, FromSockAddrBufTooSmall) { } TEST_F(IPEndPointTest, Equality) { - for (uint16 index = 0; index < test_count; ++index) { + for (uint16_t index = 0; index < test_count; ++index) { IPEndPoint src(tests[index].ip_address, index); IPEndPoint dest(src); EXPECT_TRUE(src == dest); @@ -159,8 +159,8 @@ TEST_F(IPEndPointTest, ToString) { IPEndPoint endpoint; EXPECT_EQ(0, endpoint.port()); - for (uint16 index = 0; index < test_count; ++index) { - uint16 port = 100 + index; + for (uint16_t index = 0; index < test_count; ++index) { + uint16_t port = 100 + index; IPEndPoint endpoint(tests[index].ip_address, port); const std::string result = endpoint.ToString(); EXPECT_EQ(tests[index].host_normalized + ":" + base::IntToString(port), diff --git a/net/base/ip_pattern.cc b/net/base/ip_pattern.cc index f67d3a0..941dbf1 100644 --- a/net/base/ip_pattern.cc +++ b/net/base/ip_pattern.cc @@ -18,15 +18,15 @@ namespace net { class IPPattern::ComponentPattern { public: ComponentPattern(); - void AppendRange(uint32 min, uint32 max); - bool Match(uint32 value) const; + void AppendRange(uint32_t min, uint32_t max); + bool Match(uint32_t value) const; private: struct Range { public: - Range(uint32 min, uint32 max) : minimum(min), maximum(max) {} - uint32 minimum; - uint32 maximum; + Range(uint32_t min, uint32_t max) : minimum(min), maximum(max) {} + uint32_t minimum; + uint32_t maximum; }; typedef std::vector<Range> RangeVector; @@ -37,11 +37,11 @@ class IPPattern::ComponentPattern { IPPattern::ComponentPattern::ComponentPattern() {} -void IPPattern::ComponentPattern::AppendRange(uint32 min, uint32 max) { +void IPPattern::ComponentPattern::AppendRange(uint32_t min, uint32_t max) { ranges_.push_back(Range(min, max)); } -bool IPPattern::ComponentPattern::Match(uint32 value) const { +bool IPPattern::ComponentPattern::Match(uint32_t value) const { // Simple linear search should be fine, as we usually only have very few // distinct ranges to test. for (RangeVector::const_iterator range_it = ranges_.begin(); @@ -71,7 +71,7 @@ bool IPPattern::Match(const IPAddressNumber& address) const { // 8, so it is easier to count separately. int address_index = 0; for (size_t i = 0; i < ip_mask_.size(); ++i) { - uint32 value_to_test = address[address_index++]; + uint32_t value_to_test = address[address_index++]; if (!is_ipv4_) { value_to_test = (value_to_test << 8) + address[address_index++]; } @@ -109,7 +109,7 @@ bool IPPattern::ParsePattern(const std::string& ip_pattern) { *component_it = is_ipv4_ ? "[0-255]" : "[0-FFFF]"; } else if ((*component_it)[0] != '[') { // This value will just have a specific integer to match. - uint32 value; + uint32_t value; if (!ValueTextToInt(*component_it, &value)) return false; ip_mask_.push_back(true); @@ -147,11 +147,11 @@ bool IPPattern::ParseComponentPattern(const base::StringPiece& text, for (Strings::iterator range_it = ranges.begin(); range_it != ranges.end(); ++range_it) { base::StringTokenizer range_pair(*range_it, "-"); - uint32 min = 0; + uint32_t min = 0; range_pair.GetNext(); if (!ValueTextToInt(range_pair.token(), &min)) return false; - uint32 max = min; // Sometimes we have no distinct max. + uint32_t max = min; // Sometimes we have no distinct max. if (range_pair.GetNext()) { if (!ValueTextToInt(range_pair.token(), &max)) return false; @@ -167,7 +167,7 @@ bool IPPattern::ParseComponentPattern(const base::StringPiece& text, } bool IPPattern::ValueTextToInt(const base::StringPiece& input, - uint32* output) const { + uint32_t* output) const { bool ok = is_ipv4_ ? base::StringToUint(input, output) : base::HexStringToUInt(input, output); if (!ok) { diff --git a/net/base/ip_pattern.h b/net/base/ip_pattern.h index a20a8b5..2891927 100644 --- a/net/base/ip_pattern.h +++ b/net/base/ip_pattern.h @@ -41,7 +41,7 @@ class NET_EXPORT IPPattern { bool ParseComponentPattern(const base::StringPiece& text, ComponentPattern* pattern) const; // Convert IP component to an int. Assume hex vs decimal for IPV6 vs V4. - bool ValueTextToInt(const base::StringPiece& input, uint32* output) const; + bool ValueTextToInt(const base::StringPiece& input, uint32_t* output) const; bool is_ipv4_; // The |ip_mask_| indicates, for each component, if this pattern requires an @@ -55,7 +55,7 @@ class NET_EXPORT IPPattern { // The class invariant is: // ip_mask_.size() == component_patterns_.size() // + size(our ComponentPattern list) - std::vector<uint32> component_values_; + std::vector<uint32_t> component_values_; // If only one component position was specified using a range, then this // list will only have 1 element (i.e., we only have patterns for each element // of ip_mask_ that is false.) diff --git a/net/base/load_timing_info.h b/net/base/load_timing_info.h index 00dbabf..4714222 100644 --- a/net/base/load_timing_info.h +++ b/net/base/load_timing_info.h @@ -113,7 +113,7 @@ struct NET_EXPORT LoadTimingInfo { // // 0 when there is no socket associated with the request, or it's not an HTTP // request. - uint32 socket_log_id; + uint32_t socket_log_id; // Start time as a base::Time, so times can be coverted into actual times. // Other times are recorded as TimeTicks so they are not affected by clock diff --git a/net/base/mock_file_stream.cc b/net/base/mock_file_stream.cc index 792b23b..33844a4 100644 --- a/net/base/mock_file_stream.cc +++ b/net/base/mock_file_stream.cc @@ -33,7 +33,8 @@ MockFileStream::MockFileStream( MockFileStream::~MockFileStream() { } -int MockFileStream::Seek(base::File::Whence whence, int64 offset, +int MockFileStream::Seek(base::File::Whence whence, + int64_t offset, const Int64CompletionCallback& callback) { Int64CompletionCallback wrapped_callback = base::Bind(&MockFileStream::DoCallback64, @@ -101,7 +102,7 @@ void MockFileStream::DoCallback(const CompletionCallback& callback, } void MockFileStream::DoCallback64(const Int64CompletionCallback& callback, - int64 result) { + int64_t result) { if (!throttled_) { callback.Run(result); return; @@ -123,7 +124,8 @@ int MockFileStream::ErrorCallback(const CompletionCallback& callback) { return ret; } -int64 MockFileStream::ErrorCallback64(const Int64CompletionCallback& callback) { +int64_t MockFileStream::ErrorCallback64( + const Int64CompletionCallback& callback) { CHECK_NE(OK, forced_error_); if (async_error_) { base::MessageLoop::current()->PostTask( @@ -131,7 +133,7 @@ int64 MockFileStream::ErrorCallback64(const Int64CompletionCallback& callback) { clear_forced_error(); return ERR_IO_PENDING; } - int64 ret = forced_error_; + int64_t ret = forced_error_; clear_forced_error(); return ret; } diff --git a/net/base/mock_file_stream.h b/net/base/mock_file_stream.h index 39ea1f3..cdc9be8 100644 --- a/net/base/mock_file_stream.h +++ b/net/base/mock_file_stream.h @@ -29,7 +29,7 @@ class MockFileStream : public FileStream { // FileStream methods. int Seek(base::File::Whence whence, - int64 offset, + int64_t offset, const Int64CompletionCallback& callback) override; int Read(IOBuffer* buf, int buf_len, @@ -72,9 +72,9 @@ class MockFileStream : public FileStream { return function_error; } - int64 ReturnError64(int64 function_error) { + int64_t ReturnError64(int64_t function_error) { if (forced_error_ != OK) { - int64 ret = forced_error_; + int64_t ret = forced_error_; clear_forced_error(); return ret; } @@ -85,12 +85,12 @@ class MockFileStream : public FileStream { // Wrappers for callbacks to make them honor ThrottleCallbacks and // ReleaseCallbacks. void DoCallback(const CompletionCallback& callback, int result); - void DoCallback64(const Int64CompletionCallback& callback, int64 result); + void DoCallback64(const Int64CompletionCallback& callback, int64_t result); // Depending on |async_error_|, either synchronously returns |forced_error_| // asynchronously calls |callback| with |async_error_|. int ErrorCallback(const CompletionCallback& callback); - int64 ErrorCallback64(const Int64CompletionCallback& callback); + int64_t ErrorCallback64(const Int64CompletionCallback& callback); int forced_error_; bool async_error_; diff --git a/net/base/net_util.cc b/net/base/net_util.cc index 3823b9b..031f836 100644 --- a/net/base/net_util.cc +++ b/net/base/net_util.cc @@ -268,7 +268,7 @@ base::string16 StripWWWFromHost(const GURL& url) { } bool IsPortValid(int port) { - return port >= 0 && port <= std::numeric_limits<uint16>::max(); + return port >= 0 && port <= std::numeric_limits<uint16_t>::max(); } bool IsPortAllowedByDefault(int port) { @@ -458,15 +458,15 @@ void SockaddrStorage::operator=(const SockaddrStorage& other) { // Extracts the address and port portions of a sockaddr. bool GetIPAddressFromSockAddr(const struct sockaddr* sock_addr, socklen_t sock_addr_len, - const uint8** address, + const uint8_t** address, size_t* address_len, - uint16* port) { + uint16_t* port) { if (sock_addr->sa_family == AF_INET) { if (sock_addr_len < static_cast<socklen_t>(sizeof(struct sockaddr_in))) return false; const struct sockaddr_in* addr = reinterpret_cast<const struct sockaddr_in*>(sock_addr); - *address = reinterpret_cast<const uint8*>(&addr->sin_addr); + *address = reinterpret_cast<const uint8_t*>(&addr->sin_addr); *address_len = kIPv4AddressSize; if (port) *port = base::NetToHost16(addr->sin_port); @@ -478,7 +478,7 @@ bool GetIPAddressFromSockAddr(const struct sockaddr* sock_addr, return false; const struct sockaddr_in6* addr = reinterpret_cast<const struct sockaddr_in6*>(sock_addr); - *address = reinterpret_cast<const uint8*>(&addr->sin6_addr); + *address = reinterpret_cast<const uint8_t*>(&addr->sin6_addr); *address_len = kIPv6AddressSize; if (port) *port = base::NetToHost16(addr->sin6_port); @@ -491,10 +491,10 @@ bool GetIPAddressFromSockAddr(const struct sockaddr* sock_addr, return false; const SOCKADDR_BTH* addr = reinterpret_cast<const SOCKADDR_BTH*>(sock_addr); - *address = reinterpret_cast<const uint8*>(&addr->btAddr); + *address = reinterpret_cast<const uint8_t*>(&addr->btAddr); *address_len = kBluetoothAddressSize; if (port) - *port = static_cast<uint16>(addr->port); + *port = static_cast<uint16_t>(addr->port); return true; } #endif @@ -504,7 +504,7 @@ bool GetIPAddressFromSockAddr(const struct sockaddr* sock_addr, std::string NetAddressToString(const struct sockaddr* sa, socklen_t sock_addr_len) { - const uint8* address; + const uint8_t* address; size_t address_len; if (!GetIPAddressFromSockAddr(sa, sock_addr_len, &address, &address_len, NULL)) { @@ -516,9 +516,9 @@ std::string NetAddressToString(const struct sockaddr* sa, std::string NetAddressToStringWithPort(const struct sockaddr* sa, socklen_t sock_addr_len) { - const uint8* address; + const uint8_t* address; size_t address_len; - uint16 port; + uint16_t port; if (!GetIPAddressFromSockAddr(sa, sock_addr_len, &address, &address_len, &port)) { NOTREACHED(); @@ -697,8 +697,8 @@ int ConvertAddressFamily(AddressFamily address_family) { return AF_UNSPEC; } -const uint16* GetPortFieldFromSockaddr(const struct sockaddr* address, - socklen_t address_len) { +const uint16_t* GetPortFieldFromSockaddr(const struct sockaddr* address, + socklen_t address_len) { if (address->sa_family == AF_INET) { DCHECK_LE(sizeof(sockaddr_in), static_cast<size_t>(address_len)); const struct sockaddr_in* sockaddr = @@ -716,7 +716,7 @@ const uint16* GetPortFieldFromSockaddr(const struct sockaddr* address, } int GetPortFromSockaddr(const struct sockaddr* address, socklen_t address_len) { - const uint16* port_field = GetPortFieldFromSockaddr(address, address_len); + const uint16_t* port_field = GetPortFieldFromSockaddr(address, address_len); if (!port_field) return -1; return base::NetToHost16(*port_field); diff --git a/net/base/net_util.h b/net/base/net_util.h index 9795ceb..1a32fbe 100644 --- a/net/base/net_util.h +++ b/net/base/net_util.h @@ -47,8 +47,8 @@ namespace net { typedef std::vector<unsigned char> IPAddressNumber; // Used by FormatUrl to specify handling of certain parts of the url. -typedef uint32 FormatUrlType; -typedef uint32 FormatUrlTypes; +typedef uint32_t FormatUrlType; +typedef uint32_t FormatUrlTypes; #if defined(OS_WIN) // Bluetooth address size. Windows Bluetooth is supported via winsock. @@ -124,7 +124,7 @@ bool GetIPAddressFromSockAddr(const struct sockaddr* sock_addr, socklen_t sock_addr_len, const unsigned char** address, size_t* address_len, - uint16* port); + uint16_t* port); // Same as IPAddressToString() but for a sockaddr. This output will not include // the IPv6 scope ID. @@ -207,7 +207,8 @@ NET_EXPORT std::string GetDirectoryListingHeader(const base::string16& title); // Both |name| and |raw_bytes| are escaped internally. NET_EXPORT std::string GetDirectoryListingEntry(const base::string16& name, const std::string& raw_bytes, - bool is_dir, int64 size, + bool is_dir, + int64_t size, base::Time modified); // If text starts with "www." it is removed, otherwise text is returned @@ -218,7 +219,7 @@ NET_EXPORT base::string16 StripWWW(const base::string16& text); NET_EXPORT base::string16 StripWWWFromHost(const GURL& url); // Checks if |port| is in the valid range (0 to 65535, though 0 is technically -// reserved). Should be used before casting a port to a uint16. +// reserved). Should be used before casting a port to a uint16_t. NET_EXPORT bool IsPortValid(int port); // Checks |port| against a list of ports which are restricted by default. @@ -345,8 +346,8 @@ NET_EXPORT_PRIVATE AddressFamily GetAddressFamily( NET_EXPORT_PRIVATE int ConvertAddressFamily(AddressFamily address_family); // Retuns the port field of the |sockaddr|. -const uint16* GetPortFieldFromSockaddr(const struct sockaddr* address, - socklen_t address_len); +const uint16_t* GetPortFieldFromSockaddr(const struct sockaddr* address, + socklen_t address_len); // Returns the value of port in |sockaddr| (in host byte ordering). NET_EXPORT_PRIVATE int GetPortFromSockaddr(const struct sockaddr* address, socklen_t address_len); diff --git a/net/base/net_util_icu.cc b/net/base/net_util_icu.cc index 94e1a0d..541e313 100644 --- a/net/base/net_util_icu.cc +++ b/net/base/net_util_icu.cc @@ -587,7 +587,7 @@ base::string16 IDNToUnicode(const std::string& host, std::string GetDirectoryListingEntry(const base::string16& name, const std::string& raw_bytes, bool is_dir, - int64 size, + int64_t size, Time modified) { std::string result; result.append("<script>addRow("); diff --git a/net/base/net_util_icu_unittest.cc b/net/base/net_util_icu_unittest.cc index 1b315c2..bfe63c1 100644 --- a/net/base/net_util_icu_unittest.cc +++ b/net/base/net_util_icu_unittest.cc @@ -470,7 +470,7 @@ struct GetDirectoryListingEntryCase { const wchar_t* name; const char* const raw_bytes; bool is_dir; - int64 filesize; + int64_t filesize; base::Time time; const char* const expected; }; diff --git a/net/base/net_util_unittest.cc b/net/base/net_util_unittest.cc index 8870f64..78911d0 100644 --- a/net/base/net_util_unittest.cc +++ b/net/base/net_util_unittest.cc @@ -56,7 +56,7 @@ struct HeaderCase { // Fills in sockaddr for the given 32-bit address (IPv4.) // |bytes| should be an array of length 4. -void MakeIPv4Address(const uint8* bytes, int port, SockaddrStorage* storage) { +void MakeIPv4Address(const uint8_t* bytes, int port, SockaddrStorage* storage) { memset(&storage->addr_storage, 0, sizeof(storage->addr_storage)); storage->addr_len = sizeof(struct sockaddr_in); struct sockaddr_in* addr4 = reinterpret_cast<sockaddr_in*>(storage->addr); @@ -67,7 +67,7 @@ void MakeIPv4Address(const uint8* bytes, int port, SockaddrStorage* storage) { // Fills in sockaddr for the given 128-bit address (IPv6.) // |bytes| should be an array of length 16. -void MakeIPv6Address(const uint8* bytes, int port, SockaddrStorage* storage) { +void MakeIPv6Address(const uint8_t* bytes, int port, SockaddrStorage* storage) { memset(&storage->addr_storage, 0, sizeof(storage->addr_storage)); storage->addr_len = sizeof(struct sockaddr_in6); struct sockaddr_in6* addr6 = reinterpret_cast<sockaddr_in6*>(storage->addr); @@ -332,7 +332,7 @@ TEST(NetUtilTest, GetHostAndOptionalPort) { TEST(NetUtilTest, NetAddressToString_IPv4) { const struct { - uint8 addr[4]; + uint8_t addr[4]; const char* const result; } tests[] = { {{0, 0, 0, 0}, "0.0.0.0"}, @@ -350,7 +350,7 @@ TEST(NetUtilTest, NetAddressToString_IPv4) { TEST(NetUtilTest, NetAddressToString_IPv6) { const struct { - uint8 addr[16]; + uint8_t addr[16]; const char* const result; } tests[] = { {{0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10, 0xFE, 0xDC, 0xBA, @@ -367,7 +367,7 @@ TEST(NetUtilTest, NetAddressToString_IPv6) { } TEST(NetUtilTest, NetAddressToStringWithPort_IPv4) { - uint8 addr[] = {127, 0, 0, 1}; + uint8_t addr[] = {127, 0, 0, 1}; SockaddrStorage storage; MakeIPv4Address(addr, 166, &storage); std::string result = NetAddressToStringWithPort(storage.addr, @@ -376,7 +376,7 @@ TEST(NetUtilTest, NetAddressToStringWithPort_IPv4) { } TEST(NetUtilTest, NetAddressToStringWithPort_IPv6) { - uint8 addr[] = { + uint8_t addr[] = { 0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10, 0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10 }; diff --git a/net/base/network_change_notifier.cc b/net/base/network_change_notifier.cc index 7c49fdd..004d80a 100644 --- a/net/base/network_change_notifier.cc +++ b/net/base/network_change_notifier.cc @@ -108,7 +108,7 @@ class HistogramWatcher NetworkChangeNotifier::ConnectionType type) override { DCHECK(thread_checker_.CalledOnValidThread()); base::TimeTicks now = base::TimeTicks::Now(); - int32 kilobytes_read = bytes_read_since_last_connection_change_ / 1000; + int32_t kilobytes_read = bytes_read_since_last_connection_change_ / 1000; base::TimeDelta state_duration = SinceLast(&last_connection_change_); if (bytes_read_since_last_connection_change_) { switch (last_connection_type_) { @@ -306,8 +306,8 @@ class HistogramWatcher if (bytes_read > 10000 && request_duration > base::TimeDelta::FromMilliseconds(1) && request.creation_time() > last_connection_change_) { - int32 kbps = static_cast<int32>( - bytes_read * 8 / request_duration.InMilliseconds()); + int32_t kbps = static_cast<int32_t>(bytes_read * 8 / + request_duration.InMilliseconds()); if (kbps > peak_kbps_since_last_connection_change_) peak_kbps_since_last_connection_change_ = kbps; } @@ -361,9 +361,9 @@ class HistogramWatcher NetworkChangeNotifier::ConnectionType last_polled_connection_type_; // Count of how many times NotifyDataReceived() has been called while the // NetworkChangeNotifier thought network connection was offline. - int32 offline_packets_received_; + int32_t offline_packets_received_; // Number of bytes of network data received since last connectivity change. - int32 bytes_read_since_last_connection_change_; + int32_t bytes_read_since_last_connection_change_; // Fastest round-trip-time (RTT) since last connectivity change. RTT measured // from URLRequest creation until first byte received. base::TimeDelta fastest_RTT_since_last_connection_change_; @@ -375,7 +375,7 @@ class HistogramWatcher // 2) NotifyDataReceived() may be called repeatedly for one URLRequest. // 3) The transfer time includes at least one RTT while no bytes are read. // Erring on the conservative side is hopefully offset by taking the maximum. - int32 peak_kbps_since_last_connection_change_; + int32_t peak_kbps_since_last_connection_change_; base::ThreadChecker thread_checker_; diff --git a/net/base/network_interfaces.cc b/net/base/network_interfaces.cc index e9e8dc5..a49bce6 100644 --- a/net/base/network_interfaces.cc +++ b/net/base/network_interfaces.cc @@ -12,10 +12,10 @@ NetworkInterface::NetworkInterface() NetworkInterface::NetworkInterface(const std::string& name, const std::string& friendly_name, - uint32 interface_index, + uint32_t interface_index, NetworkChangeNotifier::ConnectionType type, const IPAddressNumber& address, - uint32 prefix_length, + uint32_t prefix_length, int ip_address_attributes) : name(name), friendly_name(friendly_name), diff --git a/net/base/network_interfaces.h b/net/base/network_interfaces.h index 4ca249e..b667b41 100644 --- a/net/base/network_interfaces.h +++ b/net/base/network_interfaces.h @@ -46,19 +46,19 @@ struct NET_EXPORT NetworkInterface { NetworkInterface(); NetworkInterface(const std::string& name, const std::string& friendly_name, - uint32 interface_index, + uint32_t interface_index, NetworkChangeNotifier::ConnectionType type, const IPAddressNumber& address, - uint32 prefix_length, + uint32_t prefix_length, int ip_address_attributes); ~NetworkInterface(); std::string name; std::string friendly_name; // Same as |name| on non-Windows. - uint32 interface_index; // Always 0 on Android. + uint32_t interface_index; // Always 0 on Android. NetworkChangeNotifier::ConnectionType type; IPAddressNumber address; - uint32 prefix_length; + uint32_t prefix_length; int ip_address_attributes; // Combination of |IPAddressAttributes|. }; diff --git a/net/base/network_interfaces_mac.cc b/net/base/network_interfaces_mac.cc index 5a21bd0..8176c6c 100644 --- a/net/base/network_interfaces_mac.cc +++ b/net/base/network_interfaces_mac.cc @@ -197,7 +197,7 @@ bool GetNetworkListImpl(NetworkInterfaceList* networks, } if (address.FromSockAddr(addr, addr_size)) { - uint8 prefix_length = 0; + uint8_t prefix_length = 0; if (interface->ifa_netmask) { // If not otherwise set, assume the same sa_family as ifa_addr. if (interface->ifa_netmask->sa_family == 0) { diff --git a/net/base/network_interfaces_unittest.cc b/net/base/network_interfaces_unittest.cc index b4b7797f..ed821cf 100644 --- a/net/base/network_interfaces_unittest.cc +++ b/net/base/network_interfaces_unittest.cc @@ -650,9 +650,9 @@ bool read_int_or_bool(DWORD data_size, PVOID data) { switch (data_size) { case 1: - return !!*reinterpret_cast<uint8*>(data); + return !!*reinterpret_cast<uint8_t*>(data); case 4: - return !!*reinterpret_cast<uint32*>(data); + return !!*reinterpret_cast<uint32_t*>(data); default: LOG(FATAL) << "That is not a type I know!"; return false; diff --git a/net/base/network_interfaces_win.cc b/net/base/network_interfaces_win.cc index e2383c7..ec9aeeb 100644 --- a/net/base/network_interfaces_win.cc +++ b/net/base/network_interfaces_win.cc @@ -146,7 +146,7 @@ bool GetNetworkListImpl(NetworkInterfaceList* networks, continue; } - uint32 index = + uint32_t index = (family == AF_INET) ? adapter->IfIndex : adapter->Ipv6IfIndex; // From http://technet.microsoft.com/en-us/ff568768(v=vs.60).aspx, the diff --git a/net/base/network_quality_estimator_unittest.cc b/net/base/network_quality_estimator_unittest.cc index 61a5a9c..82e1bba 100644 --- a/net/base/network_quality_estimator_unittest.cc +++ b/net/base/network_quality_estimator_unittest.cc @@ -40,7 +40,7 @@ TEST(NetworkQualityEstimatorTest, TestPeakKbpsFastestRTTUpdates) { TestDelegate d; TestURLRequestContext context(false); - uint64 min_transfer_size_in_bytes = + uint64_t min_transfer_size_in_bytes = NetworkQualityEstimator::kMinTransferSizeInBytes; base::TimeDelta request_duration = base::TimeDelta::FromMicroseconds( NetworkQualityEstimator::kMinRequestDurationMicroseconds); @@ -71,7 +71,7 @@ TEST(NetworkQualityEstimatorTest, TestPeakKbpsFastestRTTUpdates) { EXPECT_GT(network_quality.fastest_rtt_confidence, 0); EXPECT_GT(network_quality.peak_throughput_kbps_confidence, 0); EXPECT_GE(network_quality.fastest_rtt, request_duration); - EXPECT_GT(network_quality.peak_throughput_kbps, uint32(0)); + EXPECT_GT(network_quality.peak_throughput_kbps, uint32_t(0)); EXPECT_LE( network_quality.peak_throughput_kbps, min_transfer_size_in_bytes * 8.0 / request_duration.InMilliseconds()); diff --git a/net/base/openssl_private_key_store_android.cc b/net/base/openssl_private_key_store_android.cc index c52b1c1..e866efd 100644 --- a/net/base/openssl_private_key_store_android.cc +++ b/net/base/openssl_private_key_store_android.cc @@ -38,8 +38,8 @@ bool OpenSSLPrivateKeyStore::StoreKeyPair(const GURL& url, bool ret = false; if (public_len > 0 && private_len > 0) { ret = android::StoreKeyPair( - static_cast<const uint8*>(public_key), public_len, - static_cast<const uint8*>(private_key), private_len); + static_cast<const uint8_t*>(public_key), public_len, + static_cast<const uint8_t*>(private_key), private_len); } LOG_IF(ERROR, !ret) << "StoreKeyPair failed. pub len = " << public_len << " priv len = " << private_len; diff --git a/net/base/priority_queue.h b/net/base/priority_queue.h index 9b17d61..6b53ecc 100644 --- a/net/base/priority_queue.h +++ b/net/base/priority_queue.h @@ -39,7 +39,7 @@ class PriorityQueue : public base::NonThreadSafe { #endif public: - typedef uint32 Priority; + typedef uint32_t Priority; // A pointer to a value stored in the queue. The pointer becomes invalid // when the queue is destroyed or cleared, or the value is erased. diff --git a/net/base/sdch_manager.cc b/net/base/sdch_manager.cc index 5080203..ba96659a 100644 --- a/net/base/sdch_manager.cc +++ b/net/base/sdch_manager.cc @@ -405,7 +405,7 @@ SdchProblemCode SdchManager::AddSdchDictionary( if (value != "1.0") return SDCH_DICTIONARY_UNSUPPORTED_VERSION; } else if (name == "max-age") { - int64 seconds; + int64_t seconds; base::StringToInt64(value, &seconds); expiration = base::Time::Now() + base::TimeDelta::FromSeconds(seconds); } else if (name == "port") { diff --git a/net/base/test_completion_callback.h b/net/base/test_completion_callback.h index 883180c..236c9b3 100644 --- a/net/base/test_completion_callback.h +++ b/net/base/test_completion_callback.h @@ -107,7 +107,7 @@ class TestClosure : public internal::TestCompletionCallbackBaseInternal { typedef internal::TestCompletionCallbackTemplate<int> TestCompletionCallbackBase; -typedef internal::TestCompletionCallbackTemplate<int64> +typedef internal::TestCompletionCallbackTemplate<int64_t> TestInt64CompletionCallbackBase; class TestCompletionCallback : public TestCompletionCallbackBase { diff --git a/net/base/upload_bytes_element_reader.cc b/net/base/upload_bytes_element_reader.cc index 44f61f4..fd74dd8 100644 --- a/net/base/upload_bytes_element_reader.cc +++ b/net/base/upload_bytes_element_reader.cc @@ -12,10 +12,8 @@ namespace net { UploadBytesElementReader::UploadBytesElementReader(const char* bytes, - uint64 length) - : bytes_(bytes), - length_(length), - offset_(0) { + uint64_t length) + : bytes_(bytes), length_(length), offset_(0) { } UploadBytesElementReader::~UploadBytesElementReader() { @@ -31,11 +29,11 @@ int UploadBytesElementReader::Init(const CompletionCallback& callback) { return OK; } -uint64 UploadBytesElementReader::GetContentLength() const { +uint64_t UploadBytesElementReader::GetContentLength() const { return length_; } -uint64 UploadBytesElementReader::BytesRemaining() const { +uint64_t UploadBytesElementReader::BytesRemaining() const { return length_ - offset_; } @@ -49,7 +47,7 @@ int UploadBytesElementReader::Read(IOBuffer* buf, DCHECK_LT(0, buf_length); const int num_bytes_to_read = static_cast<int>( - std::min(BytesRemaining(), static_cast<uint64>(buf_length))); + std::min(BytesRemaining(), static_cast<uint64_t>(buf_length))); // Check if we have anything to copy first, because we are getting // the address of an element in |bytes_| and that will throw an diff --git a/net/base/upload_bytes_element_reader.h b/net/base/upload_bytes_element_reader.h index 3246d12..4864c9a 100644 --- a/net/base/upload_bytes_element_reader.h +++ b/net/base/upload_bytes_element_reader.h @@ -19,17 +19,17 @@ namespace net { // ownership of the data. class NET_EXPORT UploadBytesElementReader : public UploadElementReader { public: - UploadBytesElementReader(const char* bytes, uint64 length); + UploadBytesElementReader(const char* bytes, uint64_t length); ~UploadBytesElementReader() override; const char* bytes() const { return bytes_; } - uint64 length() const { return length_; } + uint64_t length() const { return length_; } // UploadElementReader overrides: const UploadBytesElementReader* AsBytesReader() const override; int Init(const CompletionCallback& callback) override; - uint64 GetContentLength() const override; - uint64 BytesRemaining() const override; + uint64_t GetContentLength() const override; + uint64_t BytesRemaining() const override; bool IsInMemory() const override; int Read(IOBuffer* buf, int buf_length, @@ -37,8 +37,8 @@ class NET_EXPORT UploadBytesElementReader : public UploadElementReader { private: const char* const bytes_; - const uint64 length_; - uint64 offset_; + const uint64_t length_; + uint64_t offset_; DISALLOW_COPY_AND_ASSIGN(UploadBytesElementReader); }; diff --git a/net/base/upload_data_stream.cc b/net/base/upload_data_stream.cc index 936c912..c2d88f9 100644 --- a/net/base/upload_data_stream.cc +++ b/net/base/upload_data_stream.cc @@ -11,7 +11,7 @@ namespace net { -UploadDataStream::UploadDataStream(bool is_chunked, int64 identifier) +UploadDataStream::UploadDataStream(bool is_chunked, int64_t identifier) : total_size_(0), current_position_(0), identifier_(identifier), @@ -71,7 +71,7 @@ void UploadDataStream::Reset() { ResetInternal(); } -void UploadDataStream::SetSize(uint64 size) { +void UploadDataStream::SetSize(uint64_t size) { DCHECK(!initialized_successfully_); DCHECK(!is_chunked_); total_size_ = size; diff --git a/net/base/upload_data_stream.h b/net/base/upload_data_stream.h index d7df8c9..a4573ea 100644 --- a/net/base/upload_data_stream.h +++ b/net/base/upload_data_stream.h @@ -24,7 +24,7 @@ class NET_EXPORT UploadDataStream { // |identifier| identifies a particular upload instance, which is used by the // cache to formulate a cache key. This value should be unique across browser // sessions. A value of 0 is used to indicate an unspecified identifier. - UploadDataStream(bool is_chunked, int64 identifier); + UploadDataStream(bool is_chunked, int64_t identifier); virtual ~UploadDataStream(); @@ -62,11 +62,11 @@ class NET_EXPORT UploadDataStream { // Returns the total size of the data stream and the current position. // When the data is chunked, always returns zero. Must always return the same // value after each call to Initialize(). - uint64 size() const { return total_size_; } - uint64 position() const { return current_position_; } + uint64_t size() const { return total_size_; } + uint64_t position() const { return current_position_; } // See constructor for description. - int64 identifier() const { return identifier_; } + int64_t identifier() const { return identifier_; } bool is_chunked() const { return is_chunked_; } @@ -97,7 +97,7 @@ class NET_EXPORT UploadDataStream { // Must be called before InitInternal completes, for non-chunked uploads. // Must not be called for chunked uploads. - void SetSize(uint64 size); + void SetSize(uint64_t size); // Must be called for chunked uploads before the final ReadInternal call // completes. Must not be called for non-chunked uploads. @@ -121,10 +121,10 @@ class NET_EXPORT UploadDataStream { // before all but the first call to InitInternal. virtual void ResetInternal() = 0; - uint64 total_size_; - uint64 current_position_; + uint64_t total_size_; + uint64_t current_position_; - const int64 identifier_; + const int64_t identifier_; const bool is_chunked_; diff --git a/net/base/upload_element_reader.h b/net/base/upload_element_reader.h index a46b970..2814efa 100644 --- a/net/base/upload_element_reader.h +++ b/net/base/upload_element_reader.h @@ -37,10 +37,10 @@ class NET_EXPORT UploadElementReader { // Returns the byte-length of the element. For files that do not exist, 0 // is returned. This is done for consistency with Mozilla. - virtual uint64 GetContentLength() const = 0; + virtual uint64_t GetContentLength() const = 0; // Returns the number of bytes remaining to read. - virtual uint64 BytesRemaining() const = 0; + virtual uint64_t BytesRemaining() const = 0; // Returns true if the upload element is entirely in memory. // The default implementation returns false. diff --git a/net/base/upload_file_element_reader.cc b/net/base/upload_file_element_reader.cc index 8475622..56ca3b7 100644 --- a/net/base/upload_file_element_reader.cc +++ b/net/base/upload_file_element_reader.cc @@ -18,15 +18,15 @@ namespace { // In tests, this value is used to override the return value of // UploadFileElementReader::GetContentLength() when set to non-zero. -uint64 overriding_content_length = 0; +uint64_t overriding_content_length = 0; } // namespace UploadFileElementReader::UploadFileElementReader( base::TaskRunner* task_runner, const base::FilePath& path, - uint64 range_offset, - uint64 range_length, + uint64_t range_offset, + uint64_t range_length, const base::Time& expected_modification_time) : task_runner_(task_runner), path_(path), @@ -62,13 +62,13 @@ int UploadFileElementReader::Init(const CompletionCallback& callback) { return result; } -uint64 UploadFileElementReader::GetContentLength() const { +uint64_t UploadFileElementReader::GetContentLength() const { if (overriding_content_length) return overriding_content_length; return content_length_; } -uint64 UploadFileElementReader::BytesRemaining() const { +uint64_t UploadFileElementReader::BytesRemaining() const { return bytes_remaining_; } @@ -78,7 +78,7 @@ int UploadFileElementReader::Read(IOBuffer* buf, DCHECK(!callback.is_null()); int num_bytes_to_read = static_cast<int>( - std::min(BytesRemaining(), static_cast<uint64>(buf_length))); + std::min(BytesRemaining(), static_cast<uint64_t>(buf_length))); if (num_bytes_to_read == 0) return 0; @@ -127,7 +127,7 @@ void UploadFileElementReader::OnOpenCompleted( void UploadFileElementReader::OnSeekCompleted( const CompletionCallback& callback, - int64 result) { + int64_t result) { DCHECK(!callback.is_null()); if (result < 0) { @@ -160,8 +160,8 @@ void UploadFileElementReader::OnGetFileInfoCompleted( return; } - int64 length = file_info->size; - if (range_offset_ < static_cast<uint64>(length)) { + int64_t length = file_info->size; + if (range_offset_ < static_cast<uint64_t>(length)) { // Compensate for the offset. length = std::min(length - range_offset_, range_length_); } @@ -192,7 +192,7 @@ int UploadFileElementReader::OnReadCompleted( result = ERR_UPLOAD_FILE_CHANGED; if (result > 0) { - DCHECK_GE(bytes_remaining_, static_cast<uint64>(result)); + DCHECK_GE(bytes_remaining_, static_cast<uint64_t>(result)); bytes_remaining_ -= result; } @@ -202,7 +202,7 @@ int UploadFileElementReader::OnReadCompleted( } UploadFileElementReader::ScopedOverridingContentLengthForTests:: -ScopedOverridingContentLengthForTests(uint64 value) { + ScopedOverridingContentLengthForTests(uint64_t value) { overriding_content_length = value; } diff --git a/net/base/upload_file_element_reader.h b/net/base/upload_file_element_reader.h index 04ce928..010d660 100644 --- a/net/base/upload_file_element_reader.h +++ b/net/base/upload_file_element_reader.h @@ -29,14 +29,14 @@ class NET_EXPORT UploadFileElementReader : public UploadElementReader { // |task_runner| is used to perform file operations. It must not be NULL. UploadFileElementReader(base::TaskRunner* task_runner, const base::FilePath& path, - uint64 range_offset, - uint64 range_length, + uint64_t range_offset, + uint64_t range_length, const base::Time& expected_modification_time); ~UploadFileElementReader() override; const base::FilePath& path() const { return path_; } - uint64 range_offset() const { return range_offset_; } - uint64 range_length() const { return range_length_; } + uint64_t range_offset() const { return range_offset_; } + uint64_t range_length() const { return range_length_; } const base::Time& expected_modification_time() const { return expected_modification_time_; } @@ -44,8 +44,8 @@ class NET_EXPORT UploadFileElementReader : public UploadElementReader { // UploadElementReader overrides: const UploadFileElementReader* AsFileReader() const override; int Init(const CompletionCallback& callback) override; - uint64 GetContentLength() const override; - uint64 BytesRemaining() const override; + uint64_t GetContentLength() const override; + uint64_t BytesRemaining() const override; int Read(IOBuffer* buf, int buf_length, const CompletionCallback& callback) override; @@ -60,7 +60,7 @@ class NET_EXPORT UploadFileElementReader : public UploadElementReader { // These methods are used to implement Init(). void OnOpenCompleted(const CompletionCallback& callback, int result); - void OnSeekCompleted(const CompletionCallback& callback, int64 result); + void OnSeekCompleted(const CompletionCallback& callback, int64_t result); void OnGetFileInfoCompleted(const CompletionCallback& callback, base::File::Info* file_info, bool result); @@ -71,18 +71,18 @@ class NET_EXPORT UploadFileElementReader : public UploadElementReader { // Sets an value to override the result for GetContentLength(). // Used for tests. struct NET_EXPORT_PRIVATE ScopedOverridingContentLengthForTests { - explicit ScopedOverridingContentLengthForTests(uint64 value); + explicit ScopedOverridingContentLengthForTests(uint64_t value); ~ScopedOverridingContentLengthForTests(); }; scoped_refptr<base::TaskRunner> task_runner_; const base::FilePath path_; - const uint64 range_offset_; - const uint64 range_length_; + const uint64_t range_offset_; + const uint64_t range_length_; const base::Time expected_modification_time_; scoped_ptr<FileStream> file_stream_; - uint64 content_length_; - uint64 bytes_remaining_; + uint64_t content_length_; + uint64_t bytes_remaining_; base::WeakPtrFactory<UploadFileElementReader> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(UploadFileElementReader); diff --git a/net/base/upload_file_element_reader_unittest.cc b/net/base/upload_file_element_reader_unittest.cc index 719ce1e..38797cb 100644 --- a/net/base/upload_file_element_reader_unittest.cc +++ b/net/base/upload_file_element_reader_unittest.cc @@ -178,8 +178,8 @@ TEST_F(UploadFileElementReaderTest, InitDuringAsyncOperation) { } TEST_F(UploadFileElementReaderTest, Range) { - const uint64 kOffset = 2; - const uint64 kLength = bytes_.size() - kOffset * 3; + const uint64_t kOffset = 2; + const uint64_t kLength = bytes_.size() - kOffset * 3; reader_.reset( new UploadFileElementReader(base::MessageLoopProxy::current().get(), temp_file_path_, diff --git a/net/base/upload_progress.h b/net/base/upload_progress.h index 0620009..1389ecc 100644 --- a/net/base/upload_progress.h +++ b/net/base/upload_progress.h @@ -12,15 +12,15 @@ namespace net { class UploadProgress { public: UploadProgress() : size_(0), position_(0) {} - UploadProgress(uint64 position, uint64 size) + UploadProgress(uint64_t position, uint64_t size) : size_(size), position_(position) {} - uint64 size() const { return size_; } - uint64 position() const { return position_; } + uint64_t size() const { return size_; } + uint64_t position() const { return position_; } private: - uint64 size_; - uint64 position_; + uint64_t size_; + uint64_t position_; }; } // namespace net diff --git a/net/cert/asn1_util.cc b/net/cert/asn1_util.cc index 6dcff52..4bc37a6 100644 --- a/net/cert/asn1_util.cc +++ b/net/cert/asn1_util.cc @@ -12,7 +12,7 @@ bool ParseElement(base::StringPiece* in, unsigned tag_value, base::StringPiece* out, unsigned *out_header_len) { - const uint8* data = reinterpret_cast<const uint8*>(in->data()); + const uint8_t* data = reinterpret_cast<const uint8_t*>(in->data()); // We don't support kAny and kOptional at the same time. if ((tag_value & kAny) && (tag_value & kOptional)) @@ -243,7 +243,7 @@ bool ExtractCRLURLsFromDERCert(base::StringPiece cert, // kCRLDistributionPointsOID is the DER encoding of the OID for the X.509 // CRL Distribution Points extension. - static const uint8 kCRLDistributionPointsOID[] = {0x55, 0x1d, 0x1f}; + static const uint8_t kCRLDistributionPointsOID[] = {0x55, 0x1d, 0x1f}; if (oid.size() != sizeof(kCRLDistributionPointsOID) || memcmp(oid.data(), kCRLDistributionPointsOID, oid.size()) != 0) { diff --git a/net/cert/cert_database.h b/net/cert/cert_database.h index 43e715e..64f5069 100644 --- a/net/cert/cert_database.h +++ b/net/cert/cert_database.h @@ -5,7 +5,7 @@ #ifndef NET_CERT_CERT_DATABASE_H_ #define NET_CERT_CERT_DATABASE_H_ -#include "base/basictypes.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "net/base/net_export.h" diff --git a/net/cert/cert_status_flags.h b/net/cert/cert_status_flags.h index e66856b..a766595 100644 --- a/net/cert/cert_status_flags.h +++ b/net/cert/cert_status_flags.h @@ -5,14 +5,15 @@ #ifndef NET_CERT_CERT_STATUS_FLAGS_H_ #define NET_CERT_CERT_STATUS_FLAGS_H_ -#include "base/basictypes.h" +#include <stdint.h> + #include "net/base/net_export.h" namespace net { // Bitmask of status flags of a certificate, representing any errors, as well as // other non-error status information such as whether the certificate is EV. -typedef uint32 CertStatus; +typedef uint32_t CertStatus; // NOTE: Because these names have appeared in bug reports, we preserve them as // MACRO_STYLE for continuity, instead of renaming them to kConstantStyle as diff --git a/net/cert/cert_verifier.h b/net/cert/cert_verifier.h index 0c74fa7..6e5eac9 100644 --- a/net/cert/cert_verifier.h +++ b/net/cert/cert_verifier.h @@ -7,7 +7,7 @@ #include <string> -#include "base/basictypes.h" +#include "base/macros.h" #include "net/base/completion_callback.h" #include "net/base/net_export.h" diff --git a/net/cert/cert_verify_proc.cc b/net/cert/cert_verify_proc.cc index bcb14c9..31006d5 100644 --- a/net/cert/cert_verify_proc.cc +++ b/net/cert/cert_verify_proc.cc @@ -6,7 +6,6 @@ #include <stdint.h> -#include "base/basictypes.h" #include "base/metrics/histogram.h" #include "base/sha1.h" #include "base/strings/stringprintf.h" @@ -299,7 +298,7 @@ int CertVerifyProc::Verify(X509Certificate* cert, // static bool CertVerifyProc::IsBlacklisted(X509Certificate* cert) { static const unsigned kComodoSerialBytes = 16; - static const uint8 kComodoSerials[][kComodoSerialBytes] = { + static const uint8_t kComodoSerials[][kComodoSerialBytes] = { // Not a real certificate. For testing only. {0x07,0x7a,0x59,0xbc,0xd5,0x34,0x59,0x60,0x1c,0xa6,0x90,0x72,0x67,0xa6,0xdd,0x1c}, @@ -372,7 +371,7 @@ bool CertVerifyProc::IsBlacklisted(X509Certificate* cert) { static const char kCloudFlareCNSuffix[] = ".cloudflare.com"; // kCloudFlareEpoch is the base::Time internal value for midnight at the // beginning of April 2nd, 2014, UTC. - static const int64 kCloudFlareEpoch = INT64_C(13040870400000000); + static const int64_t kCloudFlareEpoch = INT64_C(13040870400000000); if (cn.size() > arraysize(kCloudFlareCNSuffix) - 1 && cn.compare(cn.size() - (arraysize(kCloudFlareCNSuffix) - 1), arraysize(kCloudFlareCNSuffix) - 1, @@ -389,7 +388,7 @@ bool CertVerifyProc::IsBlacklisted(X509Certificate* cert) { bool CertVerifyProc::IsPublicKeyBlacklisted( const HashValueVector& public_key_hashes) { static const unsigned kNumHashes = 17; - static const uint8 kHashes[kNumHashes][base::kSHA1Length] = { + static const uint8_t kHashes[kNumHashes][base::kSHA1Length] = { // Subject: CN=DigiNotar Root CA // Issuer: CN=Entrust.net x2 and self-signed {0x41, 0x0f, 0x36, 0x36, 0x32, 0x58, 0xf3, 0x0b, 0x34, 0x7d, @@ -529,7 +528,7 @@ static bool CheckNameConstraints(const std::vector<std::string>& dns_names, // array of fixed-length strings that contain the domains that the SPKI is // allowed to issue for. struct PublicKeyDomainLimitation { - uint8 public_key[base::kSHA1Length]; + uint8_t public_key[base::kSHA1Length]; const char (*domains)[kMaxDomainLength]; }; diff --git a/net/cert/cert_verify_proc_android.cc b/net/cert/cert_verify_proc_android.cc index 6689ad8..d35f108 100644 --- a/net/cert/cert_verify_proc_android.cc +++ b/net/cert/cert_verify_proc_android.cc @@ -111,7 +111,7 @@ bool VerifyFromAndroidTrustManager(const std::vector<std::string>& cert_bytes, continue; HashValue sha1(HASH_VALUE_SHA1); - base::SHA1HashBytes(reinterpret_cast<const uint8*>(spki_bytes.data()), + base::SHA1HashBytes(reinterpret_cast<const uint8_t*>(spki_bytes.data()), spki_bytes.size(), sha1.data()); verify_result->public_key_hashes.push_back(sha1); diff --git a/net/cert/cert_verify_proc_mac.cc b/net/cert/cert_verify_proc_mac.cc index d298fee..c0eb068 100644 --- a/net/cert/cert_verify_proc_mac.cc +++ b/net/cert/cert_verify_proc_mac.cc @@ -678,7 +678,7 @@ int CertVerifyProcMac::VerifyInternal( ", chain_info[" << index << "].StatusBits is " << chain_info[index].StatusBits; } - for (uint32 status_code_index = 0; + for (uint32_t status_code_index = 0; status_code_index < chain_info[index].NumStatusCodes; ++status_code_index) { // As of OS X 10.9, attempting to verify a certificate chain that diff --git a/net/cert/cert_verify_proc_openssl.cc b/net/cert/cert_verify_proc_openssl.cc index 5649245..286b21b 100644 --- a/net/cert/cert_verify_proc_openssl.cc +++ b/net/cert/cert_verify_proc_openssl.cc @@ -170,7 +170,7 @@ void AppendPublicKeyHashes(X509_STORE_CTX* store_ctx, continue; HashValue sha1(HASH_VALUE_SHA1); - base::SHA1HashBytes(reinterpret_cast<const uint8*>(spki_bytes.data()), + base::SHA1HashBytes(reinterpret_cast<const uint8_t*>(spki_bytes.data()), spki_bytes.size(), sha1.data()); hashes->push_back(sha1); diff --git a/net/cert/cert_verify_proc_win.cc b/net/cert/cert_verify_proc_win.cc index 21572b4..4eada6f 100644 --- a/net/cert/cert_verify_proc_win.cc +++ b/net/cert/cert_verify_proc_win.cc @@ -441,7 +441,7 @@ CRLSetResult CheckRevocationWithCRLSet(PCCERT_CHAIN_CONTEXT chain, const std::string spki_hash = crypto::SHA256HashString(spki); const CRYPT_INTEGER_BLOB* serial_blob = &cert->pCertInfo->SerialNumber; - scoped_ptr<uint8[]> serial_bytes(new uint8[serial_blob->cbData]); + scoped_ptr<uint8_t[]> serial_bytes(new uint8_t[serial_blob->cbData]); // The bytes of the serial number are stored little-endian. for (unsigned j = 0; j < serial_blob->cbData; j++) serial_bytes[j] = serial_blob->pbData[serial_blob->cbData - j - 1]; @@ -496,7 +496,7 @@ void AppendPublicKeyHashes(PCCERT_CHAIN_CONTEXT chain, continue; HashValue sha1(HASH_VALUE_SHA1); - base::SHA1HashBytes(reinterpret_cast<const uint8*>(spki_bytes.data()), + base::SHA1HashBytes(reinterpret_cast<const uint8_t*>(spki_bytes.data()), spki_bytes.size(), sha1.data()); hashes->push_back(sha1); diff --git a/net/cert/crl_set.cc b/net/cert/crl_set.cc index 2d4f5c3..bc2cecb 100644 --- a/net/cert/crl_set.cc +++ b/net/cert/crl_set.cc @@ -63,11 +63,11 @@ bool CRLSet::IsExpired() const { if (not_after_ == 0) return false; - uint64 now = base::Time::Now().ToTimeT(); + uint64_t now = base::Time::Now().ToTimeT(); return now > not_after_; } -uint32 CRLSet::sequence() const { +uint32_t CRLSet::sequence() const { return sequence_; } diff --git a/net/cert/crl_set.h b/net/cert/crl_set.h index 688e47c..f54e346 100644 --- a/net/cert/crl_set.h +++ b/net/cert/crl_set.h @@ -49,7 +49,7 @@ class NET_EXPORT CRLSet : public base::RefCountedThreadSafe<CRLSet> { // sequence returns the sequence number of this CRL set. CRL sets generated // by the same source are given strictly monotonically increasing sequence // numbers. - uint32 sequence() const; + uint32_t sequence() const; // CRLList contains a list of (issuer SPKI hash, revoked serial numbers) // pairs. @@ -82,11 +82,11 @@ class NET_EXPORT CRLSet : public base::RefCountedThreadSafe<CRLSet> { friend class base::RefCountedThreadSafe<CRLSet>; friend class CRLSetStorage; - uint32 sequence_; + uint32_t sequence_; CRLList crls_; // not_after_ contains the time, in UNIX epoch seconds, after which the // CRLSet should be considered stale, or 0 if no such time was given. - uint64 not_after_; + uint64_t not_after_; // crls_index_by_issuer_ maps from issuer SPKI hashes to the index in |crls_| // where the information for that issuer can be found. We have both |crls_| // and |crls_index_by_issuer_| because, when applying a delta update, we need diff --git a/net/cert/crl_set_storage.cc b/net/cert/crl_set_storage.cc index a952584..86b2460 100644 --- a/net/cert/crl_set_storage.cc +++ b/net/cert/crl_set_storage.cc @@ -19,7 +19,7 @@ namespace net { // Decompress zlib decompressed |in| into |out|. |out_len| is the number of // bytes at |out| and must be exactly equal to the size of the decompressed // data. -static bool DecompressZlib(uint8* out, int out_len, base::StringPiece in) { +static bool DecompressZlib(uint8_t* out, int out_len, base::StringPiece in) { z_stream z; memset(&z, 0, sizeof(z)); @@ -51,16 +51,16 @@ static bool DecompressZlib(uint8* out, int out_len, base::StringPiece in) { // byte[32] parent_spki_sha256 // uint32le num_serials // [num_serials] { -// uint8 serial_length; +// uint8_t serial_length; // byte[serial_length] serial; // } // // header_bytes consists of a JSON dictionary with the following keys: // Version (int): currently 0 // ContentType (string): "CRLSet" or "CRLSetDelta" (magic value) -// DeltaFrom (int32): if this is a delta update (see below), then this +// DeltaFrom (int32_t): if this is a delta update (see below), then this // contains the sequence number of the base CRLSet. -// Sequence (int32): the monotonic sequence number of this CRL set. +// Sequence (int32_t): the monotonic sequence number of this CRL set. // // A delta CRLSet is similar to a CRLSet: // @@ -91,7 +91,7 @@ static bool DecompressZlib(uint8* out, int out_len, base::StringPiece in) { // // the serial is the same // case 1: // // serial inserted -// uint8 serial_length +// uint8_t serial_length // byte[serial_length] serial // case 2: // // serial deleted @@ -114,8 +114,8 @@ static bool DecompressZlib(uint8* out, int out_len, base::StringPiece in) { static base::DictionaryValue* ReadHeader(base::StringPiece* data) { if (data->size() < 2) return NULL; - uint16 header_len; - memcpy(&header_len, data->data(), 2); // assumes little-endian. + uint16_t header_len; + memcpy(&header_len, data->data(), 2); // Assumes little-endian. data->remove_prefix(2); if (data->size() < header_len) @@ -145,22 +145,23 @@ static bool ReadCRL(base::StringPiece* data, std::string* out_parent_spki_hash, out_parent_spki_hash->assign(data->data(), crypto::kSHA256Length); data->remove_prefix(crypto::kSHA256Length); - if (data->size() < sizeof(uint32)) + if (data->size() < sizeof(uint32_t)) return false; - uint32 num_serials; - memcpy(&num_serials, data->data(), sizeof(uint32)); // assumes little endian + uint32_t num_serials; + // Assumes little endian. + memcpy(&num_serials, data->data(), sizeof(uint32_t)); if (num_serials > 32 * 1024 * 1024) // Sanity check. return false; out_serials->reserve(num_serials); - data->remove_prefix(sizeof(uint32)); + data->remove_prefix(sizeof(uint32_t)); - for (uint32 i = 0; i < num_serials; ++i) { - if (data->size() < sizeof(uint8)) + for (uint32_t i = 0; i < num_serials; ++i) { + if (data->size() < sizeof(uint8_t)) return false; - uint8 serial_length = data->data()[0]; - data->remove_prefix(sizeof(uint8)); + uint8_t serial_length = data->data()[0]; + data->remove_prefix(sizeof(uint8_t)); if (data->size() < serial_length) return false; @@ -211,14 +212,14 @@ bool CRLSetStorage::CopyBlockedSPKIsFromHeader( static const unsigned kMaxUncompressedChangesLength = 1024 * 1024; static bool ReadChanges(base::StringPiece* data, - std::vector<uint8>* out_changes) { - uint32 uncompressed_size, compressed_size; - if (data->size() < 2 * sizeof(uint32)) + std::vector<uint8_t>* out_changes) { + uint32_t uncompressed_size, compressed_size; + if (data->size() < 2 * sizeof(uint32_t)) return false; - // assumes little endian. - memcpy(&uncompressed_size, data->data(), sizeof(uint32)); + // Assumes little endian. + memcpy(&uncompressed_size, data->data(), sizeof(uint32_t)); data->remove_prefix(4); - memcpy(&compressed_size, data->data(), sizeof(uint32)); + memcpy(&compressed_size, data->data(), sizeof(uint32_t)); data->remove_prefix(4); if (uncompressed_size > kMaxUncompressedChangesLength) @@ -247,12 +248,12 @@ enum { static bool ReadDeltaCRL(base::StringPiece* data, const std::vector<std::string>& old_serials, std::vector<std::string>* out_serials) { - std::vector<uint8> changes; + std::vector<uint8_t> changes; if (!ReadChanges(data, &changes)) return false; size_t i = 0; - for (std::vector<uint8>::const_iterator k = changes.begin(); + for (std::vector<uint8_t>::const_iterator k = changes.begin(); k != changes.end(); ++k) { if (*k == SYMBOL_SAME) { if (i >= old_serials.size()) @@ -260,11 +261,11 @@ static bool ReadDeltaCRL(base::StringPiece* data, out_serials->push_back(old_serials[i]); i++; } else if (*k == SYMBOL_INSERT) { - uint8 serial_length; - if (data->size() < sizeof(uint8)) + uint8_t serial_length; + if (data->size() < sizeof(uint8_t)) return false; - memcpy(&serial_length, data->data(), sizeof(uint8)); - data->remove_prefix(sizeof(uint8)); + memcpy(&serial_length, data->data(), sizeof(uint8_t)); + data->remove_prefix(sizeof(uint8_t)); if (data->size() < serial_length) return false; @@ -330,8 +331,8 @@ bool CRLSetStorage::Parse(base::StringPiece data, return false; scoped_refptr<CRLSet> crl_set(new CRLSet()); - crl_set->sequence_ = static_cast<uint32>(sequence); - crl_set->not_after_ = static_cast<uint64>(not_after); + crl_set->sequence_ = static_cast<uint32_t>(sequence); + crl_set->not_after_ = static_cast<uint64_t>(not_after); crl_set->crls_.reserve(64); // Value observed experimentally. for (size_t crl_index = 0; !data.empty(); crl_index++) { @@ -381,9 +382,8 @@ bool CRLSetStorage::ApplyDelta(const CRLSet* in_crl_set, int sequence, delta_from; if (!header_dict->GetInteger("Sequence", &sequence) || - !header_dict->GetInteger("DeltaFrom", &delta_from) || - delta_from < 0 || - static_cast<uint32>(delta_from) != in_crl_set->sequence_) { + !header_dict->GetInteger("DeltaFrom", &delta_from) || delta_from < 0 || + static_cast<uint32_t>(delta_from) != in_crl_set->sequence_) { return false; } @@ -396,19 +396,19 @@ bool CRLSetStorage::ApplyDelta(const CRLSet* in_crl_set, return false; scoped_refptr<CRLSet> crl_set(new CRLSet); - crl_set->sequence_ = static_cast<uint32>(sequence); - crl_set->not_after_ = static_cast<uint64>(not_after); + crl_set->sequence_ = static_cast<uint32_t>(sequence); + crl_set->not_after_ = static_cast<uint64_t>(not_after); if (!CopyBlockedSPKIsFromHeader(crl_set.get(), header_dict.get())) return false; - std::vector<uint8> crl_changes; + std::vector<uint8_t> crl_changes; if (!ReadChanges(&data, &crl_changes)) return false; size_t i = 0, j = 0; - for (std::vector<uint8>::const_iterator k = crl_changes.begin(); + for (std::vector<uint8_t>::const_iterator k = crl_changes.begin(); k != crl_changes.end(); ++k) { if (*k == SYMBOL_SAME) { if (i >= in_crl_set->crls_.size()) @@ -521,7 +521,7 @@ std::string CRLSetStorage::Serialize(const CRLSet* crl_set) { uint8_t* out = reinterpret_cast<uint8_t*>( WriteInto(&ret, len + 1 /* to include final NUL */)); size_t off = 0; - CHECK(base::IsValueInRangeForNumericType<uint16>(header.size())); + CHECK(base::IsValueInRangeForNumericType<uint16_t>(header.size())); out[off++] = static_cast<uint8_t>(header.size()); out[off++] = static_cast<uint8_t>(header.size() >> 8); memcpy(out + off, header.data(), header.size()); @@ -531,7 +531,7 @@ std::string CRLSetStorage::Serialize(const CRLSet* crl_set) { i != crl_set->crls_.end(); ++i) { memcpy(out + off, i->first.data(), i->first.size()); off += i->first.size(); - const uint32 num_serials = i->second.size(); + const uint32_t num_serials = i->second.size(); memcpy(out + off, &num_serials, sizeof(num_serials)); off += sizeof(num_serials); diff --git a/net/cert/crl_set_unittest.cc b/net/cert/crl_set_unittest.cc index 4f74c29e..6e154d3 100644 --- a/net/cert/crl_set_unittest.cc +++ b/net/cert/crl_set_unittest.cc @@ -10,7 +10,7 @@ namespace net { // These data blocks were generated using a lot of code that is still in // development. For now, if you need to update them, you have to contact agl. -static const uint8 kGIACRLSet[] = { +static const uint8_t kGIACRLSet[] = { 0x60, 0x00, 0x7b, 0x22, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x43, 0x52, 0x4c, 0x53, 0x65, 0x74, 0x22, 0x2c, 0x22, @@ -35,7 +35,7 @@ static const uint8 kGIACRLSet[] = { 0x00, 0x00, 0x1d, 0x77, }; -static const uint8 kNoopDeltaCRL[] = { +static const uint8_t kNoopDeltaCRL[] = { 0xc3, 0x00, 0x7b, 0x22, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x43, 0x52, 0x4c, 0x53, 0x65, 0x74, 0x44, 0x65, 0x6c, @@ -55,7 +55,7 @@ static const uint8 kNoopDeltaCRL[] = { 0x00, 0x04, 0x00, 0x00, 0xff, 0xff, 0x00, 0x01, 0x00, 0x01, }; -static const uint8 kAddCRLDelta[] = { +static const uint8_t kAddCRLDelta[] = { 0xc3, 0x00, 0x7b, 0x22, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x43, 0x52, 0x4c, 0x53, 0x65, 0x74, 0x44, 0x65, 0x6c, @@ -80,7 +80,7 @@ static const uint8 kAddCRLDelta[] = { 0x01, 0x30, 0x01, 0x31, 0x01, 0x32, }; -static const uint8 kRemoveCRLDelta[] = { +static const uint8_t kRemoveCRLDelta[] = { 0xc3, 0x00, 0x7b, 0x22, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x43, 0x52, 0x4c, 0x53, 0x65, 0x74, 0x44, 0x65, 0x6c, @@ -100,7 +100,7 @@ static const uint8 kRemoveCRLDelta[] = { 0x60, 0x02, 0x04, 0x00, 0x00, 0xff, 0xff, 0x00, 0x04, 0x00, 0x03, }; -static const uint8 kUpdateSerialsDelta[] = { +static const uint8_t kUpdateSerialsDelta[] = { 0xc3, 0x00, 0x7b, 0x22, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x43, 0x52, 0x4c, 0x53, 0x65, 0x74, 0x44, 0x65, 0x6c, @@ -150,7 +150,7 @@ static const uint8 kUpdateSerialsDelta[] = { 0xb0, }; -static const uint8 kBlockedSPKICRLSet[] = { +static const uint8_t kBlockedSPKICRLSet[] = { 0x8e, 0x00, 0x7b, 0x22, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x43, 0x52, 0x4c, 0x53, 0x65, 0x74, 0x22, 0x2c, 0x22, @@ -165,7 +165,7 @@ static const uint8 kBlockedSPKICRLSet[] = { 0x7d, }; -static const uint8 kExpiredCRLSet[] = { +static const uint8_t kExpiredCRLSet[] = { 0x6d, 0x00, 0x7b, 0x22, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x43, 0x52, 0x4c, 0x53, 0x65, 0x74, 0x22, 0x2c, 0x22, @@ -179,7 +179,7 @@ static const uint8 kExpiredCRLSet[] = { // kGIASPKISHA256 is the SHA256 digest the Google Internet Authority's // SubjectPublicKeyInfo. -static const uint8 kGIASPKISHA256[32] = { +static const uint8_t kGIASPKISHA256[32] = { 0xb6, 0xb9, 0x54, 0x32, 0xab, 0xae, 0x57, 0xfe, 0x02, 0x0c, 0xb2, 0xb7, 0x4f, 0x4f, 0x9f, 0x91, 0x73, 0xc8, 0xc7, 0x08, 0xaf, 0xc9, 0xe7, 0x32, 0xac, 0xe2, 0x32, 0x79, 0x04, 0x7c, 0x6d, 0x05, @@ -307,7 +307,7 @@ TEST(CRLSetTest, BlockedSPKIs) { EXPECT_TRUE(CRLSetStorage::Parse(s, &set)); ASSERT_TRUE(set.get() != NULL); - const uint8 spki_hash[] = { + const uint8_t spki_hash[] = { 227, 176, 196, 66, 152, 252, 28, 20, 154, 251, 244, 200, 153, 111, 185, 36, 39, 174, 65, 228, 100, 155, 147, 76, 164, 149, 153, 27, 120, 82, 184, 85, 0, diff --git a/net/cert/ct_log_response_parser.cc b/net/cert/ct_log_response_parser.cc index f7cc25f..5a2edac 100644 --- a/net/cert/ct_log_response_parser.cc +++ b/net/cert/ct_log_response_parser.cc @@ -126,9 +126,8 @@ bool FillSignedTreeHead(const base::StringPiece& json_signed_tree_head, signed_tree_head->version = SignedTreeHead::V1; signed_tree_head->tree_size = parsed_sth.tree_size; signed_tree_head->timestamp = - base::Time::UnixEpoch() + - base::TimeDelta::FromMilliseconds( - static_cast<int64>(parsed_sth.timestamp)); + base::Time::UnixEpoch() + base::TimeDelta::FromMilliseconds( + static_cast<int64_t>(parsed_sth.timestamp)); signed_tree_head->signature = parsed_sth.signature; memcpy(signed_tree_head->sha256_root_hash, parsed_sth.sha256_root_hash.c_str(), diff --git a/net/cert/ct_serialization.cc b/net/cert/ct_serialization.cc index 489717a..6ea3cedc 100644 --- a/net/cert/ct_serialization.cc +++ b/net/cert/ct_serialization.cc @@ -4,7 +4,8 @@ #include "net/cert/ct_serialization.h" -#include "base/basictypes.h" +#include <stdint.h> + #include "base/logging.h" namespace net { @@ -348,7 +349,7 @@ bool DecodeSignedCertificateTimestamp( } result->version = SignedCertificateTimestamp::SCT_VERSION_1; - uint64 timestamp; + uint64_t timestamp; base::StringPiece log_id; base::StringPiece extensions; if (!ReadFixedBytes(kLogIdLength, input, &log_id) || @@ -359,8 +360,8 @@ bool DecodeSignedCertificateTimestamp( return false; } - if (timestamp > static_cast<uint64>(kint64max)) { - DVLOG(1) << "Timestamp value too big to cast to int64: " << timestamp; + if (timestamp > static_cast<uint64_t>(kint64max)) { + DVLOG(1) << "Timestamp value too big to cast to int64_t: " << timestamp; return false; } @@ -368,7 +369,7 @@ bool DecodeSignedCertificateTimestamp( extensions.CopyToString(&result->extensions); result->timestamp = base::Time::UnixEpoch() + - base::TimeDelta::FromMilliseconds(static_cast<int64>(timestamp)); + base::TimeDelta::FromMilliseconds(static_cast<int64_t>(timestamp)); output->swap(result); return true; diff --git a/net/cert/multi_threaded_cert_verifier.h b/net/cert/multi_threaded_cert_verifier.h index 177f8df..9632970 100644 --- a/net/cert/multi_threaded_cert_verifier.h +++ b/net/cert/multi_threaded_cert_verifier.h @@ -5,12 +5,13 @@ #ifndef NET_CERT_MULTI_THREADED_CERT_VERIFIER_H_ #define NET_CERT_MULTI_THREADED_CERT_VERIFIER_H_ +#include <stdint.h> #include <set> #include <string> #include <vector> -#include "base/basictypes.h" #include "base/gtest_prod_util.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/threading/non_thread_safe.h" #include "net/base/completion_callback.h" @@ -156,9 +157,9 @@ class NET_EXPORT_PRIVATE MultiThreadedCertVerifier // For unit testing. void ClearCache() { cache_.Clear(); } size_t GetCacheSize() const { return cache_.size(); } - uint64 cache_hits() const { return cache_hits_; } - uint64 requests() const { return requests_; } - uint64 inflight_joins() const { return inflight_joins_; } + uint64_t cache_hits() const { return cache_hits_; } + uint64_t requests() const { return requests_; } + uint64_t inflight_joins() const { return inflight_joins_; } // cache_ maps from a request to a cached result. CertVerifierCache cache_; @@ -166,9 +167,9 @@ class NET_EXPORT_PRIVATE MultiThreadedCertVerifier // inflight_ holds the jobs for which an active verification is taking place. JobSet inflight_; - uint64 requests_; - uint64 cache_hits_; - uint64 inflight_joins_; + uint64_t requests_; + uint64_t cache_hits_; + uint64_t inflight_joins_; scoped_refptr<CertVerifyProc> verify_proc_; diff --git a/net/cert/nss_cert_database.h b/net/cert/nss_cert_database.h index b68a56d..42447f95a 100644 --- a/net/cert/nss_cert_database.h +++ b/net/cert/nss_cert_database.h @@ -5,11 +5,12 @@ #ifndef NET_CERT_NSS_CERT_DATABASE_H_ #define NET_CERT_NSS_CERT_DATABASE_H_ +#include <stdint.h> #include <string> #include <vector> -#include "base/basictypes.h" #include "base/callback_forward.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/strings/string16.h" @@ -85,7 +86,7 @@ class NET_EXPORT NSSCertDatabase { // Use TRUST_DEFAULT to inherit trust as normal. // NOTE: The actual constants are defined using an enum instead of static // consts due to compilation/linkage constraints with template functions. - typedef uint32 TrustBits; + typedef uint32_t TrustBits; enum { TRUST_DEFAULT = 0, TRUSTED_SSL = 1 << 0, diff --git a/net/cert/signed_certificate_timestamp.cc b/net/cert/signed_certificate_timestamp.cc index bbd36df..f5f9c94 100644 --- a/net/cert/signed_certificate_timestamp.cc +++ b/net/cert/signed_certificate_timestamp.cc @@ -48,7 +48,7 @@ void SignedCertificateTimestamp::Persist(base::Pickle* pickle) { scoped_refptr<SignedCertificateTimestamp> SignedCertificateTimestamp::CreateFromPickle(base::PickleIterator* iter) { int version; - int64 timestamp; + int64_t timestamp; int hash_algorithm; int sig_algorithm; scoped_refptr<SignedCertificateTimestamp> sct( diff --git a/net/cert/signed_tree_head.h b/net/cert/signed_tree_head.h index fdeef4a..fdbcdc4 100644 --- a/net/cert/signed_tree_head.h +++ b/net/cert/signed_tree_head.h @@ -17,7 +17,7 @@ namespace net { namespace ct { -static const uint8 kSthRootHashLength = 32; +static const uint8_t kSthRootHashLength = 32; // Signed Tree Head as defined in section 3.5. of RFC6962 struct NET_EXPORT SignedTreeHead { @@ -28,7 +28,7 @@ struct NET_EXPORT SignedTreeHead { Version version; base::Time timestamp; - uint64 tree_size; + uint64_t tree_size; char sha256_root_hash[kSthRootHashLength]; DigitallySigned signature; }; diff --git a/net/cert/test_root_certs_android.cc b/net/cert/test_root_certs_android.cc index 7358827..44cd1f9d 100644 --- a/net/cert/test_root_certs_android.cc +++ b/net/cert/test_root_certs_android.cc @@ -17,7 +17,7 @@ bool TestRootCerts::Add(X509Certificate* certificate) { &cert_bytes)) return false; android::AddTestRootCertificate( - reinterpret_cast<const uint8*>(cert_bytes.data()), cert_bytes.size()); + reinterpret_cast<const uint8_t*>(cert_bytes.data()), cert_bytes.size()); empty_ = false; return true; } diff --git a/net/cert/test_root_certs_win.cc b/net/cert/test_root_certs_win.cc index 4e941e2..a83ac04 100644 --- a/net/cert/test_root_certs_win.cc +++ b/net/cert/test_root_certs_win.cc @@ -4,7 +4,8 @@ #include "net/cert/test_root_certs.h" -#include "base/basictypes.h" +#include <stdint.h> + #include "base/lazy_instance.h" #include "base/logging.h" #include "base/win/win_util.h" @@ -99,7 +100,7 @@ BOOL WINAPI InterceptedOpenStoreW(LPCSTR store_provider, // If the high word is all zeroes, then |store_provider| is a numeric ID. // Otherwise, it's a pointer to a null-terminated ASCII string. See the // documentation for CryptGetOIDFunctionAddress for more information. - uint32 store_as_uint = reinterpret_cast<uint32>(store_provider); + uint32_t store_as_uint = reinterpret_cast<uint32_t>(store_provider); if (store_as_uint > 0xFFFF || store_provider != CERT_STORE_PROV_SYSTEM_W || !g_capi_injector.Get().original_function) return FALSE; diff --git a/net/cert/x509_cert_types_mac.cc b/net/cert/x509_cert_types_mac.cc index d5b2ea3..c8ed4fe 100644 --- a/net/cert/x509_cert_types_mac.cc +++ b/net/cert/x509_cert_types_mac.cc @@ -29,13 +29,13 @@ namespace { // as long as the symbols are properly exposed. The fact that Apple's // implementation stores it in BER is an internal implementation detail // observed by studying libsecurity_cssm. -const uint8 kDomainComponentData[] = { +const uint8_t kDomainComponentData[] = { 0x09, 0x92, 0x26, 0x89, 0x93, 0xF2, 0x2C, 0x64, 0x01, 0x19 }; const CSSM_OID kDomainComponentOID = { arraysize(kDomainComponentData), - const_cast<uint8*>(kDomainComponentData) + const_cast<uint8_t*>(kDomainComponentData) }; const CSSM_OID* kOIDs[] = { diff --git a/net/cert/x509_cert_types_unittest.cc b/net/cert/x509_cert_types_unittest.cc index a6645c0..f3bf8fc 100644 --- a/net/cert/x509_cert_types_unittest.cc +++ b/net/cert/x509_cert_types_unittest.cc @@ -4,7 +4,6 @@ #include "net/cert/x509_cert_types.h" -#include "base/basictypes.h" #include "base/strings/string_piece.h" #include "base/time/time.h" #include "net/test/test_certificate_data.h" diff --git a/net/cert/x509_certificate.cc b/net/cert/x509_certificate.cc index 7d1b47f..7dbac36 100644 --- a/net/cert/x509_certificate.cc +++ b/net/cert/x509_certificate.cc @@ -339,7 +339,7 @@ X509Certificate* X509Certificate::CreateFromPickle( return NULL; OSCertHandles intermediates; - uint32 num_intermediates = 0; + uint32_t num_intermediates = 0; if (type != PICKLETYPE_SINGLE_CERTIFICATE) { if (!pickle_iter->ReadUInt32(&num_intermediates)) { FreeOSCertHandle(cert_handle); @@ -361,7 +361,7 @@ X509Certificate* X509Certificate::CreateFromPickle( // cached pickles will all get replaced. // TODO(mdm): remove this compatibility code in April 2013 or so. base::PickleIterator saved_iter = *pickle_iter; - uint32 zero_check = 0; + uint32_t zero_check = 0; if (!pickle_iter->ReadUInt32(&zero_check)) { // This may not be an error. If there are no intermediates, and we're // reading an old 32-bit pickle, and there's nothing else after this in @@ -379,7 +379,7 @@ X509Certificate* X509Certificate::CreateFromPickle( *pickle_iter = saved_iter; #endif // defined(OS_POSIX) && !defined(OS_MACOSX) && defined(__x86_64__) - for (uint32 i = 0; i < num_intermediates; ++i) { + for (uint32_t i = 0; i < num_intermediates; ++i) { OSCertHandle intermediate = ReadOSCertHandleFromPickle(pickle_iter); if (!intermediate) break; diff --git a/net/cert/x509_certificate_known_roots_mac.h b/net/cert/x509_certificate_known_roots_mac.h index a3d81ae..fb5d0f5b 100644 --- a/net/cert/x509_certificate_known_roots_mac.h +++ b/net/cert/x509_certificate_known_roots_mac.h @@ -10,7 +10,7 @@ // // Note that these *are not* trust anchors for Chromium. They are only used to // distinguish `real' root CAs from roots that were user-installed. -static uint8 kKnownRootCertSHA1Hashes[][20] = { +static uint8_t kKnownRootCertSHA1Hashes[][20] = { {0x01, 0x68, 0x97, 0xe1, 0xa0, 0xb8, 0xf2, 0xc3, 0xb1, 0x34, 0x66, 0x5c, 0x20, 0xa7, 0x27, 0xb7, 0xa1, 0x58, 0xe2, 0x8f}, {0x02, 0x72, 0x68, 0x29, 0x3e, 0x5f, 0x5d, 0x17, 0xaa, 0xa4, diff --git a/net/cert/x509_certificate_known_roots_win.h b/net/cert/x509_certificate_known_roots_win.h index 058c272..ce7dce8 100644 --- a/net/cert/x509_certificate_known_roots_win.h +++ b/net/cert/x509_certificate_known_roots_win.h @@ -14,7 +14,7 @@ // // Note that these *are not* trust anchors for Chromium. They are only used to // distinguish `real' root CAs from roots that were user-installed. -static uint8 kKnownRootCertSHA1Hashes[][20] = { +static uint8_t kKnownRootCertSHA1Hashes[][20] = { {0x00, 0x48, 0xf8, 0xd3, 0x7b, 0x15, 0x3f, 0x6e, 0xa2, 0x79, 0x8c, 0x32, 0x3e, 0xf4, 0xf3, 0x18, 0xa5, 0x62, 0x4a, 0x9e}, {0x00, 0xea, 0x52, 0x2c, 0x8a, 0x9c, 0x06, 0xaa, 0x3e, 0xcc, diff --git a/net/cert/x509_certificate_mac.cc b/net/cert/x509_certificate_mac.cc index 5f1d58f..64457e4 100644 --- a/net/cert/x509_certificate_mac.cc +++ b/net/cert/x509_certificate_mac.cc @@ -300,7 +300,7 @@ bool X509Certificate::IsSameOSCert(X509Certificate::OSCertHandle a, X509Certificate::OSCertHandle X509Certificate::CreateOSCertHandleFromBytes( const char* data, int length) { CSSM_DATA cert_data; - cert_data.Data = const_cast<uint8*>(reinterpret_cast<const uint8*>(data)); + cert_data.Data = const_cast<uint8_t*>(reinterpret_cast<const uint8_t*>(data)); cert_data.Length = length; OSCertHandle cert_handle = NULL; diff --git a/net/cert/x509_certificate_unittest.cc b/net/cert/x509_certificate_unittest.cc index 3bf6671..c100bae 100644 --- a/net/cert/x509_certificate_unittest.cc +++ b/net/cert/x509_certificate_unittest.cc @@ -4,7 +4,8 @@ #include "net/cert/x509_certificate.h" -#include "base/basictypes.h" +#include <stdint.h> + #include "base/files/file_path.h" #include "base/memory/scoped_ptr.h" #include "base/pickle.h" @@ -47,39 +48,39 @@ namespace net { // $ date +%s -d '<date str>' // Google's cert. -uint8 google_fingerprint[] = { +uint8_t google_fingerprint[] = { 0xab, 0xbe, 0x5e, 0xb4, 0x93, 0x88, 0x4e, 0xe4, 0x60, 0xc6, 0xef, 0xf8, 0xea, 0xd4, 0xb1, 0x55, 0x4b, 0xc9, 0x59, 0x3c }; // webkit.org's cert. -uint8 webkit_fingerprint[] = { +uint8_t webkit_fingerprint[] = { 0xa1, 0x4a, 0x94, 0x46, 0x22, 0x8e, 0x70, 0x66, 0x2b, 0x94, 0xf9, 0xf8, 0x57, 0x83, 0x2d, 0xa2, 0xff, 0xbc, 0x84, 0xc2 }; // thawte.com's cert (it's EV-licious!). -uint8 thawte_fingerprint[] = { +uint8_t thawte_fingerprint[] = { 0x85, 0x04, 0x2d, 0xfd, 0x2b, 0x0e, 0xc6, 0xc8, 0xaf, 0x2d, 0x77, 0xd6, 0xa1, 0x3a, 0x64, 0x04, 0x27, 0x90, 0x97, 0x37 }; // A certificate for https://www.unosoft.hu/, whose AIA extension contains // an LDAP URL without a host name. -uint8 unosoft_hu_fingerprint[] = { +uint8_t unosoft_hu_fingerprint[] = { 0x32, 0xff, 0xe3, 0xbe, 0x2c, 0x3b, 0xc7, 0xca, 0xbf, 0x2d, 0x64, 0xbd, 0x25, 0x66, 0xf2, 0xec, 0x8b, 0x0f, 0xbf, 0xd8 }; // The fingerprint of the Google certificate used in the parsing tests, // which is newer than the one included in the x509_certificate_data.h -uint8 google_parse_fingerprint[] = { +uint8_t google_parse_fingerprint[] = { 0x40, 0x50, 0x62, 0xe5, 0xbe, 0xfd, 0xe4, 0xaf, 0x97, 0xe9, 0x38, 0x2a, 0xf1, 0x6c, 0xc8, 0x7c, 0x8f, 0xb7, 0xc4, 0xe2 }; // The fingerprint for the Thawte SGC certificate -uint8 thawte_parse_fingerprint[] = { +uint8_t thawte_parse_fingerprint[] = { 0xec, 0x07, 0x10, 0x03, 0xd8, 0xf5, 0xa3, 0x7f, 0x42, 0xc4, 0x55, 0x7f, 0x65, 0x6a, 0xae, 0x86, 0x65, 0xfa, 0x4b, 0x02 }; @@ -90,7 +91,7 @@ const double kGoogleParseValidFrom = 1261094400; const double kGoogleParseValidTo = 1324252799; void CheckGoogleCert(const scoped_refptr<X509Certificate>& google_cert, - uint8* expected_fingerprint, + uint8_t* expected_fingerprint, double valid_from, double valid_to) { ASSERT_NE(static_cast<X509Certificate*>(NULL), google_cert.get()); @@ -301,7 +302,7 @@ TEST(X509CertificateTest, SerialNumbers) { X509Certificate::CreateFromBytes( reinterpret_cast<const char*>(google_der), sizeof(google_der))); - static const uint8 google_serial[16] = { + static const uint8_t google_serial[16] = { 0x01,0x2a,0x39,0x76,0x0d,0x3f,0x4f,0xc9, 0x0b,0xe7,0xbd,0x2b,0xcf,0x95,0x2e,0x7a, }; @@ -317,7 +318,7 @@ TEST(X509CertificateTest, SerialNumbers) { reinterpret_cast<const char*>(paypal_null_der), sizeof(paypal_null_der))); - static const uint8 paypal_null_serial[3] = {0x00, 0xf0, 0x9b}; + static const uint8_t paypal_null_serial[3] = {0x00, 0xf0, 0x9b}; ASSERT_EQ(sizeof(paypal_null_serial), paypal_null_cert->serial_number().size()); EXPECT_TRUE(memcmp(paypal_null_cert->serial_number().data(), @@ -328,7 +329,7 @@ TEST(X509CertificateTest, SHA256FingerprintsCorrectly) { scoped_refptr<X509Certificate> google_cert(X509Certificate::CreateFromBytes( reinterpret_cast<const char*>(google_der), sizeof(google_der))); - static const uint8 google_sha256_fingerprint[32] = { + static const uint8_t google_sha256_fingerprint[32] = { 0x21, 0xaf, 0x58, 0x74, 0xea, 0x6b, 0xad, 0xbd, 0xe4, 0xb3, 0xb1, 0xaa, 0x53, 0x32, 0x80, 0x8f, 0xbf, 0x8a, 0x24, 0x7d, 0x98, 0xec, 0x7f, 0x77, 0x49, 0x38, 0x42, 0x81, 0x26, 0x7f, 0xed, 0x38}; @@ -373,16 +374,16 @@ TEST(X509CertificateTest, CAFingerprints) { X509Certificate::CreateFromHandle(server_cert->os_cert_handle(), intermediates); - static const uint8 cert_chain1_ca_fingerprint[20] = { + static const uint8_t cert_chain1_ca_fingerprint[20] = { 0xc2, 0xf0, 0x08, 0x7d, 0x01, 0xe6, 0x86, 0x05, 0x3a, 0x4d, 0x63, 0x3e, 0x7e, 0x70, 0xd4, 0xef, 0x65, 0xc2, 0xcc, 0x4f }; - static const uint8 cert_chain2_ca_fingerprint[20] = { + static const uint8_t cert_chain2_ca_fingerprint[20] = { 0xd5, 0x59, 0xa5, 0x86, 0x66, 0x9b, 0x08, 0xf4, 0x6a, 0x30, 0xa1, 0x33, 0xf8, 0xa9, 0xed, 0x3d, 0x03, 0x8e, 0x2e, 0xa8 }; // The SHA-1 hash of nothing. - static const uint8 cert_chain3_ca_fingerprint[20] = { + static const uint8_t cert_chain3_ca_fingerprint[20] = { 0xda, 0x39, 0xa3, 0xee, 0x5e, 0x6b, 0x4b, 0x0d, 0x32, 0x55, 0xbf, 0xef, 0x95, 0x60, 0x18, 0x90, 0xaf, 0xd8, 0x07, 0x09 }; @@ -395,20 +396,20 @@ TEST(X509CertificateTest, CAFingerprints) { // Test the SHA-256 hash calculation functions explicitly since they are not // used by X509Certificate internally. - static const uint8 cert_chain1_ca_fingerprint_256[32] = { + static const uint8_t cert_chain1_ca_fingerprint_256[32] = { 0x51, 0x15, 0x30, 0x49, 0x97, 0x54, 0xf8, 0xb4, 0x17, 0x41, 0x6b, 0x58, 0x78, 0xb0, 0x89, 0xd2, 0xc3, 0xae, 0x66, 0xc1, 0x16, 0x80, 0xa0, 0x78, 0xe7, 0x53, 0x45, 0xa2, 0xfb, 0x80, 0xe1, 0x07 }; - static const uint8 cert_chain2_ca_fingerprint_256[32] = { + static const uint8_t cert_chain2_ca_fingerprint_256[32] = { 0x00, 0xbd, 0x2b, 0x0e, 0xdd, 0x83, 0x40, 0xb1, 0x74, 0x6c, 0xc3, 0x95, 0xc0, 0xe3, 0x55, 0xb2, 0x16, 0x58, 0x53, 0xfd, 0xb9, 0x3c, 0x52, 0xda, 0xdd, 0xa8, 0x22, 0x8b, 0x07, 0x00, 0x2d, 0xce }; // The SHA-256 hash of nothing. - static const uint8 cert_chain3_ca_fingerprint_256[32] = { + static const uint8_t cert_chain3_ca_fingerprint_256[32] = { 0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, @@ -430,19 +431,19 @@ TEST(X509CertificateTest, CAFingerprints) { EXPECT_TRUE(memcmp(ca_fingerprint_256_3.data, cert_chain3_ca_fingerprint_256, 32) == 0); - static const uint8 cert_chain1_chain_fingerprint_256[32] = { + static const uint8_t cert_chain1_chain_fingerprint_256[32] = { 0xac, 0xff, 0xcc, 0x63, 0x0d, 0xd0, 0xa7, 0x19, 0x78, 0xb5, 0x8a, 0x47, 0x8b, 0x67, 0x97, 0xcb, 0x8d, 0xe1, 0x6a, 0x8a, 0x57, 0x70, 0xda, 0x9a, 0x53, 0x72, 0xe2, 0xa0, 0x08, 0xab, 0xcc, 0x8f }; - static const uint8 cert_chain2_chain_fingerprint_256[32] = { + static const uint8_t cert_chain2_chain_fingerprint_256[32] = { 0x67, 0x3a, 0x11, 0x20, 0xd6, 0x94, 0x14, 0xe4, 0x16, 0x9f, 0x58, 0xe2, 0x8b, 0xf7, 0x27, 0xed, 0xbb, 0xe8, 0xa7, 0xff, 0x1c, 0x8c, 0x0f, 0x21, 0x38, 0x16, 0x7c, 0xad, 0x1f, 0x22, 0x6f, 0x9b }; - static const uint8 cert_chain3_chain_fingerprint_256[32] = { + static const uint8_t cert_chain3_chain_fingerprint_256[32] = { 0x16, 0x7a, 0xbd, 0xb4, 0x57, 0x04, 0x65, 0x3c, 0x3b, 0xef, 0x6e, 0x6a, 0xa6, 0x02, 0x73, 0x30, 0x3e, 0x34, 0x1b, 0x43, 0xc2, 0x7c, 0x98, 0x52, 0x9f, 0x34, 0x7f, 0x55, 0x97, 0xe9, @@ -486,14 +487,14 @@ TEST(X509CertificateTest, ParseSubjectAltNames) { // Ensure that both IPv4 and IPv6 addresses are correctly parsed. ASSERT_EQ(2U, ip_addresses.size()); - static const uint8 kIPv4Address[] = { + static const uint8_t kIPv4Address[] = { 0x7F, 0x00, 0x00, 0x02 }; ASSERT_EQ(arraysize(kIPv4Address), ip_addresses[0].size()); EXPECT_EQ(0, memcmp(ip_addresses[0].data(), kIPv4Address, arraysize(kIPv4Address))); - static const uint8 kIPv6Address[] = { + static const uint8_t kIPv6Address[] = { 0xFE, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }; @@ -519,8 +520,8 @@ TEST(X509CertificateTest, ExtractSPKIFromDERCert) { base::StringPiece spkiBytes; EXPECT_TRUE(asn1::ExtractSPKIFromDERCert(derBytes, &spkiBytes)); - uint8 hash[base::kSHA1Length]; - base::SHA1HashBytes(reinterpret_cast<const uint8*>(spkiBytes.data()), + uint8_t hash[base::kSHA1Length]; + base::SHA1HashBytes(reinterpret_cast<const uint8_t*>(spkiBytes.data()), spkiBytes.size(), hash); EXPECT_EQ(0, memcmp(hash, kNistSPKIHash, sizeof(hash))); @@ -813,7 +814,7 @@ TEST(X509CertificateTest, GetDefaultNickname) { const struct CertificateFormatTestData { const char* file_name; X509Certificate::Format format; - uint8* chain_fingerprints[3]; + uint8_t* chain_fingerprints[3]; } kFormatTestData[] = { // DER Parsing - single certificate, DER encoded { "google.single.der", X509Certificate::FORMAT_SINGLE_CERTIFICATE, @@ -913,7 +914,7 @@ TEST_P(X509CertificateParseTest, CanParseFormat) { // comparing fingerprints. const X509Certificate* cert = certs[i].get(); const SHA1HashValue& actual_fingerprint = cert->fingerprint(); - uint8* expected_fingerprint = test_data_.chain_fingerprints[i]; + uint8_t* expected_fingerprint = test_data_.chain_fingerprints[i]; for (size_t j = 0; j < 20; ++j) EXPECT_EQ(expected_fingerprint[j], actual_fingerprint.data[j]); @@ -1121,7 +1122,7 @@ TEST_P(X509CertificateNameVerifyTest, VerifyHostname) { ASSERT_NE(0U, addr_ascii.length()); if (addr_ascii[0] == 'x') { // Hex encoded address addr_ascii.erase(0, 1); - std::vector<uint8> bytes; + std::vector<uint8_t> bytes; EXPECT_TRUE(base::HexStringToBytes(addr_ascii, &bytes)) << "Could not parse hex address " << addr_ascii << " i = " << i; ip_addressses.push_back(std::string(reinterpret_cast<char*>(&bytes[0]), diff --git a/net/cert/x509_certificate_win.cc b/net/cert/x509_certificate_win.cc index 3e20c5f..7be74ed 100644 --- a/net/cert/x509_certificate_win.cc +++ b/net/cert/x509_certificate_win.cc @@ -164,7 +164,7 @@ void X509Certificate::Initialize() { ca_fingerprint_ = CalculateCAFingerprint(intermediate_ca_certs_); const CRYPT_INTEGER_BLOB* serial = &cert_handle_->pCertInfo->SerialNumber; - scoped_ptr<uint8[]> serial_bytes(new uint8[serial->cbData]); + scoped_ptr<uint8_t[]> serial_bytes(new uint8_t[serial->cbData]); for (unsigned i = 0; i < serial->cbData; i++) serial_bytes[i] = serial->pbData[serial->cbData - i - 1]; serial_number_ = std::string( diff --git a/net/cert/x509_util.cc b/net/cert/x509_util.cc index 2fb3f54..bbdc194 100644 --- a/net/cert/x509_util.cc +++ b/net/cert/x509_util.cc @@ -4,7 +4,6 @@ #include "net/cert/x509_util.h" -#include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "base/time/time.h" #include "crypto/ec_private_key.h" @@ -16,7 +15,7 @@ namespace net { namespace x509_util { // RSA keys created by CreateKeyAndSelfSignedCert will be of this length. -static const uint16 kRSAKeyLength = 1024; +static const uint16_t kRSAKeyLength = 1024; // Certificates made by CreateKeyAndSelfSignedCert and // CreateKeyAndChannelIDEC will be signed using this digest algorithm. @@ -56,7 +55,7 @@ bool ClientCertSorter::operator()( } bool CreateKeyAndSelfSignedCert(const std::string& subject, - uint32 serial_number, + uint32_t serial_number, base::Time not_valid_before, base::Time not_valid_after, scoped_ptr<crypto::RSAPrivateKey>* key, diff --git a/net/cert/x509_util.h b/net/cert/x509_util.h index a996f85..a1c2968 100644 --- a/net/cert/x509_util.h +++ b/net/cert/x509_util.h @@ -5,6 +5,7 @@ #ifndef NET_CERT_X509_UTIL_H_ #define NET_CERT_X509_UTIL_H_ +#include <stdint.h> #include <string> #include "base/memory/ref_counted.h" @@ -56,7 +57,7 @@ NET_EXPORT_PRIVATE bool IsSupportedValidityRange(base::Time not_valid_before, // Use this certificate only after the above risks are acknowledged. NET_EXPORT bool CreateKeyAndSelfSignedCert( const std::string& subject, - uint32 serial_number, + uint32_t serial_number, base::Time not_valid_before, base::Time not_valid_after, scoped_ptr<crypto::RSAPrivateKey>* key, @@ -68,7 +69,7 @@ NET_EXPORT bool CreateKeyAndSelfSignedCert( NET_EXPORT bool CreateSelfSignedCert(crypto::RSAPrivateKey* key, DigestAlgorithm alg, const std::string& subject, - uint32 serial_number, + uint32_t serial_number, base::Time not_valid_before, base::Time not_valid_after, std::string* der_cert); diff --git a/net/cert/x509_util_mac.cc b/net/cert/x509_util_mac.cc index c9aa37b..3959b80 100644 --- a/net/cert/x509_util_mac.cc +++ b/net/cert/x509_util_mac.cc @@ -211,7 +211,7 @@ OSStatus CSSMCachedCertificate::GetField(const CSSM_OID* field_oid, CSSM_OID_PTR oid = const_cast<CSSM_OID_PTR>(field_oid); CSSM_DATA_PTR field_ptr = NULL; CSSM_HANDLE results_handle = CSSM_INVALID_HANDLE; - uint32 field_value_count = 0; + uint32_t field_value_count = 0; CSSM_RETURN status = CSSM_CL_CertGetFirstCachedFieldValue( cl_handle_, cached_cert_handle_, oid, &results_handle, &field_value_count, &field_ptr); diff --git a/net/cert/x509_util_mac.h b/net/cert/x509_util_mac.h index caf7a28..a35266b 100644 --- a/net/cert/x509_util_mac.h +++ b/net/cert/x509_util_mac.h @@ -10,7 +10,7 @@ #include <string> -#include "base/basictypes.h" +#include "base/macros.h" #include "net/base/net_export.h" namespace net { diff --git a/net/cert/x509_util_nss.cc b/net/cert/x509_util_nss.cc index 51878fb..fa6dc1c 100644 --- a/net/cert/x509_util_nss.cc +++ b/net/cert/x509_util_nss.cc @@ -38,12 +38,11 @@ namespace { // Returns NULL if an error is encountered in the certificate creation // process. // Caller responsible for freeing returned certificate object. -CERTCertificate* CreateCertificate( - SECKEYPublicKey* public_key, - const std::string& subject, - uint32 serial_number, - base::Time not_valid_before, - base::Time not_valid_after) { +CERTCertificate* CreateCertificate(SECKEYPublicKey* public_key, + const std::string& subject, + uint32_t serial_number, + base::Time not_valid_before, + base::Time not_valid_after) { // Create info about public key. CERTSubjectPublicKeyInfo* spki = SECKEY_CreateSubjectPublicKeyInfo(public_key); @@ -156,7 +155,7 @@ namespace x509_util { bool CreateSelfSignedCert(crypto::RSAPrivateKey* key, DigestAlgorithm alg, const std::string& subject, - uint32 serial_number, + uint32_t serial_number, base::Time not_valid_before, base::Time not_valid_after, std::string* der_cert) { diff --git a/net/cert/x509_util_openssl.cc b/net/cert/x509_util_openssl.cc index c87d553..d5873ca 100644 --- a/net/cert/x509_util_openssl.cc +++ b/net/cert/x509_util_openssl.cc @@ -215,8 +215,8 @@ bool IsSupportedValidityRange(base::Time not_valid_before, // // Note: This ignores leap seconds, but should be enough in practice. // - const int64 kDaysFromYear0001ToUnixEpoch = 719162; - const int64 kDaysFromUnixEpochToYear10000 = 2932896 + 1; + const int64_t kDaysFromYear0001ToUnixEpoch = 719162; + const int64_t kDaysFromUnixEpochToYear10000 = 2932896 + 1; const base::Time kEpoch = base::Time::UnixEpoch(); const base::Time kYear0001 = kEpoch - base::TimeDelta::FromDays(kDaysFromYear0001ToUnixEpoch); @@ -233,7 +233,7 @@ bool IsSupportedValidityRange(base::Time not_valid_before, bool CreateSelfSignedCert(crypto::RSAPrivateKey* key, DigestAlgorithm alg, const std::string& common_name, - uint32 serial_number, + uint32_t serial_number, base::Time not_valid_before, base::Time not_valid_after, std::string* der_encoded) { diff --git a/net/cert/x509_util_openssl_unittest.cc b/net/cert/x509_util_openssl_unittest.cc index 3e4f41a..9eebff8 100644 --- a/net/cert/x509_util_openssl_unittest.cc +++ b/net/cert/x509_util_openssl_unittest.cc @@ -20,8 +20,8 @@ TEST(X509UtilOpenSSLTest, IsSupportedValidityRange) { now, now - base::TimeDelta::FromSeconds(1))); // See x509_util_openssl.cc to see how these were computed. - const int64 kDaysFromYear0001ToUnixEpoch = 719162; - const int64 kDaysFromUnixEpochToYear10000 = 2932896 + 1; + const int64_t kDaysFromYear0001ToUnixEpoch = 719162; + const int64_t kDaysFromUnixEpochToYear10000 = 2932896 + 1; // When computing too_old / too_late, add one day to account for // possible leap seconds. diff --git a/net/cert/x509_util_unittest.cc b/net/cert/x509_util_unittest.cc index 716f61e..abce23a 100644 --- a/net/cert/x509_util_unittest.cc +++ b/net/cert/x509_util_unittest.cc @@ -79,7 +79,7 @@ TEST(X509UtilTest, CreateKeyAndSelfSigned) { // This test creates a self-signed cert from a private key and then verifies the // content of the certificate. TEST(X509UtilTest, CreateSelfSigned) { - const uint8 private_key_info[] = { + const uint8_t private_key_info[] = { 0x30, 0x82, 0x02, 0x78, 0x02, 0x01, 0x00, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x82, @@ -162,7 +162,7 @@ TEST(X509UtilTest, CreateSelfSigned) { 0xb1, 0xc5, 0x15, 0xf3 }; - std::vector<uint8> input; + std::vector<uint8_t> input; input.resize(sizeof(private_key_info)); memcpy(&input.front(), private_key_info, sizeof(private_key_info)); |