Browse Source

refactor: Remove some useless casts

Can't actually enable Wuseless-cast though because Qt's MOC-generated code is
full of them.
reviewable/pr6551/r18
Anthony Bilinski 4 years ago
parent
commit
ece26e4a4f
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
  1. 4
      src/chatlog/chatline.cpp
  2. 2
      src/core/core.cpp
  3. 2
      src/model/sessionchatlog.cpp

4
src/chatlog/chatline.cpp

@ -49,7 +49,7 @@ void ChatLine::visibilityChanged(bool visible) @@ -49,7 +49,7 @@ void ChatLine::visibilityChanged(bool visible)
ChatLineContent* ChatLine::getContent(int col) const
{
if (col < static_cast<int>(content.size()) && col >= 0)
if (col < content.size() && col >= 0)
return content[col];
return nullptr;
@ -145,7 +145,7 @@ void ChatLine::addColumn(ChatLineContent* item, ColumnFormat fmt) @@ -145,7 +145,7 @@ void ChatLine::addColumn(ChatLineContent* item, ColumnFormat fmt)
void ChatLine::replaceContent(int col, ChatLineContent* lineContent)
{
if (col >= 0 && col < static_cast<int>(content.size()) && lineContent) {
if (col >= 0 && col < content.size() && lineContent) {
QGraphicsScene* scene = content[col]->scene();
delete content[col];

2
src/core/core.cpp

@ -1670,7 +1670,7 @@ uint32_t Core::joinGroupchat(const GroupInvite& inviteInfo) @@ -1670,7 +1670,7 @@ uint32_t Core::joinGroupchat(const GroupInvite& inviteInfo)
case TOX_CONFERENCE_TYPE_AV: {
qDebug() << QString("Trying to join AV groupchat invite sent by friend %1").arg(friendId);
groupNum = toxav_join_av_groupchat(tox.get(), friendId, cookie, cookieLength,
CoreAV::groupCallCallback, const_cast<Core*>(this));
CoreAV::groupCallCallback, this);
break;
}
default:

2
src/model/sessionchatlog.cpp

@ -98,7 +98,7 @@ std::map<ChatLogIdx, ChatLogItem>::const_iterator @@ -98,7 +98,7 @@ std::map<ChatLogIdx, ChatLogItem>::const_iterator
firstItemAfterDate(QDate date, const std::map<ChatLogIdx, ChatLogItem>& items)
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
return std::lower_bound(items.begin(), items.end(), QDateTime(date.startOfDay()),
return std::lower_bound(items.begin(), items.end(), date.startOfDay(),
#else
return std::lower_bound(items.begin(), items.end(), QDateTime(date),
#endif

Loading…
Cancel
Save