The Road to Clang-Format part 3
Whitespace! Part Deux
Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
Change-Id: I2033813f12ab073bb57f4771e007126b0f8c7e26
diff --git a/src/util/hei_bit_string.cpp b/src/util/hei_bit_string.cpp
index 24de34e..b863829 100755
--- a/src/util/hei_bit_string.cpp
+++ b/src/util/hei_bit_string.cpp
@@ -31,7 +31,7 @@
// Get the relative address of this byte and the relative starting position
// within the byte.
uint64_t relPos = 0;
- uint8_t * relAddr = getRelativePosition(relPos, i_pos);
+ uint8_t* relAddr = getRelativePosition(relPos, i_pos);
// Get the length of the target bit field within this byte and the length of
// the bit field for any remaining bits.
@@ -75,7 +75,7 @@
// Get the relative address of this byte and the relative starting position
// within the byte.
uint64_t relPos = 0;
- uint8_t * relAddr = getRelativePosition(relPos, i_pos);
+ uint8_t* relAddr = getRelativePosition(relPos, i_pos);
// Get the length of the target bit field within this byte and the length of
// the bit field for any remaining bits.
@@ -132,7 +132,7 @@
// could be used in the constructor of BitStringBuffer, which could causes
// an infinite loop.
uint8_t a[sizeof(i_pattern)] = {};
- BitString bs { sizeof(i_pattern)*8, a };
+ BitString bs { sizeof(i_pattern) * 8, a };
bs.setFieldRight(0, i_pLen, i_pattern);
// Iterate the range in chunks the size of i_pLen.
@@ -152,7 +152,7 @@
//------------------------------------------------------------------------------
-void BitString::setString(const BitString & i_sStr, uint64_t i_sPos,
+void BitString::setString(const BitString& i_sStr, uint64_t i_sPos,
uint64_t i_sLen, uint64_t i_dPos)
{
// Ensure the source parameters are valid.
@@ -171,8 +171,8 @@
// The bit strings may be in overlapping memory spaces. So we need to copy
// the data in the correct direction to prevent overlapping.
uint64_t sRelOffset = 0, dRelOffset = 0;
- uint8_t * sRelAddr = i_sStr.getRelativePosition(sRelOffset, i_sPos);
- uint8_t * dRelAddr = getRelativePosition(dRelOffset, i_dPos);
+ uint8_t* sRelAddr = i_sStr.getRelativePosition(sRelOffset, i_sPos);
+ uint8_t* dRelAddr = getRelativePosition(dRelOffset, i_dPos);
// Copy the data.
if ((dRelAddr == sRelAddr) && (dRelOffset == sRelOffset))
@@ -208,7 +208,7 @@
//------------------------------------------------------------------------------
-void BitString::maskString(const BitString & i_mask)
+void BitString::maskString(const BitString& i_mask)
{
// Get the length of the smallest string.
uint64_t actLen = std::min(getBitLen(), i_mask.getBitLen());
@@ -226,7 +226,7 @@
//------------------------------------------------------------------------------
-bool BitString::isEqual(const BitString & i_str) const
+bool BitString::isEqual(const BitString& i_str) const
{
if (getBitLen() != i_str.getBitLen())
return false; // size not equal
@@ -295,7 +295,7 @@
//------------------------------------------------------------------------------
-BitStringBuffer BitString::operator&(const BitString & i_bs) const
+BitStringBuffer BitString::operator&(const BitString& i_bs) const
{
// Get the length of the smallest string.
uint64_t actLen = std::min(getBitLen(), i_bs.getBitLen());
@@ -317,7 +317,7 @@
//------------------------------------------------------------------------------
-BitStringBuffer BitString::operator|(const BitString & i_bs) const
+BitStringBuffer BitString::operator|(const BitString& i_bs) const
{
// Get the length of the smallest string.
uint64_t actLen = std::min(getBitLen(), i_bs.getBitLen());
@@ -376,15 +376,15 @@
//------------------------------------------------------------------------------
-uint8_t * BitString::getRelativePosition(uint64_t & o_relPos,
- uint64_t i_absPos) const
+uint8_t* BitString::getRelativePosition(uint64_t& o_relPos,
+ uint64_t i_absPos) const
{
HEI_ASSERT(nullptr != getBufAddr()); // must to have a valid address
HEI_ASSERT(i_absPos < getBitLen()); // must be a valid position
o_relPos = (i_absPos + iv_offset) % UINT8_BIT_LEN;
- return ((uint8_t *)iv_bufAddr + ((i_absPos + iv_offset) / UINT8_BIT_LEN));
+ return ((uint8_t*)iv_bufAddr + ((i_absPos + iv_offset) / UINT8_BIT_LEN));
}
//##############################################################################
@@ -401,12 +401,12 @@
BitStringBuffer::~BitStringBuffer()
{
- delete [] (uint8_t *)getBufAddr();
+ delete [] (uint8_t*)getBufAddr();
}
//------------------------------------------------------------------------------
-BitStringBuffer::BitStringBuffer(const BitString & i_bs) :
+BitStringBuffer::BitStringBuffer(const BitString& i_bs) :
BitString(i_bs.getBitLen(), nullptr)
{
initBuffer();
@@ -415,7 +415,7 @@
//------------------------------------------------------------------------------
-BitStringBuffer::BitStringBuffer(const BitStringBuffer & i_bsb) :
+BitStringBuffer::BitStringBuffer(const BitStringBuffer& i_bsb) :
BitString(i_bsb.getBitLen(), nullptr)
{
initBuffer();
@@ -424,11 +424,11 @@
//------------------------------------------------------------------------------
-BitStringBuffer & BitStringBuffer::operator=(const BitString & i_bs)
+BitStringBuffer& BitStringBuffer::operator=(const BitString& i_bs)
{
// 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 [] (uint8_t*)getBufAddr();
setBufAddr(nullptr);
setBitLen(i_bs.getBitLen());
@@ -440,13 +440,13 @@
//------------------------------------------------------------------------------
-BitStringBuffer & BitStringBuffer::operator=(const BitStringBuffer & i_bsb)
+BitStringBuffer& BitStringBuffer::operator=(const BitStringBuffer& i_bsb)
{
if (this != &i_bsb) // Check for assignment to self
{
// 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 [] (uint8_t*)getBufAddr();
setBufAddr(nullptr);
setBitLen(i_bsb.getBitLen());
@@ -462,7 +462,7 @@
void BitStringBuffer::initBuffer()
{
// Deallocate the current buffer.
- delete [] (uint8_t *)getBufAddr();
+ delete [] (uint8_t*)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 7f83624..a227ffc 100755
--- a/src/util/hei_bit_string.hpp
+++ b/src/util/hei_bit_string.hpp
@@ -76,7 +76,7 @@
* @pre Use getMinBytes() to calulate the minimum number of bytes needed
* to allocate sufficient memory space for this bit string.
*/
- BitString(uint64_t i_bitLen, void * i_bufAddr, uint64_t i_offset = 0) :
+ 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)
{}
@@ -88,7 +88,7 @@
/** @return The address of the bit string buffer. Note that this may
* return nullptr. */
- void * getBufAddr() const { return iv_bufAddr; }
+ void* getBufAddr() const { return iv_bufAddr; }
/**
* @param i_bitLen The number of bits for a bit string.
@@ -257,7 +257,7 @@
* string, then the extra bits in this string are not modified.
* @note This string and the source string may specify overlapping memory.
*/
- void setString(const BitString & i_sStr, uint64_t i_sPos, uint64_t i_sLen,
+ void setString(const BitString& i_sStr, uint64_t i_sPos, uint64_t i_sLen,
uint64_t i_dPos = 0);
/**
@@ -268,7 +268,7 @@
* @note See the other definition of this function for details and
* restrictions.
*/
- void setString(const BitString & i_sStr)
+ void setString(const BitString& i_sStr)
{
setString(i_sStr, 0, i_sStr.getBitLen());
}
@@ -282,7 +282,7 @@
* @note If the length of the given string is less than the length of this
* string, then the extra bits in this string are not modified.
*/
- void maskString(const BitString & i_mask);
+ void maskString(const BitString& i_mask);
/**
* @param i_str The string to compare.
@@ -290,7 +290,7 @@
* @pre Both strings must be of equal length and have same values to be
* equal.
*/
- bool isEqual(const BitString & i_str) const;
+ bool isEqual(const BitString& i_str) const;
/** @return True if there are no bit set(1) in this bit string, false
* otherwise. */
@@ -309,16 +309,16 @@
uint64_t getSetCount() const { return getSetCount(0, getBitLen()); }
/** @brief Comparison operator. */
- bool operator==(const BitString & i_str) const { return isEqual(i_str); }
+ bool operator==(const BitString& i_str) const { return isEqual(i_str); }
/** @brief Bitwise NOT operator. */
BitStringBuffer operator~() const;
/** @brief Bitwise AND operator. */
- BitStringBuffer operator&(const BitString & i_bs) const;
+ BitStringBuffer operator&(const BitString& i_bs) const;
/** @brief Bitwise OR operator. */
- BitStringBuffer operator|(const BitString & i_bs) const;
+ BitStringBuffer operator|(const BitString& i_bs) const;
/** @brief Right shift operator. */
BitStringBuffer operator>>(uint64_t i_shift) const;
@@ -329,10 +329,10 @@
/**
* @brief Explicitly disables copy from BitString.
*
- * Prevents assigning a BitString & to a BitString, which would strip
+ * Prevents assigning a BitString& to a BitString, which would strip
* polymorphism.
*/
- BitString(const BitString & i_bs) = delete;
+ BitString(const BitString& i_bs) = delete;
/**
* @brief Explicitly disables assignment from BitStringBuffer.
@@ -340,7 +340,7 @@
* Allowing this would be dangerous if the BitStringBuffer goes out of scope
* because the BitString would point to memory that is no longer in context.
*/
- BitString & operator=(const BitStringBuffer & i_bsb) = delete;
+ BitString& operator=(const BitStringBuffer& i_bsb) = delete;
/**
* @brief Explicitly disables copy from BitStringBuffer.
@@ -348,7 +348,7 @@
* Allowing this would be dangerous if the BitStringBuffer goes out of scope
* because the BitString would point to memory that is no longer in context.
*/
- BitString(const BitStringBuffer & i_bsb) = delete;
+ BitString(const BitStringBuffer& i_bsb) = delete;
protected: // functions
@@ -357,7 +357,7 @@
* @pre Before calling this function, make sure you deallocate the old
* buffer to avoid memory leaks.
*/
- void setBufAddr(void * i_newBufAddr) { iv_bufAddr = i_newBufAddr; }
+ void setBufAddr(void* i_newBufAddr) { iv_bufAddr = i_newBufAddr; }
/** @param i_newBitLen The new bit length of this bit string buffer. */
void setBitLen(uint64_t i_newBitLen) { iv_bitLen = i_newBitLen; }
@@ -374,14 +374,14 @@
* @pre nullptr != getBufAddr()
* @pre i_absPos < getBitLen()
*/
- uint8_t * getRelativePosition(uint64_t & o_relPos,
- uint64_t i_absPos) const;
+ uint8_t* getRelativePosition(uint64_t& o_relPos,
+ uint64_t i_absPos) const;
private: // instance variables
- 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.
+ void* iv_bufAddr; ///< The beginning address of this buffer.
+ uint64_t iv_offset; ///< Start position offset
};
//##############################################################################
@@ -407,16 +407,16 @@
~BitStringBuffer();
/** @brief Copy constructor from BitString */
- BitStringBuffer(const BitString & i_bs);
+ BitStringBuffer(const BitString& i_bs);
/** @brief Copy constructor from BitStringBuffer */
- BitStringBuffer(const BitStringBuffer & i_bsb);
+ BitStringBuffer(const BitStringBuffer& i_bsb);
/** @brief Assignment from BitString */
- BitStringBuffer & operator=(const BitString & i_bs);
+ BitStringBuffer& operator=(const BitString& i_bs);
/** @brief Assignment from BitStringBuffer */
- BitStringBuffer & operator=(const BitStringBuffer & i_bsb);
+ BitStringBuffer& operator=(const BitStringBuffer& i_bsb);
private: // functions
diff --git a/src/util/hei_flyweight.hpp b/src/util/hei_flyweight.hpp
index de0f055..d6ce023 100644
--- a/src/util/hei_flyweight.hpp
+++ b/src/util/hei_flyweight.hpp
@@ -21,15 +21,15 @@
~Flyweight() { clear(); }
/** @brief Default copy constructor. */
- Flyweight(const Flyweight &) = delete;
+ Flyweight(const Flyweight&) = delete;
/** @brief Default assignment operator. */
- Flyweight & operator=(const Flyweight &) = delete;
+ Flyweight& operator=(const Flyweight&) = delete;
public:
/** @brief Provides access to a singleton instance of this object. */
- static Flyweight & getSingleton()
+ static Flyweight& getSingleton()
{
static Flyweight theFlyweight;
return theFlyweight;
@@ -41,13 +41,13 @@
* @param The target entry.
* @return A reference to this entry in the factory.
*/
- T & get(const T & i_entry)
+ T& get(const T& i_entry)
{
// The index is sorted by the value of the T objects. Check to see if
// this entry already exists in the factory.
auto itr =
std::lower_bound(iv_index.begin(), iv_index.end(), &i_entry,
- [](const T * a, const T * b) { return *a < *b; });
+ [](const T* a, const T* b) { return *a < *b; });
// std::lower_bound() will return the first element that does not
// compare less than i_entry. So if an entry is found, we must make sure