mirror of
https://github.com/monero-project/monero-gui.git
synced 2025-01-10 12:54:30 +00:00
build: fix all warnings, treat warnings as errors
This commit is contained in:
parent
eb7fae92ef
commit
98abdaa5d5
21 changed files with 36 additions and 73 deletions
|
@ -337,6 +337,8 @@ if(APPLE)
|
|||
endif()
|
||||
|
||||
# warnings
|
||||
add_c_flag_if_supported(-Werror C_SECURITY_FLAGS)
|
||||
add_cxx_flag_if_supported(-Werror CXX_SECURITY_FLAGS)
|
||||
add_c_flag_if_supported(-Wformat C_SECURITY_FLAGS)
|
||||
add_cxx_flag_if_supported(-Wformat CXX_SECURITY_FLAGS)
|
||||
add_c_flag_if_supported(-Wformat-security C_SECURITY_FLAGS)
|
||||
|
|
|
@ -176,8 +176,8 @@ android {
|
|||
|
||||
|
||||
|
||||
QMAKE_CXXFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -Wformat -Wformat-security
|
||||
QMAKE_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -Wformat -Wformat-security
|
||||
QMAKE_CXXFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -Werror -Wformat -Wformat-security
|
||||
QMAKE_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -Werror -Wformat -Wformat-security
|
||||
|
||||
ios {
|
||||
message("Host is IOS")
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include "DaemonManager.h"
|
||||
#include <QElapsedTimer>
|
||||
#include <QFile>
|
||||
#include <QThread>
|
||||
#include <QFileInfo>
|
||||
|
@ -36,7 +37,6 @@
|
|||
#include <QtConcurrent/QtConcurrent>
|
||||
#include <QApplication>
|
||||
#include <QProcess>
|
||||
#include <QTime>
|
||||
#include <QStorageInfo>
|
||||
#include <QVariantMap>
|
||||
#include <QVariant>
|
||||
|
@ -173,8 +173,8 @@ bool DaemonManager::stop(NetworkType::Type nettype)
|
|||
bool DaemonManager::startWatcher(NetworkType::Type nettype) const
|
||||
{
|
||||
// Check if daemon is started every 2 seconds
|
||||
QTime timer;
|
||||
timer.restart();
|
||||
QElapsedTimer timer;
|
||||
timer.start();
|
||||
while(true && !m_app_exit && timer.elapsed() / 1000 < DAEMON_START_TIMEOUT_SECONDS ) {
|
||||
QThread::sleep(2);
|
||||
if(!running(nettype)) {
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
AddressBook::AddressBook(Monero::AddressBook *abImpl,QObject *parent)
|
||||
: QObject(parent), m_addressBookImpl(abImpl)
|
||||
{
|
||||
qDebug(__FUNCTION__);
|
||||
getAll();
|
||||
}
|
||||
|
||||
|
@ -48,8 +47,6 @@ int AddressBook::errorCode() const
|
|||
|
||||
void AddressBook::getAll()
|
||||
{
|
||||
qDebug(__FUNCTION__);
|
||||
|
||||
emit refreshStarted();
|
||||
|
||||
{
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include <QDateTime>
|
||||
|
||||
namespace Monero {
|
||||
class AddressBook;
|
||||
struct AddressBook;
|
||||
}
|
||||
class AddressBookRow;
|
||||
|
||||
|
|
|
@ -32,14 +32,11 @@
|
|||
Subaddress::Subaddress(Monero::Subaddress *subaddressImpl, QObject *parent)
|
||||
: QObject(parent), m_subaddressImpl(subaddressImpl)
|
||||
{
|
||||
qDebug(__FUNCTION__);
|
||||
getAll();
|
||||
}
|
||||
|
||||
void Subaddress::getAll() const
|
||||
{
|
||||
qDebug(__FUNCTION__);
|
||||
|
||||
emit refreshStarted();
|
||||
|
||||
{
|
||||
|
|
|
@ -32,14 +32,11 @@
|
|||
SubaddressAccount::SubaddressAccount(Monero::SubaddressAccount *subaddressAccountImpl, QObject *parent)
|
||||
: QObject(parent), m_subaddressAccountImpl(subaddressAccountImpl)
|
||||
{
|
||||
qDebug(__FUNCTION__);
|
||||
getAll();
|
||||
}
|
||||
|
||||
void SubaddressAccount::getAll() const
|
||||
{
|
||||
qDebug(__FUNCTION__);
|
||||
|
||||
emit refreshStarted();
|
||||
|
||||
{
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include <QDateTime>
|
||||
|
||||
namespace Monero {
|
||||
class TransactionHistory;
|
||||
struct TransactionHistory;
|
||||
}
|
||||
|
||||
class TransactionInfo;
|
||||
|
|
|
@ -68,38 +68,38 @@ public:
|
|||
|
||||
}
|
||||
|
||||
virtual void moneySpent(const std::string &txId, uint64_t amount)
|
||||
virtual void moneySpent(const std::string &txId, uint64_t amount) override
|
||||
{
|
||||
qDebug() << __FUNCTION__;
|
||||
emit m_wallet->moneySpent(QString::fromStdString(txId), amount);
|
||||
}
|
||||
|
||||
|
||||
virtual void moneyReceived(const std::string &txId, uint64_t amount)
|
||||
virtual void moneyReceived(const std::string &txId, uint64_t amount) override
|
||||
{
|
||||
qDebug() << __FUNCTION__;
|
||||
emit m_wallet->moneyReceived(QString::fromStdString(txId), amount);
|
||||
}
|
||||
|
||||
virtual void unconfirmedMoneyReceived(const std::string &txId, uint64_t amount)
|
||||
virtual void unconfirmedMoneyReceived(const std::string &txId, uint64_t amount) override
|
||||
{
|
||||
qDebug() << __FUNCTION__;
|
||||
emit m_wallet->unconfirmedMoneyReceived(QString::fromStdString(txId), amount);
|
||||
}
|
||||
|
||||
virtual void newBlock(uint64_t height)
|
||||
virtual void newBlock(uint64_t height) override
|
||||
{
|
||||
// qDebug() << __FUNCTION__;
|
||||
emit m_wallet->newBlock(height, m_wallet->daemonBlockChainTargetHeight());
|
||||
}
|
||||
|
||||
virtual void updated()
|
||||
virtual void updated() override
|
||||
{
|
||||
emit m_wallet->updated();
|
||||
}
|
||||
|
||||
// called when wallet refreshed by background thread or explicitly
|
||||
virtual void refreshed()
|
||||
virtual void refreshed() override
|
||||
{
|
||||
qDebug() << __FUNCTION__;
|
||||
emit m_wallet->refreshed();
|
||||
|
@ -1028,9 +1028,9 @@ Wallet::Wallet(Monero::Wallet *w, QObject *parent)
|
|||
m_walletImpl->setListener(m_walletListener);
|
||||
m_currentSubaddressAccount = getCacheAttribute(ATTRIBUTE_SUBADDRESS_ACCOUNT).toUInt();
|
||||
// start cache timers
|
||||
m_connectionStatusTime.restart();
|
||||
m_daemonBlockChainHeightTime.restart();
|
||||
m_daemonBlockChainTargetHeightTime.restart();
|
||||
m_connectionStatusTime.start();
|
||||
m_daemonBlockChainHeightTime.start();
|
||||
m_daemonBlockChainTargetHeightTime.start();
|
||||
m_initialized = false;
|
||||
m_connectionStatusRunning = false;
|
||||
m_daemonUsername = "";
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
#ifndef WALLET_H
|
||||
#define WALLET_H
|
||||
|
||||
#include <QElapsedTimer>
|
||||
#include <QObject>
|
||||
#include <QTime>
|
||||
#include <QMutex>
|
||||
#include <QList>
|
||||
#include <QJSValue>
|
||||
|
@ -43,7 +43,7 @@
|
|||
#include "NetworkType.h"
|
||||
|
||||
namespace Monero {
|
||||
class Wallet; // forward declaration
|
||||
struct Wallet; // forward declaration
|
||||
}
|
||||
|
||||
|
||||
|
@ -406,15 +406,15 @@ private:
|
|||
QString m_paymentId;
|
||||
AddressBook * m_addressBook;
|
||||
mutable AddressBookModel * m_addressBookModel;
|
||||
mutable QTime m_daemonBlockChainHeightTime;
|
||||
mutable QElapsedTimer m_daemonBlockChainHeightTime;
|
||||
mutable quint64 m_daemonBlockChainHeight;
|
||||
int m_daemonBlockChainHeightTtl;
|
||||
mutable QTime m_daemonBlockChainTargetHeightTime;
|
||||
mutable QElapsedTimer m_daemonBlockChainTargetHeightTime;
|
||||
mutable quint64 m_daemonBlockChainTargetHeight;
|
||||
int m_daemonBlockChainTargetHeightTtl;
|
||||
mutable ConnectionStatus m_connectionStatus;
|
||||
int m_connectionStatusTtl;
|
||||
mutable QTime m_connectionStatusTime;
|
||||
mutable QElapsedTimer m_connectionStatusTime;
|
||||
bool m_disconnected;
|
||||
mutable bool m_initialized;
|
||||
uint32_t m_currentSubaddressAccount;
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
class Wallet;
|
||||
namespace Monero {
|
||||
class WalletManager;
|
||||
struct WalletManager;
|
||||
}
|
||||
|
||||
class WalletManager : public QObject
|
||||
|
|
|
@ -269,7 +269,7 @@ int main(int argc, char *argv[])
|
|||
// screen settings
|
||||
// Mobile is designed on 128dpi
|
||||
qreal ref_dpi = 128;
|
||||
QRect geo = QApplication::desktop()->availableGeometry();
|
||||
QRect geo = QGuiApplication::primaryScreen()->availableGeometry();
|
||||
QRect rect = QGuiApplication::primaryScreen()->geometry();
|
||||
qreal dpi = QGuiApplication::primaryScreen()->logicalDotsPerInch();
|
||||
qreal physicalDpi = QGuiApplication::primaryScreen()->physicalDotsPerInch();
|
||||
|
|
|
@ -35,18 +35,15 @@
|
|||
AddressBookModel::AddressBookModel(QObject *parent, AddressBook *addressBook)
|
||||
: QAbstractListModel(parent) , m_addressBook(addressBook)
|
||||
{
|
||||
qDebug(__FUNCTION__);
|
||||
connect(m_addressBook,SIGNAL(refreshStarted()),this,SLOT(startReset()));
|
||||
connect(m_addressBook,SIGNAL(refreshFinished()),this,SLOT(endReset()));
|
||||
|
||||
}
|
||||
|
||||
void AddressBookModel::startReset(){
|
||||
qDebug(__FUNCTION__);
|
||||
beginResetModel();
|
||||
}
|
||||
void AddressBookModel::endReset(){
|
||||
qDebug(__FUNCTION__);
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
|
|
|
@ -35,17 +35,14 @@
|
|||
SubaddressAccountModel::SubaddressAccountModel(QObject *parent, SubaddressAccount *subaddressAccount)
|
||||
: QAbstractListModel(parent), m_subaddressAccount(subaddressAccount)
|
||||
{
|
||||
qDebug(__FUNCTION__);
|
||||
connect(m_subaddressAccount,SIGNAL(refreshStarted()),this,SLOT(startReset()));
|
||||
connect(m_subaddressAccount,SIGNAL(refreshFinished()),this,SLOT(endReset()));
|
||||
}
|
||||
|
||||
void SubaddressAccountModel::startReset(){
|
||||
qDebug("SubaddressAccountModel::startReset");
|
||||
beginResetModel();
|
||||
}
|
||||
void SubaddressAccountModel::endReset(){
|
||||
qDebug("SubaddressAccountModel::endReset");
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
|
|
|
@ -35,18 +35,15 @@
|
|||
SubaddressModel::SubaddressModel(QObject *parent, Subaddress *subaddress)
|
||||
: QAbstractListModel(parent), m_subaddress(subaddress)
|
||||
{
|
||||
qDebug(__FUNCTION__);
|
||||
connect(m_subaddress,SIGNAL(refreshStarted()),this,SLOT(startReset()));
|
||||
connect(m_subaddress,SIGNAL(refreshFinished()),this,SLOT(endReset()));
|
||||
|
||||
}
|
||||
|
||||
void SubaddressModel::startReset(){
|
||||
qDebug(__FUNCTION__);
|
||||
beginResetModel();
|
||||
}
|
||||
void SubaddressModel::endReset(){
|
||||
qDebug(__FUNCTION__);
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ QPair<bool, QFuture<void>> FutureScheduler::run(std::function<void()> function)
|
|||
});
|
||||
}
|
||||
|
||||
QPair<bool, QFuture<QJSValueList>> FutureScheduler::run(std::function<QJSValueList() noexcept> function, const QJSValue &callback)
|
||||
QPair<bool, QFuture<QJSValueList>> FutureScheduler::run(std::function<QJSValueList()> function, const QJSValue &callback)
|
||||
{
|
||||
if (!callback.isCallable())
|
||||
{
|
||||
|
|
|
@ -22,20 +22,12 @@ public:
|
|||
void shutdownWaitForFinished() noexcept;
|
||||
|
||||
QPair<bool, QFuture<void>> run(std::function<void()> function) noexcept;
|
||||
QPair<bool, QFuture<QJSValueList>> run(std::function<QJSValueList() noexcept> function, const QJSValue &callback);
|
||||
QPair<bool, QFuture<QJSValueList>> run(std::function<QJSValueList()> function, const QJSValue &callback);
|
||||
|
||||
private:
|
||||
bool add() noexcept;
|
||||
void done() noexcept;
|
||||
|
||||
template<typename T>
|
||||
QFutureWatcher<T> *newWatcher()
|
||||
{
|
||||
QFutureWatcher<T> *watcher = new QFutureWatcher<T>();
|
||||
|
||||
return watcher;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
QPair<bool, QFuture<T>> execute(std::function<QFuture<T>(QFutureWatcher<T> *)> makeFuture) noexcept
|
||||
{
|
||||
|
@ -43,8 +35,8 @@ private:
|
|||
{
|
||||
try
|
||||
{
|
||||
auto *watcher = newWatcher<T>();
|
||||
connect(watcher, &QFutureWatcher<T>::finished, [this, watcher] {
|
||||
auto *watcher = new QFutureWatcher<T>();
|
||||
connect(watcher, &QFutureWatcher<T>::finished, [watcher] {
|
||||
watcher->deleteLater();
|
||||
});
|
||||
watcher->setFuture(makeFuture(watcher));
|
||||
|
|
|
@ -43,8 +43,8 @@
|
|||
#include "KeysFiles.h"
|
||||
|
||||
|
||||
WalletKeysFiles::WalletKeysFiles(const qint64 &modified, const qint64 &created, const QString &path, const quint8 &networkType, const QString &address)
|
||||
: m_modified(modified), m_created(created), m_path(path), m_networkType(networkType), m_address(address)
|
||||
WalletKeysFiles::WalletKeysFiles(const qint64 &modified, const QString &path, const quint8 &networkType, const QString &address)
|
||||
: m_modified(modified), m_path(path), m_networkType(networkType), m_address(address)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -58,11 +58,6 @@ QString WalletKeysFiles::address() const
|
|||
return m_address;
|
||||
}
|
||||
|
||||
qint64 WalletKeysFiles::created() const
|
||||
{
|
||||
return m_created;
|
||||
}
|
||||
|
||||
QString WalletKeysFiles::path() const
|
||||
{
|
||||
return m_path;
|
||||
|
@ -134,10 +129,8 @@ void WalletKeysFilesModel::findWallets(const QString &moneroAccountsDir)
|
|||
|
||||
const QFileInfo info(wallet);
|
||||
const QDateTime modifiedAt = info.lastModified();
|
||||
const QDateTime createdAt = info.created(); // @TODO: QFileInfo::birthTime() >= Qt 5.10
|
||||
|
||||
this->addWalletKeysFile(WalletKeysFiles(modifiedAt.toSecsSinceEpoch(),
|
||||
createdAt.toSecsSinceEpoch(),
|
||||
info.absoluteFilePath(), networkType, address));
|
||||
}
|
||||
}
|
||||
|
@ -167,8 +160,6 @@ QVariant WalletKeysFilesModel::data(const QModelIndex & index, int role) const {
|
|||
return walletKeyFile.networkType();
|
||||
else if (role == AddressRole)
|
||||
return walletKeyFile.address();
|
||||
else if (role == CreatedRole)
|
||||
return walletKeyFile.created();
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
@ -178,6 +169,5 @@ QHash<int, QByteArray> WalletKeysFilesModel::roleNames() const {
|
|||
roles[PathRole] = "path";
|
||||
roles[NetworkTypeRole] = "networktype";
|
||||
roles[AddressRole] = "address";
|
||||
roles[CreatedRole] = "created";
|
||||
return roles;
|
||||
}
|
||||
|
|
|
@ -37,17 +37,15 @@
|
|||
class WalletKeysFiles
|
||||
{
|
||||
public:
|
||||
WalletKeysFiles(const qint64 &modified, const qint64 &created, const QString &path, const quint8 &networkType, const QString &address);
|
||||
WalletKeysFiles(const qint64 &modified, const QString &path, const quint8 &networkType, const QString &address);
|
||||
|
||||
qint64 modified() const;
|
||||
qint64 created() const;
|
||||
QString path() const;
|
||||
quint8 networkType() const;
|
||||
QString address() const;
|
||||
|
||||
private:
|
||||
qint64 m_modified;
|
||||
qint64 m_created;
|
||||
QString m_path;
|
||||
quint8 m_networkType;
|
||||
QString m_address;
|
||||
|
@ -61,8 +59,7 @@ public:
|
|||
ModifiedRole = Qt::UserRole + 1,
|
||||
PathRole,
|
||||
NetworkTypeRole,
|
||||
AddressRole,
|
||||
CreatedRole
|
||||
AddressRole
|
||||
};
|
||||
|
||||
WalletKeysFilesModel(WalletManager *walletManager, QObject *parent = 0);
|
||||
|
|
|
@ -884,7 +884,7 @@ void CreateArrays(NodeSPtr Root, StringIntSet_t & StrSet, StringOfInts & ChildAd
|
|||
if (x >= (1 << BITS_CHILD_MAP_INDEX))
|
||||
{
|
||||
char Tmp[20];
|
||||
snprintf(Tmp, sizeof Tmp, "%lu", x);
|
||||
snprintf(Tmp, sizeof Tmp, "%zu", x);
|
||||
throw string("Not enough bits for child map index value of ") + Tmp + " for " +
|
||||
Its->s + " (BITS_CHILD_MAP_INDEX too small)";
|
||||
}
|
||||
|
@ -1046,7 +1046,7 @@ static int OutputBinary(ostream *Out, const string & ChkFile, const string & Cha
|
|||
Out->write((char *)WordEnds, NumWordEnd);
|
||||
h(WordEnds, NumWordEnd);
|
||||
OutputSize += NumWordEnd;
|
||||
delete WordEnds;
|
||||
delete[] WordEnds;
|
||||
|
||||
StringIntSet_t::iterator Its;
|
||||
string Str;
|
||||
|
|
|
@ -960,7 +960,7 @@ typedef struct
|
|||
} SpatialMatchInfo_t;
|
||||
|
||||
/* Shift mapping, characters in pairs: first is shifted, second un-shifted. */
|
||||
static const uint8_t UK_Shift[] = "!1\"2$4%5&7(9)0*8:;<,>.?/@'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz^6_-{[|\\}]~#€4£3¬`";
|
||||
static const uint8_t UK_Shift[] = "!1\"2$4%5&7(9)0*8:;<,>.?/@'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz^6_-{[|\\}]~#\x80""4\xA3""3\xAC`";
|
||||
static const uint8_t US_Shift[] = "!1\"'#3$4%5&7(9)0*8:;<,>.?/@2AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz^6_-{[|\\}]~`";
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue