Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a Clang Static Analyzer warning that the variable is not used #56

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/model/ircbuffermodel.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,9 @@ void IrcBufferModelPrivate::insertBuffer(int index, IrcBuffer* buffer, bool noti
if (sortMethod != Irc::SortByHand) {
QList<IrcBuffer*>::iterator it;
if (sortOrder == Qt::AscendingOrder)
it = qUpperBound(bufferList.begin(), bufferList.end(), buffer, IrcBufferLessThan(q, sortMethod));
it = std::upper_bound(bufferList.begin(), bufferList.end(), buffer, IrcBufferLessThan(q, sortMethod));
else
it = qUpperBound(bufferList.begin(), bufferList.end(), buffer, IrcBufferGreaterThan(q, sortMethod));
it = std::upper_bound(bufferList.begin(), bufferList.end(), buffer, IrcBufferGreaterThan(q, sortMethod));
index = it - bufferList.begin();
} else if (index == -1) {
index = bufferList.count();
Expand Down Expand Up @@ -605,6 +605,7 @@ void IrcBufferModelPrivate::_irc_restoreBuffers()
chans.clear();
keys.clear();
joinCommandLength = joinCommandMinLength;
(void)joinCommandLength; // Fix a Static Analyzer warning that the variable is never read
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we probably shouldn't hide the issue but check if it's actually a bug that it's not used... @Venemo can you check this?

}

// Add channel to list
Expand Down Expand Up @@ -1064,9 +1065,9 @@ void IrcBufferModel::sort(Irc::SortMethod method, Qt::SortOrder order)
persistentBuffers += static_cast<IrcBuffer*>(index.internalPointer());

if (order == Qt::AscendingOrder)
qSort(d->bufferList.begin(), d->bufferList.end(), IrcBufferLessThan(this, method));
std::sort(d->bufferList.begin(), d->bufferList.end(), IrcBufferLessThan(this, method));
else
qSort(d->bufferList.begin(), d->bufferList.end(), IrcBufferGreaterThan(this, method));
std::sort(d->bufferList.begin(), d->bufferList.end(), IrcBufferGreaterThan(this, method));

QModelIndexList newPersistentIndexes;
foreach (IrcBuffer* buffer, persistentBuffers)
Expand Down
13 changes: 7 additions & 6 deletions src/model/ircusermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "ircchannel_p.h"
#include "ircuser.h"
#include <qpointer.h>
#include <algorithm>

IRC_BEGIN_NAMESPACE

Expand Down Expand Up @@ -125,9 +126,9 @@ void IrcUserModelPrivate::insertUser(int index, IrcUser* user, bool notify)
if (sortMethod != Irc::SortByHand) {
QList<IrcUser*>::iterator it;
if (sortOrder == Qt::AscendingOrder)
it = qUpperBound(userList.begin(), userList.end(), user, IrcUserLessThan(q, sortMethod));
it = std::upper_bound(userList.begin(), userList.end(), user, IrcUserLessThan(q, sortMethod));
else
it = qUpperBound(userList.begin(), userList.end(), user, IrcUserGreaterThan(q, sortMethod));
it = std::upper_bound(userList.begin(), userList.end(), user, IrcUserGreaterThan(q, sortMethod));
index = it - userList.begin();
}
if (notify)
Expand Down Expand Up @@ -179,9 +180,9 @@ void IrcUserModelPrivate::setUsers(const QList<IrcUser*>& users, bool reset)
userList = users;
if (sortMethod != Irc::SortByHand) {
if (sortOrder == Qt::AscendingOrder)
qSort(userList.begin(), userList.end(), IrcUserLessThan(q, sortMethod));
std::sort(userList.begin(), userList.end(), IrcUserLessThan(q, sortMethod));
else
qSort(userList.begin(), userList.end(), IrcUserGreaterThan(q, sortMethod));
std::sort(userList.begin(), userList.end(), IrcUserGreaterThan(q, sortMethod));
}
updateTitles();
if (reset)
Expand Down Expand Up @@ -695,9 +696,9 @@ void IrcUserModel::sort(Irc::SortMethod method, Qt::SortOrder order)
persistentUsers += static_cast<IrcUser*>(index.internalPointer());

if (order == Qt::AscendingOrder)
qSort(d->userList.begin(), d->userList.end(), IrcUserLessThan(this, method));
std::sort(d->userList.begin(), d->userList.end(), IrcUserLessThan(this, method));
else
qSort(d->userList.begin(), d->userList.end(), IrcUserGreaterThan(this, method));
std::sort(d->userList.begin(), d->userList.end(), IrcUserGreaterThan(this, method));

if (d->updateTitles())
emit titlesChanged(d->titles);
Expand Down