Updates from latest cppcheck
Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
Change-Id: Ia9dd43ce762f613e35d07f3028a918bba6ac36ce
diff --git a/src/util/hei_bit_string.cpp b/src/util/hei_bit_string.cpp
index 88eb7bb..066cde9 100644
--- a/src/util/hei_bit_string.cpp
+++ b/src/util/hei_bit_string.cpp
@@ -422,7 +422,7 @@
o_relPos = (i_absPos + iv_offset) % UINT8_BIT_LEN;
- return ((uint8_t*)iv_bufAddr + ((i_absPos + iv_offset) / UINT8_BIT_LEN));
+ return (iv_bufAddr + ((i_absPos + iv_offset) / UINT8_BIT_LEN));
}
//##############################################################################
@@ -439,7 +439,7 @@
BitStringBuffer::~BitStringBuffer()
{
- delete[](uint8_t*) getBufAddr();
+ delete[] getBufAddr();
}
//------------------------------------------------------------------------------
@@ -472,7 +472,7 @@
{
// The initBuffer() function will deallocate the buffer as well, however we
// also need to deallocate the buffer here before we set the length.
- delete[](uint8_t*) getBufAddr();
+ delete[] getBufAddr();
setBufAddr(nullptr);
setBitLen(i_bs.getBitLen());
@@ -493,7 +493,7 @@
{
// The initBuffer() function will deallocate the buffer as well, however
// we also need to deallocate the buffer here before we set the length.
- delete[](uint8_t*) getBufAddr();
+ delete[] getBufAddr();
setBufAddr(nullptr);
setBitLen(i_bsb.getBitLen());
@@ -512,7 +512,7 @@
void BitStringBuffer::initBuffer()
{
// Deallocate the current buffer.
- delete[](uint8_t*) getBufAddr();
+ delete[] getBufAddr();
// create new buffer, initialized to 0's
setBufAddr(new uint8_t[getMinBytes(getBitLen())]());
diff --git a/src/util/hei_bit_string.hpp b/src/util/hei_bit_string.hpp
index 59369b7..5a1ad0f 100644
--- a/src/util/hei_bit_string.hpp
+++ b/src/util/hei_bit_string.hpp
@@ -75,7 +75,8 @@
* to allocate sufficient memory space for this bit string.
*/
BitString(uint64_t i_bitLen, void* i_bufAddr, uint64_t i_offset = 0) :
- iv_bitLen(i_bitLen), iv_bufAddr(i_bufAddr), iv_offset(i_offset)
+ iv_bitLen(i_bitLen), iv_bufAddr(static_cast<uint8_t*>(i_bufAddr)),
+ iv_offset(i_offset)
{}
/** @brief Destructor */
@@ -89,7 +90,7 @@
/** @return The address of the bit string buffer. Note that this may
* return nullptr. */
- void* getBufAddr() const
+ uint8_t* getBufAddr() const
{
return iv_bufAddr;
}
@@ -391,7 +392,7 @@
*/
void setBufAddr(void* i_newBufAddr)
{
- iv_bufAddr = i_newBufAddr;
+ iv_bufAddr = static_cast<uint8_t*>(i_newBufAddr);
}
/** @param i_newBitLen The new bit length of this bit string buffer. */
@@ -414,9 +415,9 @@
uint8_t* getRelativePosition(uint64_t& o_relPos, uint64_t i_absPos) const;
private:
- uint64_t iv_bitLen; ///< The bit length of this buffer.
- void* iv_bufAddr; ///< The beginning address of this buffer.
- uint64_t iv_offset; ///< Start position offset
+ uint64_t iv_bitLen; ///< The bit length of this buffer.
+ uint8_t* iv_bufAddr; ///< The beginning address of this buffer.
+ uint64_t iv_offset; ///< Start position offset
};
//##############################################################################