diff options
author | Edwin Mons <edwin.mons@isode.com> | 2018-11-08 14:12:36 (GMT) |
---|---|---|
committer | Edwin Mons <edwin.mons@isode.com> | 2018-11-08 15:30:19 (GMT) |
commit | 0b4e062a59613b2597b712c0106c3ed08b747637 (patch) | |
tree | 7b062a8123d37be7226d4eb36c553b04563255c6 /Swift/Controllers/Chat/ChatControllerBase.cpp | |
parent | cf3d517763a3d74a2ec9fd6f7bdee8cbaee3550f (diff) | |
download | swift-0b4e062a59613b2597b712c0106c3ed08b747637.zip swift-0b4e062a59613b2597b712c0106c3ed08b747637.tar.bz2 |
Change unread counters to size_t
Since the counters cannot be negative, changing the type used for unread
counters to size_t seems a better fit, and it avoids the need for
numeric_casts.
Test-Information:
Unit tests pass on macOS 10.13
Change-Id: I61badcfc410f0cce7f922da90b50ef5a809c6521
Diffstat (limited to 'Swift/Controllers/Chat/ChatControllerBase.cpp')
-rw-r--r-- | Swift/Controllers/Chat/ChatControllerBase.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Swift/Controllers/Chat/ChatControllerBase.cpp b/Swift/Controllers/Chat/ChatControllerBase.cpp index 8a26a56..3805084 100644 --- a/Swift/Controllers/Chat/ChatControllerBase.cpp +++ b/Swift/Controllers/Chat/ChatControllerBase.cpp @@ -118,8 +118,8 @@ void ChatControllerBase::handleAllMessagesRead() { } } -int ChatControllerBase::getUnreadCount() { - return boost::numeric_cast<int>(targetedUnreadMessages_.size()); +size_t ChatControllerBase::getUnreadCount() { + return targetedUnreadMessages_.size(); } void ChatControllerBase::handleSendMessageRequest(const std::string &body, bool isCorrectionMessage) { @@ -193,11 +193,10 @@ ChatWindow::ChatMessage ChatControllerBase::buildChatWindowChatMessage(const std } void ChatControllerBase::updateMessageCount() { - int intCount = boost::numeric_cast<int>(unreadMessages_.size()); - chatWindow_->setUnreadMessageCount(intCount); auto baseJID = getBaseJID(); auto state = chattables_.getState(baseJID); - state.unreadCount = intCount; + state.unreadCount = unreadMessages_.size(); + chatWindow_->setUnreadMessageCount(state.unreadCount); chattables_.setState(baseJID, state); #ifndef NOT_YET onUnreadCountChanged(); |