diff options
author | Jack Lloyd <[email protected]> | 2017-10-03 00:38:15 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-10-03 00:38:15 -0400 |
commit | 04d64c3e0fe60a25b1f1a5c2eaf7e2986d2130dd (patch) | |
tree | 3dc2cc7e970fc5f1cdc94887b03704d82c37e07e /src/lib/utils/locking_allocator | |
parent | 180540de74c58a72492692f58b63f32647e80bd8 (diff) |
Add wrappers for reinterpret_cast between char* and uint8_t*
Generally speaking reinterpret_cast is sketchy stuff. But the
special case of char*/uint8_t* is both common and safe. By
isolating those, the remaining (likely sketchy) cases are easier
to grep for.
Diffstat (limited to 'src/lib/utils/locking_allocator')
-rw-r--r-- | src/lib/utils/locking_allocator/locking_allocator.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/utils/locking_allocator/locking_allocator.cpp b/src/lib/utils/locking_allocator/locking_allocator.cpp index f36fa9130..c7ca1662f 100644 --- a/src/lib/utils/locking_allocator/locking_allocator.cpp +++ b/src/lib/utils/locking_allocator/locking_allocator.cpp @@ -64,7 +64,7 @@ void* mlock_allocator::allocate(size_t num_elems, size_t elem_size) m_freelist.erase(i); clear_mem(m_pool + offset, n); - BOTAN_ASSERT((reinterpret_cast<size_t>(m_pool) + offset) % alignment == 0, + BOTAN_ASSERT((reinterpret_cast<uintptr_t>(m_pool) + offset) % alignment == 0, "Returning correctly aligned pointer"); return m_pool + offset; @@ -107,7 +107,7 @@ void* mlock_allocator::allocate(size_t num_elems, size_t elem_size) clear_mem(m_pool + offset + alignment_padding, n); - BOTAN_ASSERT((reinterpret_cast<size_t>(m_pool) + offset + alignment_padding) % alignment == 0, + BOTAN_ASSERT((reinterpret_cast<uintptr_t>(m_pool) + offset + alignment_padding) % alignment == 0, "Returning correctly aligned pointer"); return m_pool + offset + alignment_padding; |