Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13115900
D4722.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Subscribers
None
D4722.diff
View Options
diff --git a/src/qt/addresstablemodel.cpp b/src/qt/addresstablemodel.cpp
--- a/src/qt/addresstablemodel.cpp
+++ b/src/qt/addresstablemodel.cpp
@@ -11,6 +11,8 @@
#include <qt/walletmodel.h>
#include <wallet/wallet.h>
+#include <algorithm>
+
#include <QDebug>
#include <QFont>
@@ -84,23 +86,23 @@
QString::fromStdString(EncodeCashAddr(
address.dest, parent->walletModel->getChainParams()))));
}
- // qLowerBound() and qUpperBound() require our cachedAddressTable list
- // to be sorted in asc order. Even though the map is already sorted this
- // re-sorting step is needed because the originating map is sorted by
- // binary address, not by base58() address.
- qSort(cachedAddressTable.begin(), cachedAddressTable.end(),
- AddressTableEntryLessThan());
+ // std::lower_bound() and std::upper_bound() require our
+ // cachedAddressTable list to be sorted in asc order Even though the map
+ // is already sorted this re-sorting step is needed because the
+ // originating map is sorted by binary address, not by base58() address.
+ std::sort(cachedAddressTable.begin(), cachedAddressTable.end(),
+ AddressTableEntryLessThan());
}
void updateEntry(const QString &address, const QString &label, bool isMine,
const QString &purpose, int status) {
// Find address / label in model
- QList<AddressTableEntry>::iterator lower =
- qLowerBound(cachedAddressTable.begin(), cachedAddressTable.end(),
- address, AddressTableEntryLessThan());
- QList<AddressTableEntry>::iterator upper =
- qUpperBound(cachedAddressTable.begin(), cachedAddressTable.end(),
- address, AddressTableEntryLessThan());
+ QList<AddressTableEntry>::iterator lower = std::lower_bound(
+ cachedAddressTable.begin(), cachedAddressTable.end(), address,
+ AddressTableEntryLessThan());
+ QList<AddressTableEntry>::iterator upper = std::upper_bound(
+ cachedAddressTable.begin(), cachedAddressTable.end(), address,
+ AddressTableEntryLessThan());
int lowerIndex = (lower - cachedAddressTable.begin());
int upperIndex = (upper - cachedAddressTable.begin());
bool inModel = (lower != upper);
diff --git a/src/qt/bantablemodel.cpp b/src/qt/bantablemodel.cpp
--- a/src/qt/bantablemodel.cpp
+++ b/src/qt/bantablemodel.cpp
@@ -12,6 +12,8 @@
#include <sync.h>
#include <util/time.h>
+#include <algorithm>
+
#include <QDebug>
#include <QList>
@@ -57,11 +59,12 @@
cachedBanlist.append(banEntry);
}
- if (sortColumn >= 0)
+ if (sortColumn >= 0) {
// sort cachedBanlist (use stable sort to prevent rows jumping
// around unnecessarily)
- qStableSort(cachedBanlist.begin(), cachedBanlist.end(),
- BannedNodeLessThan(sortColumn, sortOrder));
+ std::stable_sort(cachedBanlist.begin(), cachedBanlist.end(),
+ BannedNodeLessThan(sortColumn, sortOrder));
+ }
}
int size() const { return cachedBanlist.size(); }
diff --git a/src/qt/peertablemodel.cpp b/src/qt/peertablemodel.cpp
--- a/src/qt/peertablemodel.cpp
+++ b/src/qt/peertablemodel.cpp
@@ -12,6 +12,8 @@
#include <sync.h>
#include <validation.h> // for cs_main
+#include <algorithm>
+
#include <QDebug>
#include <QList>
#include <QTimer>
@@ -73,8 +75,8 @@
if (sortColumn >= 0) {
// sort cacheNodeStats (use stable sort to prevent rows jumping
// around unnecessarily)
- qStableSort(cachedNodeStats.begin(), cachedNodeStats.end(),
- NodeLessThan(sortColumn, sortOrder));
+ std::stable_sort(cachedNodeStats.begin(), cachedNodeStats.end(),
+ NodeLessThan(sortColumn, sortOrder));
}
// build index map
diff --git a/src/qt/recentrequeststablemodel.cpp b/src/qt/recentrequeststablemodel.cpp
--- a/src/qt/recentrequeststablemodel.cpp
+++ b/src/qt/recentrequeststablemodel.cpp
@@ -8,6 +8,7 @@
#include <qt/guiutil.h>
#include <qt/optionsmodel.h>
+#include <algorithm>
#include <clientversion.h>
#include <streams.h>
@@ -195,7 +196,8 @@
}
void RecentRequestsTableModel::sort(int column, Qt::SortOrder order) {
- qSort(list.begin(), list.end(), RecentRequestEntryLessThan(column, order));
+ std::sort(list.begin(), list.end(),
+ RecentRequestEntryLessThan(column, order));
Q_EMIT dataChanged(
index(0, 0, QModelIndex()),
index(list.size() - 1, NUMBER_OF_COLUMNS - 1, QModelIndex()));
diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp
--- a/src/qt/transactiontablemodel.cpp
+++ b/src/qt/transactiontablemodel.cpp
@@ -20,6 +20,8 @@
#include <util/system.h>
#include <validation.h>
+#include <algorithm>
+
#include <QColor>
#include <QDateTime>
#include <QDebug>
@@ -89,9 +91,9 @@
QString::number(status);
// Find bounds of this transaction in model
- QList<TransactionRecord>::iterator lower = qLowerBound(
+ QList<TransactionRecord>::iterator lower = std::lower_bound(
cachedWallet.begin(), cachedWallet.end(), txid, TxLessThan());
- QList<TransactionRecord>::iterator upper = qUpperBound(
+ QList<TransactionRecord>::iterator upper = std::upper_bound(
cachedWallet.begin(), cachedWallet.end(), txid, TxLessThan());
int lowerIndex = (lower - cachedWallet.begin());
int upperIndex = (upper - cachedWallet.begin());
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 1, 12:36 (13 m, 58 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5187861
Default Alt Text
D4722.diff (5 KB)
Attached To
D4722: refactor: replace qLowerBound & qUpperBound with std:: upper_bound & lower_bound
Event Timeline
Log In to Comment