summaryrefslogtreecommitdiff
path: root/src/net/messagein.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-06-06 23:34:34 +0300
committerAndrei Karas <akaras@inbox.ru>2017-06-07 19:23:40 +0300
commit36ba43d6ea38062b17f7e63ef659962bfc51c64d (patch)
tree190156cb88b13a38a6d13c69ee0742cc078065a1 /src/net/messagein.cpp
parentf1518dd8476c968a43fa57cfb06198e290a4f77a (diff)
downloadmanaplus-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.gz
manaplus-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.bz2
manaplus-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.xz
manaplus-36ba43d6ea38062b17f7e63ef659962bfc51c64d.zip
Fix clang-tidy check readability-implicit-bool-cast.
Diffstat (limited to 'src/net/messagein.cpp')
-rw-r--r--src/net/messagein.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp
index fbf3f9c4e..11b28d510 100644
--- a/src/net/messagein.cpp
+++ b/src/net/messagein.cpp
@@ -51,7 +51,7 @@ MessageIn::MessageIn(const char *const data,
MessageIn::~MessageIn()
{
- if (mLength)
+ if (mLength != 0u)
{
if (mPos != mLength && mPos != 2)
{
@@ -207,7 +207,7 @@ void MessageIn::skip(const unsigned int length, const char *const str)
void MessageIn::skipToEnd(const char *const str)
{
const int diff = CAST_S32(mLength - mPos);
- if (diff)
+ if (diff != 0)
{
DEBUGLOG2("skip: " + toString(diff), mPos, str);
mPos = mLength;
@@ -234,7 +234,7 @@ std::string MessageIn::readString(int length, const char *const dstr)
const char *const stringEnd
= static_cast<const char *>(memchr(stringBeg, '\0', length));
- const std::string str(stringBeg, stringEnd
+ const std::string str(stringBeg, stringEnd != nullptr
? stringEnd - stringBeg : CAST_SIZE(length));
DEBUGLOG2("readString: " + str, mPos, dstr);
mPos += length;
@@ -259,12 +259,12 @@ std::string MessageIn::readRawString(int length, const char *const dstr)
const char *const stringBeg = mData + CAST_SIZE(mPos);
const char *const stringEnd
= static_cast<const char *>(memchr(stringBeg, '\0', length));
- std::string str(stringBeg, stringEnd
+ std::string str(stringBeg, stringEnd != nullptr
? stringEnd - stringBeg : CAST_SIZE(length));
DEBUGLOG2("readString: " + str, mPos, dstr);
- if (stringEnd)
+ if (stringEnd != nullptr)
{
const size_t len2 = CAST_SIZE(length)
- (stringEnd - stringBeg) - 1;
@@ -272,7 +272,7 @@ std::string MessageIn::readRawString(int length, const char *const dstr)
const char *const stringEnd2
= static_cast<const char *>(memchr(stringBeg2, '\0', len2));
const std::string hiddenPart = std::string(stringBeg2,
- stringEnd2 ? stringEnd2 - stringBeg2 : len2);
+ stringEnd2 != nullptr ? stringEnd2 - stringBeg2 : len2);
if (hiddenPart.length() > 0)
{
DEBUGLOG2("readString2: " + hiddenPart, mPos, dstr);
@@ -314,12 +314,12 @@ unsigned char *MessageIn::readBytes(int length, const char *const dstr)
str += " ";
for (int f = 0; f < length; f ++)
{
- if (buf[f])
+ if (buf[f] != 0u)
str.append(strprintf("%c", buf[f]));
else
str.append("_");
}
- if (dstr)
+ if (dstr != nullptr)
logger->dlog(dstr);
logger->dlog("ReadBytes: " + str);
#endif // ENABLEDEBUGLOG