Skip to content

Commit

Permalink
rename ch to chr to avoid shadow variable in ChibiOS
Browse files Browse the repository at this point in the history
  • Loading branch information
magicrub committed Mar 25, 2018
1 parent 1dfcaca commit f935822
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions libuavcan/include/uavcan/marshal/array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -809,13 +809,13 @@ class UAVCAN_EXPORT Array : public ArrayImpl<T, ArrayMode, MaxSize_>
* This operator can only be used with string-like arrays; otherwise it will fail to compile.
* @ref c_str()
*/
bool operator==(const char* ch) const
bool operator==(const char* chr) const
{
if (ch == UAVCAN_NULLPTR)
if (chr == UAVCAN_NULLPTR)
{
return false;
}
return std::strncmp(Base::c_str(), ch, MaxSize) == 0;
return std::strncmp(Base::c_str(), chr, MaxSize) == 0;
}

/**
Expand All @@ -827,18 +827,18 @@ class UAVCAN_EXPORT Array : public ArrayImpl<T, ArrayMode, MaxSize_>
* This operator can only be used with string-like arrays; otherwise it will fail to compile.
* @ref c_str()
*/
SelfType& operator=(const char* ch)
SelfType& operator=(const char* chr)
{
StaticAssert<Base::IsStringLike>::check();
StaticAssert<IsDynamic>::check();
Base::clear();
if (ch == UAVCAN_NULLPTR)
if (chr == UAVCAN_NULLPTR)
{
handleFatalError("Array::operator=(const char*)");
}
while (*ch)
while (*chr)
{
push_back(ValueType(*ch++)); // Value type is likely to be unsigned char, so conversion may be required.
push_back(ValueType(*chr++)); // Value type is likely to be unsigned char, so conversion may be required.
}
return *this;
}
Expand All @@ -847,17 +847,17 @@ class UAVCAN_EXPORT Array : public ArrayImpl<T, ArrayMode, MaxSize_>
* This operator can only be used with string-like arrays; otherwise it will fail to compile.
* @ref c_str()
*/
SelfType& operator+=(const char* ch)
SelfType& operator+=(const char* chr)
{
StaticAssert<Base::IsStringLike>::check();
StaticAssert<IsDynamic>::check();
if (ch == UAVCAN_NULLPTR)
if (chr == UAVCAN_NULLPTR)
{
handleFatalError("Array::operator+=(const char*)");
}
while (*ch)
while (*chr)
{
push_back(ValueType(*ch++));
push_back(ValueType(*chr++));
}
return *this;
}
Expand Down

0 comments on commit f935822

Please sign in to comment.