From aeffe1056f9ff6526d87a16ef55222899f5528f7 Mon Sep 17 00:00:00 2001 From: "ted.mielczarek@gmail.com" Date: Wed, 6 Mar 2013 14:04:42 +0000 Subject: Use stdint types everywhere R=mark at https://breakpad.appspot.com/535002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1121 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/processor/static_map_unittest.cc | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'src/processor/static_map_unittest.cc') diff --git a/src/processor/static_map_unittest.cc b/src/processor/static_map_unittest.cc index eb1e1354..97b1e61a 100644 --- a/src/processor/static_map_unittest.cc +++ b/src/processor/static_map_unittest.cc @@ -49,7 +49,7 @@ class SimpleMapSerializer { static char* Serialize(const std::map &stdmap, unsigned int* size = NULL) { unsigned int size_per_node = - sizeof(u_int32_t) + sizeof(Key) + sizeof(Value); + sizeof(uint32_t) + sizeof(Key) + sizeof(Value); unsigned int memsize = sizeof(int32_t) + size_per_node * stdmap.size(); if (size) *size = memsize; @@ -58,12 +58,12 @@ class SimpleMapSerializer { char* address = mem; // Writer the number of nodes: - new (address) u_int32_t(static_cast(stdmap.size())); - address += sizeof(u_int32_t); + new (address) uint32_t(static_cast(stdmap.size())); + address += sizeof(uint32_t); // Nodes' offset: - u_int32_t* offsets = reinterpret_cast(address); - address += sizeof(u_int32_t) * stdmap.size(); + uint32_t* offsets = reinterpret_cast(address); + address += sizeof(uint32_t) * stdmap.size(); // Keys: Key* keys = reinterpret_cast(address); @@ -95,16 +95,16 @@ class TestInvalidMap : public ::testing::Test { }; TEST_F(TestInvalidMap, TestNegativeNumberNodes) { - memset(data, 0xff, sizeof(u_int32_t)); // Set the number of nodes = -1 + memset(data, 0xff, sizeof(uint32_t)); // Set the number of nodes = -1 test_map = TestMap(data); ASSERT_FALSE(test_map.ValidateInMemoryStructure()); } TEST_F(TestInvalidMap, TestWrongOffsets) { - u_int32_t* header = reinterpret_cast(data); - const u_int32_t kNumNodes = 2; - const u_int32_t kHeaderOffset = - sizeof(u_int32_t) + kNumNodes * (sizeof(u_int32_t) + sizeof(KeyType)); + uint32_t* header = reinterpret_cast(data); + const uint32_t kNumNodes = 2; + const uint32_t kHeaderOffset = + sizeof(uint32_t) + kNumNodes * (sizeof(uint32_t) + sizeof(KeyType)); header[0] = kNumNodes; header[1] = kHeaderOffset + 3; // Wrong offset for first node @@ -118,16 +118,16 @@ TEST_F(TestInvalidMap, TestWrongOffsets) { } TEST_F(TestInvalidMap, TestUnSortedKeys) { - u_int32_t* header = reinterpret_cast(data); - const u_int32_t kNumNodes = 2; - const u_int32_t kHeaderOffset = - sizeof(u_int32_t) + kNumNodes * (sizeof(u_int32_t) + sizeof(KeyType)); + uint32_t* header = reinterpret_cast(data); + const uint32_t kNumNodes = 2; + const uint32_t kHeaderOffset = + sizeof(uint32_t) + kNumNodes * (sizeof(uint32_t) + sizeof(KeyType)); header[0] = kNumNodes; header[1] = kHeaderOffset; header[2] = kHeaderOffset + sizeof(ValueType); KeyType* keys = reinterpret_cast( - data + (kNumNodes + 1) * sizeof(u_int32_t)); + data + (kNumNodes + 1) * sizeof(uint32_t)); // Set keys in non-increasing order. keys[0] = 10; keys[1] = 7; @@ -171,10 +171,10 @@ class TestValidMap : public ::testing::Test { // Set correct size of memory allocation for each test case. unsigned int size_per_node = - sizeof(u_int32_t) + sizeof(KeyType) + sizeof(ValueType); + sizeof(uint32_t) + sizeof(KeyType) + sizeof(ValueType); for (testcase = 0; testcase < kNumberTestCases; ++testcase) { correct_size[testcase] = - sizeof(u_int32_t) + std_map[testcase].size() * size_per_node; + sizeof(uint32_t) + std_map[testcase].size() * size_per_node; } } -- cgit v1.2.1