diff options
author | ted.mielczarek@gmail.com <ted.mielczarek@gmail.com@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2013-03-06 14:04:42 +0000 |
---|---|---|
committer | ted.mielczarek@gmail.com <ted.mielczarek@gmail.com@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2013-03-06 14:04:42 +0000 |
commit | aeffe1056f9ff6526d87a16ef55222899f5528f7 (patch) | |
tree | 1b7601a9135f82c14e73535c9d4a24f94d494662 /src/processor/static_map_unittest.cc | |
parent | Work around Windows headers #defining ERROR by renaming enum values in StackF... (diff) | |
download | breakpad-aeffe1056f9ff6526d87a16ef55222899f5528f7.tar.xz |
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
Diffstat (limited to 'src/processor/static_map_unittest.cc')
-rw-r--r-- | src/processor/static_map_unittest.cc | 34 |
1 files changed, 17 insertions, 17 deletions
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<Key, Value> &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<u_int32_t>(stdmap.size())); - address += sizeof(u_int32_t); + new (address) uint32_t(static_cast<uint32_t>(stdmap.size())); + address += sizeof(uint32_t); // Nodes' offset: - u_int32_t* offsets = reinterpret_cast<u_int32_t*>(address); - address += sizeof(u_int32_t) * stdmap.size(); + uint32_t* offsets = reinterpret_cast<uint32_t*>(address); + address += sizeof(uint32_t) * stdmap.size(); // Keys: Key* keys = reinterpret_cast<Key*>(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<u_int32_t*>(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<uint32_t*>(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<u_int32_t*>(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<uint32_t*>(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<KeyType*>( - 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; } } |