diff options
author | avi <avi@chromium.org> | 2015-12-26 14:15:14 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-26 22:16:15 +0000 |
commit | 9b6f42934e5a1e65ebfc668d91a28a6e2678a14c (patch) | |
tree | 6fb35dc2e15b6aeb7ce5d8fb2daf08f58c6d77e7 /base | |
parent | 28523e2cf18ee02f503e1792788b88d828968055 (diff) | |
download | chromium_src-9b6f42934e5a1e65ebfc668d91a28a6e2678a14c.zip chromium_src-9b6f42934e5a1e65ebfc668d91a28a6e2678a14c.tar.gz chromium_src-9b6f42934e5a1e65ebfc668d91a28a6e2678a14c.tar.bz2 |
Switch to standard integer types in base/.
BUG=138542
TBR=mark@chromium.org
NOPRESUBMIT=true
Review URL: https://codereview.chromium.org/1538743002
Cr-Commit-Position: refs/heads/master@{#366910}
Diffstat (limited to 'base')
285 files changed, 1195 insertions, 814 deletions
diff --git a/base/allocator/allocator_shim_win.cc b/base/allocator/allocator_shim_win.cc index 2a933ee..2c5a40f 100644 --- a/base/allocator/allocator_shim_win.cc +++ b/base/allocator/allocator_shim_win.cc @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <limits.h> #include <malloc.h> #include <new.h> #include <windows.h> - -#include "base/basictypes.h" +#include <stddef.h> // This shim make it possible to perform additional checks on allocations // before passing them to the Heap functions. diff --git a/base/allocator/unittest_utils.cc b/base/allocator/unittest_utils.cc index 130ba15..051d5685 100644 --- a/base/allocator/unittest_utils.cc +++ b/base/allocator/unittest_utils.cc @@ -6,6 +6,7 @@ // of other libraries #include <config.h> +#include <stddef.h> inline int snprintf(char* buffer, size_t count, const char* format, ...) { int result; diff --git a/base/at_exit.h b/base/at_exit.h index 6fe7361..04e3f76 100644 --- a/base/at_exit.h +++ b/base/at_exit.h @@ -8,8 +8,8 @@ #include <stack> #include "base/base_export.h" -#include "base/basictypes.h" #include "base/callback.h" +#include "base/macros.h" #include "base/synchronization/lock.h" namespace base { diff --git a/base/atomic_sequence_num.h b/base/atomic_sequence_num.h index 7bf2778..59b0d25 100644 --- a/base/atomic_sequence_num.h +++ b/base/atomic_sequence_num.h @@ -6,7 +6,7 @@ #define BASE_ATOMIC_SEQUENCE_NUM_H_ #include "base/atomicops.h" -#include "base/basictypes.h" +#include "base/macros.h" namespace base { diff --git a/base/atomicops_internals_atomicword_compat.h b/base/atomicops_internals_atomicword_compat.h index 342a6e4..8b000d2 100644 --- a/base/atomicops_internals_atomicword_compat.h +++ b/base/atomicops_internals_atomicword_compat.h @@ -7,7 +7,11 @@ #ifndef BASE_ATOMICOPS_INTERNALS_ATOMICWORD_COMPAT_H_ #define BASE_ATOMICOPS_INTERNALS_ATOMICWORD_COMPAT_H_ -// AtomicWord is a synonym for intptr_t, and Atomic32 is a synonym for int32, +#include <stdint.h> + +#include "build/build_config.h" + +// AtomicWord is a synonym for intptr_t, and Atomic32 is a synonym for int32_t, // which in turn means int. On some LP32 platforms, intptr_t is an int, but // on others, it's a long. When AtomicWord and Atomic32 are based on different // fundamental types, their pointers are incompatible. diff --git a/base/atomicops_internals_portable.h b/base/atomicops_internals_portable.h index d285610..ee034de 100644 --- a/base/atomicops_internals_portable.h +++ b/base/atomicops_internals_portable.h @@ -34,6 +34,8 @@ #include <atomic> +#include "build/build_config.h" + namespace base { namespace subtle { diff --git a/base/atomicops_internals_x86_msvc.h b/base/atomicops_internals_x86_msvc.h index 6ff0f44..9f05b7e 100644 --- a/base/atomicops_internals_x86_msvc.h +++ b/base/atomicops_internals_x86_msvc.h @@ -12,6 +12,7 @@ #include <intrin.h> #include "base/macros.h" +#include "build/build_config.h" #if defined(ARCH_CPU_64_BITS) // windows.h #defines this (only on x64). This causes problems because the diff --git a/base/auto_reset.h b/base/auto_reset.h index a5bcfaa..9116537 100644 --- a/base/auto_reset.h +++ b/base/auto_reset.h @@ -5,7 +5,7 @@ #ifndef BASE_AUTO_RESET_H_ #define BASE_AUTO_RESET_H_ -#include "base/basictypes.h" +#include "base/macros.h" // base::AutoReset<> is useful for setting a variable to a new value only within // a particular scope. An base::AutoReset<> object resets a variable to its diff --git a/base/base64.cc b/base/base64.cc index 8ed1249..ca8ee93 100644 --- a/base/base64.cc +++ b/base/base64.cc @@ -4,6 +4,8 @@ #include "base/base64.h" +#include <stddef.h> + #include "third_party/modp_b64/modp_b64.h" namespace base { diff --git a/base/base64url.cc b/base/base64url.cc index 106bba9..0a2c045 100644 --- a/base/base64url.cc +++ b/base/base64url.cc @@ -4,7 +4,10 @@ #include "base/base64url.h" +#include <stddef.h> + #include "base/base64.h" +#include "base/macros.h" #include "base/numerics/safe_math.h" #include "base/strings/string_util.h" #include "third_party/modp_b64/modp_b64.h" diff --git a/base/base64url.h b/base/base64url.h index dd4c5a2..66a4824 100644 --- a/base/base64url.h +++ b/base/base64url.h @@ -9,6 +9,7 @@ #include "base/base_export.h" #include "base/compiler_specific.h" +#include "base/macros.h" #include "base/strings/string_piece.h" namespace base { diff --git a/base/base64url_unittest.cc b/base/base64url_unittest.cc index 489c174..45aa4a8 100644 --- a/base/base64url_unittest.cc +++ b/base/base64url_unittest.cc @@ -4,6 +4,7 @@ #include "base/base64url.h" +#include "base/macros.h" #include "testing/gtest/include/gtest/gtest.h" namespace base { diff --git a/base/base_paths_mac.mm b/base/base_paths_mac.mm index af4bd1a..839df0d 100644 --- a/base/base_paths_mac.mm +++ b/base/base_paths_mac.mm @@ -8,6 +8,7 @@ #include <dlfcn.h> #import <Foundation/Foundation.h> #include <mach-o/dyld.h> +#include <stdint.h> #include "base/base_paths.h" #include "base/compiler_specific.h" diff --git a/base/base_paths_posix.cc b/base/base_paths_posix.cc index 4b847c4..a436a4d 100644 --- a/base/base_paths_posix.cc +++ b/base/base_paths_posix.cc @@ -7,6 +7,7 @@ // Android). #include <limits.h> +#include <stddef.h> #include <ostream> #include <string> diff --git a/base/base_switches.cc b/base/base_switches.cc index 2874e61..02b2229 100644 --- a/base/base_switches.cc +++ b/base/base_switches.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "base/base_switches.h" +#include "build/build_config.h" namespace switches { diff --git a/base/big_endian.cc b/base/big_endian.cc index 9b69147..514581f 100644 --- a/base/big_endian.cc +++ b/base/big_endian.cc @@ -43,19 +43,19 @@ bool BigEndianReader::Read(T* value) { return true; } -bool BigEndianReader::ReadU8(uint8* value) { +bool BigEndianReader::ReadU8(uint8_t* value) { return Read(value); } -bool BigEndianReader::ReadU16(uint16* value) { +bool BigEndianReader::ReadU16(uint16_t* value) { return Read(value); } -bool BigEndianReader::ReadU32(uint32* value) { +bool BigEndianReader::ReadU32(uint32_t* value) { return Read(value); } -bool BigEndianReader::ReadU64(uint64* value) { +bool BigEndianReader::ReadU64(uint64_t* value) { return Read(value); } @@ -86,19 +86,19 @@ bool BigEndianWriter::Write(T value) { return true; } -bool BigEndianWriter::WriteU8(uint8 value) { +bool BigEndianWriter::WriteU8(uint8_t value) { return Write(value); } -bool BigEndianWriter::WriteU16(uint16 value) { +bool BigEndianWriter::WriteU16(uint16_t value) { return Write(value); } -bool BigEndianWriter::WriteU32(uint32 value) { +bool BigEndianWriter::WriteU32(uint32_t value) { return Write(value); } -bool BigEndianWriter::WriteU64(uint64 value) { +bool BigEndianWriter::WriteU64(uint64_t value) { return Write(value); } diff --git a/base/big_endian.h b/base/big_endian.h index 914767f..b1466e2 100644 --- a/base/big_endian.h +++ b/base/big_endian.h @@ -5,8 +5,10 @@ #ifndef BASE_BIG_ENDIAN_H_ #define BASE_BIG_ENDIAN_H_ +#include <stddef.h> +#include <stdint.h> + #include "base/base_export.h" -#include "base/basictypes.h" #include "base/strings/string_piece.h" namespace base { @@ -21,8 +23,8 @@ inline void ReadBigEndian(const char buf[], T* out) { *out = buf[0]; for (size_t i = 1; i < sizeof(T); ++i) { *out <<= 8; - // Must cast to uint8 to avoid clobbering by sign extension. - *out |= static_cast<uint8>(buf[i]); + // Must cast to uint8_t to avoid clobbering by sign extension. + *out |= static_cast<uint8_t>(buf[i]); } } @@ -37,13 +39,13 @@ inline void WriteBigEndian(char buf[], T val) { } // Specializations to make clang happy about the (dead code) shifts above. -template<> -inline void ReadBigEndian<uint8>(const char buf[], uint8* out) { +template <> +inline void ReadBigEndian<uint8_t>(const char buf[], uint8_t* out) { *out = buf[0]; } -template<> -inline void WriteBigEndian<uint8>(char buf[], uint8 val) { +template <> +inline void WriteBigEndian<uint8_t>(char buf[], uint8_t val) { buf[0] = static_cast<char>(val); } @@ -60,10 +62,10 @@ class BASE_EXPORT BigEndianReader { bool ReadBytes(void* out, size_t len); // Creates a StringPiece in |out| that points to the underlying buffer. bool ReadPiece(base::StringPiece* out, size_t len); - bool ReadU8(uint8* value); - bool ReadU16(uint16* value); - bool ReadU32(uint32* value); - bool ReadU64(uint64* value); + bool ReadU8(uint8_t* value); + bool ReadU16(uint16_t* value); + bool ReadU32(uint32_t* value); + bool ReadU64(uint64_t* value); private: // Hidden to promote type safety. @@ -85,10 +87,10 @@ class BASE_EXPORT BigEndianWriter { bool Skip(size_t len); bool WriteBytes(const void* buf, size_t len); - bool WriteU8(uint8 value); - bool WriteU16(uint16 value); - bool WriteU32(uint32 value); - bool WriteU64(uint64 value); + bool WriteU8(uint8_t value); + bool WriteU16(uint16_t value); + bool WriteU32(uint32_t value); + bool WriteU64(uint64_t value); private: // Hidden to promote type safety. diff --git a/base/big_endian_unittest.cc b/base/big_endian_unittest.cc index 0e4b3f1..4e1e7ce 100644 --- a/base/big_endian_unittest.cc +++ b/base/big_endian_unittest.cc @@ -4,6 +4,8 @@ #include "base/big_endian.h" +#include <stdint.h> + #include "base/strings/string_piece.h" #include "testing/gtest/include/gtest/gtest.h" @@ -13,10 +15,10 @@ TEST(BigEndianReaderTest, ReadsValues) { char data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xA, 0xB, 0xC, 0xD, 0xE, 0xF, 0x1A, 0x2B, 0x3C, 0x4D, 0x5E }; char buf[2]; - uint8 u8; - uint16 u16; - uint32 u32; - uint64 u64; + uint8_t u8; + uint16_t u16; + uint32_t u32; + uint64_t u64; base::StringPiece piece; BigEndianReader reader(data, sizeof(data)); @@ -43,10 +45,10 @@ TEST(BigEndianReaderTest, ReadsValues) { TEST(BigEndianReaderTest, RespectsLength) { char data[8]; char buf[2]; - uint8 u8; - uint16 u16; - uint32 u32; - uint64 u64; + uint8_t u8; + uint16_t u16; + uint32_t u32; + uint64_t u64; base::StringPiece piece; BigEndianReader reader(data, sizeof(data)); // 8 left @@ -88,10 +90,10 @@ TEST(BigEndianWriterTest, WritesValues) { TEST(BigEndianWriterTest, RespectsLength) { char data[8]; char buf[2]; - uint8 u8 = 0; - uint16 u16 = 0; - uint32 u32 = 0; - uint64 u64 = 0; + uint8_t u8 = 0; + uint16_t u16 = 0; + uint32_t u32 = 0; + uint64_t u64 = 0; BigEndianWriter writer(data, sizeof(data)); // 8 left EXPECT_FALSE(writer.Skip(9)); diff --git a/base/bind_helpers.h b/base/bind_helpers.h index 7995124..2add755 100644 --- a/base/bind_helpers.h +++ b/base/bind_helpers.h @@ -143,13 +143,15 @@ #ifndef BASE_BIND_HELPERS_H_ #define BASE_BIND_HELPERS_H_ +#include <stddef.h> + #include <type_traits> #include <utility> -#include "base/basictypes.h" #include "base/callback.h" #include "base/memory/weak_ptr.h" #include "base/template_util.h" +#include "build/build_config.h" namespace base { namespace internal { diff --git a/base/bind_internal.h b/base/bind_internal.h index 947df15..ac7cd00 100644 --- a/base/bind_internal.h +++ b/base/bind_internal.h @@ -5,6 +5,8 @@ #ifndef BASE_BIND_INTERNAL_H_ #define BASE_BIND_INTERNAL_H_ +#include <stddef.h> + #include <type_traits> #include "base/bind_helpers.h" diff --git a/base/bind_internal_win.h b/base/bind_internal_win.h index 42fbf23..2ee12ef 100644 --- a/base/bind_internal_win.h +++ b/base/bind_internal_win.h @@ -8,6 +8,8 @@ #ifndef BASE_BIND_INTERNAL_WIN_H_ #define BASE_BIND_INTERNAL_WIN_H_ +#include "build/build_config.h" + // In the x64 architecture in Windows, __fastcall, __stdcall, etc, are all // the same as __cdecl which would turn the following specializations into // multiple definitions. diff --git a/base/bind_unittest.cc b/base/bind_unittest.cc index 32c2c4a..7850ea6 100644 --- a/base/bind_unittest.cc +++ b/base/bind_unittest.cc @@ -8,9 +8,11 @@ #include <utility> #include "base/callback.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" +#include "build/build_config.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/base/bind_unittest.nc b/base/bind_unittest.nc index 10d2c80..9569be476 100644 --- a/base/bind_unittest.nc +++ b/base/bind_unittest.nc @@ -5,8 +5,9 @@ // This is a "No Compile Test" suite. // http://dev.chromium.org/developers/testing/no-compile-tests -#include "base/callback.h" #include "base/bind.h" +#include "base/callback.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" namespace base { diff --git a/base/bits.h b/base/bits.h index 505d2c8..a3a59d1 100644 --- a/base/bits.h +++ b/base/bits.h @@ -7,21 +7,23 @@ #ifndef BASE_BITS_H_ #define BASE_BITS_H_ -#include "base/basictypes.h" +#include <stddef.h> +#include <stdint.h> + #include "base/logging.h" namespace base { namespace bits { // Returns the integer i such as 2^i <= n < 2^(i+1) -inline int Log2Floor(uint32 n) { +inline int Log2Floor(uint32_t n) { if (n == 0) return -1; int log = 0; - uint32 value = n; + uint32_t value = n; for (int i = 4; i >= 0; --i) { int shift = (1 << i); - uint32 x = value >> shift; + uint32_t x = value >> shift; if (x != 0) { value = x; log += shift; @@ -32,7 +34,7 @@ inline int Log2Floor(uint32 n) { } // Returns the integer i such as 2^(i-1) < n <= 2^i -inline int Log2Ceiling(uint32 n) { +inline int Log2Ceiling(uint32_t n) { if (n == 0) { return -1; } else { diff --git a/base/bits_unittest.cc b/base/bits_unittest.cc index 1dad0f4..4f5b6ea4 100644 --- a/base/bits_unittest.cc +++ b/base/bits_unittest.cc @@ -6,6 +6,8 @@ #include "base/bits.h" +#include <stddef.h> + #include <limits> #include "testing/gtest/include/gtest/gtest.h" diff --git a/base/callback_helpers.h b/base/callback_helpers.h index 8481e3e..8608039 100644 --- a/base/callback_helpers.h +++ b/base/callback_helpers.h @@ -14,9 +14,9 @@ #ifndef BASE_CALLBACK_HELPERS_H_ #define BASE_CALLBACK_HELPERS_H_ -#include "base/basictypes.h" #include "base/callback.h" #include "base/compiler_specific.h" +#include "base/macros.h" namespace base { diff --git a/base/callback_list.h b/base/callback_list.h index 5f263f8..7d6a478 100644 --- a/base/callback_list.h +++ b/base/callback_list.h @@ -7,11 +7,11 @@ #include <list> -#include "base/basictypes.h" #include "base/callback.h" #include "base/callback_internal.h" #include "base/compiler_specific.h" #include "base/logging.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" // OVERVIEW: diff --git a/base/callback_list_unittest.cc b/base/callback_list_unittest.cc index 71e781c..010efc5 100644 --- a/base/callback_list_unittest.cc +++ b/base/callback_list_unittest.cc @@ -6,9 +6,9 @@ #include <utility> -#include "base/basictypes.h" #include "base/bind.h" #include "base/bind_helpers.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/base/callback_list_unittest.nc b/base/callback_list_unittest.nc index 0704c8d..fd83d02 100644 --- a/base/callback_list_unittest.nc +++ b/base/callback_list_unittest.nc @@ -10,6 +10,7 @@ #include "base/basictypes.h" #include "base/bind.h" #include "base/bind_helpers.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" namespace base { diff --git a/base/cancelable_callback.h b/base/cancelable_callback.h index 2b9d260..47dfb2d 100644 --- a/base/cancelable_callback.h +++ b/base/cancelable_callback.h @@ -48,6 +48,7 @@ #include "base/callback_internal.h" #include "base/compiler_specific.h" #include "base/logging.h" +#include "base/macros.h" #include "base/memory/weak_ptr.h" namespace base { diff --git a/base/command_line.cc b/base/command_line.cc index e2dde1c..c991959 100644 --- a/base/command_line.cc +++ b/base/command_line.cc @@ -7,9 +7,9 @@ #include <algorithm> #include <ostream> -#include "base/basictypes.h" #include "base/files/file_path.h" #include "base/logging.h" +#include "base/macros.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" diff --git a/base/command_line_unittest.cc b/base/command_line_unittest.cc index ac8a395..967ce1c 100644 --- a/base/command_line_unittest.cc +++ b/base/command_line_unittest.cc @@ -5,11 +5,12 @@ #include <string> #include <vector> -#include "base/basictypes.h" #include "base/command_line.h" #include "base/files/file_path.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/strings/utf_string_conversions.h" +#include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" namespace base { diff --git a/base/compiler_specific.h b/base/compiler_specific.h index 8de949d..339e9b7 100644 --- a/base/compiler_specific.h +++ b/base/compiler_specific.h @@ -112,7 +112,7 @@ // Return the byte alignment of the given type (available at compile time). // Use like: -// ALIGNOF(int32) // this would be 4 +// ALIGNOF(int32_t) // this would be 4 #if defined(COMPILER_MSVC) #define ALIGNOF(type) __alignof(type) #elif defined(COMPILER_GCC) diff --git a/base/containers/hash_tables.h b/base/containers/hash_tables.h index a1244f7..c421ddd 100644 --- a/base/containers/hash_tables.h +++ b/base/containers/hash_tables.h @@ -21,9 +21,11 @@ #ifndef BASE_CONTAINERS_HASH_TABLES_H_ #define BASE_CONTAINERS_HASH_TABLES_H_ +#include <stddef.h> +#include <stdint.h> + #include <utility> -#include "base/basictypes.h" #include "base/strings/string16.h" #include "build/build_config.h" @@ -196,19 +198,19 @@ using hash_set = BASE_HASH_IMPL_NAMESPACE::hash_set<Key, Hash, Pred, Alloc>; // h32(x32, y32) = (h64(x32, y32) * rand_odd64 + rand16 * 2^16) % 2^64 / 2^32 // // Contact danakj@chromium.org for any questions. -inline std::size_t HashInts32(uint32 value1, uint32 value2) { - uint64 value1_64 = value1; - uint64 hash64 = (value1_64 << 32) | value2; +inline std::size_t HashInts32(uint32_t value1, uint32_t value2) { + uint64_t value1_64 = value1; + uint64_t hash64 = (value1_64 << 32) | value2; - if (sizeof(std::size_t) >= sizeof(uint64)) + if (sizeof(std::size_t) >= sizeof(uint64_t)) return static_cast<std::size_t>(hash64); - uint64 odd_random = 481046412LL << 32 | 1025306955LL; - uint32 shift_random = 10121U << 16; + uint64_t odd_random = 481046412LL << 32 | 1025306955LL; + uint32_t shift_random = 10121U << 16; hash64 = hash64 * odd_random + shift_random; std::size_t high_bits = static_cast<std::size_t>( - hash64 >> (8 * (sizeof(uint64) - sizeof(std::size_t)))); + hash64 >> (8 * (sizeof(uint64_t) - sizeof(std::size_t)))); return high_bits; } @@ -217,33 +219,33 @@ inline std::size_t HashInts32(uint32 value1, uint32 value2) { // breaking the two 64-bit inputs into 4 32-bit values: // http://opendatastructures.org/versions/edition-0.1d/ods-java/node33.html#SECTION00832000000000000000 // Then we reduce our result to 32 bits if required, similar to above. -inline std::size_t HashInts64(uint64 value1, uint64 value2) { - uint32 short_random1 = 842304669U; - uint32 short_random2 = 619063811U; - uint32 short_random3 = 937041849U; - uint32 short_random4 = 3309708029U; +inline std::size_t HashInts64(uint64_t value1, uint64_t value2) { + uint32_t short_random1 = 842304669U; + uint32_t short_random2 = 619063811U; + uint32_t short_random3 = 937041849U; + uint32_t short_random4 = 3309708029U; - uint32 value1a = static_cast<uint32>(value1 & 0xffffffff); - uint32 value1b = static_cast<uint32>((value1 >> 32) & 0xffffffff); - uint32 value2a = static_cast<uint32>(value2 & 0xffffffff); - uint32 value2b = static_cast<uint32>((value2 >> 32) & 0xffffffff); + uint32_t value1a = static_cast<uint32_t>(value1 & 0xffffffff); + uint32_t value1b = static_cast<uint32_t>((value1 >> 32) & 0xffffffff); + uint32_t value2a = static_cast<uint32_t>(value2 & 0xffffffff); + uint32_t value2b = static_cast<uint32_t>((value2 >> 32) & 0xffffffff); - uint64 product1 = static_cast<uint64>(value1a) * short_random1; - uint64 product2 = static_cast<uint64>(value1b) * short_random2; - uint64 product3 = static_cast<uint64>(value2a) * short_random3; - uint64 product4 = static_cast<uint64>(value2b) * short_random4; + uint64_t product1 = static_cast<uint64_t>(value1a) * short_random1; + uint64_t product2 = static_cast<uint64_t>(value1b) * short_random2; + uint64_t product3 = static_cast<uint64_t>(value2a) * short_random3; + uint64_t product4 = static_cast<uint64_t>(value2b) * short_random4; - uint64 hash64 = product1 + product2 + product3 + product4; + uint64_t hash64 = product1 + product2 + product3 + product4; - if (sizeof(std::size_t) >= sizeof(uint64)) + if (sizeof(std::size_t) >= sizeof(uint64_t)) return static_cast<std::size_t>(hash64); - uint64 odd_random = 1578233944LL << 32 | 194370989LL; - uint32 shift_random = 20591U << 16; + uint64_t odd_random = 1578233944LL << 32 | 194370989LL; + uint32_t shift_random = 20591U << 16; hash64 = hash64 * odd_random + shift_random; std::size_t high_bits = static_cast<std::size_t>( - hash64 >> (8 * (sizeof(uint64) - sizeof(std::size_t)))); + hash64 >> (8 * (sizeof(uint64_t) - sizeof(std::size_t)))); return high_bits; } diff --git a/base/containers/hash_tables_unittest.cc b/base/containers/hash_tables_unittest.cc index f775dff..6072e5d 100644 --- a/base/containers/hash_tables_unittest.cc +++ b/base/containers/hash_tables_unittest.cc @@ -7,7 +7,6 @@ #include <stdint.h> #include <string> -#include "base/basictypes.h" #include "testing/gtest/include/gtest/gtest.h" namespace { @@ -25,27 +24,27 @@ class HashPairTest : public testing::Test { // Verify that a hash_map can be constructed for pairs of integers of various // sizes. TEST_F(HashPairTest, IntegerPairs) { - typedef std::pair<int16, int16> Int16Int16Pair; - typedef std::pair<int16, int32> Int16Int32Pair; - typedef std::pair<int16, int64> Int16Int64Pair; + typedef std::pair<int16_t, int16_t> Int16Int16Pair; + typedef std::pair<int16_t, int32_t> Int16Int32Pair; + typedef std::pair<int16_t, int64_t> Int16Int64Pair; INSERT_PAIR_TEST(Int16Int16Pair, 4, 6); INSERT_PAIR_TEST(Int16Int32Pair, 9, (1 << 29) + 378128932); INSERT_PAIR_TEST(Int16Int64Pair, 10, (INT64_C(1) << 60) + INT64_C(78931732321)); - typedef std::pair<int32, int16> Int32Int16Pair; - typedef std::pair<int32, int32> Int32Int32Pair; - typedef std::pair<int32, int64> Int32Int64Pair; + typedef std::pair<int32_t, int16_t> Int32Int16Pair; + typedef std::pair<int32_t, int32_t> Int32Int32Pair; + typedef std::pair<int32_t, int64_t> Int32Int64Pair; INSERT_PAIR_TEST(Int32Int16Pair, 4, 6); INSERT_PAIR_TEST(Int32Int32Pair, 9, (1 << 29) + 378128932); INSERT_PAIR_TEST(Int32Int64Pair, 10, (INT64_C(1) << 60) + INT64_C(78931732321)); - typedef std::pair<int64, int16> Int64Int16Pair; - typedef std::pair<int64, int32> Int64Int32Pair; - typedef std::pair<int64, int64> Int64Int64Pair; + typedef std::pair<int64_t, int16_t> Int64Int16Pair; + typedef std::pair<int64_t, int32_t> Int64Int32Pair; + typedef std::pair<int64_t, int64_t> Int64Int64Pair; INSERT_PAIR_TEST(Int64Int16Pair, 4, 6); INSERT_PAIR_TEST(Int64Int32Pair, 9, (1 << 29) + 378128932); diff --git a/base/containers/linked_list_unittest.cc b/base/containers/linked_list_unittest.cc index 93a9f38..f4ecc71 100644 --- a/base/containers/linked_list_unittest.cc +++ b/base/containers/linked_list_unittest.cc @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/basictypes.h" #include "base/containers/linked_list.h" +#include "base/macros.h" #include "testing/gtest/include/gtest/gtest.h" namespace base { diff --git a/base/containers/mru_cache.h b/base/containers/mru_cache.h index 4bacf68..272a773 100644 --- a/base/containers/mru_cache.h +++ b/base/containers/mru_cache.h @@ -16,14 +16,16 @@ #ifndef BASE_CONTAINERS_MRU_CACHE_H_ #define BASE_CONTAINERS_MRU_CACHE_H_ +#include <stddef.h> + #include <algorithm> #include <list> #include <map> #include <utility> -#include "base/basictypes.h" #include "base/containers/hash_tables.h" #include "base/logging.h" +#include "base/macros.h" namespace base { diff --git a/base/containers/mru_cache_unittest.cc b/base/containers/mru_cache_unittest.cc index d412381..8ebecdb 100644 --- a/base/containers/mru_cache_unittest.cc +++ b/base/containers/mru_cache_unittest.cc @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/basictypes.h" +#include <stddef.h> + #include "base/containers/mru_cache.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/base/containers/scoped_ptr_hash_map.h b/base/containers/scoped_ptr_hash_map.h index bc635f4..189c314 100644 --- a/base/containers/scoped_ptr_hash_map.h +++ b/base/containers/scoped_ptr_hash_map.h @@ -5,12 +5,14 @@ #ifndef BASE_CONTAINERS_SCOPED_PTR_HASH_MAP_H_ #define BASE_CONTAINERS_SCOPED_PTR_HASH_MAP_H_ +#include <stddef.h> + #include <algorithm> #include <utility> -#include "base/basictypes.h" #include "base/containers/hash_tables.h" #include "base/logging.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/stl_util.h" diff --git a/base/containers/small_map.h b/base/containers/small_map.h index 8ae4219..427736c 100644 --- a/base/containers/small_map.h +++ b/base/containers/small_map.h @@ -5,11 +5,12 @@ #ifndef BASE_CONTAINERS_SMALL_MAP_H_ #define BASE_CONTAINERS_SMALL_MAP_H_ +#include <stddef.h> + #include <map> #include <string> #include <utility> -#include "base/basictypes.h" #include "base/containers/hash_tables.h" #include "base/logging.h" #include "base/memory/manual_constructor.h" diff --git a/base/containers/stack_container.h b/base/containers/stack_container.h index 2c7dd65..9e0efc1 100644 --- a/base/containers/stack_container.h +++ b/base/containers/stack_container.h @@ -5,10 +5,12 @@ #ifndef BASE_CONTAINERS_STACK_CONTAINER_H_ #define BASE_CONTAINERS_STACK_CONTAINER_H_ +#include <stddef.h> + #include <string> #include <vector> -#include "base/basictypes.h" +#include "base/macros.h" #include "base/memory/aligned_memory.h" #include "base/strings/string16.h" #include "build/build_config.h" diff --git a/base/containers/stack_container_unittest.cc b/base/containers/stack_container_unittest.cc index e6c1914..05c733a 100644 --- a/base/containers/stack_container_unittest.cc +++ b/base/containers/stack_container_unittest.cc @@ -4,10 +4,13 @@ #include "base/containers/stack_container.h" +#include <stddef.h> + #include <algorithm> #include "base/memory/aligned_memory.h" #include "base/memory/ref_counted.h" +#include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" namespace base { diff --git a/base/cpu.cc b/base/cpu.cc index ecffb86..7135445 100644 --- a/base/cpu.cc +++ b/base/cpu.cc @@ -4,12 +4,15 @@ #include "base/cpu.h" +#include <limits.h> +#include <stddef.h> +#include <stdint.h> #include <stdlib.h> #include <string.h> #include <algorithm> -#include "base/basictypes.h" +#include "base/macros.h" #include "base/strings/string_piece.h" #include "build/build_config.h" @@ -82,12 +85,12 @@ void __cpuid(int cpu_info[4], int info_type) { // _xgetbv returns the value of an Intel Extended Control Register (XCR). // Currently only XCR0 is defined by Intel so |xcr| should always be zero. -uint64 _xgetbv(uint32 xcr) { - uint32 eax, edx; +uint64_t _xgetbv(uint32_t xcr) { + uint32_t eax, edx; __asm__ volatile ( "xgetbv" : "=a"(eax), "=d"(edx) : "c"(xcr)); - return (static_cast<uint64>(edx) << 32) | eax; + return (static_cast<uint64_t>(edx) << 32) | eax; } #endif // !_MSC_VER diff --git a/base/critical_closure.h b/base/critical_closure.h index 75e3704..6ebd7af 100644 --- a/base/critical_closure.h +++ b/base/critical_closure.h @@ -6,6 +6,8 @@ #define BASE_CRITICAL_CLOSURE_H_ #include "base/callback.h" +#include "base/macros.h" +#include "build/build_config.h" #if defined(OS_IOS) #include "base/bind.h" diff --git a/base/deferred_sequenced_task_runner.h b/base/deferred_sequenced_task_runner.h index 110d988..de5c3b9 100644 --- a/base/deferred_sequenced_task_runner.h +++ b/base/deferred_sequenced_task_runner.h @@ -8,9 +8,9 @@ #include <vector> #include "base/base_export.h" -#include "base/basictypes.h" #include "base/callback.h" #include "base/compiler_specific.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/sequenced_task_runner.h" #include "base/synchronization/lock.h" diff --git a/base/deferred_sequenced_task_runner_unittest.cc b/base/deferred_sequenced_task_runner_unittest.cc index 6e17ad9..883a3dd 100644 --- a/base/deferred_sequenced_task_runner_unittest.cc +++ b/base/deferred_sequenced_task_runner_unittest.cc @@ -4,7 +4,6 @@ #include "base/deferred_sequenced_task_runner.h" -#include "base/basictypes.h" #include "base/bind.h" #include "base/bind_helpers.h" #include "base/location.h" diff --git a/base/environment.cc b/base/environment.cc index ca24ac7..adb7387 100644 --- a/base/environment.cc +++ b/base/environment.cc @@ -4,11 +4,14 @@ #include "base/environment.h" +#include <stddef.h> + #include <vector> #include "base/strings/string_piece.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" +#include "build/build_config.h" #if defined(OS_POSIX) #include <stdlib.h> diff --git a/base/environment_unittest.cc b/base/environment_unittest.cc index c955e79..77e9717 100644 --- a/base/environment_unittest.cc +++ b/base/environment_unittest.cc @@ -4,6 +4,7 @@ #include "base/environment.h" #include "base/memory/scoped_ptr.h" +#include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" diff --git a/base/feature_list.cc b/base/feature_list.cc index 104bf08..d10c60b 100644 --- a/base/feature_list.cc +++ b/base/feature_list.cc @@ -4,6 +4,8 @@ #include "base/feature_list.h" +#include <stddef.h> + #include <utility> #include <vector> diff --git a/base/feature_list.h b/base/feature_list.h index 3967263..875d3b5 100644 --- a/base/feature_list.h +++ b/base/feature_list.h @@ -10,8 +10,8 @@ #include <vector> #include "base/base_export.h" -#include "base/basictypes.h" #include "base/gtest_prod_util.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/strings/string_piece.h" #include "base/synchronization/lock.h" diff --git a/base/feature_list_unittest.cc b/base/feature_list_unittest.cc index 29c1f16..edd656e 100644 --- a/base/feature_list_unittest.cc +++ b/base/feature_list_unittest.cc @@ -4,9 +4,12 @@ #include "base/feature_list.h" +#include <stddef.h> + #include <utility> #include "base/format_macros.h" +#include "base/macros.h" #include "base/metrics/field_trial.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" diff --git a/base/file_version_info_mac.h b/base/file_version_info_mac.h index e677838..9cc4b10 100644 --- a/base/file_version_info_mac.h +++ b/base/file_version_info_mac.h @@ -10,6 +10,7 @@ #include "base/file_version_info.h" #include "base/mac/scoped_nsobject.h" +#include "base/macros.h" @class NSBundle; diff --git a/base/file_version_info_mac.mm b/base/file_version_info_mac.mm index 8542b19..ce42924 100644 --- a/base/file_version_info_mac.mm +++ b/base/file_version_info_mac.mm @@ -11,6 +11,7 @@ #include "base/mac/bundle_locations.h" #include "base/mac/foundation_util.h" #include "base/strings/sys_string_conversions.h" +#include "build/build_config.h" FileVersionInfoMac::FileVersionInfoMac(NSBundle *bundle) : bundle_([bundle retain]) { diff --git a/base/file_version_info_unittest.cc b/base/file_version_info_unittest.cc index d4ab954..4c0ba6f 100644 --- a/base/file_version_info_unittest.cc +++ b/base/file_version_info_unittest.cc @@ -2,10 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <stddef.h> + #include "base/file_version_info.h" #include "base/files/file_path.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/path_service.h" +#include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" #if defined(OS_WIN) diff --git a/base/file_version_info_win.cc b/base/file_version_info_win.cc index a7dc216..02a14db 100644 --- a/base/file_version_info_win.cc +++ b/base/file_version_info_win.cc @@ -5,10 +5,13 @@ #include "base/file_version_info_win.h" #include <windows.h> +#include <stddef.h> +#include <stdint.h> #include "base/file_version_info.h" #include "base/files/file_path.h" #include "base/logging.h" +#include "base/macros.h" #include "base/threading/thread_restrictions.h" using base::FilePath; @@ -68,7 +71,7 @@ FileVersionInfo* FileVersionInfo::CreateFileVersionInfo( } LanguageAndCodePage* translate = NULL; - uint32 page_count; + uint32_t page_count; BOOL query_result = VerQueryValue(data, L"\\VarFileInfo\\Translation", (void**) &translate, &page_count); @@ -171,7 +174,7 @@ bool FileVersionInfoWin::GetValue(const wchar_t* name, _snwprintf_s(sub_block, MAX_PATH, MAX_PATH, L"\\StringFileInfo\\%04x%04x\\%ls", language, code_page, name); LPVOID value = NULL; - uint32 size; + uint32_t size; BOOL r = ::VerQueryValue(data_.get(), sub_block, &value, &size); if (r && value) { value_str->assign(static_cast<wchar_t*>(value)); diff --git a/base/file_version_info_win.h b/base/file_version_info_win.h index 09d8d37..6dd0202 100644 --- a/base/file_version_info_win.h +++ b/base/file_version_info_win.h @@ -8,8 +8,8 @@ #include <string> #include "base/base_export.h" -#include "base/basictypes.h" #include "base/file_version_info.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" struct tagVS_FIXEDFILEINFO; diff --git a/base/format_macros.h b/base/format_macros.h index d58658d..0697c6d 100644 --- a/base/format_macros.h +++ b/base/format_macros.h @@ -21,6 +21,9 @@ // printf("xyz: %" PRIuS, size); // The "u" in the macro corresponds to %u, and S is for "size". +#include <stddef.h> +#include <stdint.h> + #include "build/build_config.h" #if defined(OS_POSIX) && (defined(_INTTYPES_H) || defined(_INTTYPES_H_)) && \ diff --git a/base/guid.cc b/base/guid.cc index be5c58b..99b037b 100644 --- a/base/guid.cc +++ b/base/guid.cc @@ -4,6 +4,8 @@ #include "base/guid.h" +#include <stddef.h> + #include "base/strings/string_util.h" namespace base { diff --git a/base/guid.h b/base/guid.h index abcc589..c0a06f8 100644 --- a/base/guid.h +++ b/base/guid.h @@ -5,10 +5,11 @@ #ifndef BASE_GUID_H_ #define BASE_GUID_H_ +#include <stdint.h> + #include <string> #include "base/base_export.h" -#include "base/basictypes.h" #include "build/build_config.h" namespace base { @@ -24,7 +25,7 @@ BASE_EXPORT bool IsValidGUID(const std::string& guid); #if defined(OS_POSIX) // For unit testing purposes only. Do not use outside of tests. -BASE_EXPORT std::string RandomDataToGUIDString(const uint64 bytes[2]); +BASE_EXPORT std::string RandomDataToGUIDString(const uint64_t bytes[2]); #endif } // namespace base diff --git a/base/guid_posix.cc b/base/guid_posix.cc index f0fedc2..ec1ca51 100644 --- a/base/guid_posix.cc +++ b/base/guid_posix.cc @@ -4,13 +4,15 @@ #include "base/guid.h" +#include <stdint.h> + #include "base/rand_util.h" #include "base/strings/stringprintf.h" namespace base { std::string GenerateGUID() { - uint64 sixteen_bytes[2] = { base::RandUint64(), base::RandUint64() }; + uint64_t sixteen_bytes[2] = {base::RandUint64(), base::RandUint64()}; // Set the GUID to version 4 as described in RFC 4122, section 4.4. // The format of GUID version 4 must be xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx, @@ -30,7 +32,7 @@ std::string GenerateGUID() { // TODO(cmasone): Once we're comfortable this works, migrate Windows code to // use this as well. -std::string RandomDataToGUIDString(const uint64 bytes[2]) { +std::string RandomDataToGUIDString(const uint64_t bytes[2]) { return StringPrintf("%08X-%04X-%04X-%04X-%012llX", static_cast<unsigned int>(bytes[0] >> 32), static_cast<unsigned int>((bytes[0] >> 16) & 0x0000ffff), diff --git a/base/guid_unittest.cc b/base/guid_unittest.cc index 1c5d393..b6d976d 100644 --- a/base/guid_unittest.cc +++ b/base/guid_unittest.cc @@ -4,9 +4,12 @@ #include "base/guid.h" +#include <stdint.h> + #include <limits> #include "base/strings/string_util.h" +#include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" namespace base { @@ -26,13 +29,13 @@ bool IsGUIDv4(const std::string& guid) { } // namespace TEST(GUIDTest, GUIDGeneratesAllZeroes) { - uint64 bytes[] = { 0, 0 }; + uint64_t bytes[] = {0, 0}; std::string clientid = RandomDataToGUIDString(bytes); EXPECT_EQ("00000000-0000-0000-0000-000000000000", clientid); } TEST(GUIDTest, GUIDGeneratesCorrectly) { - uint64 bytes[] = { 0x0123456789ABCDEFULL, 0xFEDCBA9876543210ULL }; + uint64_t bytes[] = {0x0123456789ABCDEFULL, 0xFEDCBA9876543210ULL}; std::string clientid = RandomDataToGUIDString(bytes); EXPECT_EQ("01234567-89AB-CDEF-FEDC-BA9876543210", clientid); } diff --git a/base/guid_win.cc b/base/guid_win.cc index da3453d..1e84d78 100644 --- a/base/guid_win.cc +++ b/base/guid_win.cc @@ -9,7 +9,6 @@ #include <objbase.h> #include <windows.h> -#include "base/basictypes.h" #include "base/logging.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" diff --git a/base/hash.cc b/base/hash.cc index a7db64a..d3206f6 100644 --- a/base/hash.cc +++ b/base/hash.cc @@ -11,7 +11,7 @@ extern "C" uint32_t SuperFastHash(const char* data, int len); namespace base { -uint32 SuperFastHash(const char* data, int len) { +uint32_t SuperFastHash(const char* data, int len) { return ::SuperFastHash(data, len); } diff --git a/base/hash.h b/base/hash.h index e46f6ac..ed8d9fd 100644 --- a/base/hash.h +++ b/base/hash.h @@ -5,21 +5,23 @@ #ifndef BASE_HASH_H_ #define BASE_HASH_H_ +#include <stddef.h> +#include <stdint.h> + #include <limits> #include <string> #include "base/base_export.h" -#include "base/basictypes.h" #include "base/logging.h" namespace base { // WARNING: This hash function should not be used for any cryptographic purpose. -BASE_EXPORT uint32 SuperFastHash(const char* data, int len); +BASE_EXPORT uint32_t SuperFastHash(const char* data, int len); // Computes a hash of a memory buffer |data| of a given |length|. // WARNING: This hash function should not be used for any cryptographic purpose. -inline uint32 Hash(const char* data, size_t length) { +inline uint32_t Hash(const char* data, size_t length) { if (length > static_cast<size_t>(std::numeric_limits<int>::max())) { NOTREACHED(); return 0; @@ -29,7 +31,7 @@ inline uint32 Hash(const char* data, size_t length) { // Computes a hash of a string |str|. // WARNING: This hash function should not be used for any cryptographic purpose. -inline uint32 Hash(const std::string& str) { +inline uint32_t Hash(const std::string& str) { return Hash(str.data(), str.size()); } diff --git a/base/id_map.h b/base/id_map.h index b04bcdd..15c6662 100644 --- a/base/id_map.h +++ b/base/id_map.h @@ -5,11 +5,13 @@ #ifndef BASE_ID_MAP_H_ #define BASE_ID_MAP_H_ +#include <stddef.h> #include <stdint.h> #include <set> #include "base/containers/hash_tables.h" #include "base/logging.h" +#include "base/macros.h" #include "base/sequence_checker.h" // Ownership semantics - own pointer means the pointer is deleted in Remove() diff --git a/base/id_map_unittest.cc b/base/id_map_unittest.cc index 2cd6309..7a07a28 100644 --- a/base/id_map_unittest.cc +++ b/base/id_map_unittest.cc @@ -4,6 +4,8 @@ #include "base/id_map.h" +#include <stdint.h> + #include "testing/gtest/include/gtest/gtest.h" namespace { @@ -28,12 +30,12 @@ TEST(IDMapTest, Basic) { TestObject obj1; TestObject obj2; - int32 id1 = map.Add(&obj1); + int32_t id1 = map.Add(&obj1); EXPECT_FALSE(map.IsEmpty()); EXPECT_EQ(1U, map.size()); EXPECT_EQ(&obj1, map.Lookup(id1)); - int32 id2 = map.Add(&obj2); + int32_t id2 = map.Add(&obj2); EXPECT_FALSE(map.IsEmpty()); EXPECT_EQ(2U, map.size()); @@ -102,7 +104,7 @@ TEST(IDMapTest, IteratorRemainsValidWhenRemovingOtherElements) { map.Add(&obj[i]); // IDMap uses a hash_map, which has no predictable iteration order. - int32 ids_in_iteration_order[kCount]; + int32_t ids_in_iteration_order[kCount]; const TestObject* objs_in_iteration_order[kCount]; int counter = 0; for (IDMap<TestObject>::const_iterator iter(&map); @@ -212,7 +214,7 @@ TEST(IDMapTest, IteratorRemainsValidWhenClearing) { map.Add(&obj[i]); // IDMap uses a hash_map, which has no predictable iteration order. - int32 ids_in_iteration_order[kCount]; + int32_t ids_in_iteration_order[kCount]; const TestObject* objs_in_iteration_order[kCount]; int counter = 0; for (IDMap<TestObject>::const_iterator iter(&map); diff --git a/base/ios/crb_protocol_observers.mm b/base/ios/crb_protocol_observers.mm index 4302fd4..8c4172a 100644 --- a/base/ios/crb_protocol_observers.mm +++ b/base/ios/crb_protocol_observers.mm @@ -5,6 +5,7 @@ #import "base/ios/crb_protocol_observers.h" #include <objc/runtime.h> +#include <stddef.h> #include <algorithm> #include <vector> diff --git a/base/ios/device_util.h b/base/ios/device_util.h index 1cd9a04..b1bed5c 100644 --- a/base/ios/device_util.h +++ b/base/ios/device_util.h @@ -5,6 +5,8 @@ #ifndef BASE_IOS_DEVICE_UTIL_H_ #define BASE_IOS_DEVICE_UTIL_H_ +#include <stdint.h> + #include <string> namespace ios { diff --git a/base/ios/device_util.mm b/base/ios/device_util.mm index 4af8234..44e7c6c 100644 --- a/base/ios/device_util.mm +++ b/base/ios/device_util.mm @@ -9,6 +9,7 @@ #include <ifaddrs.h> #include <net/if_dl.h> +#include <stddef.h> #include <string.h> #include <sys/socket.h> #include <sys/sysctl.h> diff --git a/base/ios/ios_util.h b/base/ios/ios_util.h index 9f65339..e677adc 100644 --- a/base/ios/ios_util.h +++ b/base/ios/ios_util.h @@ -5,8 +5,9 @@ #ifndef BASE_IOS_IOS_UTIL_H_ #define BASE_IOS_IOS_UTIL_H_ +#include <stdint.h> + #include "base/base_export.h" -#include "base/basictypes.h" namespace base { namespace ios { @@ -18,7 +19,9 @@ BASE_EXPORT bool IsRunningOnIOS8OrLater(); BASE_EXPORT bool IsRunningOnIOS9OrLater(); // Returns whether the operating system is at the given version or later. -BASE_EXPORT bool IsRunningOnOrLater(int32 major, int32 minor, int32 bug_fix); +BASE_EXPORT bool IsRunningOnOrLater(int32_t major, + int32_t minor, + int32_t bug_fix); // Returns whether iOS is signalling that an RTL text direction should be used // regardless of the current locale. This should not return true if the current diff --git a/base/ios/ios_util.mm b/base/ios/ios_util.mm index 554a202..627fb40 100644 --- a/base/ios/ios_util.mm +++ b/base/ios/ios_util.mm @@ -5,14 +5,16 @@ #include "base/ios/ios_util.h" #import <Foundation/Foundation.h> +#include <stddef.h> +#include "base/macros.h" #include "base/sys_info.h" namespace { // Return a 3 elements array containing the major, minor and bug fix version of // the OS. -const int32* OSVersionAsArray() { - int32* digits = new int32[3]; +const int32_t* OSVersionAsArray() { + int32_t* digits = new int32_t[3]; base::SysInfo::OperatingSystemVersionNumbers( &digits[0], &digits[1], &digits[2]); return digits; @@ -31,9 +33,9 @@ bool IsRunningOnIOS9OrLater() { return IsRunningOnOrLater(9, 0, 0); } -bool IsRunningOnOrLater(int32 major, int32 minor, int32 bug_fix) { - static const int32* current_version = OSVersionAsArray(); - int32 version[] = { major, minor, bug_fix }; +bool IsRunningOnOrLater(int32_t major, int32_t minor, int32_t bug_fix) { + static const int32_t* current_version = OSVersionAsArray(); + int32_t version[] = {major, minor, bug_fix}; for (size_t i = 0; i < arraysize(version); i++) { if (current_version[i] != version[i]) return current_version[i] > version[i]; diff --git a/base/ios/scoped_critical_action.h b/base/ios/scoped_critical_action.h index 803d587..61c471e 100644 --- a/base/ios/scoped_critical_action.h +++ b/base/ios/scoped_critical_action.h @@ -5,6 +5,7 @@ #ifndef BASE_IOS_SCOPED_CRITICAL_ACTION_H_ #define BASE_IOS_SCOPED_CRITICAL_ACTION_H_ +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/synchronization/lock.h" diff --git a/base/ios/weak_nsobject.h b/base/ios/weak_nsobject.h index fc3a7c3..136e430 100644 --- a/base/ios/weak_nsobject.h +++ b/base/ios/weak_nsobject.h @@ -8,7 +8,6 @@ #import <Foundation/Foundation.h> #import <objc/runtime.h> -#include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/logging.h" #include "base/memory/ref_counted.h" diff --git a/base/ios/weak_nsobject_unittest.mm b/base/ios/weak_nsobject_unittest.mm index 81de993..f7abfa1 100644 --- a/base/ios/weak_nsobject_unittest.mm +++ b/base/ios/weak_nsobject_unittest.mm @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/basictypes.h" #include "base/bind.h" #include "base/ios/weak_nsobject.h" #include "base/mac/scoped_nsobject.h" diff --git a/base/json/json_file_value_serializer.cc b/base/json/json_file_value_serializer.cc index 9862703..516f876 100644 --- a/base/json/json_file_value_serializer.cc +++ b/base/json/json_file_value_serializer.cc @@ -7,6 +7,7 @@ #include "base/files/file_util.h" #include "base/json/json_string_value_serializer.h" #include "base/logging.h" +#include "build/build_config.h" using base::FilePath; diff --git a/base/json/json_file_value_serializer.h b/base/json/json_file_value_serializer.h index 4e5e09c..f6b4e5f 100644 --- a/base/json/json_file_value_serializer.h +++ b/base/json/json_file_value_serializer.h @@ -5,11 +5,13 @@ #ifndef BASE_JSON_JSON_FILE_VALUE_SERIALIZER_H_ #define BASE_JSON_JSON_FILE_VALUE_SERIALIZER_H_ +#include <stddef.h> + #include <string> #include "base/base_export.h" -#include "base/basictypes.h" #include "base/files/file_path.h" +#include "base/macros.h" #include "base/values.h" class BASE_EXPORT JSONFileValueSerializer : public base::ValueSerializer { diff --git a/base/json/json_parser.cc b/base/json/json_parser.cc index 9be690a..3229275 100644 --- a/base/json/json_parser.cc +++ b/base/json/json_parser.cc @@ -7,6 +7,7 @@ #include <cmath> #include "base/logging.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_piece.h" @@ -24,7 +25,7 @@ namespace { const int kStackMaxDepth = 100; -const int32 kExtendedASCIIStart = 0x80; +const int32_t kExtendedASCIIStart = 0x80; // This and the class below are used to own the JSON input string for when // string tokens are stored as StringPiece instead of std::string. This @@ -227,9 +228,9 @@ Value* JSONParser::Parse(const StringPiece& input) { // <0xEF 0xBB 0xBF>, advance the start position to avoid the // ParseNextToken function mis-treating a Unicode BOM as an invalid // character and returning NULL. - if (CanConsume(3) && static_cast<uint8>(*pos_) == 0xEF && - static_cast<uint8>(*(pos_ + 1)) == 0xBB && - static_cast<uint8>(*(pos_ + 2)) == 0xBF) { + if (CanConsume(3) && static_cast<uint8_t>(*pos_) == 0xEF && + static_cast<uint8_t>(*(pos_ + 1)) == 0xBB && + static_cast<uint8_t>(*(pos_ + 2)) == 0xBF) { NextNChars(3); } @@ -613,7 +614,7 @@ bool JSONParser::ConsumeStringRaw(StringBuilder* out) { StringBuilder string(NextChar()); int length = end_pos_ - start_pos_; - int32 next_char = 0; + int32_t next_char = 0; while (CanConsume(1)) { pos_ = start_pos_ + index_; // CBU8_NEXT is postcrement. @@ -774,8 +775,8 @@ bool JSONParser::DecodeUTF16(std::string* dest_string) { return false; } - uint32 code_point = CBU16_GET_SUPPLEMENTARY(code_unit16_high, - code_unit16_low); + uint32_t code_point = + CBU16_GET_SUPPLEMENTARY(code_unit16_high, code_unit16_low); if (!IsValidCharacter(code_point)) return false; @@ -794,11 +795,11 @@ bool JSONParser::DecodeUTF16(std::string* dest_string) { return true; } -void JSONParser::DecodeUTF8(const int32& point, StringBuilder* dest) { +void JSONParser::DecodeUTF8(const int32_t& point, StringBuilder* dest) { DCHECK(IsValidCharacter(point)); // Anything outside of the basic ASCII plane will need to be decoded from - // int32 to a multi-byte sequence. + // int32_t to a multi-byte sequence. if (point < kExtendedASCIIStart) { dest->Append(static_cast<char>(point)); } else { diff --git a/base/json/json_parser.h b/base/json/json_parser.h index ac1ad85..57c07ba 100644 --- a/base/json/json_parser.h +++ b/base/json/json_parser.h @@ -5,13 +5,16 @@ #ifndef BASE_JSON_JSON_PARSER_H_ #define BASE_JSON_JSON_PARSER_H_ +#include <stddef.h> +#include <stdint.h> + #include <string> #include "base/base_export.h" -#include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/gtest_prod_util.h" #include "base/json/json_reader.h" +#include "base/macros.h" #include "base/strings/string_piece.h" namespace base { @@ -180,7 +183,7 @@ class BASE_EXPORT JSONParser { // Helper function for ConsumeStringRaw() that takes a single code point, // decodes it into UTF-8 units, and appends it to the given builder. The // point must be valid. - void DecodeUTF8(const int32& point, StringBuilder* dest); + void DecodeUTF8(const int32_t& point, StringBuilder* dest); // Assuming that the parser is wound to the start of a valid JSON number, // this parses and converts it to either an int or double value. diff --git a/base/json/json_parser_unittest.cc b/base/json/json_parser_unittest.cc index c5a1710..da86b33 100644 --- a/base/json/json_parser_unittest.cc +++ b/base/json/json_parser_unittest.cc @@ -4,6 +4,8 @@ #include "base/json/json_parser.h" +#include <stddef.h> + #include "base/json/json_reader.h" #include "base/memory/scoped_ptr.h" #include "base/values.h" diff --git a/base/json/json_reader.h b/base/json/json_reader.h index 46d1682..45783b0 100644 --- a/base/json/json_reader.h +++ b/base/json/json_reader.h @@ -31,7 +31,6 @@ #include <string> #include "base/base_export.h" -#include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "base/strings/string_piece.h" diff --git a/base/json/json_reader_unittest.cc b/base/json/json_reader_unittest.cc index 1dc20d7..21eec4a 100644 --- a/base/json/json_reader_unittest.cc +++ b/base/json/json_reader_unittest.cc @@ -4,9 +4,12 @@ #include "base/json/json_reader.h" +#include <stddef.h> + #include "base/base_paths.h" #include "base/files/file_util.h" #include "base/logging.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/path_service.h" #include "base/strings/string_piece.h" diff --git a/base/json/json_string_value_serializer.h b/base/json/json_string_value_serializer.h index 90f697d..2459f48 100644 --- a/base/json/json_string_value_serializer.h +++ b/base/json/json_string_value_serializer.h @@ -8,8 +8,8 @@ #include <string> #include "base/base_export.h" -#include "base/basictypes.h" #include "base/files/file_path.h" +#include "base/macros.h" #include "base/strings/string_piece.h" #include "base/values.h" diff --git a/base/json/json_value_converter.h b/base/json/json_value_converter.h index f94d46e..a1e0d5b 100644 --- a/base/json/json_value_converter.h +++ b/base/json/json_value_converter.h @@ -5,12 +5,14 @@ #ifndef BASE_JSON_JSON_VALUE_CONVERTER_H_ #define BASE_JSON_JSON_VALUE_CONVERTER_H_ +#include <stddef.h> + #include <string> #include <vector> #include "base/base_export.h" -#include "base/basictypes.h" #include "base/logging.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/scoped_vector.h" #include "base/stl_util.h" diff --git a/base/json/json_value_serializer_unittest.cc b/base/json/json_value_serializer_unittest.cc index 7da11cf..a8531f0 100644 --- a/base/json/json_value_serializer_unittest.cc +++ b/base/json/json_value_serializer_unittest.cc @@ -16,6 +16,7 @@ #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" +#include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" namespace base { diff --git a/base/json/json_writer.cc b/base/json/json_writer.cc index 2d3ae0f..19bc0da 100644 --- a/base/json/json_writer.cc +++ b/base/json/json_writer.cc @@ -14,6 +14,7 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" +#include "build/build_config.h" namespace base { diff --git a/base/json/json_writer.h b/base/json/json_writer.h index 5711665..ef43341 100644 --- a/base/json/json_writer.h +++ b/base/json/json_writer.h @@ -5,10 +5,12 @@ #ifndef BASE_JSON_JSON_WRITER_H_ #define BASE_JSON_JSON_WRITER_H_ +#include <stddef.h> + #include <string> #include "base/base_export.h" -#include "base/basictypes.h" +#include "base/macros.h" namespace base { diff --git a/base/json/json_writer_unittest.cc b/base/json/json_writer_unittest.cc index a6f1a18..a62b3ba 100644 --- a/base/json/json_writer_unittest.cc +++ b/base/json/json_writer_unittest.cc @@ -4,6 +4,7 @@ #include "base/json/json_writer.h" #include "base/values.h" +#include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" namespace base { diff --git a/base/json/string_escape.cc b/base/json/string_escape.cc index 28b3ec6..f67fa93 100644 --- a/base/json/string_escape.cc +++ b/base/json/string_escape.cc @@ -4,6 +4,7 @@ #include "base/json/string_escape.h" +#include <stddef.h> #include <stdint.h> #include <limits> diff --git a/base/json/string_escape_unittest.cc b/base/json/string_escape_unittest.cc index f7ccafc..ae3d82a 100644 --- a/base/json/string_escape_unittest.cc +++ b/base/json/string_escape_unittest.cc @@ -4,6 +4,9 @@ #include "base/json/string_escape.h" +#include <stddef.h> + +#include "base/macros.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/base/lazy_instance.cc b/base/lazy_instance.cc index 594c1fe..5468065 100644 --- a/base/lazy_instance.cc +++ b/base/lazy_instance.cc @@ -6,7 +6,6 @@ #include "base/at_exit.h" #include "base/atomicops.h" -#include "base/basictypes.h" #include "base/threading/platform_thread.h" namespace base { diff --git a/base/lazy_instance.h b/base/lazy_instance.h index d52b543..fd03210 100644 --- a/base/lazy_instance.h +++ b/base/lazy_instance.h @@ -39,7 +39,6 @@ #include "base/atomicops.h" #include "base/base_export.h" -#include "base/basictypes.h" #include "base/debug/leak_annotations.h" #include "base/logging.h" #include "base/memory/aligned_memory.h" diff --git a/base/lazy_instance_unittest.cc b/base/lazy_instance_unittest.cc index ec9ef26..8947b12 100644 --- a/base/lazy_instance_unittest.cc +++ b/base/lazy_instance_unittest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <stddef.h> + #include "base/at_exit.h" #include "base/atomic_sequence_num.h" #include "base/lazy_instance.h" diff --git a/base/linux_util.cc b/base/linux_util.cc index d94588f..744a231 100644 --- a/base/linux_util.cc +++ b/base/linux_util.cc @@ -7,6 +7,7 @@ #include <dirent.h> #include <errno.h> #include <fcntl.h> +#include <limits.h> #include <stdlib.h> #include <sys/stat.h> #include <sys/types.h> @@ -21,6 +22,7 @@ #include "base/process/launch.h" #include "base/strings/string_util.h" #include "base/synchronization/lock.h" +#include "build/build_config.h" namespace { diff --git a/base/location.h b/base/location.h index 8f77f7e..d3bb23c 100644 --- a/base/location.h +++ b/base/location.h @@ -5,11 +5,12 @@ #ifndef BASE_LOCATION_H_ #define BASE_LOCATION_H_ +#include <stddef.h> + #include <cassert> #include <string> #include "base/base_export.h" -#include "base/basictypes.h" #include "base/containers/hash_tables.h" namespace tracked_objects { diff --git a/base/logging.cc b/base/logging.cc index 22e0aa0..9ad50e8 100644 --- a/base/logging.cc +++ b/base/logging.cc @@ -5,6 +5,10 @@ #include "base/logging.h" #include <limits.h> +#include <stdint.h> + +#include "base/macros.h" +#include "build/build_config.h" #if defined(OS_WIN) #include <io.h> @@ -128,7 +132,7 @@ LogMessageHandlerFunction log_message_handler = nullptr; // Helper functions to wrap platform differences. -int32 CurrentProcessId() { +int32_t CurrentProcessId() { #if defined(OS_WIN) return GetCurrentProcessId(); #elif defined(OS_POSIX) @@ -136,7 +140,7 @@ int32 CurrentProcessId() { #endif } -uint64 TickCount() { +uint64_t TickCount() { #if defined(OS_WIN) return GetTickCount(); #elif defined(OS_MACOSX) @@ -149,9 +153,8 @@ uint64 TickCount() { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); - uint64 absolute_micro = - static_cast<int64>(ts.tv_sec) * 1000000 + - static_cast<int64>(ts.tv_nsec) / 1000; + uint64_t absolute_micro = static_cast<int64_t>(ts.tv_sec) * 1000000 + + static_cast<int64_t>(ts.tv_nsec) / 1000; return absolute_micro; #endif diff --git a/base/logging.h b/base/logging.h index e95bd3b..300c9b5 100644 --- a/base/logging.h +++ b/base/logging.h @@ -5,14 +5,16 @@ #ifndef BASE_LOGGING_H_ #define BASE_LOGGING_H_ +#include <stddef.h> + #include <cassert> -#include <string> #include <cstring> #include <sstream> +#include <string> #include "base/base_export.h" -#include "base/basictypes.h" #include "base/debug/debugger.h" +#include "base/macros.h" #include "build/build_config.h" // diff --git a/base/logging_unittest.cc b/base/logging_unittest.cc index 6953107..22fb855 100644 --- a/base/logging_unittest.cc +++ b/base/logging_unittest.cc @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/logging.h" +#include "base/macros.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/base/logging_win.h b/base/logging_win.h index de34a64..cdde7bb 100644 --- a/base/logging_win.h +++ b/base/logging_win.h @@ -5,12 +5,14 @@ #ifndef BASE_LOGGING_WIN_H_ #define BASE_LOGGING_WIN_H_ +#include <stddef.h> + #include <string> #include "base/base_export.h" -#include "base/basictypes.h" -#include "base/win/event_trace_provider.h" #include "base/logging.h" +#include "base/macros.h" +#include "base/win/event_trace_provider.h" namespace base { template <typename Type> diff --git a/base/mac/foundation_util_unittest.mm b/base/mac/foundation_util_unittest.mm index 508d611..e15daf4 100644 --- a/base/mac/foundation_util_unittest.mm +++ b/base/mac/foundation_util_unittest.mm @@ -4,6 +4,7 @@ #include "base/mac/foundation_util.h" +#include <limits.h> #include <stddef.h> #include "base/compiler_specific.h" diff --git a/base/macros.h b/base/macros.h index b3e32ca..fa12dd2 100644 --- a/base/macros.h +++ b/base/macros.h @@ -55,7 +55,7 @@ template <typename T, size_t N> char (&ArraySizeHelper(T (&array)[N]))[N]; // support. // // float f = 3.14159265358979; -// int i = bit_cast<int32>(f); +// int i = bit_cast<int32_t>(f); // // i = 0x40490fdb // // The classical address-casting method is: @@ -5,6 +5,7 @@ #ifndef BASE_MD5_H_ #define BASE_MD5_H_ +#include <stddef.h> #include <stdint.h> #include "base/base_export.h" diff --git a/base/md5_unittest.cc b/base/md5_unittest.cc index 08c99f1..3926b66 100644 --- a/base/md5_unittest.cc +++ b/base/md5_unittest.cc @@ -5,7 +5,6 @@ #include <string.h> #include <string> -#include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "base/md5.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/base/message_loop/incoming_task_queue.cc b/base/message_loop/incoming_task_queue.cc index eab14e9..d02bbc7 100644 --- a/base/message_loop/incoming_task_queue.cc +++ b/base/message_loop/incoming_task_queue.cc @@ -11,6 +11,7 @@ #include "base/metrics/histogram.h" #include "base/synchronization/waitable_event.h" #include "base/time/time.h" +#include "build/build_config.h" namespace base { namespace internal { diff --git a/base/message_loop/incoming_task_queue.h b/base/message_loop/incoming_task_queue.h index 7dd1e82..e450aa1 100644 --- a/base/message_loop/incoming_task_queue.h +++ b/base/message_loop/incoming_task_queue.h @@ -6,6 +6,7 @@ #define BASE_MESSAGE_LOOP_INCOMING_TASK_QUEUE_H_ #include "base/base_export.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/pending_task.h" #include "base/synchronization/lock.h" diff --git a/base/message_loop/message_loop.cc b/base/message_loop/message_loop.cc index b5e9c65..cfa86d9 100644 --- a/base/message_loop/message_loop.cc +++ b/base/message_loop/message_loop.cc @@ -22,6 +22,7 @@ #include "base/time/time.h" #include "base/trace_event/trace_event.h" #include "base/tracked_objects.h" +#include "build/build_config.h" #if defined(OS_MACOSX) #include "base/message_loop/message_pump_mac.h" diff --git a/base/message_loop/message_loop.h b/base/message_loop/message_loop.h index 6e4be9d..364d04d 100644 --- a/base/message_loop/message_loop.h +++ b/base/message_loop/message_loop.h @@ -9,10 +9,10 @@ #include <string> #include "base/base_export.h" -#include "base/basictypes.h" #include "base/callback_forward.h" #include "base/debug/task_annotator.h" #include "base/location.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop/incoming_task_queue.h" @@ -25,6 +25,7 @@ #include "base/synchronization/lock.h" #include "base/time/time.h" #include "base/tracking_info.h" +#include "build/build_config.h" // TODO(sky): these includes should not be necessary. Nuke them. #if defined(OS_WIN) diff --git a/base/message_loop/message_loop_task_runner.h b/base/message_loop/message_loop_task_runner.h index dc2947d..5e70b128 100644 --- a/base/message_loop/message_loop_task_runner.h +++ b/base/message_loop/message_loop_task_runner.h @@ -6,6 +6,7 @@ #define BASE_MESSAGE_LOOP_MESSAGE_LOOP_TASK_RUNNER_H_ #include "base/base_export.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/pending_task.h" #include "base/single_thread_task_runner.h" diff --git a/base/message_loop/message_loop_test.cc b/base/message_loop/message_loop_test.cc index f821220..ac50d64 100644 --- a/base/message_loop/message_loop_test.cc +++ b/base/message_loop/message_loop_test.cc @@ -4,9 +4,12 @@ #include "base/message_loop/message_loop_test.h" +#include <stddef.h> + #include <utility> #include "base/bind.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/run_loop.h" #include "base/synchronization/waitable_event.h" diff --git a/base/message_loop/message_loop_unittest.cc b/base/message_loop/message_loop_unittest.cc index c08dc7f..8b7a84d 100644 --- a/base/message_loop/message_loop_unittest.cc +++ b/base/message_loop/message_loop_unittest.cc @@ -2,12 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <stddef.h> +#include <stdint.h> + #include <vector> #include "base/bind.h" #include "base/bind_helpers.h" #include "base/compiler_specific.h" #include "base/logging.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop_test.h" @@ -19,6 +23,7 @@ #include "base/thread_task_runner_handle.h" #include "base/threading/platform_thread.h" #include "base/threading/thread.h" +#include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" #if defined(OS_WIN) diff --git a/base/message_loop/message_pump.h b/base/message_loop/message_pump.h index a2edb45..c53be80 100644 --- a/base/message_loop/message_pump.h +++ b/base/message_loop/message_pump.h @@ -6,7 +6,6 @@ #define BASE_MESSAGE_LOOP_MESSAGE_PUMP_H_ #include "base/base_export.h" -#include "base/basictypes.h" #include "base/message_loop/timer_slack.h" #include "base/threading/non_thread_safe.h" diff --git a/base/message_loop/message_pump_android.h b/base/message_loop/message_pump_android.h index d48050d..795bd5e 100644 --- a/base/message_loop/message_pump_android.h +++ b/base/message_loop/message_pump_android.h @@ -10,6 +10,7 @@ #include "base/android/scoped_java_ref.h" #include "base/base_export.h" #include "base/compiler_specific.h" +#include "base/macros.h" #include "base/message_loop/message_pump.h" namespace base { diff --git a/base/message_loop/message_pump_default.cc b/base/message_loop/message_pump_default.cc index 27c19e0..ed15395 100644 --- a/base/message_loop/message_pump_default.cc +++ b/base/message_loop/message_pump_default.cc @@ -6,6 +6,7 @@ #include "base/logging.h" #include "base/threading/thread_restrictions.h" +#include "build/build_config.h" #if defined(OS_MACOSX) #include "base/mac/scoped_nsautorelease_pool.h" diff --git a/base/message_loop/message_pump_default.h b/base/message_loop/message_pump_default.h index 8aeaa62..4cd7cd1 100644 --- a/base/message_loop/message_pump_default.h +++ b/base/message_loop/message_pump_default.h @@ -6,6 +6,7 @@ #define BASE_MESSAGE_LOOP_MESSAGE_PUMP_DEFAULT_H_ #include "base/base_export.h" +#include "base/macros.h" #include "base/message_loop/message_pump.h" #include "base/synchronization/waitable_event.h" #include "base/time/time.h" diff --git a/base/message_loop/message_pump_glib.h b/base/message_loop/message_pump_glib.h index 9f44571..b94eeaf 100644 --- a/base/message_loop/message_pump_glib.h +++ b/base/message_loop/message_pump_glib.h @@ -6,6 +6,7 @@ #define BASE_MESSAGE_LOOP_MESSAGE_PUMP_GLIB_H_ #include "base/base_export.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop/message_pump.h" #include "base/observer_list.h" diff --git a/base/message_loop/message_pump_glib_unittest.cc b/base/message_loop/message_pump_glib_unittest.cc index 7ddd4f0..cd12eba 100644 --- a/base/message_loop/message_pump_glib_unittest.cc +++ b/base/message_loop/message_pump_glib_unittest.cc @@ -13,6 +13,7 @@ #include "base/bind.h" #include "base/bind_helpers.h" #include "base/callback.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" diff --git a/base/message_loop/message_pump_io_ios.h b/base/message_loop/message_pump_io_ios.h index 317a59c..e1cbae6 100644 --- a/base/message_loop/message_pump_io_ios.h +++ b/base/message_loop/message_pump_io_ios.h @@ -8,6 +8,7 @@ #include "base/base_export.h" #include "base/mac/scoped_cffiledescriptorref.h" #include "base/mac/scoped_cftyperef.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/message_loop/message_pump_mac.h" diff --git a/base/message_loop/message_pump_io_ios_unittest.cc b/base/message_loop/message_pump_io_ios_unittest.cc index ba96f83..ed39468 100644 --- a/base/message_loop/message_pump_io_ios_unittest.cc +++ b/base/message_loop/message_pump_io_ios_unittest.cc @@ -6,6 +6,7 @@ #include <unistd.h> +#include "base/macros.h" #include "base/message_loop/message_loop.h" #include "base/posix/eintr_wrapper.h" #include "base/threading/thread.h" diff --git a/base/message_loop/message_pump_libevent.cc b/base/message_loop/message_pump_libevent.cc index 2923f5c..c0a02b2 100644 --- a/base/message_loop/message_pump_libevent.cc +++ b/base/message_loop/message_pump_libevent.cc @@ -17,6 +17,7 @@ #include "base/third_party/libevent/event.h" #include "base/time/time.h" #include "base/trace_event/trace_event.h" +#include "build/build_config.h" #if defined(OS_MACOSX) #include "base/mac/scoped_nsautorelease_pool.h" diff --git a/base/message_loop/message_pump_libevent.h b/base/message_loop/message_pump_libevent.h index 8b815ae..4d2f4f7 100644 --- a/base/message_loop/message_pump_libevent.h +++ b/base/message_loop/message_pump_libevent.h @@ -5,8 +5,8 @@ #ifndef BASE_MESSAGE_LOOP_MESSAGE_PUMP_LIBEVENT_H_ #define BASE_MESSAGE_LOOP_MESSAGE_PUMP_LIBEVENT_H_ -#include "base/basictypes.h" #include "base/compiler_specific.h" +#include "base/macros.h" #include "base/message_loop/message_pump.h" #include "base/observer_list.h" #include "base/threading/thread_checker.h" diff --git a/base/message_loop/message_pump_libevent_unittest.cc b/base/message_loop/message_pump_libevent_unittest.cc index 89393d1..eb30d53 100644 --- a/base/message_loop/message_pump_libevent_unittest.cc +++ b/base/message_loop/message_pump_libevent_unittest.cc @@ -17,6 +17,7 @@ #include "base/synchronization/waitable_event_watcher.h" #include "base/third_party/libevent/event.h" #include "base/threading/thread.h" +#include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" namespace base { diff --git a/base/message_loop/message_pump_mac.h b/base/message_loop/message_pump_mac.h index c46f261..14b8377 100644 --- a/base/message_loop/message_pump_mac.h +++ b/base/message_loop/message_pump_mac.h @@ -32,12 +32,13 @@ #include "base/message_loop/message_pump.h" -#include "base/basictypes.h" #include <CoreFoundation/CoreFoundation.h> +#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/message_loop/timer_slack.h" +#include "build/build_config.h" #if defined(__OBJC__) #if defined(OS_IOS) diff --git a/base/message_loop/message_pump_mac.mm b/base/message_loop/message_pump_mac.mm index 53e3363..b50ea68 100644 --- a/base/message_loop/message_pump_mac.mm +++ b/base/message_loop/message_pump_mac.mm @@ -12,9 +12,11 @@ #include "base/logging.h" #include "base/mac/call_with_eh_frame.h" #include "base/mac/scoped_cftyperef.h" +#include "base/macros.h" #include "base/message_loop/timer_slack.h" #include "base/run_loop.h" #include "base/time/time.h" +#include "build/build_config.h" #if !defined(OS_IOS) #import <AppKit/AppKit.h> diff --git a/base/message_loop/message_pump_perftest.cc b/base/message_loop/message_pump_perftest.cc index c568425..789fc1f 100644 --- a/base/message_loop/message_pump_perftest.cc +++ b/base/message_loop/message_pump_perftest.cc @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <stddef.h> +#include <stdint.h> + #include "base/bind.h" #include "base/format_macros.h" #include "base/memory/scoped_vector.h" diff --git a/base/message_loop/message_pump_win.cc b/base/message_loop/message_pump_win.cc index 14e4320..e7246fe 100644 --- a/base/message_loop/message_pump_win.cc +++ b/base/message_loop/message_pump_win.cc @@ -4,8 +4,10 @@ #include "base/message_loop/message_pump_win.h" -#include <limits> #include <math.h> +#include <stdint.h> + +#include <limits> #include "base/message_loop/message_loop.h" #include "base/metrics/histogram.h" diff --git a/base/message_loop/message_pump_win.h b/base/message_loop/message_pump_win.h index 9f1838d..257ccc9 100644 --- a/base/message_loop/message_pump_win.h +++ b/base/message_loop/message_pump_win.h @@ -10,7 +10,6 @@ #include <list> #include "base/base_export.h" -#include "base/basictypes.h" #include "base/message_loop/message_pump.h" #include "base/message_loop/message_pump_dispatcher.h" #include "base/observer_list.h" diff --git a/base/metrics/bucket_ranges.cc b/base/metrics/bucket_ranges.cc index 949c813..084cdd3 100644 --- a/base/metrics/bucket_ranges.cc +++ b/base/metrics/bucket_ranges.cc @@ -11,62 +11,70 @@ namespace base { // Static table of checksums for all possible 8 bit bytes. -const uint32 kCrcTable[256] = { 0x0, 0x77073096L, 0xee0e612cL, -0x990951baL, 0x76dc419L, 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0xedb8832L, -0x79dcb8a4L, 0xe0d5e91eL, 0x97d2d988L, 0x9b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, -0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL, 0x1adad47dL, -0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L, 0x646ba8c0L, 0xfd62f97aL, -0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L, 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, -0x4c69105eL, 0xd56041e4L, 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, -0xa50ab56bL, 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L, -0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL, 0xc8d75180L, -0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L, 0xb8bda50fL, 0x2802b89eL, -0x5f058808L, 0xc60cd9b2L, 0xb10be924L, 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, -0xb6662d3dL, 0x76dc4190L, 0x1db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, -0x6b6b51fL, 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0xf00f934L, 0x9609a88eL, -0xe10e9818L, 0x7f6a0dbbL, 0x86d3d2dL, 0x91646c97L, 0xe6635c01L, 0x6b6b51f4L, -0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL, 0x1b01a57bL, 0x8208f4c1L, -0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L, 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, -0x15da2d49L, 0x8cd37cf3L, 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, -0xd4bb30e2L, 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL, -0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L, 0xaa0a4c5fL, -0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L, 0xc90c2086L, 0x5768b525L, -0x206f85b3L, 0xb966d409L, 0xce61e49fL, 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, -0xc7d7a8b4L, 0x59b33d17L, 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, -0x9abfb3b6L, 0x3b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x4db2615L, -0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0xd6d6a3eL, 0x7a6a5aa8L, 0xe40ecf0bL, -0x9309ff9dL, 0xa00ae27L, 0x7d079eb1L, 0xf00f9344L, 0x8708a3d2L, 0x1e01f268L, -0x6906c2feL, 0xf762575dL, 0x806567cbL, 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, -0x89d32be0L, 0x10da7a5aL, 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, -0x60b08ed5L, 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L, -0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL, 0x36034af6L, -0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL, 0x4669be79L, 0xcb61b38cL, -0xbc66831aL, 0x256fd2a0L, 0x5268e236L, 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, -0x5505262fL, 0xc5ba3bbeL, 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, -0xb5d0cf31L, 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL, -0x26d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x5005713L, 0x95bf4a82L, -0xe2b87a14L, 0x7bb12baeL, 0xcb61b38L, 0x92d28e9bL, 0xe5d5be0dL, 0x7cdcefb7L, -0xbdbdf21L, 0x86d3d2d4L, 0xf1d4e242L, 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, -0xf6b9265bL, 0x6fb077e1L, 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, -0x11010b5cL, 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L, -0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L, 0x4969474dL, -0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L, 0x37d83bf0L, 0xa9bcae53L, -0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L, 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, -0x24b4a3a6L, 0xbad03605L, 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, -0xc4614ab8L, 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL, -0x2d02ef8dL, +const uint32_t kCrcTable[256] = { + 0x0, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x76dc419L, + 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0xedb8832L, 0x79dcb8a4L, + 0xe0d5e91eL, 0x97d2d988L, 0x9b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, + 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL, + 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L, + 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L, + 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L, + 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL, + 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L, + 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL, + 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L, + 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L, + 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L, + 0x1db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x6b6b51fL, + 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0xf00f934L, 0x9609a88eL, + 0xe10e9818L, 0x7f6a0dbbL, 0x86d3d2dL, 0x91646c97L, 0xe6635c01L, + 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL, + 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L, + 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L, + 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L, + 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL, + 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L, + 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L, + 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL, + 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L, + 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L, + 0x3b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x4db2615L, + 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0xd6d6a3eL, 0x7a6a5aa8L, + 0xe40ecf0bL, 0x9309ff9dL, 0xa00ae27L, 0x7d079eb1L, 0xf00f9344L, + 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL, + 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL, + 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L, + 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L, + 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL, + 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL, + 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L, + 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL, + 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L, + 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL, + 0x26d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x5005713L, + 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0xcb61b38L, 0x92d28e9bL, + 0xe5d5be0dL, 0x7cdcefb7L, 0xbdbdf21L, 0x86d3d2d4L, 0xf1d4e242L, + 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L, + 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL, + 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L, + 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L, + 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L, + 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L, + 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L, + 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L, + 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL, + 0x2d02ef8dL, }; // We generate the CRC-32 using the low order bits to select whether to XOR in // the reversed polynomial 0xedb88320L. This is nice and simple, and allows us -// to keep the quotient in a uint32. Since we're not concerned about the nature -// of corruptions (i.e., we don't care about bit sequencing, since we are -// handling memory changes, which are more grotesque) so we don't bother to -// get the CRC correct for big-endian vs little-ending calculations. All we -// need is a nice hash, that tends to depend on all the bits of the sample, with -// very little chance of changes in one place impacting changes in another -// place. -static uint32 Crc32(uint32 sum, HistogramBase::Sample value) { +// to keep the quotient in a uint32_t. Since we're not concerned about the +// nature of corruptions (i.e., we don't care about bit sequencing, since we are +// handling memory changes, which are more grotesque) so we don't bother to get +// the CRC correct for big-endian vs little-ending calculations. All we need is +// a nice hash, that tends to depend on all the bits of the sample, with very +// little chance of changes in one place impacting changes in another place. +static uint32_t Crc32(uint32_t sum, HistogramBase::Sample value) { // TODO(jar): Switch to false and watch stats. const bool kUseRealCrc = true; @@ -84,12 +92,12 @@ static uint32 Crc32(uint32 sum, HistogramBase::Sample value) { // and we don't care about edge cases since we have an even number of bytes. union { HistogramBase::Sample range; - uint16 ints[sizeof(HistogramBase::Sample) / 2]; + uint16_t ints[sizeof(HistogramBase::Sample) / 2]; } converter; DCHECK_EQ(sizeof(HistogramBase::Sample), sizeof(converter)); converter.range = value; sum += converter.ints[0]; - sum = (sum << 16) ^ sum ^ (static_cast<uint32>(converter.ints[1]) << 11); + sum = (sum << 16) ^ sum ^ (static_cast<uint32_t>(converter.ints[1]) << 11); sum += sum >> 11; } return sum; @@ -107,9 +115,9 @@ void BucketRanges::set_range(size_t i, HistogramBase::Sample value) { ranges_[i] = value; } -uint32 BucketRanges::CalculateChecksum() const { +uint32_t BucketRanges::CalculateChecksum() const { // Seed checksum. - uint32 checksum = static_cast<uint32>(ranges_.size()); + uint32_t checksum = static_cast<uint32_t>(ranges_.size()); for (size_t index = 0; index < ranges_.size(); ++index) checksum = Crc32(checksum, ranges_[index]); diff --git a/base/metrics/bucket_ranges.h b/base/metrics/bucket_ranges.h index eb330f4..c356195 100644 --- a/base/metrics/bucket_ranges.h +++ b/base/metrics/bucket_ranges.h @@ -17,10 +17,15 @@ #ifndef BASE_METRICS_BUCKET_RANGES_H_ #define BASE_METRICS_BUCKET_RANGES_H_ +#include <stddef.h> +#include <stdint.h> + #include <vector> +#include <limits.h> + #include "base/base_export.h" -#include "base/basictypes.h" +#include "base/macros.h" #include "base/metrics/histogram_base.h" namespace base { @@ -35,8 +40,8 @@ class BASE_EXPORT BucketRanges { size_t size() const { return ranges_.size(); } HistogramBase::Sample range(size_t i) const { return ranges_[i]; } void set_range(size_t i, HistogramBase::Sample value); - uint32 checksum() const { return checksum_; } - void set_checksum(uint32 checksum) { checksum_ = checksum; } + uint32_t checksum() const { return checksum_; } + void set_checksum(uint32_t checksum) { checksum_ = checksum; } // A bucket is defined by a consecutive pair of entries in |ranges|, so there // is one fewer bucket than there are ranges. For example, if |ranges| is @@ -46,7 +51,7 @@ class BASE_EXPORT BucketRanges { // Checksum methods to verify whether the ranges are corrupted (e.g. bad // memory access). - uint32 CalculateChecksum() const; + uint32_t CalculateChecksum() const; bool HasValidChecksum() const; void ResetChecksum(); @@ -62,16 +67,16 @@ class BASE_EXPORT BucketRanges { // Checksum for the conntents of ranges_. Used to detect random over-writes // of our data, and to quickly see if some other BucketRanges instance is // possibly Equal() to this instance. - // TODO(kaiwang): Consider change this to uint64. Because we see a lot of + // TODO(kaiwang): Consider change this to uint64_t. Because we see a lot of // noise on UMA dashboard. - uint32 checksum_; + uint32_t checksum_; DISALLOW_COPY_AND_ASSIGN(BucketRanges); }; ////////////////////////////////////////////////////////////////////////////// // Expose only for test. -BASE_EXPORT extern const uint32 kCrcTable[256]; +BASE_EXPORT extern const uint32_t kCrcTable[256]; } // namespace base diff --git a/base/metrics/bucket_ranges_unittest.cc b/base/metrics/bucket_ranges_unittest.cc index fc0699c..481054c 100644 --- a/base/metrics/bucket_ranges_unittest.cc +++ b/base/metrics/bucket_ranges_unittest.cc @@ -4,6 +4,8 @@ #include "base/metrics/bucket_ranges.h" +#include <stdint.h> + #include "testing/gtest/include/gtest/gtest.h" namespace base { @@ -76,9 +78,9 @@ TEST(BucketRangesTest, Checksum) { // http://www.w3.org/TR/PNG/#D-CRCAppendix. TEST(BucketRangesTest, Crc32TableTest) { for (int i = 0; i < 256; ++i) { - uint32 checksum = i; + uint32_t checksum = i; for (int j = 0; j < 8; ++j) { - const uint32 kReversedPolynomial = 0xedb88320L; + const uint32_t kReversedPolynomial = 0xedb88320L; if (checksum & 1) checksum = kReversedPolynomial ^ (checksum >> 1); else diff --git a/base/metrics/field_trial.cc b/base/metrics/field_trial.cc index 4c0ae1a..370ded9 100644 --- a/base/metrics/field_trial.cc +++ b/base/metrics/field_trial.cc @@ -298,7 +298,7 @@ FieldTrial* FieldTrialList::FactoryGetFieldTrialWithRandomizationSeed( const int month, const int day_of_month, FieldTrial::RandomizationType randomization_type, - uint32 randomization_seed, + uint32_t randomization_seed, int* default_group_number) { if (default_group_number) *default_group_number = FieldTrial::kDefaultGroupNumber; diff --git a/base/metrics/field_trial.h b/base/metrics/field_trial.h index 31ad354..6c1d93e 100644 --- a/base/metrics/field_trial.h +++ b/base/metrics/field_trial.h @@ -54,6 +54,9 @@ #ifndef BASE_METRICS_FIELD_TRIAL_H_ #define BASE_METRICS_FIELD_TRIAL_H_ +#include <stddef.h> +#include <stdint.h> + #include <map> #include <set> #include <string> @@ -61,6 +64,7 @@ #include "base/base_export.h" #include "base/gtest_prod_util.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/observer_list_threadsafe.h" #include "base/synchronization/lock.h" @@ -97,7 +101,7 @@ class BASE_EXPORT FieldTrial : public RefCounted<FieldTrial> { // providers that support it. A given instance should always return the same // value given the same input |trial_name| and |randomization_seed| values. virtual double GetEntropyForTrial(const std::string& trial_name, - uint32 randomization_seed) const = 0; + uint32_t randomization_seed) const = 0; }; // A pair representing a Field Trial and its selected group. @@ -398,7 +402,7 @@ class BASE_EXPORT FieldTrialList { const int month, const int day_of_month, FieldTrial::RandomizationType randomization_type, - uint32 randomization_seed, + uint32_t randomization_seed, int* default_group_number); // The Find() method can be used to test to see if a named trial was already diff --git a/base/metrics/field_trial_unittest.cc b/base/metrics/field_trial_unittest.cc index 380cd59..ffb3eb2 100644 --- a/base/metrics/field_trial_unittest.cc +++ b/base/metrics/field_trial_unittest.cc @@ -4,7 +4,10 @@ #include "base/metrics/field_trial.h" +#include <stddef.h> + #include "base/build_time.h" +#include "base/macros.h" #include "base/message_loop/message_loop.h" #include "base/rand_util.h" #include "base/run_loop.h" diff --git a/base/metrics/histogram.cc b/base/metrics/histogram.cc index 083856b..62c2bc8 100644 --- a/base/metrics/histogram.cc +++ b/base/metrics/histogram.cc @@ -9,6 +9,7 @@ #include "base/metrics/histogram.h" +#include <limits.h> #include <math.h> #include <algorithm> @@ -37,7 +38,7 @@ bool ReadHistogramArguments(PickleIterator* iter, int* declared_min, int* declared_max, size_t* bucket_count, - uint32* range_checksum) { + uint32_t* range_checksum) { if (!iter->ReadString(histogram_name) || !iter->ReadInt(flags) || !iter->ReadInt(declared_min) || @@ -68,7 +69,7 @@ bool ReadHistogramArguments(PickleIterator* iter, } bool ValidateRangeChecksum(const HistogramBase& histogram, - uint32 range_checksum) { + uint32_t range_checksum) { const Histogram& casted_histogram = static_cast<const Histogram&>(histogram); @@ -87,7 +88,7 @@ HistogramBase* Histogram::FactoryGet(const std::string& name, Sample minimum, Sample maximum, size_t bucket_count, - int32 flags) { + int32_t flags) { bool valid_arguments = InspectConstructionArguments(name, &minimum, &maximum, &bucket_count); DCHECK(valid_arguments); @@ -126,7 +127,7 @@ HistogramBase* Histogram::FactoryTimeGet(const std::string& name, TimeDelta minimum, TimeDelta maximum, size_t bucket_count, - int32 flags) { + int32_t flags) { return FactoryGet(name, static_cast<Sample>(minimum.InMilliseconds()), static_cast<Sample>(maximum.InMilliseconds()), bucket_count, flags); @@ -136,7 +137,7 @@ HistogramBase* Histogram::FactoryGet(const char* name, Sample minimum, Sample maximum, size_t bucket_count, - int32 flags) { + int32_t flags) { return FactoryGet(std::string(name), minimum, maximum, bucket_count, flags); } @@ -144,7 +145,7 @@ HistogramBase* Histogram::FactoryTimeGet(const char* name, TimeDelta minimum, TimeDelta maximum, size_t bucket_count, - int32 flags) { + int32_t flags) { return FactoryTimeGet(std::string(name), minimum, maximum, bucket_count, flags); } @@ -204,7 +205,7 @@ int Histogram::FindCorruption(const HistogramSamples& samples) const { if (!bucket_ranges()->HasValidChecksum()) inconsistencies |= RANGE_CHECKSUM_ERROR; - int64 delta64 = samples.redundant_count() - samples.TotalCount(); + int64_t delta64 = samples.redundant_count() - samples.TotalCount(); if (delta64 != 0) { int delta = static_cast<int>(delta64); if (delta != delta64) @@ -378,7 +379,7 @@ HistogramBase* Histogram::DeserializeInfoImpl(PickleIterator* iter) { int declared_min; int declared_max; size_t bucket_count; - uint32 range_checksum; + uint32_t range_checksum; if (!ReadHistogramArguments(iter, &histogram_name, &flags, &declared_min, &declared_max, &bucket_count, &range_checksum)) { @@ -438,8 +439,8 @@ void Histogram::WriteAsciiImpl(bool graph_it, } } - int64 remaining = sample_count; - int64 past = 0; + int64_t remaining = sample_count; + int64_t past = 0; // Output the actual histogram graph. for (size_t i = 0; i < bucket_count(); ++i) { Count current = snapshot->GetCountAtIndex(i); @@ -498,9 +499,9 @@ void Histogram::WriteAsciiHeader(const SampleVector& samples, StringAppendF(output, " (flags = 0x%x)", flags() & ~kHexRangePrintingFlag); } -void Histogram::WriteAsciiBucketContext(const int64 past, +void Histogram::WriteAsciiBucketContext(const int64_t past, const Count current, - const int64 remaining, + const int64_t remaining, const size_t i, std::string* output) const { double scaled_sum = (past + current + remaining) / 100.0; @@ -519,7 +520,7 @@ void Histogram::GetParameters(DictionaryValue* params) const { } void Histogram::GetCountAndBucketData(Count* count, - int64* sum, + int64_t* sum, ListValue* buckets) const { scoped_ptr<SampleVector> snapshot = SnapshotSampleVector(); *count = snapshot->TotalCount(); @@ -550,7 +551,7 @@ HistogramBase* LinearHistogram::FactoryGet(const std::string& name, Sample minimum, Sample maximum, size_t bucket_count, - int32 flags) { + int32_t flags) { return FactoryGetWithRangeDescription( name, minimum, maximum, bucket_count, flags, NULL); } @@ -559,7 +560,7 @@ HistogramBase* LinearHistogram::FactoryTimeGet(const std::string& name, TimeDelta minimum, TimeDelta maximum, size_t bucket_count, - int32 flags) { + int32_t flags) { return FactoryGet(name, static_cast<Sample>(minimum.InMilliseconds()), static_cast<Sample>(maximum.InMilliseconds()), bucket_count, flags); @@ -569,7 +570,7 @@ HistogramBase* LinearHistogram::FactoryGet(const char* name, Sample minimum, Sample maximum, size_t bucket_count, - int32 flags) { + int32_t flags) { return FactoryGet(std::string(name), minimum, maximum, bucket_count, flags); } @@ -577,18 +578,18 @@ HistogramBase* LinearHistogram::FactoryTimeGet(const char* name, TimeDelta minimum, TimeDelta maximum, size_t bucket_count, - int32 flags) { + int32_t flags) { return FactoryTimeGet(std::string(name), minimum, maximum, bucket_count, flags); } HistogramBase* LinearHistogram::FactoryGetWithRangeDescription( - const std::string& name, - Sample minimum, - Sample maximum, - size_t bucket_count, - int32 flags, - const DescriptionPair descriptions[]) { + const std::string& name, + Sample minimum, + Sample maximum, + size_t bucket_count, + int32_t flags, + const DescriptionPair descriptions[]) { bool valid_arguments = Histogram::InspectConstructionArguments( name, &minimum, &maximum, &bucket_count); DCHECK(valid_arguments); @@ -685,7 +686,7 @@ HistogramBase* LinearHistogram::DeserializeInfoImpl(PickleIterator* iter) { int declared_min; int declared_max; size_t bucket_count; - uint32 range_checksum; + uint32_t range_checksum; if (!ReadHistogramArguments(iter, &histogram_name, &flags, &declared_min, &declared_max, &bucket_count, &range_checksum)) { @@ -706,7 +707,7 @@ HistogramBase* LinearHistogram::DeserializeInfoImpl(PickleIterator* iter) { //------------------------------------------------------------------------------ HistogramBase* BooleanHistogram::FactoryGet(const std::string& name, - int32 flags) { + int32_t flags) { HistogramBase* histogram = StatisticsRecorder::FindHistogram(name); if (!histogram) { // To avoid racy destruction at shutdown, the following will be leaked. @@ -727,7 +728,7 @@ HistogramBase* BooleanHistogram::FactoryGet(const std::string& name, return histogram; } -HistogramBase* BooleanHistogram::FactoryGet(const char* name, int32 flags) { +HistogramBase* BooleanHistogram::FactoryGet(const char* name, int32_t flags) { return FactoryGet(std::string(name), flags); } @@ -745,7 +746,7 @@ HistogramBase* BooleanHistogram::DeserializeInfoImpl(PickleIterator* iter) { int declared_min; int declared_max; size_t bucket_count; - uint32 range_checksum; + uint32_t range_checksum; if (!ReadHistogramArguments(iter, &histogram_name, &flags, &declared_min, &declared_max, &bucket_count, &range_checksum)) { @@ -768,7 +769,7 @@ HistogramBase* BooleanHistogram::DeserializeInfoImpl(PickleIterator* iter) { HistogramBase* CustomHistogram::FactoryGet( const std::string& name, const std::vector<Sample>& custom_ranges, - int32 flags) { + int32_t flags) { CHECK(ValidateCustomRanges(custom_ranges)); HistogramBase* histogram = StatisticsRecorder::FindHistogram(name); @@ -794,7 +795,7 @@ HistogramBase* CustomHistogram::FactoryGet( HistogramBase* CustomHistogram::FactoryGet( const char* name, const std::vector<Sample>& custom_ranges, - int32 flags) { + int32_t flags) { return FactoryGet(std::string(name), custom_ranges, flags); } @@ -848,7 +849,7 @@ HistogramBase* CustomHistogram::DeserializeInfoImpl(PickleIterator* iter) { int declared_min; int declared_max; size_t bucket_count; - uint32 range_checksum; + uint32_t range_checksum; if (!ReadHistogramArguments(iter, &histogram_name, &flags, &declared_min, &declared_max, &bucket_count, &range_checksum)) { diff --git a/base/metrics/histogram.h b/base/metrics/histogram.h index 8840493..28bb29b 100644 --- a/base/metrics/histogram.h +++ b/base/metrics/histogram.h @@ -66,15 +66,18 @@ #ifndef BASE_METRICS_HISTOGRAM_H_ #define BASE_METRICS_HISTOGRAM_H_ +#include <stddef.h> +#include <stdint.h> + #include <map> #include <string> #include <vector> #include "base/base_export.h" -#include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/gtest_prod_util.h" #include "base/logging.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/metrics/bucket_ranges.h" #include "base/metrics/histogram_base.h" @@ -114,12 +117,12 @@ class BASE_EXPORT Histogram : public HistogramBase { Sample minimum, Sample maximum, size_t bucket_count, - int32 flags); + int32_t flags); static HistogramBase* FactoryTimeGet(const std::string& name, base::TimeDelta minimum, base::TimeDelta maximum, size_t bucket_count, - int32 flags); + int32_t flags); // Overloads of the above two functions that take a const char* |name| param, // to avoid code bloat from the std::string constructor being inlined into @@ -128,12 +131,12 @@ class BASE_EXPORT Histogram : public HistogramBase { Sample minimum, Sample maximum, size_t bucket_count, - int32 flags); + int32_t flags); static HistogramBase* FactoryTimeGet(const char* name, base::TimeDelta minimum, base::TimeDelta maximum, size_t bucket_count, - int32 flags); + int32_t flags); static void InitializeBucketRanges(Sample minimum, Sample maximum, @@ -249,15 +252,17 @@ class BASE_EXPORT Histogram : public HistogramBase { // Write information about previous, current, and next buckets. // Information such as cumulative percentage, etc. - void WriteAsciiBucketContext(const int64 past, const Count current, - const int64 remaining, const size_t i, + void WriteAsciiBucketContext(const int64_t past, + const Count current, + const int64_t remaining, + const size_t i, std::string* output) const; // WriteJSON calls these. void GetParameters(DictionaryValue* params) const override; void GetCountAndBucketData(Count* count, - int64* sum, + int64_t* sum, ListValue* buckets) const override; // Does not own this object. Should get from StatisticsRecorder. @@ -287,12 +292,12 @@ class BASE_EXPORT LinearHistogram : public Histogram { Sample minimum, Sample maximum, size_t bucket_count, - int32 flags); + int32_t flags); static HistogramBase* FactoryTimeGet(const std::string& name, TimeDelta minimum, TimeDelta maximum, size_t bucket_count, - int32 flags); + int32_t flags); // Overloads of the above two functions that take a const char* |name| param, // to avoid code bloat from the std::string constructor being inlined into @@ -301,12 +306,12 @@ class BASE_EXPORT LinearHistogram : public Histogram { Sample minimum, Sample maximum, size_t bucket_count, - int32 flags); + int32_t flags); static HistogramBase* FactoryTimeGet(const char* name, TimeDelta minimum, TimeDelta maximum, size_t bucket_count, - int32 flags); + int32_t flags); struct DescriptionPair { Sample sample; @@ -323,7 +328,7 @@ class BASE_EXPORT LinearHistogram : public Histogram { Sample minimum, Sample maximum, size_t bucket_count, - int32 flags, + int32_t flags, const DescriptionPair descriptions[]); static void InitializeBucketRanges(Sample minimum, @@ -368,12 +373,12 @@ class BASE_EXPORT LinearHistogram : public Histogram { // BooleanHistogram is a histogram for booleans. class BASE_EXPORT BooleanHistogram : public LinearHistogram { public: - static HistogramBase* FactoryGet(const std::string& name, int32 flags); + static HistogramBase* FactoryGet(const std::string& name, int32_t flags); // Overload of the above function that takes a const char* |name| param, // to avoid code bloat from the std::string constructor being inlined into // call sites. - static HistogramBase* FactoryGet(const char* name, int32 flags); + static HistogramBase* FactoryGet(const char* name, int32_t flags); HistogramType GetHistogramType() const override; @@ -398,14 +403,14 @@ class BASE_EXPORT CustomHistogram : public Histogram { // client should not depend on this. static HistogramBase* FactoryGet(const std::string& name, const std::vector<Sample>& custom_ranges, - int32 flags); + int32_t flags); // Overload of the above function that takes a const char* |name| param, // to avoid code bloat from the std::string constructor being inlined into // call sites. static HistogramBase* FactoryGet(const char* name, const std::vector<Sample>& custom_ranges, - int32 flags); + int32_t flags); // Overridden from Histogram: HistogramType GetHistogramType() const override; diff --git a/base/metrics/histogram_base.cc b/base/metrics/histogram_base.cc index e9d4898..412f143 100644 --- a/base/metrics/histogram_base.cc +++ b/base/metrics/histogram_base.cc @@ -4,7 +4,8 @@ #include "base/metrics/histogram_base.h" -#include <climits> +#include <limits.h> + #include <utility> #include "base/json/json_string_value_serializer.h" @@ -72,12 +73,12 @@ void HistogramBase::CheckName(const StringPiece& name) const { DCHECK_EQ(histogram_name(), name); } -void HistogramBase::SetFlags(int32 flags) { +void HistogramBase::SetFlags(int32_t flags) { HistogramBase::Count old_flags = subtle::NoBarrier_Load(&flags_); subtle::NoBarrier_Store(&flags_, old_flags | flags); } -void HistogramBase::ClearFlags(int32 flags) { +void HistogramBase::ClearFlags(int32_t flags) { HistogramBase::Count old_flags = subtle::NoBarrier_Load(&flags_); subtle::NoBarrier_Store(&flags_, old_flags & ~flags); } @@ -103,7 +104,7 @@ int HistogramBase::FindCorruption(const HistogramSamples& samples) const { void HistogramBase::WriteJSON(std::string* output) const { Count count; - int64 sum; + int64_t sum; scoped_ptr<ListValue> buckets(new ListValue()); GetCountAndBucketData(&count, &sum, buckets.get()); scoped_ptr<DictionaryValue> parameters(new DictionaryValue()); diff --git a/base/metrics/histogram_base.h b/base/metrics/histogram_base.h index f45cc9c..4fa07c6 100644 --- a/base/metrics/histogram_base.h +++ b/base/metrics/histogram_base.h @@ -5,6 +5,8 @@ #ifndef BASE_METRICS_HISTOGRAM_BASE_H_ #define BASE_METRICS_HISTOGRAM_BASE_H_ +#include <limits.h> +#include <stddef.h> #include <stdint.h> #include <string> @@ -12,7 +14,7 @@ #include "base/atomicops.h" #include "base/base_export.h" -#include "base/basictypes.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/strings/string_piece.h" #include "base/time/time.h" @@ -169,7 +171,7 @@ class BASE_EXPORT HistogramBase { // counts to |buckets|, the total sample count to |count| and the total sum // to |sum|. virtual void GetCountAndBucketData(Count* count, - int64* sum, + int64_t* sum, ListValue* buckets) const = 0; //// Produce actual graph (set of blank vs non blank char's) for a bucket. diff --git a/base/metrics/histogram_delta_serialization.h b/base/metrics/histogram_delta_serialization.h index 0bc4a59..0a3983f 100644 --- a/base/metrics/histogram_delta_serialization.h +++ b/base/metrics/histogram_delta_serialization.h @@ -9,7 +9,7 @@ #include <vector> #include "base/base_export.h" -#include "base/basictypes.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/metrics/histogram_flattener.h" #include "base/metrics/histogram_snapshot_manager.h" diff --git a/base/metrics/histogram_flattener.h b/base/metrics/histogram_flattener.h index ca05a4f..b5fe976 100644 --- a/base/metrics/histogram_flattener.h +++ b/base/metrics/histogram_flattener.h @@ -8,7 +8,7 @@ #include <map> #include <string> -#include "base/basictypes.h" +#include "base/macros.h" #include "base/metrics/histogram.h" namespace base { diff --git a/base/metrics/histogram_macros.h b/base/metrics/histogram_macros.h index 882c58a..0492f0c 100644 --- a/base/metrics/histogram_macros.h +++ b/base/metrics/histogram_macros.h @@ -6,7 +6,6 @@ #define BASE_METRICS_HISTOGRAM_MACROS_H_ #include "base/atomicops.h" -#include "base/basictypes.h" #include "base/logging.h" #include "base/metrics/histogram.h" #include "base/time/time.h" diff --git a/base/metrics/histogram_samples.h b/base/metrics/histogram_samples.h index 98e372b..3da3e2d 100644 --- a/base/metrics/histogram_samples.h +++ b/base/metrics/histogram_samples.h @@ -5,10 +5,13 @@ #ifndef BASE_METRICS_HISTOGRAM_SAMPLES_H_ #define BASE_METRICS_HISTOGRAM_SAMPLES_H_ +#include <stddef.h> +#include <stdint.h> + #include "base/atomicops.h" -#include "base/basictypes.h" -#include "base/metrics/histogram_base.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" +#include "base/metrics/histogram_base.h" namespace base { diff --git a/base/metrics/histogram_snapshot_manager.h b/base/metrics/histogram_snapshot_manager.h index 867049f..bad4668 100644 --- a/base/metrics/histogram_snapshot_manager.h +++ b/base/metrics/histogram_snapshot_manager.h @@ -5,10 +5,12 @@ #ifndef BASE_METRICS_HISTOGRAM_SNAPSHOT_MANAGER_H_ #define BASE_METRICS_HISTOGRAM_SNAPSHOT_MANAGER_H_ +#include <stdint.h> + #include <map> #include <string> -#include "base/basictypes.h" +#include "base/macros.h" #include "base/metrics/histogram_base.h" namespace base { diff --git a/base/metrics/histogram_snapshot_manager_unittest.cc b/base/metrics/histogram_snapshot_manager_unittest.cc index e9e7398..b6a367a 100644 --- a/base/metrics/histogram_snapshot_manager_unittest.cc +++ b/base/metrics/histogram_snapshot_manager_unittest.cc @@ -7,6 +7,7 @@ #include <string> #include <vector> +#include "base/macros.h" #include "base/metrics/histogram_delta_serialization.h" #include "base/metrics/histogram_macros.h" #include "base/metrics/statistics_recorder.h" diff --git a/base/metrics/histogram_unittest.cc b/base/metrics/histogram_unittest.cc index daa0398..2fadc30 100644 --- a/base/metrics/histogram_unittest.cc +++ b/base/metrics/histogram_unittest.cc @@ -4,8 +4,12 @@ #include "base/metrics/histogram.h" -#include <climits> +#include <limits.h> +#include <stddef.h> +#include <stdint.h> + #include <algorithm> +#include <climits> #include <vector> #include "base/logging.h" @@ -414,11 +418,11 @@ TEST_F(HistogramTest, HistogramSerializeInfo) { EXPECT_TRUE(iter.ReadInt(&max)); EXPECT_EQ(64, max); - int64 bucket_count; + int64_t bucket_count; EXPECT_TRUE(iter.ReadInt64(&bucket_count)); EXPECT_EQ(8, bucket_count); - uint32 checksum; + uint32_t checksum; EXPECT_TRUE(iter.ReadUInt32(&checksum)); EXPECT_EQ(histogram->bucket_ranges()->checksum(), checksum); @@ -443,8 +447,8 @@ TEST_F(HistogramTest, CustomHistogramSerializeInfo) { int i; std::string s; - int64 bucket_count; - uint32 ui32; + int64_t bucket_count; + uint32_t ui32; EXPECT_TRUE(iter.ReadInt(&i) && iter.ReadString(&s) && iter.ReadInt(&i) && iter.ReadInt(&i) && iter.ReadInt(&i) && iter.ReadInt64(&bucket_count) && iter.ReadUInt32(&ui32)); diff --git a/base/metrics/metrics_hashes.cc b/base/metrics/metrics_hashes.cc index b09ea4b..73bce2e 100644 --- a/base/metrics/metrics_hashes.cc +++ b/base/metrics/metrics_hashes.cc @@ -12,7 +12,7 @@ namespace base { namespace { -// Converts the 8-byte prefix of an MD5 hash into a uint64 value. +// Converts the 8-byte prefix of an MD5 hash into a uint64_t value. inline uint64_t DigestToUInt64(const base::MD5Digest& digest) { uint64_t value; DCHECK_GE(sizeof(digest.a), sizeof(value)); diff --git a/base/metrics/metrics_hashes.h b/base/metrics/metrics_hashes.h index ff1c800..bd04017 100644 --- a/base/metrics/metrics_hashes.h +++ b/base/metrics/metrics_hashes.h @@ -12,8 +12,8 @@ namespace base { -// Computes a uint64 hash of a given string based on its MD5 hash. Suitable for -// metric names. +// Computes a uint64_t hash of a given string based on its MD5 hash. Suitable +// for metric names. BASE_EXPORT uint64_t HashMetricName(const std::string& name); } // namespace metrics diff --git a/base/metrics/metrics_hashes_unittest.cc b/base/metrics/metrics_hashes_unittest.cc index cfe3625..aea254e 100644 --- a/base/metrics/metrics_hashes_unittest.cc +++ b/base/metrics/metrics_hashes_unittest.cc @@ -4,6 +4,9 @@ #include "base/metrics/metrics_hashes.h" +#include <stddef.h> +#include <stdint.h> + #include "base/format_macros.h" #include "base/macros.h" #include "base/strings/stringprintf.h" diff --git a/base/metrics/sample_map.h b/base/metrics/sample_map.h index 95dc126..da536e3 100644 --- a/base/metrics/sample_map.h +++ b/base/metrics/sample_map.h @@ -8,9 +8,12 @@ #ifndef BASE_METRICS_SAMPLE_MAP_H_ #define BASE_METRICS_SAMPLE_MAP_H_ +#include <stdint.h> + #include <map> #include "base/compiler_specific.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/metrics/histogram_base.h" #include "base/metrics/histogram_samples.h" diff --git a/base/metrics/sample_vector.h b/base/metrics/sample_vector.h index 51803b0..0317869f 100644 --- a/base/metrics/sample_vector.h +++ b/base/metrics/sample_vector.h @@ -8,11 +8,14 @@ #ifndef BASE_METRICS_SAMPLE_VECTOR_H_ #define BASE_METRICS_SAMPLE_VECTOR_H_ +#include <stddef.h> #include <stdint.h> + #include <vector> #include "base/compiler_specific.h" #include "base/gtest_prod_util.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/metrics/histogram_base.h" #include "base/metrics/histogram_samples.h" diff --git a/base/metrics/sample_vector_unittest.cc b/base/metrics/sample_vector_unittest.cc index 8bd80dd..744cbfa 100644 --- a/base/metrics/sample_vector_unittest.cc +++ b/base/metrics/sample_vector_unittest.cc @@ -4,6 +4,9 @@ #include "base/metrics/sample_vector.h" +#include <limits.h> +#include <stddef.h> + #include <vector> #include "base/memory/scoped_ptr.h" diff --git a/base/metrics/sparse_histogram.cc b/base/metrics/sparse_histogram.cc index db76a8a..1ed1e786 100644 --- a/base/metrics/sparse_histogram.cc +++ b/base/metrics/sparse_histogram.cc @@ -20,7 +20,7 @@ typedef HistogramBase::Sample Sample; // static HistogramBase* SparseHistogram::FactoryGet(const std::string& name, - int32 flags) { + int32_t flags) { HistogramBase* histogram = StatisticsRecorder::FindHistogram(name); if (!histogram) { @@ -124,7 +124,7 @@ void SparseHistogram::GetParameters(DictionaryValue* params) const { } void SparseHistogram::GetCountAndBucketData(Count* count, - int64* sum, + int64_t* sum, ListValue* buckets) const { // TODO(kaiwang): Implement. (See HistogramBase::WriteJSON.) } diff --git a/base/metrics/sparse_histogram.h b/base/metrics/sparse_histogram.h index 1c35ed8..a77c020 100644 --- a/base/metrics/sparse_histogram.h +++ b/base/metrics/sparse_histogram.h @@ -5,13 +5,16 @@ #ifndef BASE_METRICS_SPARSE_HISTOGRAM_H_ #define BASE_METRICS_SPARSE_HISTOGRAM_H_ +#include <stddef.h> +#include <stdint.h> + #include <map> #include <string> #include "base/base_export.h" -#include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/logging.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/metrics/histogram_base.h" #include "base/metrics/sample_map.h" @@ -32,7 +35,7 @@ class BASE_EXPORT SparseHistogram : public HistogramBase { public: // If there's one with same name, return the existing one. If not, create a // new one. - static HistogramBase* FactoryGet(const std::string& name, int32 flags); + static HistogramBase* FactoryGet(const std::string& name, int32_t flags); ~SparseHistogram() override; @@ -64,7 +67,7 @@ class BASE_EXPORT SparseHistogram : public HistogramBase { void GetParameters(DictionaryValue* params) const override; void GetCountAndBucketData(Count* count, - int64* sum, + int64_t* sum, ListValue* buckets) const override; // Helpers for emitting Ascii graphic. Each method appends data to output. diff --git a/base/metrics/statistics_recorder.h b/base/metrics/statistics_recorder.h index 5771abcb..b1d182e 100644 --- a/base/metrics/statistics_recorder.h +++ b/base/metrics/statistics_recorder.h @@ -10,16 +10,18 @@ #ifndef BASE_METRICS_STATISTICS_RECORDER_H_ #define BASE_METRICS_STATISTICS_RECORDER_H_ +#include <stdint.h> + #include <list> #include <map> #include <string> #include <vector> #include "base/base_export.h" -#include "base/basictypes.h" #include "base/callback.h" #include "base/gtest_prod_util.h" #include "base/lazy_instance.h" +#include "base/macros.h" #include "base/metrics/histogram_base.h" namespace base { @@ -106,7 +108,7 @@ class BASE_EXPORT StatisticsRecorder { // We keep all |bucket_ranges_| in a map, from checksum to a list of // |bucket_ranges_|. Checksum is calculated from the |ranges_| in // |bucket_ranges_|. - typedef std::map<uint32, std::list<const BucketRanges*>*> RangesMap; + typedef std::map<uint32_t, std::list<const BucketRanges*>*> RangesMap; friend struct DefaultLazyInstanceTraits<StatisticsRecorder>; friend class HistogramBaseTest; diff --git a/base/metrics/statistics_recorder_unittest.cc b/base/metrics/statistics_recorder_unittest.cc index 29caf49..f14d713 100644 --- a/base/metrics/statistics_recorder_unittest.cc +++ b/base/metrics/statistics_recorder_unittest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <stddef.h> + #include <vector> #include "base/bind.h" diff --git a/base/metrics/user_metrics.cc b/base/metrics/user_metrics.cc index 9db5840..55467e6 100644 --- a/base/metrics/user_metrics.cc +++ b/base/metrics/user_metrics.cc @@ -4,9 +4,12 @@ #include "base/metrics/user_metrics.h" +#include <stddef.h> + #include <vector> #include "base/lazy_instance.h" +#include "base/macros.h" #include "base/threading/thread_checker.h" namespace base { diff --git a/base/move.h b/base/move.h index 91c91df..f90e9e8 100644 --- a/base/move.h +++ b/base/move.h @@ -8,6 +8,7 @@ #include <utility> #include "base/compiler_specific.h" +#include "base/macros.h" // TODO(crbug.com/566182): DEPRECATED! // Use DISALLOW_COPY_AND_ASSIGN instead, or if your type will be used in diff --git a/base/numerics/safe_conversions.h b/base/numerics/safe_conversions.h index db2ff84..baac188 100644 --- a/base/numerics/safe_conversions.h +++ b/base/numerics/safe_conversions.h @@ -5,6 +5,8 @@ #ifndef BASE_NUMERICS_SAFE_CONVERSIONS_H_ #define BASE_NUMERICS_SAFE_CONVERSIONS_H_ +#include <stddef.h> + #include <limits> #include <type_traits> diff --git a/base/numerics/safe_conversions_impl.h b/base/numerics/safe_conversions_impl.h index f4bc916..02e68e2 100644 --- a/base/numerics/safe_conversions_impl.h +++ b/base/numerics/safe_conversions_impl.h @@ -5,6 +5,9 @@ #ifndef BASE_NUMERICS_SAFE_CONVERSIONS_IMPL_H_ #define BASE_NUMERICS_SAFE_CONVERSIONS_IMPL_H_ +#include <limits.h> +#include <stdint.h> + #include <limits> #include "base/template_util.h" diff --git a/base/numerics/safe_math.h b/base/numerics/safe_math.h index cbf00f0..e824ba6 100644 --- a/base/numerics/safe_math.h +++ b/base/numerics/safe_math.h @@ -5,6 +5,8 @@ #ifndef BASE_NUMERICS_SAFE_MATH_H_ #define BASE_NUMERICS_SAFE_MATH_H_ +#include <stddef.h> + #include "base/numerics/safe_math_impl.h" namespace base { diff --git a/base/numerics/safe_math_impl.h b/base/numerics/safe_math_impl.h index d6977f4..4fbcc04 100644 --- a/base/numerics/safe_math_impl.h +++ b/base/numerics/safe_math_impl.h @@ -5,6 +5,7 @@ #ifndef BASE_NUMERICS_SAFE_MATH_IMPL_H_ #define BASE_NUMERICS_SAFE_MATH_IMPL_H_ +#include <stddef.h> #include <stdint.h> #include <cmath> diff --git a/base/numerics/safe_numerics_unittest.cc b/base/numerics/safe_numerics_unittest.cc index 6de2980..5242e13 100644 --- a/base/numerics/safe_numerics_unittest.cc +++ b/base/numerics/safe_numerics_unittest.cc @@ -2,9 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#if defined(COMPILER_MSVC) && defined(ARCH_CPU_32_BITS) -#include <mmintrin.h> -#endif +#include <stddef.h> #include <stdint.h> #include <limits> @@ -14,8 +12,13 @@ #include "base/numerics/safe_conversions.h" #include "base/numerics/safe_math.h" #include "base/template_util.h" +#include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" +#if defined(COMPILER_MSVC) && defined(ARCH_CPU_32_BITS) +#include <mmintrin.h> +#endif + using std::numeric_limits; using base::CheckedNumeric; using base::checked_cast; diff --git a/base/observer_list.h b/base/observer_list.h index 5173ce1..3156421 100644 --- a/base/observer_list.h +++ b/base/observer_list.h @@ -5,12 +5,14 @@ #ifndef BASE_OBSERVER_LIST_H_ #define BASE_OBSERVER_LIST_H_ +#include <stddef.h> + #include <algorithm> #include <limits> #include <vector> -#include "base/basictypes.h" #include "base/logging.h" +#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/stl_util.h" diff --git a/base/observer_list_threadsafe.h b/base/observer_list_threadsafe.h index e420494..6154ae9 100644 --- a/base/observer_list_threadsafe.h +++ b/base/observer_list_threadsafe.h @@ -8,10 +8,10 @@ #include <algorithm> #include <map> -#include "base/basictypes.h" #include "base/bind.h" #include "base/location.h" #include "base/logging.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/message_loop/message_loop.h" #include "base/observer_list.h" diff --git a/base/os_compat_android.cc b/base/os_compat_android.cc index b2756b2..1eb6536 100644 --- a/base/os_compat_android.cc +++ b/base/os_compat_android.cc @@ -6,6 +6,7 @@ #include <asm/unistd.h> #include <errno.h> +#include <limits.h> #include <math.h> #include <sys/stat.h> #include <sys/syscall.h> diff --git a/base/path_service.cc b/base/path_service.cc index 3b9b69e..3f954d7 100644 --- a/base/path_service.cc +++ b/base/path_service.cc @@ -16,6 +16,7 @@ #include "base/lazy_instance.h" #include "base/logging.h" #include "base/synchronization/lock.h" +#include "build/build_config.h" namespace base { diff --git a/base/path_service_unittest.cc b/base/path_service_unittest.cc index 569c0f4..2b7bea8 100644 --- a/base/path_service_unittest.cc +++ b/base/path_service_unittest.cc @@ -4,7 +4,6 @@ #include "base/path_service.h" -#include "base/basictypes.h" #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" diff --git a/base/pickle.cc b/base/pickle.cc index 678c425..d83391b 100644 --- a/base/pickle.cc +++ b/base/pickle.cc @@ -11,6 +11,7 @@ #include "base/bits.h" #include "base/macros.h" +#include "build/build_config.h" namespace base { @@ -71,7 +72,7 @@ const char* PickleIterator::GetReadPointerAndAdvance(int num_bytes) { inline const char* PickleIterator::GetReadPointerAndAdvance( int num_elements, size_t size_element) { - // Check for int32 overflow. + // Check for int32_t overflow. int64_t num_bytes = static_cast<int64_t>(num_elements) * size_element; int num_bytes32 = static_cast<int>(num_bytes); if (num_bytes != static_cast<int64_t>(num_bytes32)) diff --git a/base/pickle.h b/base/pickle.h index 8e82c62..02bc432 100644 --- a/base/pickle.h +++ b/base/pickle.h @@ -5,6 +5,7 @@ #ifndef BASE_PICKLE_H_ #define BASE_PICKLE_H_ +#include <stddef.h> #include <stdint.h> #include <string> diff --git a/base/pickle_unittest.cc b/base/pickle_unittest.cc index 6804614..b195a81 100644 --- a/base/pickle_unittest.cc +++ b/base/pickle_unittest.cc @@ -2,9 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <limits.h> +#include <stddef.h> +#include <stdint.h> + #include <string> -#include "base/basictypes.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/pickle.h" #include "base/strings/string16.h" @@ -19,10 +23,10 @@ const bool testbool1 = false; const bool testbool2 = true; const int testint = 2093847192; const long testlong = 1093847192; -const uint16 testuint16 = 32123; -const uint32 testuint32 = 1593847192; -const int64 testint64 = -0x7E8CA9253104BDFCLL; -const uint64 testuint64 = 0xCE8CA9253104BDF7ULL; +const uint16_t testuint16 = 32123; +const uint32_t testuint32 = 1593847192; +const int64_t testint64 = -0x7E8CA9253104BDFCLL; +const uint64_t testuint64 = 0xCE8CA9253104BDF7ULL; const size_t testsizet = 0xFEDC7654; const float testfloat = 3.1415926935f; const double testdouble = 2.71828182845904523; @@ -53,19 +57,19 @@ void VerifyResult(const Pickle& pickle) { EXPECT_TRUE(iter.ReadLong(&outlong)); EXPECT_EQ(testlong, outlong); - uint16 outuint16; + uint16_t outuint16; EXPECT_TRUE(iter.ReadUInt16(&outuint16)); EXPECT_EQ(testuint16, outuint16); - uint32 outuint32; + uint32_t outuint32; EXPECT_TRUE(iter.ReadUInt32(&outuint32)); EXPECT_EQ(testuint32, outuint32); - int64 outint64; + int64_t outint64; EXPECT_TRUE(iter.ReadInt64(&outint64)); EXPECT_EQ(testint64, outint64); - uint64 outuint64; + uint64_t outuint64; EXPECT_TRUE(iter.ReadUInt64(&outuint64)); EXPECT_EQ(testuint64, outuint64); @@ -147,12 +151,13 @@ TEST(PickleTest, EncodeDecode) { TEST(PickleTest, SizeTFrom64Bit) { Pickle pickle; // Under the hood size_t is always written as a 64-bit value, so simulate a - // 64-bit size_t even on 32-bit architectures by explicitly writing a uint64. + // 64-bit size_t even on 32-bit architectures by explicitly writing a + // uint64_t. EXPECT_TRUE(pickle.WriteUInt64(testuint64)); PickleIterator iter(pickle); size_t outsizet; - if (sizeof(size_t) < sizeof(uint64)) { + if (sizeof(size_t) < sizeof(uint64_t)) { // ReadSizeT() should return false when the original written value can't be // represented as a size_t. EXPECT_FALSE(iter.ReadSizeT(&outsizet)); @@ -398,10 +403,10 @@ TEST(PickleTest, Resize) { // construct a message that will be exactly the size of one payload unit, // note that any data will have a 4-byte header indicating the size - const size_t payload_size_after_header = unit - sizeof(uint32); + const size_t payload_size_after_header = unit - sizeof(uint32_t); Pickle pickle; - pickle.WriteData(data_ptr, - static_cast<int>(payload_size_after_header - sizeof(uint32))); + pickle.WriteData( + data_ptr, static_cast<int>(payload_size_after_header - sizeof(uint32_t))); size_t cur_payload = payload_size_after_header; // note: we assume 'unit' is a power of 2 @@ -409,7 +414,7 @@ TEST(PickleTest, Resize) { EXPECT_EQ(pickle.payload_size(), payload_size_after_header); // fill out a full page (noting data header) - pickle.WriteData(data_ptr, static_cast<int>(unit - sizeof(uint32))); + pickle.WriteData(data_ptr, static_cast<int>(unit - sizeof(uint32_t))); cur_payload += unit; EXPECT_EQ(unit * 2, pickle.capacity_after_header()); EXPECT_EQ(cur_payload, pickle.payload_size()); @@ -430,7 +435,7 @@ struct CustomHeader : Pickle::Header { } // namespace TEST(PickleTest, HeaderPadding) { - const uint32 kMagic = 0x12345678; + const uint32_t kMagic = 0x12345678; Pickle pickle(sizeof(CustomHeader)); pickle.WriteInt(kMagic); @@ -442,7 +447,7 @@ TEST(PickleTest, HeaderPadding) { int result; ASSERT_TRUE(iter.ReadInt(&result)); - EXPECT_EQ(static_cast<uint32>(result), kMagic); + EXPECT_EQ(static_cast<uint32_t>(result), kMagic); } TEST(PickleTest, EqualsOperator) { diff --git a/base/posix/safe_strerror.h b/base/posix/safe_strerror.h index 862a750..2945312 100644 --- a/base/posix/safe_strerror.h +++ b/base/posix/safe_strerror.h @@ -5,6 +5,8 @@ #ifndef BASE_POSIX_SAFE_STRERROR_H_ #define BASE_POSIX_SAFE_STRERROR_H_ +#include <stddef.h> + #include <string> #include "base/base_export.h" diff --git a/base/posix/unix_domain_socket_linux.cc b/base/posix/unix_domain_socket_linux.cc index 88a90f6..8b3094e 100644 --- a/base/posix/unix_domain_socket_linux.cc +++ b/base/posix/unix_domain_socket_linux.cc @@ -15,6 +15,7 @@ #include "base/pickle.h" #include "base/posix/eintr_wrapper.h" #include "base/stl_util.h" +#include "build/build_config.h" #if !defined(OS_NACL_NONSFI) #include <sys/uio.h> diff --git a/base/posix/unix_domain_socket_linux.h b/base/posix/unix_domain_socket_linux.h index 98c9d61..2ba739e 100644 --- a/base/posix/unix_domain_socket_linux.h +++ b/base/posix/unix_domain_socket_linux.h @@ -5,6 +5,7 @@ #ifndef BASE_POSIX_UNIX_DOMAIN_SOCKET_LINUX_H_ #define BASE_POSIX_UNIX_DOMAIN_SOCKET_LINUX_H_ +#include <stddef.h> #include <stdint.h> #include <sys/types.h> #include <vector> @@ -12,6 +13,7 @@ #include "base/base_export.h" #include "base/files/scoped_file.h" #include "base/process/process_handle.h" +#include "build/build_config.h" namespace base { diff --git a/base/posix/unix_domain_socket_linux_unittest.cc b/base/posix/unix_domain_socket_linux_unittest.cc index c683e3a..e4b63c0 100644 --- a/base/posix/unix_domain_socket_linux_unittest.cc +++ b/base/posix/unix_domain_socket_linux_unittest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <stddef.h> +#include <stdint.h> #include <sys/socket.h> #include <sys/types.h> #include <unistd.h> diff --git a/base/power_monitor/power_monitor.h b/base/power_monitor/power_monitor.h index 4acb3bf..683eeb9 100644 --- a/base/power_monitor/power_monitor.h +++ b/base/power_monitor/power_monitor.h @@ -6,7 +6,7 @@ #define BASE_POWER_MONITOR_POWER_MONITOR_H_ #include "base/base_export.h" -#include "base/basictypes.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/observer_list_threadsafe.h" #include "base/power_monitor/power_observer.h" diff --git a/base/power_monitor/power_monitor_device_source.cc b/base/power_monitor/power_monitor_device_source.cc index 0a39975..f54b7ba 100644 --- a/base/power_monitor/power_monitor_device_source.cc +++ b/base/power_monitor/power_monitor_device_source.cc @@ -5,6 +5,7 @@ #include "base/power_monitor/power_monitor_device_source.h" #include "base/time/time.h" +#include "build/build_config.h" namespace base { diff --git a/base/power_monitor/power_monitor_device_source.h b/base/power_monitor/power_monitor_device_source.h index fa0b039..2dabac8 100644 --- a/base/power_monitor/power_monitor_device_source.h +++ b/base/power_monitor/power_monitor_device_source.h @@ -6,11 +6,12 @@ #define BASE_POWER_MONITOR_POWER_MONITOR_DEVICE_SOURCE_H_ #include "base/base_export.h" -#include "base/basictypes.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/observer_list_threadsafe.h" #include "base/power_monitor/power_monitor_source.h" #include "base/power_monitor/power_observer.h" +#include "build/build_config.h" #if defined(OS_WIN) #include <windows.h> diff --git a/base/power_monitor/power_monitor_source.h b/base/power_monitor/power_monitor_source.h index b8f4185..e63f4f8 100644 --- a/base/power_monitor/power_monitor_source.h +++ b/base/power_monitor/power_monitor_source.h @@ -6,7 +6,7 @@ #define BASE_POWER_MONITOR_POWER_MONITOR_SOURCE_H_ #include "base/base_export.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/base/power_monitor/power_monitor_unittest.cc b/base/power_monitor/power_monitor_unittest.cc index 2df82618..798a21c 100644 --- a/base/power_monitor/power_monitor_unittest.cc +++ b/base/power_monitor/power_monitor_unittest.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/macros.h" #include "base/power_monitor/power_monitor.h" #include "base/test/power_monitor_test_base.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/base/process/internal_linux.cc b/base/process/internal_linux.cc index 1130764..d286f4e 100644 --- a/base/process/internal_linux.cc +++ b/base/process/internal_linux.cc @@ -4,6 +4,7 @@ #include "base/process/internal_linux.h" +#include <limits.h> #include <unistd.h> #include <map> diff --git a/base/process/process_metrics_ios.cc b/base/process/process_metrics_ios.cc index 5c2bb51..9625c22 100644 --- a/base/process/process_metrics_ios.cc +++ b/base/process/process_metrics_ios.cc @@ -4,6 +4,7 @@ #include "base/process/process_metrics.h" +#include <limits.h> #include <mach/task.h> #include <stddef.h> diff --git a/base/process/process_metrics_posix.cc b/base/process/process_metrics_posix.cc index 29fb591..fad581e 100644 --- a/base/process/process_metrics_posix.cc +++ b/base/process/process_metrics_posix.cc @@ -4,6 +4,7 @@ #include "base/process/process_metrics.h" +#include <limits.h> #include <stddef.h> #include <stdint.h> #include <sys/resource.h> diff --git a/base/profiler/alternate_timer.cc b/base/profiler/alternate_timer.cc index 02763cd..b2d2c70 100644 --- a/base/profiler/alternate_timer.cc +++ b/base/profiler/alternate_timer.cc @@ -4,11 +4,9 @@ #include "base/profiler/alternate_timer.h" -#include "base/basictypes.h" - namespace { -tracked_objects::NowFunction* g_time_function = NULL; +tracked_objects::NowFunction* g_time_function = nullptr; tracked_objects::TimeSourceType g_time_source_type = tracked_objects::TIME_SOURCE_TYPE_WALL_TIME; diff --git a/base/profiler/native_stack_sampler_win.cc b/base/profiler/native_stack_sampler_win.cc index 089b158..c240726 100644 --- a/base/profiler/native_stack_sampler_win.cc +++ b/base/profiler/native_stack_sampler_win.cc @@ -4,6 +4,7 @@ #include <objbase.h> #include <windows.h> +#include <stddef.h> #include <winternl.h> #include <cstdlib> diff --git a/base/profiler/scoped_profile.h b/base/profiler/scoped_profile.h index 2c4105d..657150a 100644 --- a/base/profiler/scoped_profile.h +++ b/base/profiler/scoped_profile.h @@ -14,6 +14,7 @@ #include "base/base_export.h" #include "base/location.h" +#include "base/macros.h" #include "base/profiler/tracked_time.h" #include "base/tracked_objects.h" diff --git a/base/profiler/scoped_tracker.h b/base/profiler/scoped_tracker.h index 23e2f07..a61de91 100644 --- a/base/profiler/scoped_tracker.h +++ b/base/profiler/scoped_tracker.h @@ -13,6 +13,7 @@ #include "base/bind.h" #include "base/callback_forward.h" #include "base/location.h" +#include "base/macros.h" #include "base/profiler/scoped_profile.h" namespace tracked_objects { diff --git a/base/profiler/stack_sampling_profiler.cc b/base/profiler/stack_sampling_profiler.cc index 52b412d..e89d052 100644 --- a/base/profiler/stack_sampling_profiler.cc +++ b/base/profiler/stack_sampling_profiler.cc @@ -12,6 +12,7 @@ #include "base/callback.h" #include "base/lazy_instance.h" #include "base/location.h" +#include "base/macros.h" #include "base/profiler/native_stack_sampler.h" #include "base/synchronization/lock.h" #include "base/thread_task_runner_handle.h" diff --git a/base/profiler/stack_sampling_profiler.h b/base/profiler/stack_sampling_profiler.h index e9b1804..ae252bb 100644 --- a/base/profiler/stack_sampling_profiler.h +++ b/base/profiler/stack_sampling_profiler.h @@ -5,12 +5,15 @@ #ifndef BASE_PROFILER_STACK_SAMPLING_PROFILER_H_ #define BASE_PROFILER_STACK_SAMPLING_PROFILER_H_ +#include <stddef.h> + #include <string> #include <vector> #include "base/base_export.h" #include "base/callback.h" #include "base/files/file_path.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/strings/string16.h" #include "base/synchronization/waitable_event.h" diff --git a/base/profiler/stack_sampling_profiler_unittest.cc b/base/profiler/stack_sampling_profiler_unittest.cc index 2ba769f..fad25a5 100644 --- a/base/profiler/stack_sampling_profiler_unittest.cc +++ b/base/profiler/stack_sampling_profiler_unittest.cc @@ -2,10 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <stddef.h> +#include <stdint.h> + #include <cstdlib> #include "base/bind.h" #include "base/compiler_specific.h" +#include "base/macros.h" #include "base/memory/scoped_vector.h" #include "base/message_loop/message_loop.h" #include "base/native_library.h" @@ -374,7 +378,7 @@ const void* MaybeFixupFunctionAddressForILT(const void* function_address) { if (*opcode == 0xe9) { // This is a relative jump instruction. Assume we're in the ILT and compute // the function start address from the instruction offset. - const int32* offset = reinterpret_cast<const int32*>(opcode + 1); + const int32_t* offset = reinterpret_cast<const int32_t*>(opcode + 1); const unsigned char* next_instruction = reinterpret_cast<const unsigned char*>(offset + 1); return next_instruction + *offset; diff --git a/base/profiler/tracked_time.cc b/base/profiler/tracked_time.cc index e5da68f..7e0040c 100644 --- a/base/profiler/tracked_time.cc +++ b/base/profiler/tracked_time.cc @@ -13,7 +13,7 @@ namespace tracked_objects { Duration::Duration() : ms_(0) {} -Duration::Duration(int32 duration) : ms_(duration) {} +Duration::Duration(int32_t duration) : ms_(duration) {} Duration& Duration::operator+=(const Duration& other) { ms_ += other.ms_; @@ -39,15 +39,16 @@ bool Duration::operator>(const Duration& other) const { // static Duration Duration::FromMilliseconds(int ms) { return Duration(ms); } -int32 Duration::InMilliseconds() const { return ms_; } +int32_t Duration::InMilliseconds() const { + return ms_; +} //------------------------------------------------------------------------------ TrackedTime::TrackedTime() : ms_(0) {} -TrackedTime::TrackedTime(int32 ms) : ms_(ms) {} +TrackedTime::TrackedTime(int32_t ms) : ms_(ms) {} TrackedTime::TrackedTime(const base::TimeTicks& time) - : ms_(static_cast<int32>((time - base::TimeTicks()).InMilliseconds())) { -} + : ms_(static_cast<int32_t>((time - base::TimeTicks()).InMilliseconds())) {} // static TrackedTime TrackedTime::Now() { diff --git a/base/profiler/tracked_time.h b/base/profiler/tracked_time.h index 2363274..b32f41b 100644 --- a/base/profiler/tracked_time.h +++ b/base/profiler/tracked_time.h @@ -5,9 +5,9 @@ #ifndef BASE_PROFILER_TRACKED_TIME_H_ #define BASE_PROFILER_TRACKED_TIME_H_ +#include <stdint.h> #include "base/base_export.h" -#include "base/basictypes.h" #include "base/time/time.h" namespace tracked_objects { @@ -36,14 +36,14 @@ class BASE_EXPORT Duration { // Similar to base::TimeDelta. static Duration FromMilliseconds(int ms); - int32 InMilliseconds() const; + int32_t InMilliseconds() const; private: friend class TrackedTime; - explicit Duration(int32 duration); + explicit Duration(int32_t duration); // Internal time is stored directly in milliseconds. - int32 ms_; + int32_t ms_; }; class BASE_EXPORT TrackedTime { // Similar to base::TimeTicks. @@ -56,14 +56,14 @@ class BASE_EXPORT TrackedTime { // Similar to base::TimeTicks. TrackedTime operator+(const Duration& other) const; bool is_null() const; - static TrackedTime FromMilliseconds(int32 ms) { return TrackedTime(ms); } + static TrackedTime FromMilliseconds(int32_t ms) { return TrackedTime(ms); } private: friend class Duration; - explicit TrackedTime(int32 ms); + explicit TrackedTime(int32_t ms); // Internal duration is stored directly in milliseconds. - uint32 ms_; + uint32_t ms_; }; } // namespace tracked_objects diff --git a/base/profiler/tracked_time_unittest.cc b/base/profiler/tracked_time_unittest.cc index c105688..f6d35ba 100644 --- a/base/profiler/tracked_time_unittest.cc +++ b/base/profiler/tracked_time_unittest.cc @@ -4,6 +4,8 @@ // Test of classes in tracked_time.cc +#include <stdint.h> + #include "base/profiler/tracked_time.h" #include "base/time/time.h" #include "base/tracked_objects.h" @@ -14,8 +16,8 @@ namespace tracked_objects { TEST(TrackedTimeTest, TrackedTimerMilliseconds) { // First make sure we basicallly transfer simple milliseconds values as // expected. Most critically, things should not become null. - int32 kSomeMilliseconds = 243; // Some example times. - int64 kReallyBigMilliseconds = (1LL << 35) + kSomeMilliseconds; + int32_t kSomeMilliseconds = 243; // Some example times. + int64_t kReallyBigMilliseconds = (1LL << 35) + kSomeMilliseconds; TrackedTime some = TrackedTime() + Duration::FromMilliseconds(kSomeMilliseconds); diff --git a/base/profiler/win32_stack_frame_unwinder.cc b/base/profiler/win32_stack_frame_unwinder.cc index 0e7f5b2..472f4f1 100644 --- a/base/profiler/win32_stack_frame_unwinder.cc +++ b/base/profiler/win32_stack_frame_unwinder.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/macros.h" #include "base/profiler/win32_stack_frame_unwinder.h" #include <windows.h> diff --git a/base/profiler/win32_stack_frame_unwinder_unittest.cc b/base/profiler/win32_stack_frame_unwinder_unittest.cc index 622415c..264ddf3 100644 --- a/base/profiler/win32_stack_frame_unwinder_unittest.cc +++ b/base/profiler/win32_stack_frame_unwinder_unittest.cc @@ -8,6 +8,7 @@ #include <vector> #include "base/compiler_specific.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/base/rand_util.cc b/base/rand_util.cc index 1a3b79e..fab6c66 100644 --- a/base/rand_util.cc +++ b/base/rand_util.cc @@ -4,6 +4,7 @@ #include "base/rand_util.h" +#include <limits.h> #include <math.h> #include <stdint.h> diff --git a/base/rand_util.h b/base/rand_util.h index e0fb91f..881dbd5 100644 --- a/base/rand_util.h +++ b/base/rand_util.h @@ -5,6 +5,7 @@ #ifndef BASE_RAND_UTIL_H_ #define BASE_RAND_UTIL_H_ +#include <stddef.h> #include <stdint.h> #include <string> diff --git a/base/rand_util_nacl.cc b/base/rand_util_nacl.cc index b771dc4..35b4b26 100644 --- a/base/rand_util_nacl.cc +++ b/base/rand_util_nacl.cc @@ -5,8 +5,9 @@ #include "base/rand_util.h" #include <nacl/nacl_random.h> +#include <stddef.h> +#include <stdint.h> -#include "base/basictypes.h" #include "base/logging.h" namespace { @@ -28,8 +29,8 @@ void GetRandomBytes(void* output, size_t num_bytes) { namespace base { // NOTE: This function must be cryptographically secure. http://crbug.com/140076 -uint64 RandUint64() { - uint64 result; +uint64_t RandUint64() { + uint64_t result; GetRandomBytes(&result, sizeof(result)); return result; } diff --git a/base/rand_util_posix.cc b/base/rand_util_posix.cc index fe73b96..6a6e05a 100644 --- a/base/rand_util_posix.cc +++ b/base/rand_util_posix.cc @@ -6,6 +6,8 @@ #include <errno.h> #include <fcntl.h> +#include <stddef.h> +#include <stdint.h> #include <unistd.h> #include "base/files/file_util.h" @@ -39,8 +41,8 @@ base::LazyInstance<URandomFd>::Leaky g_urandom_fd = LAZY_INSTANCE_INITIALIZER; namespace base { // NOTE: This function must be cryptographically secure. http://crbug.com/140076 -uint64 RandUint64() { - uint64 number; +uint64_t RandUint64() { + uint64_t number; RandBytes(&number, sizeof(number)); return number; } diff --git a/base/rand_util_unittest.cc b/base/rand_util_unittest.cc index 689b8ad39..ea803ee 100644 --- a/base/rand_util_unittest.cc +++ b/base/rand_util_unittest.cc @@ -4,6 +4,9 @@ #include "base/rand_util.h" +#include <stddef.h> +#include <stdint.h> + #include <algorithm> #include <limits> @@ -67,7 +70,7 @@ TEST(RandUtilTest, RandBytesAsString) { TEST(RandUtilTest, RandGeneratorForRandomShuffle) { EXPECT_EQ(base::RandGenerator(1), 0U); EXPECT_LE(std::numeric_limits<ptrdiff_t>::max(), - std::numeric_limits<int64>::max()); + std::numeric_limits<int64_t>::max()); } TEST(RandUtilTest, RandGeneratorIsUniform) { @@ -83,16 +86,17 @@ TEST(RandUtilTest, RandGeneratorIsUniform) { // top half. A bit of calculus care of jar@ shows that the largest // measurable delta is when the top of the range is 3/4ths of the // way, so that's what we use in the test. - const uint64 kTopOfRange = (std::numeric_limits<uint64>::max() / 4ULL) * 3ULL; - const uint64 kExpectedAverage = kTopOfRange / 2ULL; - const uint64 kAllowedVariance = kExpectedAverage / 50ULL; // +/- 2% + const uint64_t kTopOfRange = + (std::numeric_limits<uint64_t>::max() / 4ULL) * 3ULL; + const uint64_t kExpectedAverage = kTopOfRange / 2ULL; + const uint64_t kAllowedVariance = kExpectedAverage / 50ULL; // +/- 2% const int kMinAttempts = 1000; const int kMaxAttempts = 1000000; double cumulative_average = 0.0; int count = 0; while (count < kMaxAttempts) { - uint64 value = base::RandGenerator(kTopOfRange); + uint64_t value = base::RandGenerator(kTopOfRange); cumulative_average = (count * cumulative_average + value) / (count + 1); // Don't quit too quickly for things to start converging, or we may have @@ -113,13 +117,13 @@ TEST(RandUtilTest, RandGeneratorIsUniform) { TEST(RandUtilTest, RandUint64ProducesBothValuesOfAllBits) { // This tests to see that our underlying random generator is good // enough, for some value of good enough. - uint64 kAllZeros = 0ULL; - uint64 kAllOnes = ~kAllZeros; - uint64 found_ones = kAllZeros; - uint64 found_zeros = kAllOnes; + uint64_t kAllZeros = 0ULL; + uint64_t kAllOnes = ~kAllZeros; + uint64_t found_ones = kAllZeros; + uint64_t found_zeros = kAllOnes; for (size_t i = 0; i < 1000; ++i) { - uint64 value = base::RandUint64(); + uint64_t value = base::RandUint64(); found_ones |= value; found_zeros &= value; @@ -139,7 +143,7 @@ TEST(RandUtilTest, DISABLED_RandBytesPerf) { const int kTestIterations = 10; const size_t kTestBufferSize = 1 * 1024 * 1024; - scoped_ptr<uint8[]> buffer(new uint8[kTestBufferSize]); + scoped_ptr<uint8_t[]> buffer(new uint8_t[kTestBufferSize]); const base::TimeTicks now = base::TimeTicks::Now(); for (int i = 0; i < kTestIterations; ++i) base::RandBytes(buffer.get(), kTestBufferSize); diff --git a/base/rand_util_win.cc b/base/rand_util_win.cc index 8573b6b..22fdd4d 100644 --- a/base/rand_util_win.cc +++ b/base/rand_util_win.cc @@ -5,6 +5,8 @@ #include "base/rand_util.h" #include <windows.h> +#include <stddef.h> +#include <stdint.h> // #define needed to link in RtlGenRandom(), a.k.a. SystemFunction036. See the // "Community Additions" comment on MSDN here: @@ -21,8 +23,8 @@ namespace base { // NOTE: This function must be cryptographically secure. http://crbug.com/140076 -uint64 RandUint64() { - uint64 number; +uint64_t RandUint64() { + uint64_t number; RandBytes(&number, sizeof(number)); return number; } diff --git a/base/run_loop.cc b/base/run_loop.cc index 2aa4def..b8558db4 100644 --- a/base/run_loop.cc +++ b/base/run_loop.cc @@ -6,6 +6,7 @@ #include "base/bind.h" #include "base/tracked_objects.h" +#include "build/build_config.h" #if defined(OS_WIN) #include "base/message_loop/message_pump_dispatcher.h" diff --git a/base/run_loop.h b/base/run_loop.h index 9ff8d39..e23d073 100644 --- a/base/run_loop.h +++ b/base/run_loop.h @@ -7,8 +7,10 @@ #include "base/base_export.h" #include "base/callback.h" +#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/message_loop/message_loop.h" +#include "build/build_config.h" namespace base { #if defined(OS_ANDROID) diff --git a/base/scoped_clear_errno.h b/base/scoped_clear_errno.h index 7b972fc..585f6f7 100644 --- a/base/scoped_clear_errno.h +++ b/base/scoped_clear_errno.h @@ -7,7 +7,7 @@ #include <errno.h> -#include "base/basictypes.h" +#include "base/macros.h" namespace base { diff --git a/base/scoped_generic.h b/base/scoped_generic.h index 02db2e5..d41f195 100644 --- a/base/scoped_generic.h +++ b/base/scoped_generic.h @@ -10,6 +10,7 @@ #include <algorithm> #include "base/compiler_specific.h" +#include "base/macros.h" #include "base/move.h" namespace base { diff --git a/base/scoped_native_library_unittest.cc b/base/scoped_native_library_unittest.cc index c7e4489..204aadb 100644 --- a/base/scoped_native_library_unittest.cc +++ b/base/scoped_native_library_unittest.cc @@ -3,12 +3,14 @@ // found in the LICENSE file. #include "base/scoped_native_library.h" + +#include "build/build_config.h" +#include "testing/gtest/include/gtest/gtest.h" + #if defined(OS_WIN) #include "base/files/file_path.h" #endif -#include "testing/gtest/include/gtest/gtest.h" - namespace base { // Tests whether or not a function pointer retrieved via ScopedNativeLibrary diff --git a/base/scoped_observer.h b/base/scoped_observer.h index f4738f9..13d7ca8 100644 --- a/base/scoped_observer.h +++ b/base/scoped_observer.h @@ -5,11 +5,13 @@ #ifndef BASE_SCOPED_OBSERVER_H_ #define BASE_SCOPED_OBSERVER_H_ +#include <stddef.h> + #include <algorithm> #include <vector> -#include "base/basictypes.h" #include "base/logging.h" +#include "base/macros.h" #include "base/stl_util.h" // ScopedObserver is used to keep track of the set of sources an object has diff --git a/base/security_unittest.cc b/base/security_unittest.cc index cd387fb..eebe6e0 100644 --- a/base/security_unittest.cc +++ b/base/security_unittest.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include <fcntl.h> +#include <stddef.h> #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/base/sequence_checker_impl.h b/base/sequence_checker_impl.h index 741aafe..e3c5fed 100644 --- a/base/sequence_checker_impl.h +++ b/base/sequence_checker_impl.h @@ -6,7 +6,7 @@ #define BASE_SEQUENCE_CHECKER_IMPL_H_ #include "base/base_export.h" -#include "base/basictypes.h" +#include "base/macros.h" #include "base/synchronization/lock.h" #include "base/threading/sequenced_worker_pool.h" #include "base/threading/thread_checker_impl.h" diff --git a/base/sequence_checker_unittest.cc b/base/sequence_checker_unittest.cc index d721cbf..e261b04 100644 --- a/base/sequence_checker_unittest.cc +++ b/base/sequence_checker_unittest.cc @@ -4,13 +4,15 @@ #include "base/sequence_checker.h" +#include <stddef.h> + #include <utility> -#include "base/basictypes.h" #include "base/bind.h" #include "base/bind_helpers.h" #include "base/location.h" #include "base/logging.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/single_thread_task_runner.h" diff --git a/base/sequenced_task_runner_helpers.h b/base/sequenced_task_runner_helpers.h index da519bf..7980b46 100644 --- a/base/sequenced_task_runner_helpers.h +++ b/base/sequenced_task_runner_helpers.h @@ -5,8 +5,8 @@ #ifndef BASE_SEQUENCED_TASK_RUNNER_HELPERS_H_ #define BASE_SEQUENCED_TASK_RUNNER_HELPERS_H_ -#include "base/basictypes.h" #include "base/debug/alias.h" +#include "base/macros.h" // TODO(akalin): Investigate whether it's possible to just have // SequencedTaskRunner use these helpers (instead of MessageLoop). diff --git a/base/sha1.h b/base/sha1.h index 998cccb..902e301 100644 --- a/base/sha1.h +++ b/base/sha1.h @@ -5,6 +5,8 @@ #ifndef BASE_SHA1_H_ #define BASE_SHA1_H_ +#include <stddef.h> + #include <string> #include "base/base_export.h" diff --git a/base/sha1_portable.cc b/base/sha1_portable.cc index 0b9df83..dd2ab6f 100644 --- a/base/sha1_portable.cc +++ b/base/sha1_portable.cc @@ -4,9 +4,10 @@ #include "base/sha1.h" +#include <stddef.h> +#include <stdint.h> #include <string.h> -#include "base/basictypes.h" namespace base { @@ -50,20 +51,20 @@ class SecureHashAlgorithm { void Pad(); void Process(); - uint32 A, B, C, D, E; + uint32_t A, B, C, D, E; - uint32 H[5]; + uint32_t H[5]; union { - uint32 W[80]; - uint8 M[64]; + uint32_t W[80]; + uint8_t M[64]; }; - uint32 cursor; - uint64 l; + uint32_t cursor; + uint64_t l; }; -static inline uint32 f(uint32 t, uint32 B, uint32 C, uint32 D) { +static inline uint32_t f(uint32_t t, uint32_t B, uint32_t C, uint32_t D) { if (t < 20) { return (B & C) | ((~B) & D); } else if (t < 40) { @@ -75,11 +76,11 @@ static inline uint32 f(uint32 t, uint32 B, uint32 C, uint32 D) { } } -static inline uint32 S(uint32 n, uint32 X) { +static inline uint32_t S(uint32_t n, uint32_t X) { return (X << n) | (X >> (32-n)); } -static inline uint32 K(uint32 t) { +static inline uint32_t K(uint32_t t) { if (t < 20) { return 0x5a827999; } else if (t < 40) { @@ -91,7 +92,7 @@ static inline uint32 K(uint32 t) { } } -static inline void swapends(uint32* t) { +static inline void swapends(uint32_t* t) { *t = (*t >> 24) | ((*t >> 8) & 0xff00) | ((*t & 0xff00) << 8) | (*t << 24); } @@ -121,7 +122,7 @@ void SecureHashAlgorithm::Final() { } void SecureHashAlgorithm::Update(const void* data, size_t nbytes) { - const uint8* d = reinterpret_cast<const uint8*>(data); + const uint8_t* d = reinterpret_cast<const uint8_t*>(data); while (nbytes--) { M[cursor++] = *d++; if (cursor >= 64) @@ -155,7 +156,7 @@ void SecureHashAlgorithm::Pad() { } void SecureHashAlgorithm::Process() { - uint32 t; + uint32_t t; // Each a...e corresponds to a section in the FIPS 180-3 algorithm. @@ -179,7 +180,7 @@ void SecureHashAlgorithm::Process() { // d. for (t = 0; t < 80; ++t) { - uint32 TEMP = S(5, A) + f(t, B, C, D) + E + W[t] + K(t); + uint32_t TEMP = S(5, A) + f(t, B, C, D) + E + W[t] + K(t); E = D; D = C; C = S(30, B); diff --git a/base/sha1_unittest.cc b/base/sha1_unittest.cc index b29fe46..ea9cf63 100644 --- a/base/sha1_unittest.cc +++ b/base/sha1_unittest.cc @@ -4,9 +4,10 @@ #include "base/sha1.h" +#include <stddef.h> + #include <string> -#include "base/basictypes.h" #include "testing/gtest/include/gtest/gtest.h" TEST(SHA1Test, Test1) { diff --git a/base/strings/string_number_conversions_unittest.cc b/base/strings/string_number_conversions_unittest.cc index f4bdbce..907227e 100644 --- a/base/strings/string_number_conversions_unittest.cc +++ b/base/strings/string_number_conversions_unittest.cc @@ -5,6 +5,7 @@ #include "base/strings/string_number_conversions.h" #include <errno.h> +#include <limits.h> #include <stddef.h> #include <stdint.h> #include <stdio.h> diff --git a/base/strings/string_piece.cc b/base/strings/string_piece.cc index db0433a..c26bb36 100644 --- a/base/strings/string_piece.cc +++ b/base/strings/string_piece.cc @@ -5,6 +5,8 @@ #include "base/strings/string_piece.h" +#include <limits.h> + #include <algorithm> #include <ostream> diff --git a/base/supports_user_data.h b/base/supports_user_data.h index 711ee7d..5c1c7e9 100644 --- a/base/supports_user_data.h +++ b/base/supports_user_data.h @@ -8,6 +8,7 @@ #include <map> #include "base/base_export.h" +#include "base/macros.h" #include "base/memory/linked_ptr.h" #include "base/memory/ref_counted.h" #include "base/threading/thread_checker.h" diff --git a/base/sync_socket.h b/base/sync_socket.h index 201fb1c..fcf4155 100644 --- a/base/sync_socket.h +++ b/base/sync_socket.h @@ -9,17 +9,20 @@ // data. Because the receiving is blocking, they can be used to perform // rudimentary cross-process synchronization with low latency. -#include "base/basictypes.h" -#if defined(OS_WIN) -#include <windows.h> -#endif -#include <sys/types.h> +#include <stddef.h> #include "base/base_export.h" #include "base/compiler_specific.h" +#include "base/macros.h" #include "base/process/process_handle.h" #include "base/synchronization/waitable_event.h" #include "base/time/time.h" +#include "build/build_config.h" + +#if defined(OS_WIN) +#include <windows.h> +#endif +#include <sys/types.h> #if defined(OS_POSIX) #include "base/file_descriptor_posix.h" diff --git a/base/sync_socket_nacl.cc b/base/sync_socket_nacl.cc index 9e9243d..4a02082e 100644 --- a/base/sync_socket_nacl.cc +++ b/base/sync_socket_nacl.cc @@ -6,6 +6,7 @@ #include <errno.h> #include <limits.h> +#include <stddef.h> #include <stdio.h> #include <sys/types.h> diff --git a/base/sync_socket_posix.cc b/base/sync_socket_posix.cc index 51b38a5..7b9995ce 100644 --- a/base/sync_socket_posix.cc +++ b/base/sync_socket_posix.cc @@ -7,6 +7,7 @@ #include <errno.h> #include <fcntl.h> #include <limits.h> +#include <stddef.h> #include <stdio.h> #include <sys/ioctl.h> #include <sys/socket.h> @@ -19,6 +20,7 @@ #include "base/files/file_util.h" #include "base/logging.h" #include "base/threading/thread_restrictions.h" +#include "build/build_config.h" namespace base { diff --git a/base/sync_socket_unittest.cc b/base/sync_socket_unittest.cc index 0a2f3a7e..97a1aec 100644 --- a/base/sync_socket_unittest.cc +++ b/base/sync_socket_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/basictypes.h" +#include "base/macros.h" #include "base/sync_socket.h" #include "base/threading/simple_thread.h" #include "base/time/time.h" diff --git a/base/sync_socket_win.cc b/base/sync_socket_win.cc index 4b5040c..067c7de 100644 --- a/base/sync_socket_win.cc +++ b/base/sync_socket_win.cc @@ -4,7 +4,11 @@ #include "base/sync_socket.h" +#include <limits.h> +#include <stddef.h> + #include "base/logging.h" +#include "base/macros.h" #include "base/rand_util.h" #include "base/threading/thread_restrictions.h" #include "base/win/scoped_handle.h" diff --git a/base/synchronization/cancellation_flag.h b/base/synchronization/cancellation_flag.h index 0f0f08e..f2f83f4 100644 --- a/base/synchronization/cancellation_flag.h +++ b/base/synchronization/cancellation_flag.h @@ -5,8 +5,9 @@ #ifndef BASE_SYNCHRONIZATION_CANCELLATION_FLAG_H_ #define BASE_SYNCHRONIZATION_CANCELLATION_FLAG_H_ -#include "base/base_export.h" #include "base/atomicops.h" +#include "base/base_export.h" +#include "base/macros.h" #include "base/threading/platform_thread.h" namespace base { diff --git a/base/synchronization/condition_variable.h b/base/synchronization/condition_variable.h index 91e4d13..a41b2ba 100644 --- a/base/synchronization/condition_variable.h +++ b/base/synchronization/condition_variable.h @@ -65,17 +65,16 @@ #ifndef BASE_SYNCHRONIZATION_CONDITION_VARIABLE_H_ #define BASE_SYNCHRONIZATION_CONDITION_VARIABLE_H_ +#include "base/base_export.h" +#include "base/logging.h" +#include "base/macros.h" +#include "base/synchronization/lock.h" #include "build/build_config.h" #if defined(OS_POSIX) #include <pthread.h> #endif -#include "base/base_export.h" -#include "base/basictypes.h" -#include "base/logging.h" -#include "base/synchronization/lock.h" - namespace base { class ConditionVarImpl; diff --git a/base/synchronization/condition_variable_posix.cc b/base/synchronization/condition_variable_posix.cc index 0e4668f..d86fd18 100644 --- a/base/synchronization/condition_variable_posix.cc +++ b/base/synchronization/condition_variable_posix.cc @@ -5,11 +5,13 @@ #include "base/synchronization/condition_variable.h" #include <errno.h> +#include <stdint.h> #include <sys/time.h> #include "base/synchronization/lock.h" #include "base/threading/thread_restrictions.h" #include "base/time/time.h" +#include "build/build_config.h" namespace base { @@ -73,7 +75,7 @@ void ConditionVariable::Wait() { void ConditionVariable::TimedWait(const TimeDelta& max_time) { base::ThreadRestrictions::AssertWaitAllowed(); - int64 usecs = max_time.InMicroseconds(); + int64_t usecs = max_time.InMicroseconds(); struct timespec relative_time; relative_time.tv_sec = usecs / Time::kMicrosecondsPerSecond; relative_time.tv_nsec = diff --git a/base/synchronization/condition_variable_unittest.cc b/base/synchronization/condition_variable_unittest.cc index e63a723..4503922 100644 --- a/base/synchronization/condition_variable_unittest.cc +++ b/base/synchronization/condition_variable_unittest.cc @@ -20,6 +20,7 @@ #include "base/threading/thread.h" #include "base/threading/thread_collision_warner.h" #include "base/time/time.h" +#include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" diff --git a/base/synchronization/condition_variable_win.cc b/base/synchronization/condition_variable_win.cc index 4256ac8..6812eb9 100644 --- a/base/synchronization/condition_variable_win.cc +++ b/base/synchronization/condition_variable_win.cc @@ -8,6 +8,7 @@ #include <stack> #include "base/compiler_specific.h" +#include "base/macros.h" #include "base/synchronization/lock.h" #include "base/threading/thread_restrictions.h" #include "base/time/time.h" diff --git a/base/synchronization/lock.h b/base/synchronization/lock.h index 81e2748..f7dd35d 100644 --- a/base/synchronization/lock.h +++ b/base/synchronization/lock.h @@ -7,8 +7,10 @@ #include "base/base_export.h" #include "base/logging.h" +#include "base/macros.h" #include "base/synchronization/lock_impl.h" #include "base/threading/platform_thread.h" +#include "build/build_config.h" namespace base { diff --git a/base/synchronization/lock_impl.h b/base/synchronization/lock_impl.h index 42e2f99..ed85987 100644 --- a/base/synchronization/lock_impl.h +++ b/base/synchronization/lock_impl.h @@ -5,6 +5,8 @@ #ifndef BASE_SYNCHRONIZATION_LOCK_IMPL_H_ #define BASE_SYNCHRONIZATION_LOCK_IMPL_H_ +#include "base/base_export.h" +#include "base/macros.h" #include "build/build_config.h" #if defined(OS_WIN) @@ -13,9 +15,6 @@ #include <pthread.h> #endif -#include "base/base_export.h" -#include "base/basictypes.h" - namespace base { namespace internal { diff --git a/base/synchronization/lock_unittest.cc b/base/synchronization/lock_unittest.cc index 967efb8..27f335e 100644 --- a/base/synchronization/lock_unittest.cc +++ b/base/synchronization/lock_unittest.cc @@ -7,6 +7,7 @@ #include <stdlib.h> #include "base/compiler_specific.h" +#include "base/macros.h" #include "base/threading/platform_thread.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/base/synchronization/waitable_event.h b/base/synchronization/waitable_event.h index c35af54..b5d91d0 100644 --- a/base/synchronization/waitable_event.h +++ b/base/synchronization/waitable_event.h @@ -5,8 +5,11 @@ #ifndef BASE_SYNCHRONIZATION_WAITABLE_EVENT_H_ #define BASE_SYNCHRONIZATION_WAITABLE_EVENT_H_ +#include <stddef.h> + #include "base/base_export.h" -#include "base/basictypes.h" +#include "base/macros.h" +#include "build/build_config.h" #if defined(OS_WIN) #include "base/win/scoped_handle.h" diff --git a/base/synchronization/waitable_event_posix.cc b/base/synchronization/waitable_event_posix.cc index 696ffc7..64d4376 100644 --- a/base/synchronization/waitable_event_posix.cc +++ b/base/synchronization/waitable_event_posix.cc @@ -2,13 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <stddef.h> + #include <algorithm> #include <vector> #include "base/logging.h" -#include "base/synchronization/waitable_event.h" #include "base/synchronization/condition_variable.h" #include "base/synchronization/lock.h" +#include "base/synchronization/waitable_event.h" #include "base/threading/thread_restrictions.h" // ----------------------------------------------------------------------------- diff --git a/base/synchronization/waitable_event_unittest.cc b/base/synchronization/waitable_event_unittest.cc index be56cf1..2930409 100644 --- a/base/synchronization/waitable_event_unittest.cc +++ b/base/synchronization/waitable_event_unittest.cc @@ -4,9 +4,12 @@ #include "base/synchronization/waitable_event.h" +#include <stddef.h> + #include "base/compiler_specific.h" #include "base/threading/platform_thread.h" #include "base/time/time.h" +#include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" namespace base { diff --git a/base/synchronization/waitable_event_watcher_posix.cc b/base/synchronization/waitable_event_watcher_posix.cc index ad66a4c..aa425f2 100644 --- a/base/synchronization/waitable_event_watcher_posix.cc +++ b/base/synchronization/waitable_event_watcher_posix.cc @@ -6,6 +6,7 @@ #include "base/bind.h" #include "base/location.h" +#include "base/macros.h" #include "base/single_thread_task_runner.h" #include "base/synchronization/lock.h" #include "base/synchronization/waitable_event.h" diff --git a/base/synchronization/waitable_event_watcher_unittest.cc b/base/synchronization/waitable_event_watcher_unittest.cc index 5319d1e..58444b3 100644 --- a/base/synchronization/waitable_event_watcher_unittest.cc +++ b/base/synchronization/waitable_event_watcher_unittest.cc @@ -6,10 +6,12 @@ #include "base/bind.h" #include "base/callback.h" +#include "base/macros.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/synchronization/waitable_event.h" #include "base/threading/platform_thread.h" +#include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" namespace base { diff --git a/base/synchronization/waitable_event_win.cc b/base/synchronization/waitable_event_win.cc index 2d6d734..6674cdb 100644 --- a/base/synchronization/waitable_event_win.cc +++ b/base/synchronization/waitable_event_win.cc @@ -5,6 +5,7 @@ #include "base/synchronization/waitable_event.h" #include <windows.h> +#include <stddef.h> #include "base/logging.h" #include "base/numerics/safe_conversions.h" diff --git a/base/sys_byteorder.h b/base/sys_byteorder.h index efdf7df..ddb3f5b 100644 --- a/base/sys_byteorder.h +++ b/base/sys_byteorder.h @@ -11,22 +11,23 @@ #ifndef BASE_SYS_BYTEORDER_H_ #define BASE_SYS_BYTEORDER_H_ -#include "base/basictypes.h" +#include <stdint.h> + #include "build/build_config.h" namespace base { // Returns a value with all bytes in |x| swapped, i.e. reverses the endianness. -inline uint16 ByteSwap(uint16 x) { +inline uint16_t ByteSwap(uint16_t x) { return ((x & 0x00ff) << 8) | ((x & 0xff00) >> 8); } -inline uint32 ByteSwap(uint32 x) { +inline uint32_t ByteSwap(uint32_t x) { return ((x & 0x000000fful) << 24) | ((x & 0x0000ff00ul) << 8) | ((x & 0x00ff0000ul) >> 8) | ((x & 0xff000000ul) >> 24); } -inline uint64 ByteSwap(uint64 x) { +inline uint64_t ByteSwap(uint64_t x) { return ((x & 0x00000000000000ffull) << 56) | ((x & 0x000000000000ff00ull) << 40) | ((x & 0x0000000000ff0000ull) << 24) | @@ -39,21 +40,21 @@ inline uint64 ByteSwap(uint64 x) { // Converts the bytes in |x| from host order (endianness) to little endian, and // returns the result. -inline uint16 ByteSwapToLE16(uint16 x) { +inline uint16_t ByteSwapToLE16(uint16_t x) { #if defined(ARCH_CPU_LITTLE_ENDIAN) return x; #else return ByteSwap(x); #endif } -inline uint32 ByteSwapToLE32(uint32 x) { +inline uint32_t ByteSwapToLE32(uint32_t x) { #if defined(ARCH_CPU_LITTLE_ENDIAN) return x; #else return ByteSwap(x); #endif } -inline uint64 ByteSwapToLE64(uint64 x) { +inline uint64_t ByteSwapToLE64(uint64_t x) { #if defined(ARCH_CPU_LITTLE_ENDIAN) return x; #else @@ -63,21 +64,21 @@ inline uint64 ByteSwapToLE64(uint64 x) { // Converts the bytes in |x| from network to host order (endianness), and // returns the result. -inline uint16 NetToHost16(uint16 x) { +inline uint16_t NetToHost16(uint16_t x) { #if defined(ARCH_CPU_LITTLE_ENDIAN) return ByteSwap(x); #else return x; #endif } -inline uint32 NetToHost32(uint32 x) { +inline uint32_t NetToHost32(uint32_t x) { #if defined(ARCH_CPU_LITTLE_ENDIAN) return ByteSwap(x); #else return x; #endif } -inline uint64 NetToHost64(uint64 x) { +inline uint64_t NetToHost64(uint64_t x) { #if defined(ARCH_CPU_LITTLE_ENDIAN) return ByteSwap(x); #else @@ -87,21 +88,21 @@ inline uint64 NetToHost64(uint64 x) { // Converts the bytes in |x| from host to network order (endianness), and // returns the result. -inline uint16 HostToNet16(uint16 x) { +inline uint16_t HostToNet16(uint16_t x) { #if defined(ARCH_CPU_LITTLE_ENDIAN) return ByteSwap(x); #else return x; #endif } -inline uint32 HostToNet32(uint32 x) { +inline uint32_t HostToNet32(uint32_t x) { #if defined(ARCH_CPU_LITTLE_ENDIAN) return ByteSwap(x); #else return x; #endif } -inline uint64 HostToNet64(uint64 x) { +inline uint64_t HostToNet64(uint64_t x) { #if defined(ARCH_CPU_LITTLE_ENDIAN) return ByteSwap(x); #else diff --git a/base/sys_info.cc b/base/sys_info.cc index 21bfb34..cebb363 100644 --- a/base/sys_info.cc +++ b/base/sys_info.cc @@ -12,6 +12,7 @@ #include "base/strings/string_util.h" #include "base/sys_info_internal.h" #include "base/time/time.h" +#include "build/build_config.h" namespace base { diff --git a/base/sys_info.h b/base/sys_info.h index 5777e09..5686dcb 100644 --- a/base/sys_info.h +++ b/base/sys_info.h @@ -5,6 +5,7 @@ #ifndef BASE_SYS_INFO_H_ #define BASE_SYS_INFO_H_ +#include <stddef.h> #include <stdint.h> #include <map> diff --git a/base/sys_info_android.cc b/base/sys_info_android.cc index 4b923d1..cb25cdc 100644 --- a/base/sys_info_android.cc +++ b/base/sys_info_android.cc @@ -5,6 +5,8 @@ #include "base/sys_info.h" #include <dlfcn.h> +#include <stddef.h> +#include <stdint.h> #include <sys/system_properties.h> #include "base/android/sys_utils.h" diff --git a/base/sys_info_chromeos.cc b/base/sys_info_chromeos.cc index 9d33e56..e35bd0a 100644 --- a/base/sys_info_chromeos.cc +++ b/base/sys_info_chromeos.cc @@ -4,11 +4,15 @@ #include "base/sys_info.h" +#include <stddef.h> +#include <stdint.h> + #include "base/environment.h" #include "base/files/file.h" #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/lazy_instance.h" +#include "base/macros.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_piece.h" #include "base/strings/string_split.h" diff --git a/base/sys_info_freebsd.cc b/base/sys_info_freebsd.cc index bc175ed..0b2008d 100644 --- a/base/sys_info_freebsd.cc +++ b/base/sys_info_freebsd.cc @@ -4,6 +4,8 @@ #include "base/sys_info.h" +#include <stddef.h> +#include <stdint.h> #include <sys/sysctl.h> #include "base/logging.h" diff --git a/base/sys_info_internal.h b/base/sys_info_internal.h index 636a384..a179219 100644 --- a/base/sys_info_internal.h +++ b/base/sys_info_internal.h @@ -5,6 +5,8 @@ #ifndef BASE_SYS_INFO_INTERNAL_H_ #define BASE_SYS_INFO_INTERNAL_H_ +#include "base/macros.h" + namespace base { namespace internal { diff --git a/base/sys_info_ios.mm b/base/sys_info_ios.mm index 56e7b55..9a95298 100644 --- a/base/sys_info_ios.mm +++ b/base/sys_info_ios.mm @@ -5,6 +5,8 @@ #include "base/sys_info.h" #include <mach/mach.h> +#include <stddef.h> +#include <stdint.h> #include <sys/sysctl.h> #include <sys/types.h> #import <UIKit/UIKit.h> @@ -12,6 +14,7 @@ #include "base/logging.h" #include "base/mac/scoped_mach_port.h" #include "base/mac/scoped_nsautorelease_pool.h" +#include "base/macros.h" #include "base/strings/sys_string_conversions.h" namespace base { diff --git a/base/sys_info_linux.cc b/base/sys_info_linux.cc index 8ee967f..8e1f533 100644 --- a/base/sys_info_linux.cc +++ b/base/sys_info_linux.cc @@ -4,6 +4,9 @@ #include "base/sys_info.h" +#include <stddef.h> +#include <stdint.h> + #include <limits> #include "base/files/file_util.h" @@ -12,6 +15,7 @@ #include "base/numerics/safe_conversions.h" #include "base/strings/string_number_conversions.h" #include "base/sys_info_internal.h" +#include "build/build_config.h" namespace { diff --git a/base/sys_info_mac.cc b/base/sys_info_mac.cc index 919a66f..ff1ec5c 100644 --- a/base/sys_info_mac.cc +++ b/base/sys_info_mac.cc @@ -8,11 +8,14 @@ #include <CoreServices/CoreServices.h> #include <mach/mach_host.h> #include <mach/mach_init.h> +#include <stddef.h> +#include <stdint.h> #include <sys/sysctl.h> #include <sys/types.h> #include "base/logging.h" #include "base/mac/scoped_mach_port.h" +#include "base/macros.h" #include "base/strings/stringprintf.h" namespace base { diff --git a/base/sys_info_openbsd.cc b/base/sys_info_openbsd.cc index 506b836..531c117 100644 --- a/base/sys_info_openbsd.cc +++ b/base/sys_info_openbsd.cc @@ -4,11 +4,14 @@ #include "base/sys_info.h" +#include <stddef.h> +#include <stdint.h> #include <sys/param.h> #include <sys/shm.h> #include <sys/sysctl.h> #include "base/logging.h" +#include "base/macros.h" namespace { diff --git a/base/sys_info_posix.cc b/base/sys_info_posix.cc index 407134d..85ae039 100644 --- a/base/sys_info_posix.cc +++ b/base/sys_info_posix.cc @@ -5,6 +5,8 @@ #include "base/sys_info.h" #include <errno.h> +#include <stddef.h> +#include <stdint.h> #include <string.h> #include <sys/param.h> #include <sys/resource.h> @@ -17,6 +19,7 @@ #include "base/strings/utf_string_conversions.h" #include "base/sys_info_internal.h" #include "base/threading/thread_restrictions.h" +#include "build/build_config.h" #if defined(OS_ANDROID) #include <sys/vfs.h> diff --git a/base/sys_info_unittest.cc b/base/sys_info_unittest.cc index 2a54226..3f284ba 100644 --- a/base/sys_info_unittest.cc +++ b/base/sys_info_unittest.cc @@ -2,11 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <stdint.h> + #include "base/environment.h" #include "base/files/file_util.h" #include "base/sys_info.h" #include "base/threading/platform_thread.h" #include "base/time/time.h" +#include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" diff --git a/base/sys_info_win.cc b/base/sys_info_win.cc index 3bd1d5c..e2da617 100644 --- a/base/sys_info_win.cc +++ b/base/sys_info_win.cc @@ -5,6 +5,8 @@ #include "base/sys_info.h" #include <windows.h> +#include <stddef.h> +#include <stdint.h> #include <limits> diff --git a/base/system_monitor/system_monitor.h b/base/system_monitor/system_monitor.h index 5dd849f..8cfe5e9 100644 --- a/base/system_monitor/system_monitor.h +++ b/base/system_monitor/system_monitor.h @@ -6,7 +6,7 @@ #define BASE_SYSTEM_MONITOR_SYSTEM_MONITOR_H_ #include "base/base_export.h" -#include "base/basictypes.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/observer_list_threadsafe.h" #include "build/build_config.h" diff --git a/base/system_monitor/system_monitor_unittest.cc b/base/system_monitor/system_monitor_unittest.cc index f3db4c7..a874f8b 100644 --- a/base/system_monitor/system_monitor_unittest.cc +++ b/base/system_monitor/system_monitor_unittest.cc @@ -4,6 +4,7 @@ #include "base/system_monitor/system_monitor.h" +#include "base/macros.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/test/mock_devices_changed_observer.h" diff --git a/base/task/cancelable_task_tracker.cc b/base/task/cancelable_task_tracker.cc index a2e4799..a756f4e 100644 --- a/base/task/cancelable_task_tracker.cc +++ b/base/task/cancelable_task_tracker.cc @@ -4,6 +4,8 @@ #include "base/task/cancelable_task_tracker.h" +#include <stddef.h> + #include <utility> #include "base/bind.h" @@ -92,7 +94,7 @@ CancelableTaskTracker::TaskId CancelableTaskTracker::PostTaskAndReply( CancellationFlag* flag = new CancellationFlag(); TaskId id = next_id_; - next_id_++; // int64 is big enough that we ignore the potential overflow. + next_id_++; // int64_t is big enough that we ignore the potential overflow. const Closure& untrack_closure = Bind(&CancelableTaskTracker::Untrack, weak_factory_.GetWeakPtr(), id); @@ -117,7 +119,7 @@ CancelableTaskTracker::TaskId CancelableTaskTracker::NewTrackedTaskId( DCHECK(base::ThreadTaskRunnerHandle::IsSet()); TaskId id = next_id_; - next_id_++; // int64 is big enough that we ignore the potential overflow. + next_id_++; // int64_t is big enough that we ignore the potential overflow. // Will be deleted by |untrack_and_delete_flag| after Untrack(). CancellationFlag* flag = new CancellationFlag(); diff --git a/base/task/cancelable_task_tracker.h b/base/task/cancelable_task_tracker.h index b8a8b70..86b5a45 100644 --- a/base/task/cancelable_task_tracker.h +++ b/base/task/cancelable_task_tracker.h @@ -36,10 +36,12 @@ #ifndef BASE_TASK_CANCELABLE_TASK_TRACKER_H_ #define BASE_TASK_CANCELABLE_TASK_TRACKER_H_ +#include <stdint.h> + #include "base/base_export.h" -#include "base/basictypes.h" #include "base/callback.h" #include "base/containers/hash_tables.h" +#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/task_runner_util.h" #include "base/threading/thread_checker.h" @@ -56,7 +58,7 @@ class TaskRunner; class BASE_EXPORT CancelableTaskTracker { public: // All values except kBadTaskId are valid. - typedef int64 TaskId; + typedef int64_t TaskId; static const TaskId kBadTaskId; typedef base::Callback<bool()> IsCanceledCallback; diff --git a/base/task_runner.h b/base/task_runner.h index 6369c4f..6dd82cc 100644 --- a/base/task_runner.h +++ b/base/task_runner.h @@ -5,8 +5,9 @@ #ifndef BASE_TASK_RUNNER_H_ #define BASE_TASK_RUNNER_H_ +#include <stddef.h> + #include "base/base_export.h" -#include "base/basictypes.h" #include "base/callback_forward.h" #include "base/memory/ref_counted.h" #include "base/time/time.h" diff --git a/base/template_util.h b/base/template_util.h index 6d4ac9f..d58807a 100644 --- a/base/template_util.h +++ b/base/template_util.h @@ -5,7 +5,7 @@ #ifndef BASE_TEMPLATE_UTIL_H_ #define BASE_TEMPLATE_UTIL_H_ -#include <cstddef> // For size_t. +#include <stddef.h> #include "build/build_config.h" diff --git a/base/template_util_unittest.cc b/base/template_util_unittest.cc index 32883f2..b960ab1 100644 --- a/base/template_util_unittest.cc +++ b/base/template_util_unittest.cc @@ -4,7 +4,6 @@ #include "base/template_util.h" -#include "base/basictypes.h" #include "testing/gtest/include/gtest/gtest.h" namespace base { diff --git a/base/third_party/icu/icu_utf.cc b/base/third_party/icu/icu_utf.cc index b47c8ac..2b67c5d 100644 --- a/base/third_party/icu/icu_utf.cc +++ b/base/third_party/icu/icu_utf.cc @@ -74,32 +74,28 @@ namespace base_icu { * lead bytes above 0xf4 are illegal. * We keep them in this table for skipping long ISO 10646-UTF-8 sequences. */ -const uint8 -utf8_countTrailBytes[256]={ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 3, 3, 3, 3, 3, - 3, 3, 3, /* illegal in Unicode */ - 4, 4, 4, 4, /* illegal in Unicode */ - 5, 5, /* illegal in Unicode */ - 0, 0 /* illegal bytes 0xfe and 0xff */ +const uint8_t utf8_countTrailBytes[256] = + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, + 3, 3, /* illegal in Unicode */ + 4, 4, 4, 4, /* illegal in Unicode */ + 5, 5, /* illegal in Unicode */ + 0, 0 /* illegal bytes 0xfe and 0xff */ }; static const UChar32 @@ -133,12 +129,15 @@ utf8_errorValue[6]={ * * Note that a UBool is the same as an int8_t. */ -UChar32 -utf8_nextCharSafeBody(const uint8 *s, int32 *pi, int32 length, UChar32 c, UBool strict) { - int32 i=*pi; - uint8 count=CBU8_COUNT_TRAIL_BYTES(c); +UChar32 utf8_nextCharSafeBody(const uint8_t* s, + int32_t* pi, + int32_t length, + UChar32 c, + UBool strict) { + int32_t i = *pi; + uint8_t count = CBU8_COUNT_TRAIL_BYTES(c); if((i)+count<=(length)) { - uint8 trail, illegal=0; + uint8_t trail, illegal = 0; CBU8_MASK_LEAD_BYTE((c), count); /* count==0 for illegally leading trail bytes and the illegal bytes 0xfe and 0xff */ @@ -192,7 +191,7 @@ utf8_nextCharSafeBody(const uint8 *s, int32 *pi, int32 length, UChar32 c, UBool /* illegal is also set if count>=4 */ if(illegal || (c)<utf8_minLegal[count] || (CBU_IS_SURROGATE(c) && strict!=-2)) { /* error handling */ - uint8 errorCount=count; + uint8_t errorCount = count; /* don't go beyond this sequence */ i=*pi; while(count>0 && CBU8_IS_TRAIL(s[i])) { @@ -210,7 +209,7 @@ utf8_nextCharSafeBody(const uint8 *s, int32 *pi, int32 length, UChar32 c, UBool } } else /* too few bytes left */ { /* error handling */ - int32 i0=i; + int32_t i0 = i; /* don't just set (i)=(length) in case there is an illegal sequence */ while((i)<(length) && CBU8_IS_TRAIL(s[i])) { ++(i); diff --git a/base/third_party/icu/icu_utf.h b/base/third_party/icu/icu_utf.h index 2b993b0..4370fde 100644 --- a/base/third_party/icu/icu_utf.h +++ b/base/third_party/icu/icu_utf.h @@ -17,13 +17,13 @@ #ifndef BASE_THIRD_PARTY_ICU_ICU_UTF_H_ #define BASE_THIRD_PARTY_ICU_ICU_UTF_H_ -#include "base/basictypes.h" +#include <stdint.h> namespace base_icu { -typedef int32 UChar32; -typedef uint16 UChar; -typedef int8 UBool; +typedef int32_t UChar32; +typedef uint16_t UChar; +typedef int8_t UBool; // General --------------------------------------------------------------------- // from utf.h @@ -54,10 +54,9 @@ typedef int8 UBool; * @return TRUE or FALSE * @stable ICU 2.4 */ -#define CBU_IS_UNICODE_NONCHAR(c) \ - ((c)>=0xfdd0 && \ - ((uint32)(c)<=0xfdef || ((c)&0xfffe)==0xfffe) && \ - (uint32)(c)<=0x10ffff) +#define CBU_IS_UNICODE_NONCHAR(c) \ + ((c) >= 0xfdd0 && ((uint32_t)(c) <= 0xfdef || ((c)&0xfffe) == 0xfffe) && \ + (uint32_t)(c) <= 0x10ffff) /** * Is c a Unicode code point value (0..U+10ffff) @@ -76,11 +75,10 @@ typedef int8 UBool; * @return TRUE or FALSE * @stable ICU 2.4 */ -#define CBU_IS_UNICODE_CHAR(c) \ - ((uint32)(c)<0xd800 || \ - ((uint32)(c)>0xdfff && \ - (uint32)(c)<=0x10ffff && \ - !CBU_IS_UNICODE_NONCHAR(c))) +#define CBU_IS_UNICODE_CHAR(c) \ + ((uint32_t)(c) < 0xd800 || \ + ((uint32_t)(c) > 0xdfff && (uint32_t)(c) <= 0x10ffff && \ + !CBU_IS_UNICODE_NONCHAR(c))) /** * Is this code point a surrogate (U+d800..U+dfff)? @@ -103,13 +101,14 @@ typedef int8 UBool; // UTF-8 macros ---------------------------------------------------------------- // from utf8.h -extern const uint8 utf8_countTrailBytes[256]; +extern const uint8_t utf8_countTrailBytes[256]; /** * Count the trail bytes for a UTF-8 lead byte. * @internal */ -#define CBU8_COUNT_TRAIL_BYTES(leadByte) (base_icu::utf8_countTrailBytes[(uint8)leadByte]) +#define CBU8_COUNT_TRAIL_BYTES(leadByte) \ + (base_icu::utf8_countTrailBytes[(uint8_t)leadByte]) /** * Mask a UTF-8 lead byte, leave only the lower bits that form part of the code point value. @@ -131,7 +130,7 @@ extern const uint8 utf8_countTrailBytes[256]; * @return TRUE or FALSE * @stable ICU 2.4 */ -#define CBU8_IS_LEAD(c) ((uint8)((c)-0xc0)<0x3e) +#define CBU8_IS_LEAD(c) ((uint8_t)((c)-0xc0) < 0x3e) /** * Is this code unit (byte) a UTF-8 trail byte? @@ -148,16 +147,16 @@ extern const uint8 utf8_countTrailBytes[256]; * @return 1..4, or 0 if c is a surrogate or not a Unicode code point * @stable ICU 2.4 */ -#define CBU8_LENGTH(c) \ - ((uint32)(c)<=0x7f ? 1 : \ - ((uint32)(c)<=0x7ff ? 2 : \ - ((uint32)(c)<=0xd7ff ? 3 : \ - ((uint32)(c)<=0xdfff || (uint32)(c)>0x10ffff ? 0 : \ - ((uint32)(c)<=0xffff ? 3 : 4)\ - ) \ - ) \ - ) \ - ) +#define CBU8_LENGTH(c) \ + ((uint32_t)(c) <= 0x7f \ + ? 1 \ + : ((uint32_t)(c) <= 0x7ff \ + ? 2 \ + : ((uint32_t)(c) <= 0xd7ff \ + ? 3 \ + : ((uint32_t)(c) <= 0xdfff || (uint32_t)(c) > 0x10ffff \ + ? 0 \ + : ((uint32_t)(c) <= 0xffff ? 3 : 4))))) /** * The maximum number of UTF-8 code units (bytes) per Unicode code point (U+0000..U+10ffff). @@ -170,7 +169,11 @@ extern const uint8 utf8_countTrailBytes[256]; * Function for handling "next code point" with error-checking. * @internal */ -UChar32 utf8_nextCharSafeBody(const uint8 *s, int32 *pi, int32 length, UChar32 c, UBool strict); +UChar32 utf8_nextCharSafeBody(const uint8_t* s, + int32_t* pi, + int32_t length, + UChar32 c, + UBool strict); /** * Get a code point from a string at a code point boundary offset, @@ -183,55 +186,59 @@ UChar32 utf8_nextCharSafeBody(const uint8 *s, int32 *pi, int32 length, UChar32 c * If the offset points to a trail byte or an illegal UTF-8 sequence, then * c is set to a negative value. * - * @param s const uint8 * string + * @param s const uint8_t * string * @param i string offset, i<length * @param length string length * @param c output UChar32 variable, set to <0 in case of an error * @see CBU8_NEXT_UNSAFE * @stable ICU 2.4 */ -#define CBU8_NEXT(s, i, length, c) { \ - (c)=(s)[(i)++]; \ - if(((uint8)(c))>=0x80) { \ - if(CBU8_IS_LEAD(c)) { \ - (c)=base_icu::utf8_nextCharSafeBody((const uint8 *)s, &(i), (int32)(length), c, -1); \ - } else { \ - (c)=CBU_SENTINEL; \ - } \ - } \ -} +#define CBU8_NEXT(s, i, length, c) \ + { \ + (c) = (s)[(i)++]; \ + if (((uint8_t)(c)) >= 0x80) { \ + if (CBU8_IS_LEAD(c)) { \ + (c) = base_icu::utf8_nextCharSafeBody((const uint8_t*)s, &(i), \ + (int32_t)(length), c, -1); \ + } else { \ + (c) = CBU_SENTINEL; \ + } \ + } \ + } /** * Append a code point to a string, overwriting 1 to 4 bytes. * The offset points to the current end of the string contents * and is advanced (post-increment). - * "Unsafe" macro, assumes a valid code point and sufficient space in the string. + * "Unsafe" macro, assumes a valid code point and sufficient space in the + * string. * Otherwise, the result is undefined. * - * @param s const uint8 * string buffer + * @param s const uint8_t * string buffer * @param i string offset * @param c code point to append * @see CBU8_APPEND * @stable ICU 2.4 */ -#define CBU8_APPEND_UNSAFE(s, i, c) { \ - if((uint32)(c)<=0x7f) { \ - (s)[(i)++]=(uint8)(c); \ - } else { \ - if((uint32)(c)<=0x7ff) { \ - (s)[(i)++]=(uint8)(((c)>>6)|0xc0); \ - } else { \ - if((uint32)(c)<=0xffff) { \ - (s)[(i)++]=(uint8)(((c)>>12)|0xe0); \ - } else { \ - (s)[(i)++]=(uint8)(((c)>>18)|0xf0); \ - (s)[(i)++]=(uint8)((((c)>>12)&0x3f)|0x80); \ - } \ - (s)[(i)++]=(uint8)((((c)>>6)&0x3f)|0x80); \ - } \ - (s)[(i)++]=(uint8)(((c)&0x3f)|0x80); \ - } \ -} +#define CBU8_APPEND_UNSAFE(s, i, c) \ + { \ + if ((uint32_t)(c) <= 0x7f) { \ + (s)[(i)++] = (uint8_t)(c); \ + } else { \ + if ((uint32_t)(c) <= 0x7ff) { \ + (s)[(i)++] = (uint8_t)(((c) >> 6) | 0xc0); \ + } else { \ + if ((uint32_t)(c) <= 0xffff) { \ + (s)[(i)++] = (uint8_t)(((c) >> 12) | 0xe0); \ + } else { \ + (s)[(i)++] = (uint8_t)(((c) >> 18) | 0xf0); \ + (s)[(i)++] = (uint8_t)((((c) >> 12) & 0x3f) | 0x80); \ + } \ + (s)[(i)++] = (uint8_t)((((c) >> 6) & 0x3f) | 0x80); \ + } \ + (s)[(i)++] = (uint8_t)(((c)&0x3f) | 0x80); \ + } \ + } // UTF-16 macros --------------------------------------------------------------- // from utf16.h @@ -325,7 +332,7 @@ UChar32 utf8_nextCharSafeBody(const uint8 *s, int32 *pi, int32 length, UChar32 c * @return 1 or 2 * @stable ICU 2.4 */ -#define CBU16_LENGTH(c) ((uint32)(c)<=0xffff ? 1 : 2) +#define CBU16_LENGTH(c) ((uint32_t)(c) <= 0xffff ? 1 : 2) /** * The maximum number of 16-bit code units per Unicode code point (U+0000..U+10ffff). @@ -353,16 +360,17 @@ UChar32 utf8_nextCharSafeBody(const uint8 *s, int32 *pi, int32 length, UChar32 c * @param c output UChar32 variable * @stable ICU 2.4 */ -#define CBU16_NEXT(s, i, length, c) { \ - (c)=(s)[(i)++]; \ - if(CBU16_IS_LEAD(c)) { \ - uint16 __c2; \ - if((i)<(length) && CBU16_IS_TRAIL(__c2=(s)[(i)])) { \ - ++(i); \ - (c)=CBU16_GET_SUPPLEMENTARY((c), __c2); \ - } \ - } \ -} +#define CBU16_NEXT(s, i, length, c) \ + { \ + (c) = (s)[(i)++]; \ + if (CBU16_IS_LEAD(c)) { \ + uint16_t __c2; \ + if ((i) < (length) && CBU16_IS_TRAIL(__c2 = (s)[(i)])) { \ + ++(i); \ + (c) = CBU16_GET_SUPPLEMENTARY((c), __c2); \ + } \ + } \ + } /** * Append a code point to a string, overwriting 1 or 2 code units. @@ -377,14 +385,15 @@ UChar32 utf8_nextCharSafeBody(const uint8 *s, int32 *pi, int32 length, UChar32 c * @see CBU16_APPEND * @stable ICU 2.4 */ -#define CBU16_APPEND_UNSAFE(s, i, c) { \ - if((uint32)(c)<=0xffff) { \ - (s)[(i)++]=(uint16)(c); \ - } else { \ - (s)[(i)++]=(uint16)(((c)>>10)+0xd7c0); \ - (s)[(i)++]=(uint16)(((c)&0x3ff)|0xdc00); \ - } \ -} +#define CBU16_APPEND_UNSAFE(s, i, c) \ + { \ + if ((uint32_t)(c) <= 0xffff) { \ + (s)[(i)++] = (uint16_t)(c); \ + } else { \ + (s)[(i)++] = (uint16_t)(((c) >> 10) + 0xd7c0); \ + (s)[(i)++] = (uint16_t)(((c)&0x3ff) | 0xdc00); \ + } \ + } } // namesapce base_icu diff --git a/base/third_party/nspr/prtime.cc b/base/third_party/nspr/prtime.cc index a7c5a3a..177cc90 100644 --- a/base/third_party/nspr/prtime.cc +++ b/base/third_party/nspr/prtime.cc @@ -65,6 +65,8 @@ * Unit tests are in base/time/pr_time_unittest.cc. */ +#include <limits.h> + #include "base/logging.h" #include "base/third_party/nspr/prtime.h" #include "build/build_config.h" diff --git a/base/third_party/symbolize/symbolize.cc b/base/third_party/symbolize/symbolize.cc index f4861df..db82b04 100644 --- a/base/third_party/symbolize/symbolize.cc +++ b/base/third_party/symbolize/symbolize.cc @@ -773,7 +773,7 @@ static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void *pc, char *out, // Run the call back if it's installed. // Note: relocation (and much of the rest of this code) will be // wrong for prelinked shared libraries and PIE executables. - uint64 relocation = (elf_type == ET_DYN) ? start_address : 0; + uint64_t relocation = (elf_type == ET_DYN) ? start_address : 0; int num_bytes_written = g_symbolize_callback(wrapped_object_fd.get(), pc, out, out_size, relocation); diff --git a/base/third_party/symbolize/symbolize.h b/base/third_party/symbolize/symbolize.h index f617184..aeb2fe3 100644 --- a/base/third_party/symbolize/symbolize.h +++ b/base/third_party/symbolize/symbolize.h @@ -117,7 +117,7 @@ _START_GOOGLE_NAMESPACE_ // and return the size of the output written. On error, the callback // function should return -1. typedef int (*SymbolizeCallback)(int fd, void *pc, char *out, size_t out_size, - uint64 relocation); + uint64_t relocation); void InstallSymbolizeCallback(SymbolizeCallback callback); // Installs a callback function, which will be called instead of diff --git a/base/third_party/symbolize/utilities.h b/base/third_party/symbolize/utilities.h index 0bed526..3971145 100644 --- a/base/third_party/symbolize/utilities.h +++ b/base/third_party/symbolize/utilities.h @@ -6,6 +6,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -typedef uint64_t uint64; +typedef uint64_t uint64_t; #define HAVE_SYMBOLIZE 1 #define ATTRIBUTE_NOINLINE __attribute__ ((noinline)) diff --git a/base/time/pr_time_unittest.cc b/base/time/pr_time_unittest.cc index 06043a5..3f1a348 100644 --- a/base/time/pr_time_unittest.cc +++ b/base/time/pr_time_unittest.cc @@ -6,8 +6,10 @@ #include <time.h> #include "base/compiler_specific.h" +#include "base/macros.h" #include "base/third_party/nspr/prtime.h" #include "base/time/time.h" +#include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" using base::Time; diff --git a/base/time/time.cc b/base/time/time.cc index 53851fb..76ffeb7 100644 --- a/base/time/time.cc +++ b/base/time/time.cc @@ -12,8 +12,10 @@ #include "base/lazy_instance.h" #include "base/logging.h" +#include "base/macros.h" #include "base/strings/stringprintf.h" #include "base/third_party/nspr/prtime.h" +#include "build/build_config.h" namespace base { @@ -21,7 +23,7 @@ namespace base { // static TimeDelta TimeDelta::Max() { - return TimeDelta(std::numeric_limits<int64>::max()); + return TimeDelta(std::numeric_limits<int64_t>::max()); } int TimeDelta::InDays() const { @@ -56,10 +58,10 @@ double TimeDelta::InSecondsF() const { return static_cast<double>(delta_) / Time::kMicrosecondsPerSecond; } -int64 TimeDelta::InSeconds() const { +int64_t TimeDelta::InSeconds() const { if (is_max()) { // Preserve max to prevent overflow. - return std::numeric_limits<int64>::max(); + return std::numeric_limits<int64_t>::max(); } return delta_ / Time::kMicrosecondsPerSecond; } @@ -72,46 +74,46 @@ double TimeDelta::InMillisecondsF() const { return static_cast<double>(delta_) / Time::kMicrosecondsPerMillisecond; } -int64 TimeDelta::InMilliseconds() const { +int64_t TimeDelta::InMilliseconds() const { if (is_max()) { // Preserve max to prevent overflow. - return std::numeric_limits<int64>::max(); + return std::numeric_limits<int64_t>::max(); } return delta_ / Time::kMicrosecondsPerMillisecond; } -int64 TimeDelta::InMillisecondsRoundedUp() const { +int64_t TimeDelta::InMillisecondsRoundedUp() const { if (is_max()) { // Preserve max to prevent overflow. - return std::numeric_limits<int64>::max(); + return std::numeric_limits<int64_t>::max(); } return (delta_ + Time::kMicrosecondsPerMillisecond - 1) / Time::kMicrosecondsPerMillisecond; } -int64 TimeDelta::InMicroseconds() const { +int64_t TimeDelta::InMicroseconds() const { if (is_max()) { // Preserve max to prevent overflow. - return std::numeric_limits<int64>::max(); + return std::numeric_limits<int64_t>::max(); } return delta_; } namespace time_internal { -int64 SaturatedAdd(TimeDelta delta, int64 value) { - CheckedNumeric<int64> rv(delta.delta_); +int64_t SaturatedAdd(TimeDelta delta, int64_t value) { + CheckedNumeric<int64_t> rv(delta.delta_); rv += value; return FromCheckedNumeric(rv); } -int64 SaturatedSub(TimeDelta delta, int64 value) { - CheckedNumeric<int64> rv(delta.delta_); +int64_t SaturatedSub(TimeDelta delta, int64_t value) { + CheckedNumeric<int64_t> rv(delta.delta_); rv -= value; return FromCheckedNumeric(rv); } -int64 FromCheckedNumeric(const CheckedNumeric<int64> value) { +int64_t FromCheckedNumeric(const CheckedNumeric<int64_t> value) { if (value.IsValid()) return value.ValueUnsafe(); @@ -119,7 +121,7 @@ int64 FromCheckedNumeric(const CheckedNumeric<int64> value) { // is. Instead, return max/(-max), which is something that clients can reason // about. // TODO(rvargas) crbug.com/332611: don't use internal values. - int64 limit = std::numeric_limits<int64>::max(); + int64_t limit = std::numeric_limits<int64_t>::max(); if (value.validity() == internal::RANGE_UNDERFLOW) limit = -limit; return value.ValueOrDefault(limit); @@ -135,7 +137,7 @@ std::ostream& operator<<(std::ostream& os, TimeDelta time_delta) { // static Time Time::Max() { - return Time(std::numeric_limits<int64>::max()); + return Time(std::numeric_limits<int64_t>::max()); } // static @@ -154,7 +156,7 @@ time_t Time::ToTimeT() const { // Preserve max without offset to prevent overflow. return std::numeric_limits<time_t>::max(); } - if (std::numeric_limits<int64>::max() - kTimeTToMicrosecondsOffset <= us_) { + if (std::numeric_limits<int64_t>::max() - kTimeTToMicrosecondsOffset <= us_) { DLOG(WARNING) << "Overflow when converting base::Time with internal " << "value " << us_ << " to time_t."; return std::numeric_limits<time_t>::max(); @@ -210,14 +212,14 @@ double Time::ToJsTime() const { kMicrosecondsPerMillisecond); } -int64 Time::ToJavaTime() const { +int64_t Time::ToJavaTime() const { if (is_null()) { // Preserve 0 so the invalid result doesn't depend on the platform. return 0; } if (is_max()) { // Preserve max without offset to prevent overflow. - return std::numeric_limits<int64>::max(); + return std::numeric_limits<int64_t>::max(); } return ((us_ - kTimeTToMicrosecondsOffset) / kMicrosecondsPerMillisecond); diff --git a/base/time/time.h b/base/time/time.h index 6c06fbc..066d910 100644 --- a/base/time/time.h +++ b/base/time/time.h @@ -49,12 +49,13 @@ #ifndef BASE_TIME_TIME_H_ #define BASE_TIME_TIME_H_ +#include <stdint.h> #include <time.h> #include <iosfwd> +#include <limits> #include "base/base_export.h" -#include "base/basictypes.h" #include "base/numerics/safe_math.h" #include "build/build_config.h" @@ -77,8 +78,6 @@ #include "base/gtest_prod_util.h" #endif -#include <limits> - namespace base { class TimeDelta; @@ -88,14 +87,14 @@ class TimeDelta; // time classes instead. namespace time_internal { -// Add or subtract |value| from a TimeDelta. The int64 argument and return value -// are in terms of a microsecond timebase. -BASE_EXPORT int64 SaturatedAdd(TimeDelta delta, int64 value); -BASE_EXPORT int64 SaturatedSub(TimeDelta delta, int64 value); +// Add or subtract |value| from a TimeDelta. The int64_t argument and return +// value are in terms of a microsecond timebase. +BASE_EXPORT int64_t SaturatedAdd(TimeDelta delta, int64_t value); +BASE_EXPORT int64_t SaturatedSub(TimeDelta delta, int64_t value); -// Clamp |value| on overflow and underflow conditions. The int64 argument and +// Clamp |value| on overflow and underflow conditions. The int64_t argument and // return value are in terms of a microsecond timebase. -BASE_EXPORT int64 FromCheckedNumeric(const CheckedNumeric<int64> value); +BASE_EXPORT int64_t FromCheckedNumeric(const CheckedNumeric<int64_t> value); } // namespace time_internal @@ -110,11 +109,11 @@ class BASE_EXPORT TimeDelta { static TimeDelta FromDays(int days); static TimeDelta FromHours(int hours); static TimeDelta FromMinutes(int minutes); - static TimeDelta FromSeconds(int64 secs); - static TimeDelta FromMilliseconds(int64 ms); + static TimeDelta FromSeconds(int64_t secs); + static TimeDelta FromMilliseconds(int64_t ms); static TimeDelta FromSecondsD(double secs); static TimeDelta FromMillisecondsD(double ms); - static TimeDelta FromMicroseconds(int64 us); + static TimeDelta FromMicroseconds(int64_t us); #if defined(OS_WIN) static TimeDelta FromQPCValue(LONGLONG qpc_value); #endif @@ -123,9 +122,7 @@ class BASE_EXPORT TimeDelta { // when deserializing a |TimeDelta| structure, using a value known to be // compatible. It is not provided as a constructor because the integer type // may be unclear from the perspective of a caller. - static TimeDelta FromInternalValue(int64 delta) { - return TimeDelta(delta); - } + static TimeDelta FromInternalValue(int64_t delta) { return TimeDelta(delta); } // Returns the maximum time delta, which should be greater than any reasonable // time delta we might compare it to. Adding or subtracting the maximum time @@ -136,16 +133,14 @@ class BASE_EXPORT TimeDelta { // use this and do arithmetic on it, as it is more error prone than using the // provided operators. // For serializing, use FromInternalValue to reconstitute. - int64 ToInternalValue() const { - return delta_; - } + int64_t ToInternalValue() const { return delta_; } // Returns the magnitude (absolute value) of this TimeDelta. TimeDelta magnitude() const { // Some toolchains provide an incomplete C++11 implementation and lack an - // int64 overload for std::abs(). The following is a simple branchless + // int64_t overload for std::abs(). The following is a simple branchless // implementation: - const int64 mask = delta_ >> (sizeof(delta_) * 8 - 1); + const int64_t mask = delta_ >> (sizeof(delta_) * 8 - 1); return TimeDelta((delta_ + mask) ^ mask); } @@ -155,9 +150,7 @@ class BASE_EXPORT TimeDelta { } // Returns true if the time delta is the maximum time delta. - bool is_max() const { - return delta_ == std::numeric_limits<int64>::max(); - } + bool is_max() const { return delta_ == std::numeric_limits<int64_t>::max(); } #if defined(OS_POSIX) struct timespec ToTimeSpec() const; @@ -172,11 +165,11 @@ class BASE_EXPORT TimeDelta { int InHours() const; int InMinutes() const; double InSecondsF() const; - int64 InSeconds() const; + int64_t InSeconds() const; double InMillisecondsF() const; - int64 InMilliseconds() const; - int64 InMillisecondsRoundedUp() const; - int64 InMicroseconds() const; + int64_t InMilliseconds() const; + int64_t InMillisecondsRoundedUp() const; + int64_t InMicroseconds() const; TimeDelta& operator=(TimeDelta other) { delta_ = other.delta_; @@ -204,13 +197,13 @@ class BASE_EXPORT TimeDelta { // Computations with numeric types. template<typename T> TimeDelta operator*(T a) const { - CheckedNumeric<int64> rv(delta_); + CheckedNumeric<int64_t> rv(delta_); rv *= a; return TimeDelta(time_internal::FromCheckedNumeric(rv)); } template<typename T> TimeDelta operator/(T a) const { - CheckedNumeric<int64> rv(delta_); + CheckedNumeric<int64_t> rv(delta_); rv /= a; return TimeDelta(time_internal::FromCheckedNumeric(rv)); } @@ -223,9 +216,7 @@ class BASE_EXPORT TimeDelta { return *this = (*this / a); } - int64 operator/(TimeDelta a) const { - return delta_ / a.delta_; - } + int64_t operator/(TimeDelta a) const { return delta_ / a.delta_; } TimeDelta operator%(TimeDelta a) const { return TimeDelta(delta_ % a.delta_); } @@ -251,20 +242,19 @@ class BASE_EXPORT TimeDelta { } private: - friend int64 time_internal::SaturatedAdd(TimeDelta delta, int64 value); - friend int64 time_internal::SaturatedSub(TimeDelta delta, int64 value); + friend int64_t time_internal::SaturatedAdd(TimeDelta delta, int64_t value); + friend int64_t time_internal::SaturatedSub(TimeDelta delta, int64_t value); // Constructs a delta given the duration in microseconds. This is private // to avoid confusion by callers with an integer constructor. Use // FromSeconds, FromMilliseconds, etc. instead. - explicit TimeDelta(int64 delta_us) : delta_(delta_us) { - } + explicit TimeDelta(int64_t delta_us) : delta_(delta_us) {} // Private method to build a delta from a double. static TimeDelta FromDouble(double value); // Delta in microseconds. - int64 delta_; + int64_t delta_; }; template<typename T> @@ -289,20 +279,21 @@ namespace time_internal { template<class TimeClass> class TimeBase { public: - static const int64 kHoursPerDay = 24; - static const int64 kMillisecondsPerSecond = 1000; - static const int64 kMillisecondsPerDay = kMillisecondsPerSecond * 60 * 60 * - kHoursPerDay; - static const int64 kMicrosecondsPerMillisecond = 1000; - static const int64 kMicrosecondsPerSecond = kMicrosecondsPerMillisecond * - kMillisecondsPerSecond; - static const int64 kMicrosecondsPerMinute = kMicrosecondsPerSecond * 60; - static const int64 kMicrosecondsPerHour = kMicrosecondsPerMinute * 60; - static const int64 kMicrosecondsPerDay = kMicrosecondsPerHour * kHoursPerDay; - static const int64 kMicrosecondsPerWeek = kMicrosecondsPerDay * 7; - static const int64 kNanosecondsPerMicrosecond = 1000; - static const int64 kNanosecondsPerSecond = kNanosecondsPerMicrosecond * - kMicrosecondsPerSecond; + static const int64_t kHoursPerDay = 24; + static const int64_t kMillisecondsPerSecond = 1000; + static const int64_t kMillisecondsPerDay = + kMillisecondsPerSecond * 60 * 60 * kHoursPerDay; + static const int64_t kMicrosecondsPerMillisecond = 1000; + static const int64_t kMicrosecondsPerSecond = + kMicrosecondsPerMillisecond * kMillisecondsPerSecond; + static const int64_t kMicrosecondsPerMinute = kMicrosecondsPerSecond * 60; + static const int64_t kMicrosecondsPerHour = kMicrosecondsPerMinute * 60; + static const int64_t kMicrosecondsPerDay = + kMicrosecondsPerHour * kHoursPerDay; + static const int64_t kMicrosecondsPerWeek = kMicrosecondsPerDay * 7; + static const int64_t kNanosecondsPerMicrosecond = 1000; + static const int64_t kNanosecondsPerSecond = + kNanosecondsPerMicrosecond * kMicrosecondsPerSecond; // Returns true if this object has not been initialized. // @@ -314,16 +305,12 @@ class TimeBase { } // Returns true if this object represents the maximum time. - bool is_max() const { - return us_ == std::numeric_limits<int64>::max(); - } + bool is_max() const { return us_ == std::numeric_limits<int64_t>::max(); } // For serializing only. Use FromInternalValue() to reconstitute. Please don't // use this and do arithmetic on it, as it is more error prone than using the // provided operators. - int64 ToInternalValue() const { - return us_; - } + int64_t ToInternalValue() const { return us_; } TimeClass& operator=(TimeClass other) { us_ = other.us_; @@ -375,16 +362,13 @@ class TimeBase { // when deserializing a |TimeClass| structure, using a value known to be // compatible. It is not provided as a constructor because the integer type // may be unclear from the perspective of a caller. - static TimeClass FromInternalValue(int64 us) { - return TimeClass(us); - } + static TimeClass FromInternalValue(int64_t us) { return TimeClass(us); } protected: - explicit TimeBase(int64 us) : us_(us) { - } + explicit TimeBase(int64_t us) : us_(us) {} // Time value in a microsecond timebase. - int64 us_; + int64_t us_; }; } // namespace time_internal @@ -402,7 +386,7 @@ class BASE_EXPORT Time : public time_internal::TimeBase<Time> { public: // The representation of Jan 1, 1970 UTC in microseconds since the // platform-dependent epoch. - static const int64 kTimeTToMicrosecondsOffset; + static const int64_t kTimeTToMicrosecondsOffset; #if !defined(OS_WIN) // On Mac & Linux, this value is the delta from the Windows epoch of 1601 to @@ -410,12 +394,12 @@ class BASE_EXPORT Time : public time_internal::TimeBase<Time> { // 1970-based epochs to the new 1601-based ones. It should be removed from // this global header and put in the platform-specific ones when we remove the // migration code. - static const int64 kWindowsEpochDeltaMicroseconds; + static const int64_t kWindowsEpochDeltaMicroseconds; #else // To avoid overflow in QPC to Microseconds calculations, since we multiply // by kMicrosecondsPerSecond, then the QPC value should not exceed // (2^63 - 1) / 1E6. If it exceeds that threshold, we divide then multiply. - enum : int64 { kQPCOverflowThreshold = 0x8637BD05AF7 }; + enum : int64_t{kQPCOverflowThreshold = 0x8637BD05AF7}; #endif // Represents an exploded time that can be formatted nicely. This is kind of @@ -490,7 +474,7 @@ class BASE_EXPORT Time : public time_internal::TimeBase<Time> { // Converts to Java convention for times, a number of // milliseconds since the epoch. - int64 ToJavaTime() const; + int64_t ToJavaTime() const; #if defined(OS_POSIX) static Time FromTimeVal(struct timeval t); @@ -569,8 +553,7 @@ class BASE_EXPORT Time : public time_internal::TimeBase<Time> { private: friend class time_internal::TimeBase<Time>; - explicit Time(int64 us) : TimeBase(us) { - } + explicit Time(int64_t us) : TimeBase(us) {} // Explodes the given time to either local time |is_local = true| or UTC // |is_local = false|. @@ -616,12 +599,12 @@ inline TimeDelta TimeDelta::FromMinutes(int minutes) { } // static -inline TimeDelta TimeDelta::FromSeconds(int64 secs) { +inline TimeDelta TimeDelta::FromSeconds(int64_t secs) { return TimeDelta(secs) * Time::kMicrosecondsPerSecond; } // static -inline TimeDelta TimeDelta::FromMilliseconds(int64 ms) { +inline TimeDelta TimeDelta::FromMilliseconds(int64_t ms) { return TimeDelta(ms) * Time::kMicrosecondsPerMillisecond; } @@ -636,14 +619,14 @@ inline TimeDelta TimeDelta::FromMillisecondsD(double ms) { } // static -inline TimeDelta TimeDelta::FromMicroseconds(int64 us) { +inline TimeDelta TimeDelta::FromMicroseconds(int64_t us) { return TimeDelta(us); } // static inline TimeDelta TimeDelta::FromDouble(double value) { - double max_magnitude = std::numeric_limits<int64>::max(); - TimeDelta delta = TimeDelta(static_cast<int64>(value)); + double max_magnitude = std::numeric_limits<int64_t>::max(); + TimeDelta delta = TimeDelta(static_cast<int64_t>(value)); if (value > max_magnitude) delta = Max(); else if (value < -max_magnitude) @@ -708,8 +691,7 @@ class BASE_EXPORT TimeTicks : public time_internal::TimeBase<TimeTicks> { // Please use Now() to create a new object. This is for internal use // and testing. - explicit TimeTicks(int64 us) : TimeBase(us) { - } + explicit TimeTicks(int64_t us) : TimeBase(us) {} }; // For logging use only. @@ -758,8 +740,7 @@ class BASE_EXPORT ThreadTicks : public time_internal::TimeBase<ThreadTicks> { // Please use Now() to create a new object. This is for internal use // and testing. - explicit ThreadTicks(int64 us) : TimeBase(us) { - } + explicit ThreadTicks(int64_t us) : TimeBase(us) {} #if defined(OS_WIN) FRIEND_TEST_ALL_PREFIXES(TimeTicks, TSCTicksPerSecond); diff --git a/base/time/time_mac.cc b/base/time/time_mac.cc index 139e0c9..f2bc5ed 100644 --- a/base/time/time_mac.cc +++ b/base/time/time_mac.cc @@ -8,18 +8,20 @@ #include <CoreFoundation/CFTimeZone.h> #include <mach/mach.h> #include <mach/mach_time.h> +#include <stddef.h> #include <stdint.h> #include <sys/sysctl.h> #include <sys/time.h> #include <sys/types.h> #include <time.h> -#include "base/basictypes.h" #include "base/logging.h" #include "base/mac/mach_logging.h" #include "base/mac/scoped_cftyperef.h" #include "base/mac/scoped_mach_port.h" +#include "base/macros.h" #include "base/numerics/safe_conversions.h" +#include "build/build_config.h" namespace { @@ -117,16 +119,16 @@ namespace base { // => Thu Jan 01 00:00:00 UTC 1970 // irb(main):011:0> Time.at(-11644473600).getutc() // => Mon Jan 01 00:00:00 UTC 1601 -static const int64 kWindowsEpochDeltaSeconds = INT64_C(11644473600); +static const int64_t kWindowsEpochDeltaSeconds = INT64_C(11644473600); // static -const int64 Time::kWindowsEpochDeltaMicroseconds = +const int64_t Time::kWindowsEpochDeltaMicroseconds = kWindowsEpochDeltaSeconds * Time::kMicrosecondsPerSecond; // Some functions in time.cc use time_t directly, so we provide an offset // to convert from time_t (Unix epoch) and internal (Windows epoch). // static -const int64 Time::kTimeTToMicrosecondsOffset = kWindowsEpochDeltaMicroseconds; +const int64_t Time::kTimeTToMicrosecondsOffset = kWindowsEpochDeltaMicroseconds; // static Time Time::Now() { @@ -141,9 +143,9 @@ Time Time::FromCFAbsoluteTime(CFAbsoluteTime t) { return Time(); // Consider 0 as a null Time. if (t == std::numeric_limits<CFAbsoluteTime>::infinity()) return Max(); - return Time(static_cast<int64>( - (t + kCFAbsoluteTimeIntervalSince1970) * kMicrosecondsPerSecond) + - kWindowsEpochDeltaMicroseconds); + return Time(static_cast<int64_t>((t + kCFAbsoluteTimeIntervalSince1970) * + kMicrosecondsPerSecond) + + kWindowsEpochDeltaMicroseconds); } CFAbsoluteTime Time::ToCFAbsoluteTime() const { @@ -178,14 +180,14 @@ Time Time::FromExploded(bool is_local, const Exploded& exploded) { is_local ? CFTimeZoneCopySystem() : NULL); CFAbsoluteTime seconds = CFGregorianDateGetAbsoluteTime(date, time_zone) + kCFAbsoluteTimeIntervalSince1970; - return Time(static_cast<int64>(seconds * kMicrosecondsPerSecond) + - kWindowsEpochDeltaMicroseconds); + return Time(static_cast<int64_t>(seconds * kMicrosecondsPerSecond) + + kWindowsEpochDeltaMicroseconds); } void Time::Explode(bool is_local, Exploded* exploded) const { // Avoid rounding issues, by only putting the integral number of seconds // (rounded towards -infinity) into a |CFAbsoluteTime| (which is a |double|). - int64 microsecond = us_ % kMicrosecondsPerSecond; + int64_t microsecond = us_ % kMicrosecondsPerSecond; if (microsecond < 0) microsecond += kMicrosecondsPerSecond; CFAbsoluteTime seconds = ((us_ - microsecond) / kMicrosecondsPerSecond) - diff --git a/base/time/time_posix.cc b/base/time/time_posix.cc index d2bb555..4aadee6 100644 --- a/base/time/time_posix.cc +++ b/base/time/time_posix.cc @@ -15,7 +15,6 @@ #include <limits> #include <ostream> -#include "base/basictypes.h" #include "base/logging.h" #include "build/build_config.h" @@ -80,8 +79,8 @@ void SysTimeToTimeStruct(SysTime t, struct tm* timestruct, bool is_local) { } #endif // OS_ANDROID -int64 ConvertTimespecToMicros(const struct timespec& ts) { - base::CheckedNumeric<int64> result(ts.tv_sec); +int64_t ConvertTimespecToMicros(const struct timespec& ts) { + base::CheckedNumeric<int64_t> result(ts.tv_sec); result *= base::Time::kMicrosecondsPerSecond; result += (ts.tv_nsec / base::Time::kNanosecondsPerMicrosecond); return result.ValueOrDie(); @@ -94,7 +93,7 @@ int64 ConvertTimespecToMicros(const struct timespec& ts) { #if (defined(OS_POSIX) && \ defined(_POSIX_MONOTONIC_CLOCK) && _POSIX_MONOTONIC_CLOCK >= 0) || \ defined(OS_BSD) || defined(OS_ANDROID) -int64 ClockNow(clockid_t clk_id) { +int64_t ClockNow(clockid_t clk_id) { struct timespec ts; if (clock_gettime(clk_id, &ts) != 0) { NOTREACHED() << "clock_gettime(" << clk_id << ") failed."; @@ -112,7 +111,7 @@ int64 ClockNow(clockid_t clk_id) { namespace base { struct timespec TimeDelta::ToTimeSpec() const { - int64 microseconds = InMicroseconds(); + int64_t microseconds = InMicroseconds(); time_t seconds = 0; if (microseconds >= Time::kMicrosecondsPerSecond) { seconds = InSeconds(); @@ -137,16 +136,16 @@ struct timespec TimeDelta::ToTimeSpec() const { // => Thu Jan 01 00:00:00 UTC 1970 // irb(main):011:0> Time.at(-11644473600).getutc() // => Mon Jan 01 00:00:00 UTC 1601 -static const int64 kWindowsEpochDeltaSeconds = INT64_C(11644473600); +static const int64_t kWindowsEpochDeltaSeconds = INT64_C(11644473600); // static -const int64 Time::kWindowsEpochDeltaMicroseconds = +const int64_t Time::kWindowsEpochDeltaMicroseconds = kWindowsEpochDeltaSeconds * Time::kMicrosecondsPerSecond; // Some functions in time.cc use time_t directly, so we provide an offset // to convert from time_t (Unix epoch) and internal (Windows epoch). // static -const int64 Time::kTimeTToMicrosecondsOffset = kWindowsEpochDeltaMicroseconds; +const int64_t Time::kTimeTToMicrosecondsOffset = kWindowsEpochDeltaMicroseconds; // static Time Time::Now() { @@ -176,9 +175,9 @@ void Time::Explode(bool is_local, Exploded* exploded) const { // Time stores times with microsecond resolution, but Exploded only carries // millisecond resolution, so begin by being lossy. Adjust from Windows // epoch (1601) to Unix epoch (1970); - int64 microseconds = us_ - kWindowsEpochDeltaMicroseconds; + int64_t microseconds = us_ - kWindowsEpochDeltaMicroseconds; // The following values are all rounded towards -infinity. - int64 milliseconds; // Milliseconds since epoch. + int64_t milliseconds; // Milliseconds since epoch. SysTime seconds; // Seconds since epoch. int millisecond; // Exploded millisecond value (0-999). if (microseconds >= 0) { @@ -228,8 +227,7 @@ Time Time::FromExploded(bool is_local, const Exploded& exploded) { timestruct.tm_zone = NULL; // not a POSIX field, so mktime/timegm ignore #endif - - int64 milliseconds; + int64_t milliseconds; SysTime seconds; // Certain exploded dates do not really exist due to daylight saving times, @@ -247,11 +245,11 @@ Time Time::FromExploded(bool is_local, const Exploded& exploded) { // to UTC 00:00:00 that isn't -1. timestruct = timestruct0; timestruct.tm_isdst = 0; - int64 seconds_isdst0 = SysTimeFromTimeStruct(×truct, is_local); + int64_t seconds_isdst0 = SysTimeFromTimeStruct(×truct, is_local); timestruct = timestruct0; timestruct.tm_isdst = 1; - int64 seconds_isdst1 = SysTimeFromTimeStruct(×truct, is_local); + int64_t seconds_isdst1 = SysTimeFromTimeStruct(×truct, is_local); // seconds_isdst0 or seconds_isdst1 can be -1 for some timezones. // E.g. "CLST" (Chile Summer Time) returns -1 for 'tm_isdt == 1'. @@ -284,14 +282,14 @@ Time Time::FromExploded(bool is_local, const Exploded& exploded) { // 999ms to avoid the time being less than any other possible value that // this function can return. - // On Android, SysTime is int64, special care must be taken to avoid + // On Android, SysTime is int64_t, special care must be taken to avoid // overflows. - const int64 min_seconds = (sizeof(SysTime) < sizeof(int64)) - ? std::numeric_limits<SysTime>::min() - : std::numeric_limits<int32_t>::min(); - const int64 max_seconds = (sizeof(SysTime) < sizeof(int64)) - ? std::numeric_limits<SysTime>::max() - : std::numeric_limits<int32_t>::max(); + const int64_t min_seconds = (sizeof(SysTime) < sizeof(int64_t)) + ? std::numeric_limits<SysTime>::min() + : std::numeric_limits<int32_t>::min(); + const int64_t max_seconds = (sizeof(SysTime) < sizeof(int64_t)) + ? std::numeric_limits<SysTime>::max() + : std::numeric_limits<int32_t>::max(); if (exploded.year < 1969) { milliseconds = min_seconds * kMillisecondsPerSecond; } else { @@ -340,10 +338,8 @@ Time Time::FromTimeVal(struct timeval t) { if (t.tv_usec == static_cast<suseconds_t>(Time::kMicrosecondsPerSecond) - 1 && t.tv_sec == std::numeric_limits<time_t>::max()) return Max(); - return Time( - (static_cast<int64>(t.tv_sec) * Time::kMicrosecondsPerSecond) + - t.tv_usec + - kTimeTToMicrosecondsOffset); + return Time((static_cast<int64_t>(t.tv_sec) * Time::kMicrosecondsPerSecond) + + t.tv_usec + kTimeTToMicrosecondsOffset); } struct timeval Time::ToTimeVal() const { @@ -358,7 +354,7 @@ struct timeval Time::ToTimeVal() const { result.tv_usec = static_cast<suseconds_t>(Time::kMicrosecondsPerSecond) - 1; return result; } - int64 us = us_ - kTimeTToMicrosecondsOffset; + int64_t us = us_ - kTimeTToMicrosecondsOffset; result.tv_sec = us / Time::kMicrosecondsPerSecond; result.tv_usec = us % Time::kMicrosecondsPerSecond; return result; diff --git a/base/time/time_unittest.cc b/base/time/time_unittest.cc index 868a546..8a6a7f5 100644 --- a/base/time/time_unittest.cc +++ b/base/time/time_unittest.cc @@ -11,6 +11,7 @@ #include "base/compiler_specific.h" #include "base/logging.h" +#include "base/macros.h" #include "base/strings/stringprintf.h" #include "base/threading/platform_thread.h" #include "build/build_config.h" @@ -494,7 +495,7 @@ TEST_F(TimeTest, Max) { TEST_F(TimeTest, MaxConversions) { Time t = Time::Max(); - EXPECT_EQ(std::numeric_limits<int64>::max(), t.ToInternalValue()); + EXPECT_EQ(std::numeric_limits<int64_t>::max(), t.ToInternalValue()); t = Time::FromDoubleT(std::numeric_limits<double>::infinity()); EXPECT_TRUE(t.is_max()); @@ -541,7 +542,7 @@ TEST_F(TimeTest, MaxConversions) { #if defined(OS_MACOSX) TEST_F(TimeTest, TimeTOverflow) { - Time t = Time::FromInternalValue(std::numeric_limits<int64>::max() - 1); + Time t = Time::FromInternalValue(std::numeric_limits<int64_t>::max() - 1); EXPECT_FALSE(t.is_max()); EXPECT_EQ(std::numeric_limits<time_t>::max(), t.ToTimeT()); } @@ -799,19 +800,19 @@ std::string AnyToString(Any any) { } TEST(TimeDelta, Magnitude) { - const int64 zero = 0; + const int64_t zero = 0; EXPECT_EQ(TimeDelta::FromMicroseconds(zero), TimeDelta::FromMicroseconds(zero).magnitude()); - const int64 one = 1; - const int64 negative_one = -1; + const int64_t one = 1; + const int64_t negative_one = -1; EXPECT_EQ(TimeDelta::FromMicroseconds(one), TimeDelta::FromMicroseconds(one).magnitude()); EXPECT_EQ(TimeDelta::FromMicroseconds(one), TimeDelta::FromMicroseconds(negative_one).magnitude()); - const int64 max_int64_minus_one = std::numeric_limits<int64>::max() - 1; - const int64 min_int64_plus_two = std::numeric_limits<int64>::min() + 2; + const int64_t max_int64_minus_one = std::numeric_limits<int64_t>::max() - 1; + const int64_t min_int64_plus_two = std::numeric_limits<int64_t>::min() + 2; EXPECT_EQ(TimeDelta::FromMicroseconds(max_int64_minus_one), TimeDelta::FromMicroseconds(max_int64_minus_one).magnitude()); EXPECT_EQ(TimeDelta::FromMicroseconds(max_int64_minus_one), @@ -832,16 +833,16 @@ bool IsMin(TimeDelta delta) { TEST(TimeDelta, MaxConversions) { TimeDelta t = TimeDelta::Max(); - EXPECT_EQ(std::numeric_limits<int64>::max(), t.ToInternalValue()); + EXPECT_EQ(std::numeric_limits<int64_t>::max(), t.ToInternalValue()); EXPECT_EQ(std::numeric_limits<int>::max(), t.InDays()); EXPECT_EQ(std::numeric_limits<int>::max(), t.InHours()); EXPECT_EQ(std::numeric_limits<int>::max(), t.InMinutes()); EXPECT_EQ(std::numeric_limits<double>::infinity(), t.InSecondsF()); - EXPECT_EQ(std::numeric_limits<int64>::max(), t.InSeconds()); + EXPECT_EQ(std::numeric_limits<int64_t>::max(), t.InSeconds()); EXPECT_EQ(std::numeric_limits<double>::infinity(), t.InMillisecondsF()); - EXPECT_EQ(std::numeric_limits<int64>::max(), t.InMilliseconds()); - EXPECT_EQ(std::numeric_limits<int64>::max(), t.InMillisecondsRoundedUp()); + EXPECT_EQ(std::numeric_limits<int64_t>::max(), t.InMilliseconds()); + EXPECT_EQ(std::numeric_limits<int64_t>::max(), t.InMillisecondsRoundedUp()); t = TimeDelta::FromDays(std::numeric_limits<int>::max()); EXPECT_TRUE(t.is_max()); @@ -852,7 +853,7 @@ TEST(TimeDelta, MaxConversions) { t = TimeDelta::FromMinutes(std::numeric_limits<int>::max()); EXPECT_TRUE(t.is_max()); - int64 max_int = std::numeric_limits<int64>::max(); + int64_t max_int = std::numeric_limits<int64_t>::max(); t = TimeDelta::FromSeconds(max_int / Time::kMicrosecondsPerSecond + 1); EXPECT_TRUE(t.is_max()); @@ -872,7 +873,7 @@ TEST(TimeDelta, MaxConversions) { t = TimeDelta::FromMicroseconds(-max_int); EXPECT_TRUE(IsMin(t)); - t = -TimeDelta::FromMicroseconds(std::numeric_limits<int64>::min()); + t = -TimeDelta::FromMicroseconds(std::numeric_limits<int64_t>::min()); EXPECT_FALSE(IsMin(t)); t = TimeDelta::FromSecondsD(std::numeric_limits<double>::infinity()); diff --git a/base/time/time_win.cc b/base/time/time_win.cc index 9584127..b2d9c76 100644 --- a/base/time/time_win.cc +++ b/base/time/time_win.cc @@ -38,7 +38,6 @@ #include <mmsystem.h> #include <stdint.h> -#include "base/basictypes.h" #include "base/cpu.h" #include "base/lazy_instance.h" #include "base/logging.h" @@ -53,23 +52,23 @@ namespace { // From MSDN, FILETIME "Contains a 64-bit value representing the number of // 100-nanosecond intervals since January 1, 1601 (UTC)." -int64 FileTimeToMicroseconds(const FILETIME& ft) { +int64_t FileTimeToMicroseconds(const FILETIME& ft) { // Need to bit_cast to fix alignment, then divide by 10 to convert // 100-nanoseconds to microseconds. This only works on little-endian // machines. - return bit_cast<int64, FILETIME>(ft) / 10; + return bit_cast<int64_t, FILETIME>(ft) / 10; } -void MicrosecondsToFileTime(int64 us, FILETIME* ft) { +void MicrosecondsToFileTime(int64_t us, FILETIME* ft) { DCHECK_GE(us, 0LL) << "Time is less than 0, negative values are not " "representable in FILETIME"; // Multiply by 10 to convert microseconds to 100-nanoseconds. Bit_cast will // handle alignment problems. This only works on little-endian machines. - *ft = bit_cast<FILETIME, int64>(us * 10); + *ft = bit_cast<FILETIME, int64_t>(us * 10); } -int64 CurrentWallclockMicroseconds() { +int64_t CurrentWallclockMicroseconds() { FILETIME ft; ::GetSystemTimeAsFileTime(&ft); return FileTimeToMicroseconds(ft); @@ -78,7 +77,7 @@ int64 CurrentWallclockMicroseconds() { // Time between resampling the un-granular clock for this API. 60 seconds. const int kMaxMillisecondsToAvoidDrift = 60 * Time::kMillisecondsPerSecond; -int64 initial_time = 0; +int64_t initial_time = 0; TimeTicks initial_ticks; void InitializeClock() { @@ -110,7 +109,7 @@ QueryThreadCycleTimePtr GetQueryThreadCycleTimeFunction() { } // Returns the current value of the performance counter. -uint64 QPCNowRaw() { +uint64_t QPCNowRaw() { LARGE_INTEGER perf_counter_now = {}; // According to the MSDN documentation for QueryPerformanceCounter(), this // will never fail on systems that run XP or later. @@ -128,7 +127,7 @@ uint64 QPCNowRaw() { // number of leap year days between 1601 and 1970: (1970-1601)/4 excluding // 1700, 1800, and 1900. // static -const int64 Time::kTimeTToMicrosecondsOffset = INT64_C(11644473600000000); +const int64_t Time::kTimeTToMicrosecondsOffset = INT64_C(11644473600000000); // static Time Time::Now() { @@ -170,7 +169,7 @@ Time Time::NowFromSystemTime() { // static Time Time::FromFileTime(FILETIME ft) { - if (bit_cast<int64, FILETIME>(ft) == 0) + if (bit_cast<int64_t, FILETIME>(ft) == 0) return Time(); if (ft.dwHighDateTime == std::numeric_limits<DWORD>::max() && ft.dwLowDateTime == std::numeric_limits<DWORD>::max()) @@ -180,7 +179,7 @@ Time Time::FromFileTime(FILETIME ft) { FILETIME Time::ToFileTime() const { if (is_null()) - return bit_cast<FILETIME, int64>(0); + return bit_cast<FILETIME, int64_t>(0); if (is_max()) { FILETIME result; result.dwHighDateTime = std::numeric_limits<DWORD>::max(); @@ -332,7 +331,7 @@ DWORD timeGetTimeWrapper() { DWORD (*g_tick_function)(void) = &timeGetTimeWrapper; // Accumulation of time lost due to rollover (in milliseconds). -int64 g_rollover_ms = 0; +int64_t g_rollover_ms = 0; // The last timeGetTime value we saw, to detect rollover. DWORD g_last_seen_now = 0; @@ -403,7 +402,7 @@ TimeDelta InitialNowFunction(); // See "threading notes" in InitializeNowFunctionPointer() for details on how // concurrent reads/writes to these globals has been made safe. NowFunction g_now_function = &InitialNowFunction; -int64 g_qpc_ticks_per_second = 0; +int64_t g_qpc_ticks_per_second = 0; // As of January 2015, use of <atomic> is forbidden in Chromium code. This is // what std::atomic_thread_fence does on Windows on all Intel architectures when @@ -425,8 +424,8 @@ TimeDelta QPCValueToTimeDelta(LONGLONG qpc_value) { } // Otherwise, calculate microseconds in a round about manner to avoid // overflow and precision issues. - int64 whole_seconds = qpc_value / g_qpc_ticks_per_second; - int64 leftover_ticks = qpc_value - (whole_seconds * g_qpc_ticks_per_second); + int64_t whole_seconds = qpc_value / g_qpc_ticks_per_second; + int64_t leftover_ticks = qpc_value - (whole_seconds * g_qpc_ticks_per_second); return TimeDelta::FromMicroseconds( (whole_seconds * Time::kMicrosecondsPerSecond) + ((leftover_ticks * Time::kMicrosecondsPerSecond) / @@ -526,8 +525,8 @@ ThreadTicks ThreadTicks::Now() { // Return the CPU time of the current thread. double thread_time_seconds = thread_cycle_time / tsc_ticks_per_second; - return ThreadTicks(static_cast<int64>( - thread_time_seconds * Time::kMicrosecondsPerSecond)); + return ThreadTicks( + static_cast<int64_t>(thread_time_seconds * Time::kMicrosecondsPerSecond)); } // static @@ -564,13 +563,13 @@ double ThreadTicks::TSCTicksPerSecond() { // The first time that this function is called, make an initial reading of the // TSC and the performance counter. - static const uint64 tsc_initial = __rdtsc(); - static const uint64 perf_counter_initial = QPCNowRaw(); + static const uint64_t tsc_initial = __rdtsc(); + static const uint64_t perf_counter_initial = QPCNowRaw(); // Make a another reading of the TSC and the performance counter every time // that this function is called. - uint64 tsc_now = __rdtsc(); - uint64 perf_counter_now = QPCNowRaw(); + uint64_t tsc_now = __rdtsc(); + uint64_t perf_counter_now = QPCNowRaw(); // Reset the thread priority. ::SetThreadPriority(::GetCurrentThread(), previous_priority); @@ -587,7 +586,7 @@ double ThreadTicks::TSCTicksPerSecond() { LARGE_INTEGER perf_counter_frequency = {}; ::QueryPerformanceFrequency(&perf_counter_frequency); DCHECK_GE(perf_counter_now, perf_counter_initial); - uint64 perf_counter_ticks = perf_counter_now - perf_counter_initial; + uint64_t perf_counter_ticks = perf_counter_now - perf_counter_initial; double elapsed_time_seconds = perf_counter_ticks / static_cast<double>(perf_counter_frequency.QuadPart); @@ -597,7 +596,7 @@ double ThreadTicks::TSCTicksPerSecond() { // Compute the frequency of the TSC. DCHECK_GE(tsc_now, tsc_initial); - uint64 tsc_ticks = tsc_now - tsc_initial; + uint64_t tsc_ticks = tsc_now - tsc_initial; tsc_ticks_per_second = tsc_ticks / elapsed_time_seconds; return tsc_ticks_per_second; diff --git a/base/time/time_win_unittest.cc b/base/time/time_win_unittest.cc index e2bb893..ad5e0be 100644 --- a/base/time/time_win_unittest.cc +++ b/base/time/time_win_unittest.cc @@ -5,6 +5,7 @@ #include <windows.h> #include <mmsystem.h> #include <process.h> +#include <stdint.h> #include <cmath> #include <limits> @@ -44,14 +45,14 @@ MockTimeTicks::TickFunctionType MockTimeTicks::old_tick_function_; HANDLE g_rollover_test_start; unsigned __stdcall RolloverTestThreadMain(void* param) { - int64 counter = reinterpret_cast<int64>(param); + int64_t counter = reinterpret_cast<int64_t>(param); DWORD rv = WaitForSingleObject(g_rollover_test_start, INFINITE); EXPECT_EQ(rv, WAIT_OBJECT_0); TimeTicks last = TimeTicks::Now(); for (int index = 0; index < counter; index++) { TimeTicks now = TimeTicks::Now(); - int64 milliseconds = (now - last).InMilliseconds(); + int64_t milliseconds = (now - last).InMilliseconds(); // This is a tight loop; we could have looped faster than our // measurements, so the time might be 0 millis. EXPECT_GE(milliseconds, 0); @@ -81,8 +82,8 @@ TEST(TimeTicks, MAYBE_WinRollover) { // 5) Each thread verifies integrity of result. const int kThreads = 8; - // Use int64 so we can cast into a void* without a compiler warning. - const int64 kChecks = 10; + // Use int64_t so we can cast into a void* without a compiler warning. + const int64_t kChecks = 10; // It takes a lot of iterations to reproduce the bug! // (See bug 1081395) @@ -240,18 +241,18 @@ TEST(TimeTicks, FromQPCValue) { LARGE_INTEGER frequency; ASSERT_TRUE(QueryPerformanceFrequency(&frequency)); - const int64 ticks_per_second = frequency.QuadPart; + const int64_t ticks_per_second = frequency.QuadPart; ASSERT_GT(ticks_per_second, 0); // Generate the tick values to convert, advancing the tick count by varying // amounts. These values will ensure that both the fast and overflow-safe // conversion logic in FromQPCValue() is tested, and across the entire range // of possible QPC tick values. - std::vector<int64> test_cases; + std::vector<int64_t> test_cases; test_cases.push_back(0); const int kNumAdvancements = 100; - int64 ticks = 0; - int64 ticks_increment = 10; + int64_t ticks = 0; + int64_t ticks_increment = 10; for (int i = 0; i < kNumAdvancements; ++i) { test_cases.push_back(ticks); ticks += ticks_increment; @@ -267,14 +268,14 @@ TEST(TimeTicks, FromQPCValue) { ticks += ticks_increment; ticks_increment = ticks_increment * 6 / 5; } - test_cases.push_back(std::numeric_limits<int64>::max()); + test_cases.push_back(std::numeric_limits<int64_t>::max()); // Test that the conversions using FromQPCValue() match those computed here // using simple floating-point arithmetic. The floating-point math provides // enough precision to confirm the implementation is correct to the // microsecond for all |test_cases| (though it would be insufficient to // confirm many "very large" tick values which are not being tested here). - for (int64 ticks : test_cases) { + for (int64_t ticks : test_cases) { const double expected_microseconds_since_origin = (static_cast<double>(ticks) * Time::kMicrosecondsPerSecond) / ticks_per_second; diff --git a/base/timer/hi_res_timer_manager.h b/base/timer/hi_res_timer_manager.h index ed0e1e0..21cdfaf 100644 --- a/base/timer/hi_res_timer_manager.h +++ b/base/timer/hi_res_timer_manager.h @@ -6,7 +6,7 @@ #define BASE_TIMER_HI_RES_TIMER_MANAGER_H_ #include "base/base_export.h" -#include "base/basictypes.h" +#include "base/macros.h" #include "base/power_monitor/power_observer.h" namespace base { diff --git a/base/timer/hi_res_timer_manager_unittest.cc b/base/timer/hi_res_timer_manager_unittest.cc index 4fc48b5..9416048 100644 --- a/base/timer/hi_res_timer_manager_unittest.cc +++ b/base/timer/hi_res_timer_manager_unittest.cc @@ -11,6 +11,7 @@ #include "base/power_monitor/power_monitor.h" #include "base/power_monitor/power_monitor_device_source.h" #include "base/time/time.h" +#include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" namespace base { diff --git a/base/timer/mock_timer_unittest.cc b/base/timer/mock_timer_unittest.cc index f6b6953..a389815 100644 --- a/base/timer/mock_timer_unittest.cc +++ b/base/timer/mock_timer_unittest.cc @@ -4,6 +4,7 @@ #include "base/timer/mock_timer.h" +#include "base/macros.h" #include "testing/gtest/include/gtest/gtest.h" namespace { diff --git a/base/timer/timer.h b/base/timer/timer.h index c5bd9ce..661829b 100644 --- a/base/timer/timer.h +++ b/base/timer/timer.h @@ -50,11 +50,11 @@ // should be able to tell the difference. #include "base/base_export.h" -#include "base/basictypes.h" #include "base/bind.h" #include "base/bind_helpers.h" #include "base/callback.h" #include "base/location.h" +#include "base/macros.h" #include "base/time/time.h" namespace base { diff --git a/base/timer/timer_unittest.cc b/base/timer/timer_unittest.cc index 35e4315..b1d3c3e 100644 --- a/base/timer/timer_unittest.cc +++ b/base/timer/timer_unittest.cc @@ -2,10 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <stddef.h> + +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" #include "base/test/test_simple_task_runner.h" #include "base/timer/timer.h" +#include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" using base::TimeDelta; diff --git a/base/tools_sanity_unittest.cc b/base/tools_sanity_unittest.cc index 4340fcd..8d13837 100644 --- a/base/tools_sanity_unittest.cc +++ b/base/tools_sanity_unittest.cc @@ -6,12 +6,15 @@ // crashes if the test is ran without special memory testing tools. We use these // errors to verify the sanity of the tools. +#include <stddef.h> + #include "base/atomicops.h" #include "base/debug/asan_invalid_access.h" #include "base/debug/profiler.h" #include "base/message_loop/message_loop.h" #include "base/third_party/dynamic_annotations/dynamic_annotations.h" #include "base/threading/thread.h" +#include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" namespace base { diff --git a/base/tracked_objects.cc b/base/tracked_objects.cc index c7a6a3f..6ae7d46 100644 --- a/base/tracked_objects.cc +++ b/base/tracked_objects.cc @@ -18,6 +18,7 @@ #include "base/strings/stringprintf.h" #include "base/third_party/valgrind/memcheck.h" #include "base/tracking_info.h" +#include "build/build_config.h" using base::TimeDelta; @@ -131,11 +132,11 @@ DeathData::~DeathData() { // We use a macro rather than a template to force this to inline. // Related code for calculating max is discussed on the web. #define CONDITIONAL_ASSIGN(assign_it, target, source) \ - ((target) ^= ((target) ^ (source)) & -static_cast<int32>(assign_it)) + ((target) ^= ((target) ^ (source)) & -static_cast<int32_t>(assign_it)) -void DeathData::RecordDeath(const int32 queue_duration, - const int32 run_duration, - const uint32 random_number) { +void DeathData::RecordDeath(const int32_t queue_duration, + const int32_t run_duration, + const uint32_t random_number) { // We'll just clamp at INT_MAX, but we should note this in the UI as such. if (count_ < INT_MAX) ++count_; @@ -215,20 +216,19 @@ DeathDataSnapshot::DeathDataSnapshot() } DeathDataSnapshot::DeathDataSnapshot(int count, - int32 run_duration_sum, - int32 run_duration_max, - int32 run_duration_sample, - int32 queue_duration_sum, - int32 queue_duration_max, - int32 queue_duration_sample) + int32_t run_duration_sum, + int32_t run_duration_max, + int32_t run_duration_sample, + int32_t queue_duration_sum, + int32_t queue_duration_max, + int32_t queue_duration_sample) : count(count), run_duration_sum(run_duration_sum), run_duration_max(run_duration_max), run_duration_sample(run_duration_sample), queue_duration_sum(queue_duration_sum), queue_duration_max(queue_duration_max), - queue_duration_sample(queue_duration_sample) { -} + queue_duration_sample(queue_duration_sample) {} DeathDataSnapshot::~DeathDataSnapshot() { } @@ -342,7 +342,7 @@ void ThreadData::PushToHeadOfList() { (void)VALGRIND_MAKE_MEM_DEFINED_IF_ADDRESSABLE(&random_number_, sizeof(random_number_)); MSAN_UNPOISON(&random_number_, sizeof(random_number_)); - random_number_ += static_cast<uint32>(this - static_cast<ThreadData*>(0)); + random_number_ += static_cast<uint32_t>(this - static_cast<ThreadData*>(0)); random_number_ ^= (Now() - TrackedTime()).InMilliseconds(); DCHECK(!next_); @@ -499,15 +499,16 @@ Births* ThreadData::TallyABirth(const Location& location) { } void ThreadData::TallyADeath(const Births& births, - int32 queue_duration, + int32_t queue_duration, const TaskStopwatch& stopwatch) { - int32 run_duration = stopwatch.RunDurationMs(); + int32_t run_duration = stopwatch.RunDurationMs(); // Stir in some randomness, plus add constant in case durations are zero. - const uint32 kSomePrimeNumber = 2147483647; + const uint32_t kSomePrimeNumber = 2147483647; random_number_ += queue_duration + run_duration + kSomePrimeNumber; // An address is going to have some randomness to it as well ;-). - random_number_ ^= static_cast<uint32>(&births - reinterpret_cast<Births*>(0)); + random_number_ ^= + static_cast<uint32_t>(&births - reinterpret_cast<Births*>(0)); // We don't have queue durations without OS timer. OS timer is automatically // used for task-post-timing, so the use of an alternate timer implies all @@ -560,7 +561,7 @@ void ThreadData::TallyRunOnNamedThreadIfTracking( // efficient by not calling for a genuine time value. For simplicity, we'll // use a default zero duration when we can't calculate a true value. TrackedTime start_of_run = stopwatch.StartTime(); - int32 queue_duration = 0; + int32_t queue_duration = 0; if (!start_of_run.is_null()) { queue_duration = (start_of_run - completed_task.EffectiveTimePosted()) .InMilliseconds(); @@ -593,7 +594,7 @@ void ThreadData::TallyRunOnWorkerThreadIfTracking( return; TrackedTime start_of_run = stopwatch.StartTime(); - int32 queue_duration = 0; + int32_t queue_duration = 0; if (!start_of_run.is_null()) { queue_duration = (start_of_run - time_posted).InMilliseconds(); } @@ -614,7 +615,7 @@ void ThreadData::TallyRunInAScopedRegionIfTracking( if (!current_thread_data) return; - int32 queue_duration = 0; + int32_t queue_duration = 0; current_thread_data->TallyADeath(*births, queue_duration, stopwatch); } @@ -925,7 +926,7 @@ TrackedTime TaskStopwatch::StartTime() const { return start_time_; } -int32 TaskStopwatch::RunDurationMs() const { +int32_t TaskStopwatch::RunDurationMs() const { #if DCHECK_IS_ON() DCHECK(state_ == STOPPED); #endif @@ -947,12 +948,12 @@ ThreadData* TaskStopwatch::GetThreadData() const { DeathDataPhaseSnapshot::DeathDataPhaseSnapshot( int profiling_phase, int count, - int32 run_duration_sum, - int32 run_duration_max, - int32 run_duration_sample, - int32 queue_duration_sum, - int32 queue_duration_max, - int32 queue_duration_sample, + int32_t run_duration_sum, + int32_t run_duration_max, + int32_t run_duration_sample, + int32_t queue_duration_sum, + int32_t queue_duration_max, + int32_t queue_duration_sample, const DeathDataPhaseSnapshot* prev) : profiling_phase(profiling_phase), death_data(count, @@ -962,8 +963,7 @@ DeathDataPhaseSnapshot::DeathDataPhaseSnapshot( queue_duration_sum, queue_duration_max, queue_duration_sample), - prev(prev) { -} + prev(prev) {} //------------------------------------------------------------------------------ // TaskSnapshot diff --git a/base/tracked_objects.h b/base/tracked_objects.h index e62948d8..ef43fe7 100644 --- a/base/tracked_objects.h +++ b/base/tracked_objects.h @@ -5,6 +5,8 @@ #ifndef BASE_TRACKED_OBJECTS_H_ #define BASE_TRACKED_OBJECTS_H_ +#include <stdint.h> + #include <map> #include <set> #include <stack> @@ -14,11 +16,11 @@ #include "base/atomicops.h" #include "base/base_export.h" -#include "base/basictypes.h" #include "base/containers/hash_tables.h" #include "base/gtest_prod_util.h" #include "base/lazy_instance.h" #include "base/location.h" +#include "base/macros.h" #include "base/process/process_handle.h" #include "base/profiler/alternate_timer.h" #include "base/profiler/tracked_time.h" @@ -259,12 +261,12 @@ struct BASE_EXPORT DeathDataSnapshot { // a wrapper structure as a param or using an empty constructor for // snapshotting DeathData would be less efficient. DeathDataSnapshot(int count, - int32 run_duration_sum, - int32 run_duration_max, - int32 run_duration_sample, - int32 queue_duration_sum, - int32 queue_duration_max, - int32 queue_duration_sample); + int32_t run_duration_sum, + int32_t run_duration_max, + int32_t run_duration_sample, + int32_t queue_duration_sum, + int32_t queue_duration_max, + int32_t queue_duration_sample); ~DeathDataSnapshot(); // Calculates and returns the delta between this snapshot and an earlier @@ -272,12 +274,12 @@ struct BASE_EXPORT DeathDataSnapshot { DeathDataSnapshot Delta(const DeathDataSnapshot& older) const; int count; - int32 run_duration_sum; - int32 run_duration_max; - int32 run_duration_sample; - int32 queue_duration_sum; - int32 queue_duration_max; - int32 queue_duration_sample; + int32_t run_duration_sum; + int32_t run_duration_max; + int32_t run_duration_sample; + int32_t queue_duration_sum; + int32_t queue_duration_max; + int32_t queue_duration_sample; }; //------------------------------------------------------------------------------ @@ -287,12 +289,12 @@ struct BASE_EXPORT DeathDataSnapshot { struct DeathDataPhaseSnapshot { DeathDataPhaseSnapshot(int profiling_phase, int count, - int32 run_duration_sum, - int32 run_duration_max, - int32 run_duration_sample, - int32 queue_duration_sum, - int32 queue_duration_max, - int32 queue_duration_sample, + int32_t run_duration_sum, + int32_t run_duration_max, + int32_t run_duration_sample, + int32_t queue_duration_sum, + int32_t queue_duration_max, + int32_t queue_duration_sample, const DeathDataPhaseSnapshot* prev); // Profiling phase at which completion this snapshot was taken. @@ -325,19 +327,19 @@ class BASE_EXPORT DeathData { // Update stats for a task destruction (death) that had a Run() time of // |duration|, and has had a queueing delay of |queue_duration|. - void RecordDeath(const int32 queue_duration, - const int32 run_duration, - const uint32 random_number); + void RecordDeath(const int32_t queue_duration, + const int32_t run_duration, + const uint32_t random_number); // Metrics and past snapshots accessors, used only for serialization and in // tests. int count() const { return count_; } - int32 run_duration_sum() const { return run_duration_sum_; } - int32 run_duration_max() const { return run_duration_max_; } - int32 run_duration_sample() const { return run_duration_sample_; } - int32 queue_duration_sum() const { return queue_duration_sum_; } - int32 queue_duration_max() const { return queue_duration_max_; } - int32 queue_duration_sample() const { return queue_duration_sample_; } + int32_t run_duration_sum() const { return run_duration_sum_; } + int32_t run_duration_max() const { return run_duration_max_; } + int32_t run_duration_sample() const { return run_duration_sample_; } + int32_t queue_duration_sum() const { return queue_duration_sum_; } + int32_t queue_duration_max() const { return queue_duration_max_; } + int32_t queue_duration_sample() const { return queue_duration_sample_; } const DeathDataPhaseSnapshot* last_phase_snapshot() const { return last_phase_snapshot_; } @@ -362,18 +364,18 @@ class BASE_EXPORT DeathData { // Basic tallies, used to compute averages. Can be incremented only on the // death thread. - int32 run_duration_sum_; - int32 queue_duration_sum_; + int32_t run_duration_sum_; + int32_t queue_duration_sum_; // Max values, used by local visualization routines. These are often read, // but rarely updated. The max values get assigned only on the death thread, // but these fields can be set to 0 by OnProfilingPhaseCompleted() on the // snapshot thread. - int32 run_duration_max_; - int32 queue_duration_max_; + int32_t run_duration_max_; + int32_t queue_duration_max_; // Samples, used by crowd sourcing gatherers. These are almost never read, // and rarely updated. They can be modified only on the death thread. - int32 run_duration_sample_; - int32 queue_duration_sample_; + int32_t run_duration_sample_; + int32_t queue_duration_sample_; // Snapshot of this death data made at the last profiling phase completion, if // any. DeathData owns the whole list starting with this pointer. @@ -575,7 +577,7 @@ class BASE_EXPORT ThreadData { // Find a place to record a death on this thread. void TallyADeath(const Births& births, - int32 queue_duration, + int32_t queue_duration, const TaskStopwatch& stopwatch); // Snapshots (under a lock) the profiled data for the tasks for this thread @@ -708,7 +710,7 @@ class BASE_EXPORT ThreadData { // representative sample in each DeathData instance. We can't start off with // much randomness (because we can't call RandInt() on all our threads), so // we stir in more and more as we go. - uint32 random_number_; + uint32_t random_number_; // Record of what the incarnation_counter_ was when this instance was created. // If the incarnation_counter_ has changed, then we avoid pushing into the @@ -748,7 +750,7 @@ class BASE_EXPORT TaskStopwatch { // and stopping this stopwatch, minus the wallclock durations of any other // instances that are immediately nested in this one, started and stopped on // this thread during that period. - int32 RunDurationMs() const; + int32_t RunDurationMs() const; // Returns tracking info for the current thread. ThreadData* GetThreadData() const; @@ -758,14 +760,14 @@ class BASE_EXPORT TaskStopwatch { TrackedTime start_time_; // Wallclock duration of the task. - int32 wallclock_duration_ms_; + int32_t wallclock_duration_ms_; // Tracking info for the current thread. ThreadData* current_thread_data_; // Sum of wallclock durations of all stopwatches that were directly nested in // this one. - int32 excluded_duration_ms_; + int32_t excluded_duration_ms_; // Stopwatch which was running on our thread when this stopwatch was started. // That preexisting stopwatch must be adjusted to the exclude the wallclock diff --git a/base/tracked_objects_unittest.cc b/base/tracked_objects_unittest.cc index 09d7653..69dd85e 100644 --- a/base/tracked_objects_unittest.cc +++ b/base/tracked_objects_unittest.cc @@ -7,6 +7,7 @@ #include "base/tracked_objects.h" #include <stddef.h> +#include <stdint.h> #include "base/memory/scoped_ptr.h" #include "base/process/process_handle.h" @@ -184,7 +185,7 @@ TEST_F(TrackedObjectsTest, TinyStartupShutdown) { // execution. // Create a child (using the same birth location). // TrackingInfo will call TallyABirth() during construction. - const int32 start_time = 1; + const int32_t start_time = 1; base::TimeTicks kBogusBirthTime = base::TimeTicks() + base::TimeDelta::FromMilliseconds(start_time); base::TrackingInfo pending_task(location, kBogusBirthTime); @@ -192,7 +193,7 @@ TEST_F(TrackedObjectsTest, TinyStartupShutdown) { TaskStopwatch stopwatch; stopwatch.Start(); // Finally conclude the outer run. - const int32 time_elapsed = 1000; + const int32_t time_elapsed = 1000; SetTestTime(start_time + time_elapsed); stopwatch.Stop(); @@ -250,8 +251,8 @@ TEST_F(TrackedObjectsTest, DeathDataTestRecordDeath) { EXPECT_EQ(data->count(), 0); EXPECT_EQ(nullptr, data->last_phase_snapshot()); - int32 run_ms = 42; - int32 queue_ms = 8; + int32_t run_ms = 42; + int32_t queue_ms = 8; const int kUnrandomInt = 0; // Fake random int that ensure we sample data. data->RecordDeath(queue_ms, run_ms, kUnrandomInt); @@ -281,8 +282,8 @@ TEST_F(TrackedObjectsTest, DeathDataTest2Phases) { scoped_ptr<DeathData> data(new DeathData()); ASSERT_NE(data, nullptr); - int32 run_ms = 42; - int32 queue_ms = 8; + int32_t run_ms = 42; + int32_t queue_ms = 8; const int kUnrandomInt = 0; // Fake random int that ensure we sample data. data->RecordDeath(queue_ms, run_ms, kUnrandomInt); @@ -312,8 +313,8 @@ TEST_F(TrackedObjectsTest, DeathDataTest2Phases) { data->last_phase_snapshot()->death_data.queue_duration_sample); EXPECT_EQ(nullptr, data->last_phase_snapshot()->prev); - int32 run_ms1 = 21; - int32 queue_ms1 = 4; + int32_t run_ms1 = 21; + int32_t queue_ms1 = 4; data->RecordDeath(queue_ms1, run_ms1, kUnrandomInt); EXPECT_EQ(data->run_duration_sum(), run_ms + run_ms + run_ms1); diff --git a/base/tuple.h b/base/tuple.h index 96a4642..e5872cc 100644 --- a/base/tuple.h +++ b/base/tuple.h @@ -28,7 +28,10 @@ #ifndef BASE_TUPLE_H_ #define BASE_TUPLE_H_ +#include <stddef.h> + #include "base/bind_helpers.h" +#include "build/build_config.h" namespace base { diff --git a/base/value_conversions.cc b/base/value_conversions.cc index 45cd619..a461e2c 100644 --- a/base/value_conversions.cc +++ b/base/value_conversions.cc @@ -4,9 +4,10 @@ #include "base/value_conversions.h" +#include <stdint.h> + #include <string> -#include "base/basictypes.h" #include "base/files/file_path.h" #include "base/strings/string_number_conversions.h" #include "base/time/time.h" @@ -38,7 +39,7 @@ StringValue* CreateTimeDeltaValue(const TimeDelta& time) { bool GetValueAsTimeDelta(const Value& value, TimeDelta* time) { std::string str; - int64 int_value; + int64_t int_value; if (!value.GetAsString(&str) || !base::StringToInt64(str, &int_value)) return false; if (time) diff --git a/base/values.h b/base/values.h index a64f6a8..07e5b6c 100644 --- a/base/values.h +++ b/base/values.h @@ -9,7 +9,7 @@ // JavaScript. As such, it is NOT a generalized variant type, since only the // types supported by JavaScript/JSON are supported. // -// IN PARTICULAR this means that there is no support for int64 or unsigned +// IN PARTICULAR this means that there is no support for int64_t or unsigned // numbers. Writing JSON with such types would violate the spec. If you need // something like this, either use a double or make a string value containing // the number you want. @@ -18,6 +18,7 @@ #define BASE_VALUES_H_ #include <stddef.h> +#include <stdint.h> #include <iosfwd> #include <map> @@ -26,8 +27,8 @@ #include <vector> #include "base/base_export.h" -#include "base/basictypes.h" #include "base/compiler_specific.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/strings/string16.h" #include "base/strings/string_piece.h" diff --git a/base/values_unittest.cc b/base/values_unittest.cc index a5bd002..66453e0 100644 --- a/base/values_unittest.cc +++ b/base/values_unittest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <stddef.h> + #include <limits> #include <utility> diff --git a/base/version.h b/base/version.h index 814acaa..85c99a3 100644 --- a/base/version.h +++ b/base/version.h @@ -10,7 +10,6 @@ #include <vector> #include "base/base_export.h" -#include "base/basictypes.h" namespace base { @@ -25,7 +24,7 @@ class BASE_EXPORT Version { ~Version(); // Initializes from a decimal dotted version number, like "0.1.1". - // Each component is limited to a uint16. Call IsValid() to learn + // Each component is limited to a uint16_t. Call IsValid() to learn // the outcome. explicit Version(const std::string& version_str); diff --git a/base/version_unittest.cc b/base/version_unittest.cc index f40ed27..bef96f4 100644 --- a/base/version_unittest.cc +++ b/base/version_unittest.cc @@ -4,6 +4,10 @@ #include "base/version.h" +#include <stddef.h> +#include <stdint.h> + +#include "base/macros.h" #include "testing/gtest/include/gtest/gtest.h" namespace { diff --git a/base/vlog.cc b/base/vlog.cc index 519ceff..c00e631 100644 --- a/base/vlog.cc +++ b/base/vlog.cc @@ -4,12 +4,13 @@ #include "base/vlog.h" -#include <cstddef> +#include <stddef.h> + #include <ostream> #include <utility> -#include "base/basictypes.h" #include "base/logging.h" +#include "base/macros.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_split.h" diff --git a/base/vlog.h b/base/vlog.h index a32ed14..2950904c 100644 --- a/base/vlog.h +++ b/base/vlog.h @@ -9,7 +9,7 @@ #include <vector> #include "base/base_export.h" -#include "base/basictypes.h" +#include "base/macros.h" #include "base/strings/string_piece.h" namespace logging { diff --git a/base/vlog_unittest.cc b/base/vlog_unittest.cc index b505d4c..3c3f49c 100644 --- a/base/vlog_unittest.cc +++ b/base/vlog_unittest.cc @@ -4,7 +4,6 @@ #include "base/vlog.h" -#include "base/basictypes.h" #include "base/logging.h" #include "base/time/time.h" #include "testing/gtest/include/gtest/gtest.h" |