Fixed Cppcheck issues.

This commit is contained in:
Vincent Richard 2021-11-25 21:57:07 +01:00
parent 80ad529d5a
commit 23ab2a6a3c
4 changed files with 15 additions and 6 deletions

View File

@ -56,7 +56,10 @@ void folder::addMessageChangedListener(events::messageChangedListener* l) {
void folder::removeMessageChangedListener(events::messageChangedListener* l) {
std::remove(m_messageChangedListeners.begin(), m_messageChangedListeners.end(), l);
m_messageChangedListeners.erase(
std::remove(m_messageChangedListeners.begin(), m_messageChangedListeners.end(), l),
m_messageChangedListeners.end()
);
}
@ -78,7 +81,10 @@ void folder::addMessageCountListener(events::messageCountListener* l) {
void folder::removeMessageCountListener(events::messageCountListener* l) {
std::remove(m_messageCountListeners.begin(), m_messageCountListeners.end(), l);
m_messageCountListeners.erase(
std::remove(m_messageCountListeners.begin(), m_messageCountListeners.end(), l),
m_messageCountListeners.end()
);
}
@ -100,7 +106,10 @@ void folder::addFolderListener(events::folderListener* l) {
void folder::removeFolderListener(events::folderListener* l) {
std::remove(m_folderListeners.begin(), m_folderListeners.end(), l);
m_folderListeners.erase(
std::remove(m_folderListeners.begin(), m_folderListeners.end(), l),
m_folderListeners.end()
);
}

View File

@ -269,7 +269,6 @@ shared_ptr <text> text::newFromString(const string& in, const charset& ch) {
void text::createFromString(const string& in, const charset& ch) {
size_t asciiCount = 0;
size_t asciiPercent = 0;
removeAllWords();
@ -282,7 +281,7 @@ void text::createFromString(const string& in, const charset& ch) {
const bool alwaysEncode = ch.getRecommendedEncoding(recommendedEnc);
if (!alwaysEncode) {
asciiCount = utility::stringUtils::countASCIIchars(in.begin(), in.end());
const auto asciiCount = utility::stringUtils::countASCIIchars(in.begin(), in.end());
asciiPercent = (in.length() == 0 ? 100 : (100 * asciiCount) / in.length());
}

View File

@ -241,6 +241,7 @@ public:
m_state = STATE_NOT_CONNECTED;
m_bdatChunkCount = 0;
m_bdatChunkSize = m_bdatChunkReceived = 0;
m_ehloSent = m_mailSent = m_rcptSent = m_quitSent = false;
}

View File

@ -93,7 +93,7 @@ namespace CppUnit {
// Work-around for comparing 'std::string' against 'char*'
inline void assertEquals(
const char* expected,
const std::string actual,
const std::string &actual,
SourceLine sourceLine,
const std::string &message
) {