Merge #15114: Qt: Replace remaining 0 with nullptr

3a0e76fc12 Replace remaining 0 with nullptr in Qt code (Ben Woosley)
9096276e0b Don't use zero as null pointer constant (-Wzero-as-null-pointer-constant) (practicalswift)

Pull request description:

  This corrects all violations of `-Wzero-as-null-pointer-constant` identified in the Qt codebase.

  These changes are extracted from #15112 as suggested by @MarcoFalke to ease review. This is in service of enabling `-Wzero-as-null-pointer-constant`, which should eliminate this as a concern going forward.

  Note there are 2 non-Qt changes: `src/test/allocator_tests.cpp` and `src/wallet/db.cpp`.

Tree-SHA512: 206bd668802147ba42bc413c2d7d259cb59aca9ec1da74a6bf2ca3932e60ae492faacbc61bcee0fd6b4b49a4d59d075b7e5404f0526b36c47718f9b0587e7768
This commit is contained in:
Wladimir J. van der Laan 2019-01-14 15:20:45 +01:00
commit 76335298f4
No known key found for this signature in database
GPG key ID: 1E4AED62986CD25D
61 changed files with 123 additions and 125 deletions

View file

@ -59,7 +59,7 @@ protected:
AddressBookPage::AddressBookPage(const PlatformStyle *platformStyle, Mode _mode, Tabs _tab, QWidget *parent) : AddressBookPage::AddressBookPage(const PlatformStyle *platformStyle, Mode _mode, Tabs _tab, QWidget *parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::AddressBookPage), ui(new Ui::AddressBookPage),
model(0), model(nullptr),
mode(_mode), mode(_mode),
tab(_tab) tab(_tab)
{ {

View file

@ -38,7 +38,7 @@ public:
ForEditing /**< Open address book for editing */ ForEditing /**< Open address book for editing */
}; };
explicit AddressBookPage(const PlatformStyle *platformStyle, Mode mode, Tabs tab, QWidget *parent = 0); explicit AddressBookPage(const PlatformStyle *platformStyle, Mode mode, Tabs tab, QWidget *parent = nullptr);
~AddressBookPage(); ~AddressBookPage();
void setModel(AddressTableModel *model); void setModel(AddressTableModel *model);

View file

@ -153,7 +153,7 @@ public:
} }
else else
{ {
return 0; return nullptr;
} }
} }
}; };
@ -300,8 +300,8 @@ QVariant AddressTableModel::headerData(int section, Qt::Orientation orientation,
Qt::ItemFlags AddressTableModel::flags(const QModelIndex &index) const Qt::ItemFlags AddressTableModel::flags(const QModelIndex &index) const
{ {
if(!index.isValid()) if (!index.isValid()) return Qt::NoItemFlags;
return 0;
AddressTableEntry *rec = static_cast<AddressTableEntry*>(index.internalPointer()); AddressTableEntry *rec = static_cast<AddressTableEntry*>(index.internalPointer());
Qt::ItemFlags retval = Qt::ItemIsSelectable | Qt::ItemIsEnabled; Qt::ItemFlags retval = Qt::ItemIsSelectable | Qt::ItemIsEnabled;

View file

@ -25,7 +25,7 @@ class AddressTableModel : public QAbstractTableModel
Q_OBJECT Q_OBJECT
public: public:
explicit AddressTableModel(WalletModel *parent = 0); explicit AddressTableModel(WalletModel *parent = nullptr);
~AddressTableModel(); ~AddressTableModel();
enum ColumnIndex { enum ColumnIndex {

View file

@ -22,7 +22,7 @@ AskPassphraseDialog::AskPassphraseDialog(Mode _mode, QWidget *parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::AskPassphraseDialog), ui(new Ui::AskPassphraseDialog),
mode(_mode), mode(_mode),
model(0), model(nullptr),
fCapsLock(false) fCapsLock(false)
{ {
ui->setupUi(this); ui->setupUi(this);

View file

@ -76,7 +76,7 @@ public:
if (idx >= 0 && idx < cachedBanlist.size()) if (idx >= 0 && idx < cachedBanlist.size())
return &cachedBanlist[idx]; return &cachedBanlist[idx];
return 0; return nullptr;
} }
}; };
@ -145,8 +145,7 @@ QVariant BanTableModel::headerData(int section, Qt::Orientation orientation, int
Qt::ItemFlags BanTableModel::flags(const QModelIndex &index) const Qt::ItemFlags BanTableModel::flags(const QModelIndex &index) const
{ {
if(!index.isValid()) if (!index.isValid()) return Qt::NoItemFlags;
return 0;
Qt::ItemFlags retval = Qt::ItemIsSelectable | Qt::ItemIsEnabled; Qt::ItemFlags retval = Qt::ItemIsSelectable | Qt::ItemIsEnabled;
return retval; return retval;

View file

@ -45,7 +45,7 @@ class BanTableModel : public QAbstractTableModel
Q_OBJECT Q_OBJECT
public: public:
explicit BanTableModel(interfaces::Node& node, ClientModel *parent = 0); explicit BanTableModel(interfaces::Node& node, ClientModel *parent = nullptr);
~BanTableModel(); ~BanTableModel();
void startAutoRefresh(); void startAutoRefresh();
void stopAutoRefresh(); void stopAutoRefresh();

View file

@ -178,18 +178,18 @@ void BitcoinCore::shutdown()
BitcoinApplication::BitcoinApplication(interfaces::Node& node, int &argc, char **argv): BitcoinApplication::BitcoinApplication(interfaces::Node& node, int &argc, char **argv):
QApplication(argc, argv), QApplication(argc, argv),
coreThread(0), coreThread(nullptr),
m_node(node), m_node(node),
optionsModel(0), optionsModel(nullptr),
clientModel(0), clientModel(nullptr),
window(0), window(nullptr),
pollShutdownTimer(0), pollShutdownTimer(nullptr),
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
paymentServer(0), paymentServer(nullptr),
m_wallet_models(), m_wallet_models(),
#endif #endif
returnValue(0), returnValue(0),
platformStyle(0) platformStyle(nullptr)
{ {
setQuitOnLastWindowClosed(false); setQuitOnLastWindowClosed(false);
} }
@ -218,15 +218,15 @@ BitcoinApplication::~BitcoinApplication()
} }
delete window; delete window;
window = 0; window = nullptr;
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
delete paymentServer; delete paymentServer;
paymentServer = 0; paymentServer = nullptr;
#endif #endif
delete optionsModel; delete optionsModel;
optionsModel = 0; optionsModel = nullptr;
delete platformStyle; delete platformStyle;
platformStyle = 0; platformStyle = nullptr;
} }
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
@ -243,7 +243,7 @@ void BitcoinApplication::createOptionsModel(bool resetSettings)
void BitcoinApplication::createWindow(const NetworkStyle *networkStyle) void BitcoinApplication::createWindow(const NetworkStyle *networkStyle)
{ {
window = new BitcoinGUI(m_node, platformStyle, networkStyle, 0); window = new BitcoinGUI(m_node, platformStyle, networkStyle, nullptr);
pollShutdownTimer = new QTimer(window); pollShutdownTimer = new QTimer(window);
connect(pollShutdownTimer, &QTimer::timeout, window, &BitcoinGUI::detectShutdown); connect(pollShutdownTimer, &QTimer::timeout, window, &BitcoinGUI::detectShutdown);
@ -251,7 +251,7 @@ void BitcoinApplication::createWindow(const NetworkStyle *networkStyle)
void BitcoinApplication::createSplashScreen(const NetworkStyle *networkStyle) void BitcoinApplication::createSplashScreen(const NetworkStyle *networkStyle)
{ {
SplashScreen *splash = new SplashScreen(m_node, 0, networkStyle); SplashScreen *splash = new SplashScreen(m_node, nullptr, networkStyle);
// We don't hold a direct pointer to the splash screen after creation, but the splash // We don't hold a direct pointer to the splash screen after creation, but the splash
// screen will take care of deleting itself when finish() happens. // screen will take care of deleting itself when finish() happens.
splash->show(); splash->show();
@ -312,7 +312,7 @@ void BitcoinApplication::requestShutdown()
qDebug() << __func__ << ": Requesting shutdown"; qDebug() << __func__ << ": Requesting shutdown";
startThread(); startThread();
window->hide(); window->hide();
window->setClientModel(0); window->setClientModel(nullptr);
pollShutdownTimer->stop(); pollShutdownTimer->stop();
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
@ -323,7 +323,7 @@ void BitcoinApplication::requestShutdown()
m_wallet_models.clear(); m_wallet_models.clear();
#endif #endif
delete clientModel; delete clientModel;
clientModel = 0; clientModel = nullptr;
m_node.startShutdown(); m_node.startShutdown();
@ -429,7 +429,7 @@ void BitcoinApplication::shutdownResult()
void BitcoinApplication::handleRunawayException(const QString &message) void BitcoinApplication::handleRunawayException(const QString &message)
{ {
QMessageBox::critical(0, "Runaway exception", BitcoinGUI::tr("A fatal error occurred. Bitcoin can no longer continue safely and will quit.") + QString("\n\n") + message); QMessageBox::critical(nullptr, "Runaway exception", BitcoinGUI::tr("A fatal error occurred. Bitcoin can no longer continue safely and will quit.") + QString("\n\n") + message);
::exit(EXIT_FAILURE); ::exit(EXIT_FAILURE);
} }
@ -503,7 +503,7 @@ int GuiMain(int argc, char* argv[])
SetupUIArgs(); SetupUIArgs();
std::string error; std::string error;
if (!node->parseParameters(argc, argv, error)) { if (!node->parseParameters(argc, argv, error)) {
QMessageBox::critical(0, QObject::tr(PACKAGE_NAME), QMessageBox::critical(nullptr, QObject::tr(PACKAGE_NAME),
QObject::tr("Error parsing command line arguments: %1.").arg(QString::fromStdString(error))); QObject::tr("Error parsing command line arguments: %1.").arg(QString::fromStdString(error)));
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@ -540,12 +540,12 @@ int GuiMain(int argc, char* argv[])
/// - Do not call GetDataDir(true) before this step finishes /// - Do not call GetDataDir(true) before this step finishes
if (!fs::is_directory(GetDataDir(false))) if (!fs::is_directory(GetDataDir(false)))
{ {
QMessageBox::critical(0, QObject::tr(PACKAGE_NAME), QMessageBox::critical(nullptr, QObject::tr(PACKAGE_NAME),
QObject::tr("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(gArgs.GetArg("-datadir", "")))); QObject::tr("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(gArgs.GetArg("-datadir", ""))));
return EXIT_FAILURE; return EXIT_FAILURE;
} }
if (!node->readConfigFiles(error)) { if (!node->readConfigFiles(error)) {
QMessageBox::critical(0, QObject::tr(PACKAGE_NAME), QMessageBox::critical(nullptr, QObject::tr(PACKAGE_NAME),
QObject::tr("Error: Cannot parse configuration file: %1.").arg(QString::fromStdString(error))); QObject::tr("Error: Cannot parse configuration file: %1.").arg(QString::fromStdString(error)));
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@ -560,7 +560,7 @@ int GuiMain(int argc, char* argv[])
try { try {
node->selectParams(gArgs.GetChainName()); node->selectParams(gArgs.GetChainName());
} catch(std::exception &e) { } catch(std::exception &e) {
QMessageBox::critical(0, QObject::tr(PACKAGE_NAME), QObject::tr("Error: %1").arg(e.what())); QMessageBox::critical(nullptr, QObject::tr(PACKAGE_NAME), QObject::tr("Error: %1").arg(e.what()));
return EXIT_FAILURE; return EXIT_FAILURE;
} }
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET

View file

@ -60,7 +60,7 @@ public:
} }
} }
CAmount value(bool *valid_out=0) const CAmount value(bool *valid_out=nullptr) const
{ {
return parse(text(), valid_out); return parse(text(), valid_out);
} }
@ -159,7 +159,7 @@ private:
* return validity. * return validity.
* @note Must return 0 if !valid. * @note Must return 0 if !valid.
*/ */
CAmount parse(const QString &text, bool *valid_out=0) const CAmount parse(const QString &text, bool *valid_out=nullptr) const
{ {
CAmount val = 0; CAmount val = 0;
bool valid = BitcoinUnits::parse(currentUnit, text, &val); bool valid = BitcoinUnits::parse(currentUnit, text, &val);
@ -196,7 +196,7 @@ protected:
if (text().isEmpty()) // Allow step-up with empty field if (text().isEmpty()) // Allow step-up with empty field
return StepUpEnabled; return StepUpEnabled;
StepEnabled rv = 0; StepEnabled rv = StepNone;
bool valid = false; bool valid = false;
CAmount val = value(&valid); CAmount val = value(&valid);
if (valid) { if (valid) {
@ -216,7 +216,7 @@ Q_SIGNALS:
BitcoinAmountField::BitcoinAmountField(QWidget *parent) : BitcoinAmountField::BitcoinAmountField(QWidget *parent) :
QWidget(parent), QWidget(parent),
amount(0) amount(nullptr)
{ {
amount = new AmountSpinBox(this); amount = new AmountSpinBox(this);
amount->setLocale(QLocale::c()); amount->setLocale(QLocale::c());

View file

@ -26,9 +26,9 @@ class BitcoinAmountField: public QWidget
Q_PROPERTY(qint64 value READ value WRITE setValue NOTIFY valueChanged USER true) Q_PROPERTY(qint64 value READ value WRITE setValue NOTIFY valueChanged USER true)
public: public:
explicit BitcoinAmountField(QWidget *parent = 0); explicit BitcoinAmountField(QWidget *parent = nullptr);
CAmount value(bool *value=0) const; CAmount value(bool *value=nullptr) const;
void setValue(const CAmount& value); void setValue(const CAmount& value);
/** If allow empty is set to false the field will be set to the minimum allowed value if left empty. **/ /** If allow empty is set to false the field will be set to the minimum allowed value if left empty. **/

View file

@ -95,7 +95,7 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
setWindowIcon(networkStyle->getTrayAndWindowIcon()); setWindowIcon(networkStyle->getTrayAndWindowIcon());
setWindowTitle(windowTitle); setWindowTitle(windowTitle);
rpcConsole = new RPCConsole(node, _platformStyle, 0); rpcConsole = new RPCConsole(node, _platformStyle, nullptr);
helpMessageDialog = new HelpMessageDialog(node, this, false); helpMessageDialog = new HelpMessageDialog(node, this, false);
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
if(enableWallet) if(enableWallet)
@ -1196,7 +1196,7 @@ void BitcoinGUI::updateProxyIcon()
bool proxy_enabled = clientModel->getProxyInfo(ip_port); bool proxy_enabled = clientModel->getProxyInfo(ip_port);
if (proxy_enabled) { if (proxy_enabled) {
if (labelProxyIcon->pixmap() == 0) { if (labelProxyIcon->pixmap() == nullptr) {
QString ip_port_q = QString::fromStdString(ip_port); QString ip_port_q = QString::fromStdString(ip_port);
labelProxyIcon->setPixmap(platformStyle->SingleColorIcon(":/icons/proxy").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE)); labelProxyIcon->setPixmap(platformStyle->SingleColorIcon(":/icons/proxy").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
labelProxyIcon->setToolTip(tr("Proxy is <b>enabled</b>: %1").arg(ip_port_q)); labelProxyIcon->setToolTip(tr("Proxy is <b>enabled</b>: %1").arg(ip_port_q));
@ -1242,7 +1242,7 @@ void BitcoinGUI::showProgress(const QString &title, int nProgress)
progressDialog = new QProgressDialog(title, "", 0, 100); progressDialog = new QProgressDialog(title, "", 0, 100);
progressDialog->setWindowModality(Qt::ApplicationModal); progressDialog->setWindowModality(Qt::ApplicationModal);
progressDialog->setMinimumDuration(0); progressDialog->setMinimumDuration(0);
progressDialog->setCancelButton(0); progressDialog->setCancelButton(nullptr);
progressDialog->setAutoClose(false); progressDialog->setAutoClose(false);
progressDialog->setValue(0); progressDialog->setValue(0);
} }
@ -1304,8 +1304,8 @@ void BitcoinGUI::unsubscribeFromCoreSignals()
} }
UnitDisplayStatusBarControl::UnitDisplayStatusBarControl(const PlatformStyle *platformStyle) : UnitDisplayStatusBarControl::UnitDisplayStatusBarControl(const PlatformStyle *platformStyle) :
optionsModel(0), optionsModel(nullptr),
menu(0) menu(nullptr)
{ {
createContextMenu(); createContextMenu();
setToolTip(tr("Unit to show amounts in. Click to select another unit.")); setToolTip(tr("Unit to show amounts in. Click to select another unit."));

View file

@ -67,7 +67,7 @@ class BitcoinGUI : public QMainWindow
public: public:
static const std::string DEFAULT_UIPLATFORM; static const std::string DEFAULT_UIPLATFORM;
explicit BitcoinGUI(interfaces::Node& node, const PlatformStyle *platformStyle, const NetworkStyle *networkStyle, QWidget *parent = 0); explicit BitcoinGUI(interfaces::Node& node, const PlatformStyle *platformStyle, const NetworkStyle *networkStyle, QWidget *parent = nullptr);
~BitcoinGUI(); ~BitcoinGUI();
/** Set the client model. /** Set the client model.

View file

@ -35,9 +35,9 @@ ClientModel::ClientModel(interfaces::Node& node, OptionsModel *_optionsModel, QO
QObject(parent), QObject(parent),
m_node(node), m_node(node),
optionsModel(_optionsModel), optionsModel(_optionsModel),
peerTableModel(0), peerTableModel(nullptr),
banTableModel(0), banTableModel(nullptr),
pollTimer(0) pollTimer(nullptr)
{ {
cachedBestHeaderHeight = -1; cachedBestHeaderHeight = -1;
cachedBestHeaderTime = -1; cachedBestHeaderTime = -1;

View file

@ -46,7 +46,7 @@ class ClientModel : public QObject
Q_OBJECT Q_OBJECT
public: public:
explicit ClientModel(interfaces::Node& node, OptionsModel *optionsModel, QObject *parent = 0); explicit ClientModel(interfaces::Node& node, OptionsModel *optionsModel, QObject *parent = nullptr);
~ClientModel(); ~ClientModel();
interfaces::Node& node() const { return m_node; } interfaces::Node& node() const { return m_node; }

View file

@ -49,7 +49,7 @@ bool CCoinControlWidgetItem::operator<(const QTreeWidgetItem &other) const {
CoinControlDialog::CoinControlDialog(const PlatformStyle *_platformStyle, QWidget *parent) : CoinControlDialog::CoinControlDialog(const PlatformStyle *_platformStyle, QWidget *parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::CoinControlDialog), ui(new Ui::CoinControlDialog),
model(0), model(nullptr),
platformStyle(_platformStyle) platformStyle(_platformStyle)
{ {
ui->setupUi(this); ui->setupUi(this);

View file

@ -43,7 +43,7 @@ class CoinControlDialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit CoinControlDialog(const PlatformStyle *platformStyle, QWidget *parent = 0); explicit CoinControlDialog(const PlatformStyle *platformStyle, QWidget *parent = nullptr);
~CoinControlDialog(); ~CoinControlDialog();
void setModel(WalletModel *model); void setModel(WalletModel *model);

View file

@ -13,7 +13,7 @@ class CoinControlTreeWidget : public QTreeWidget
Q_OBJECT Q_OBJECT
public: public:
explicit CoinControlTreeWidget(QWidget *parent = 0); explicit CoinControlTreeWidget(QWidget *parent = nullptr);
protected: protected:
virtual void keyPressEvent(QKeyEvent *event); virtual void keyPressEvent(QKeyEvent *event);

View file

@ -10,7 +10,7 @@
CSVModelWriter::CSVModelWriter(const QString &_filename, QObject *parent) : CSVModelWriter::CSVModelWriter(const QString &_filename, QObject *parent) :
QObject(parent), QObject(parent),
filename(_filename), model(0) filename(_filename), model(nullptr)
{ {
} }

View file

@ -20,7 +20,7 @@ class CSVModelWriter : public QObject
Q_OBJECT Q_OBJECT
public: public:
explicit CSVModelWriter(const QString &filename, QObject *parent = 0); explicit CSVModelWriter(const QString &filename, QObject *parent = nullptr);
void setModel(const QAbstractItemModel *model); void setModel(const QAbstractItemModel *model);
void addColumn(const QString &title, int column, int role=Qt::EditRole); void addColumn(const QString &title, int column, int role=Qt::EditRole);

View file

@ -15,9 +15,9 @@
EditAddressDialog::EditAddressDialog(Mode _mode, QWidget *parent) : EditAddressDialog::EditAddressDialog(Mode _mode, QWidget *parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::EditAddressDialog), ui(new Ui::EditAddressDialog),
mapper(0), mapper(nullptr),
mode(_mode), mode(_mode),
model(0) model(nullptr)
{ {
ui->setupUi(this); ui->setupUi(this);

View file

@ -30,7 +30,7 @@ public:
EditSendingAddress EditSendingAddress
}; };
explicit EditAddressDialog(Mode mode, QWidget *parent = 0); explicit EditAddressDialog(Mode mode, QWidget *parent = nullptr);
~EditAddressDialog(); ~EditAddressDialog();
void setModel(AddressTableModel *model); void setModel(AddressTableModel *model);

View file

@ -133,7 +133,7 @@ namespace GUIUtil
Q_OBJECT Q_OBJECT
public: public:
explicit ToolTipToRichTextFilter(int size_threshold, QObject *parent = 0); explicit ToolTipToRichTextFilter(int size_threshold, QObject *parent = nullptr);
protected: protected:
bool eventFilter(QObject *obj, QEvent *evt); bool eventFilter(QObject *obj, QEvent *evt);

View file

@ -113,7 +113,7 @@ void FreespaceChecker::check()
Intro::Intro(QWidget *parent, uint64_t blockchain_size, uint64_t chain_state_size) : Intro::Intro(QWidget *parent, uint64_t blockchain_size, uint64_t chain_state_size) :
QDialog(parent), QDialog(parent),
ui(new Ui::Intro), ui(new Ui::Intro),
thread(0), thread(nullptr),
signalled(false), signalled(false),
m_blockchain_size(blockchain_size), m_blockchain_size(blockchain_size),
m_chain_state_size(chain_state_size) m_chain_state_size(chain_state_size)
@ -226,7 +226,7 @@ bool Intro::pickDataDirectory(interfaces::Node& node)
} }
break; break;
} catch (const fs::filesystem_error&) { } catch (const fs::filesystem_error&) {
QMessageBox::critical(0, tr(PACKAGE_NAME), QMessageBox::critical(nullptr, tr(PACKAGE_NAME),
tr("Error: Specified data directory \"%1\" cannot be created.").arg(dataDir)); tr("Error: Specified data directory \"%1\" cannot be created.").arg(dataDir));
/* fall through, back to choosing screen */ /* fall through, back to choosing screen */
} }
@ -286,7 +286,7 @@ void Intro::on_dataDirectory_textChanged(const QString &dataDirStr)
void Intro::on_ellipsisButton_clicked() void Intro::on_ellipsisButton_clicked()
{ {
QString dir = QDir::toNativeSeparators(QFileDialog::getExistingDirectory(0, "Choose data directory", ui->dataDirectory->text())); QString dir = QDir::toNativeSeparators(QFileDialog::getExistingDirectory(nullptr, "Choose data directory", ui->dataDirectory->text()));
if(!dir.isEmpty()) if(!dir.isEmpty())
ui->dataDirectory->setText(dir); ui->dataDirectory->setText(dir);
} }

View file

@ -30,7 +30,7 @@ class Intro : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit Intro(QWidget *parent = 0, explicit Intro(QWidget *parent = nullptr,
uint64_t blockchain_size = 0, uint64_t chain_state_size = 0); uint64_t blockchain_size = 0, uint64_t chain_state_size = 0);
~Intro(); ~Intro();

View file

@ -88,5 +88,5 @@ const NetworkStyle *NetworkStyle::instantiate(const QString &networkId)
network_styles[x].titleAddText); network_styles[x].titleAddText);
} }
} }
return 0; return nullptr;
} }

View file

@ -29,8 +29,8 @@
OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) : OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) :
QDialog(parent), QDialog(parent),
ui(new Ui::OptionsDialog), ui(new Ui::OptionsDialog),
model(0), model(nullptr),
mapper(0) mapper(nullptr)
{ {
ui->setupUi(this); ui->setupUi(this);

View file

@ -31,7 +31,7 @@ class OptionsModel : public QAbstractListModel
Q_OBJECT Q_OBJECT
public: public:
explicit OptionsModel(interfaces::Node& node, QObject *parent = 0, bool resetSettings = false); explicit OptionsModel(interfaces::Node& node, QObject *parent = nullptr, bool resetSettings = false);
enum OptionID { enum OptionID {
StartAtStartup, // bool StartAtStartup, // bool

View file

@ -113,8 +113,8 @@ public:
OverviewPage::OverviewPage(const PlatformStyle *platformStyle, QWidget *parent) : OverviewPage::OverviewPage(const PlatformStyle *platformStyle, QWidget *parent) :
QWidget(parent), QWidget(parent),
ui(new Ui::OverviewPage), ui(new Ui::OverviewPage),
clientModel(0), clientModel(nullptr),
walletModel(0), walletModel(nullptr),
txdelegate(new TxViewDelegate(platformStyle, this)) txdelegate(new TxViewDelegate(platformStyle, this))
{ {
ui->setupUi(this); ui->setupUi(this);

View file

@ -30,7 +30,7 @@ class OverviewPage : public QWidget
Q_OBJECT Q_OBJECT
public: public:
explicit OverviewPage(const PlatformStyle *platformStyle, QWidget *parent = 0); explicit OverviewPage(const PlatformStyle *platformStyle, QWidget *parent = nullptr);
~OverviewPage(); ~OverviewPage();
void setClientModel(ClientModel *clientModel); void setClientModel(ClientModel *clientModel);

View file

@ -194,10 +194,10 @@ bool PaymentServer::ipcSendCommandLine()
PaymentServer::PaymentServer(QObject* parent, bool startLocalServer) : PaymentServer::PaymentServer(QObject* parent, bool startLocalServer) :
QObject(parent), QObject(parent),
saveURIs(true), saveURIs(true),
uriServer(0), uriServer(nullptr),
optionsModel(0) optionsModel(nullptr)
#ifdef ENABLE_BIP70 #ifdef ENABLE_BIP70
,netManager(0) ,netManager(nullptr)
#endif #endif
{ {
#ifdef ENABLE_BIP70 #ifdef ENABLE_BIP70
@ -223,7 +223,7 @@ PaymentServer::PaymentServer(QObject* parent, bool startLocalServer) :
if (!uriServer->listen(name)) { if (!uriServer->listen(name)) {
// constructor is called early in init, so don't use "Q_EMIT message()" here // constructor is called early in init, so don't use "Q_EMIT message()" here
QMessageBox::critical(0, tr("Payment request error"), QMessageBox::critical(nullptr, tr("Payment request error"),
tr("Cannot start bitcoin: click-to-pay handler")); tr("Cannot start bitcoin: click-to-pay handler"));
} }
else { else {

View file

@ -96,7 +96,7 @@ public:
if (idx >= 0 && idx < cachedNodeStats.size()) if (idx >= 0 && idx < cachedNodeStats.size())
return &cachedNodeStats[idx]; return &cachedNodeStats[idx];
return 0; return nullptr;
} }
}; };
@ -104,7 +104,7 @@ PeerTableModel::PeerTableModel(interfaces::Node& node, ClientModel *parent) :
QAbstractTableModel(parent), QAbstractTableModel(parent),
m_node(node), m_node(node),
clientModel(parent), clientModel(parent),
timer(0) timer(nullptr)
{ {
columns << tr("NodeId") << tr("Node/Service") << tr("Ping") << tr("Sent") << tr("Received") << tr("User Agent"); columns << tr("NodeId") << tr("Node/Service") << tr("Ping") << tr("Sent") << tr("Received") << tr("User Agent");
priv.reset(new PeerTablePriv()); priv.reset(new PeerTablePriv());
@ -197,8 +197,7 @@ QVariant PeerTableModel::headerData(int section, Qt::Orientation orientation, in
Qt::ItemFlags PeerTableModel::flags(const QModelIndex &index) const Qt::ItemFlags PeerTableModel::flags(const QModelIndex &index) const
{ {
if(!index.isValid()) if (!index.isValid()) return Qt::NoItemFlags;
return 0;
Qt::ItemFlags retval = Qt::ItemIsSelectable | Qt::ItemIsEnabled; Qt::ItemFlags retval = Qt::ItemIsSelectable | Qt::ItemIsEnabled;
return retval; return retval;

View file

@ -51,7 +51,7 @@ class PeerTableModel : public QAbstractTableModel
Q_OBJECT Q_OBJECT
public: public:
explicit PeerTableModel(interfaces::Node& node, ClientModel *parent = 0); explicit PeerTableModel(interfaces::Node& node, ClientModel *parent = nullptr);
~PeerTableModel(); ~PeerTableModel();
const CNodeCombinedStats *getNodeStats(int idx); const CNodeCombinedStats *getNodeStats(int idx);
int getRowByNodeId(NodeId nodeid); int getRowByNodeId(NodeId nodeid);

View file

@ -139,6 +139,6 @@ const PlatformStyle *PlatformStyle::instantiate(const QString &platformId)
platform_styles[x].useExtraSpacing); platform_styles[x].useExtraSpacing);
} }
} }
return 0; return nullptr;
} }

View file

@ -10,7 +10,7 @@
QValidatedLineEdit::QValidatedLineEdit(QWidget *parent) : QValidatedLineEdit::QValidatedLineEdit(QWidget *parent) :
QLineEdit(parent), QLineEdit(parent),
valid(true), valid(true),
checkValidator(0) checkValidator(nullptr)
{ {
connect(this, &QValidatedLineEdit::textChanged, this, &QValidatedLineEdit::markValid); connect(this, &QValidatedLineEdit::textChanged, this, &QValidatedLineEdit::markValid);
} }

View file

@ -16,7 +16,7 @@ class QValueComboBox : public QComboBox
Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged USER true) Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged USER true)
public: public:
explicit QValueComboBox(QWidget *parent = 0); explicit QValueComboBox(QWidget *parent = nullptr);
QVariant value() const; QVariant value() const;
void setValue(const QVariant &value); void setValue(const QVariant &value);

View file

@ -25,8 +25,8 @@
ReceiveCoinsDialog::ReceiveCoinsDialog(const PlatformStyle *_platformStyle, QWidget *parent) : ReceiveCoinsDialog::ReceiveCoinsDialog(const PlatformStyle *_platformStyle, QWidget *parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::ReceiveCoinsDialog), ui(new Ui::ReceiveCoinsDialog),
columnResizingFixer(0), columnResizingFixer(nullptr),
model(0), model(nullptr),
platformStyle(_platformStyle) platformStyle(_platformStyle)
{ {
ui->setupUi(this); ui->setupUi(this);

View file

@ -39,7 +39,7 @@ public:
MINIMUM_COLUMN_WIDTH = 130 MINIMUM_COLUMN_WIDTH = 130
}; };
explicit ReceiveCoinsDialog(const PlatformStyle *platformStyle, QWidget *parent = 0); explicit ReceiveCoinsDialog(const PlatformStyle *platformStyle, QWidget *parent = nullptr);
~ReceiveCoinsDialog(); ~ReceiveCoinsDialog();
void setModel(WalletModel *model); void setModel(WalletModel *model);

View file

@ -26,7 +26,7 @@
#endif #endif
QRImageWidget::QRImageWidget(QWidget *parent): QRImageWidget::QRImageWidget(QWidget *parent):
QLabel(parent), contextMenu(0) QLabel(parent), contextMenu(nullptr)
{ {
contextMenu = new QMenu(this); contextMenu = new QMenu(this);
QAction *saveImageAction = new QAction(tr("&Save Image..."), this); QAction *saveImageAction = new QAction(tr("&Save Image..."), this);
@ -88,7 +88,7 @@ void QRImageWidget::contextMenuEvent(QContextMenuEvent *event)
ReceiveRequestDialog::ReceiveRequestDialog(QWidget *parent) : ReceiveRequestDialog::ReceiveRequestDialog(QWidget *parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::ReceiveRequestDialog), ui(new Ui::ReceiveRequestDialog),
model(0) model(nullptr)
{ {
ui->setupUi(this); ui->setupUi(this);

View file

@ -28,7 +28,7 @@ class QRImageWidget : public QLabel
Q_OBJECT Q_OBJECT
public: public:
explicit QRImageWidget(QWidget *parent = 0); explicit QRImageWidget(QWidget *parent = nullptr);
QImage exportImage(); QImage exportImage();
public Q_SLOTS: public Q_SLOTS:
@ -48,7 +48,7 @@ class ReceiveRequestDialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit ReceiveRequestDialog(QWidget *parent = 0); explicit ReceiveRequestDialog(QWidget *parent = nullptr);
~ReceiveRequestDialog(); ~ReceiveRequestDialog();
void setModel(WalletModel *model); void setModel(WalletModel *model);

View file

@ -485,7 +485,7 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty
// set library version labels // set library version labels
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
ui->berkeleyDBVersion->setText(DbEnv::version(0, 0, 0)); ui->berkeleyDBVersion->setText(DbEnv::version(nullptr, nullptr, nullptr));
#else #else
ui->label_berkeleyDBVersion->hide(); ui->label_berkeleyDBVersion->hide();
ui->berkeleyDBVersion->hide(); ui->berkeleyDBVersion->hide();

View file

@ -54,8 +54,8 @@ int getIndexForConfTarget(int target) {
SendCoinsDialog::SendCoinsDialog(const PlatformStyle *_platformStyle, QWidget *parent) : SendCoinsDialog::SendCoinsDialog(const PlatformStyle *_platformStyle, QWidget *parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::SendCoinsDialog), ui(new Ui::SendCoinsDialog),
clientModel(0), clientModel(nullptr),
model(0), model(nullptr),
fNewRecipientAllowed(true), fNewRecipientAllowed(true),
fFeeMinimized(true), fFeeMinimized(true),
platformStyle(_platformStyle) platformStyle(_platformStyle)
@ -443,7 +443,7 @@ SendCoinsEntry *SendCoinsDialog::addEntry()
void SendCoinsDialog::updateTabsAndLabels() void SendCoinsDialog::updateTabsAndLabels()
{ {
setupTabChain(0); setupTabChain(nullptr);
coinControlUpdateLabels(); coinControlUpdateLabels();
} }
@ -478,7 +478,7 @@ QWidget *SendCoinsDialog::setupTabChain(QWidget *prev)
void SendCoinsDialog::setAddress(const QString &address) void SendCoinsDialog::setAddress(const QString &address)
{ {
SendCoinsEntry *entry = 0; SendCoinsEntry *entry = nullptr;
// Replace the first entry if it is still unused // Replace the first entry if it is still unused
if(ui->entries->count() == 1) if(ui->entries->count() == 1)
{ {
@ -501,7 +501,7 @@ void SendCoinsDialog::pasteEntry(const SendCoinsRecipient &rv)
if(!fNewRecipientAllowed) if(!fNewRecipientAllowed)
return; return;
SendCoinsEntry *entry = 0; SendCoinsEntry *entry = nullptr;
// Replace the first entry if it is still unused // Replace the first entry if it is still unused
if(ui->entries->count() == 1) if(ui->entries->count() == 1)
{ {

View file

@ -31,7 +31,7 @@ class SendCoinsDialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit SendCoinsDialog(const PlatformStyle *platformStyle, QWidget *parent = 0); explicit SendCoinsDialog(const PlatformStyle *platformStyle, QWidget *parent = nullptr);
~SendCoinsDialog(); ~SendCoinsDialog();
void setClientModel(ClientModel *clientModel); void setClientModel(ClientModel *clientModel);
@ -108,7 +108,7 @@ class SendConfirmationDialog : public QMessageBox
Q_OBJECT Q_OBJECT
public: public:
SendConfirmationDialog(const QString &title, const QString &text, int secDelay = SEND_CONFIRM_DELAY, QWidget *parent = 0); SendConfirmationDialog(const QString &title, const QString &text, int secDelay = SEND_CONFIRM_DELAY, QWidget *parent = nullptr);
int exec(); int exec();
private Q_SLOTS: private Q_SLOTS:

View file

@ -21,7 +21,7 @@
SendCoinsEntry::SendCoinsEntry(const PlatformStyle *_platformStyle, QWidget *parent) : SendCoinsEntry::SendCoinsEntry(const PlatformStyle *_platformStyle, QWidget *parent) :
QStackedWidget(parent), QStackedWidget(parent),
ui(new Ui::SendCoinsEntry), ui(new Ui::SendCoinsEntry),
model(0), model(nullptr),
platformStyle(_platformStyle) platformStyle(_platformStyle)
{ {
ui->setupUi(this); ui->setupUi(this);
@ -155,7 +155,7 @@ bool SendCoinsEntry::validate(interfaces::Node& node)
} }
// Sending a zero amount is invalid // Sending a zero amount is invalid
if (ui->payAmount->value(0) <= 0) if (ui->payAmount->value(nullptr) <= 0)
{ {
ui->payAmount->setValid(false); ui->payAmount->setValid(false);
retval = false; retval = false;

View file

@ -26,7 +26,7 @@ class SendCoinsEntry : public QStackedWidget
Q_OBJECT Q_OBJECT
public: public:
explicit SendCoinsEntry(const PlatformStyle *platformStyle, QWidget *parent = 0); explicit SendCoinsEntry(const PlatformStyle *platformStyle, QWidget *parent = nullptr);
~SendCoinsEntry(); ~SendCoinsEntry();
void setModel(WalletModel *model); void setModel(WalletModel *model);

View file

@ -22,7 +22,7 @@
SignVerifyMessageDialog::SignVerifyMessageDialog(const PlatformStyle *_platformStyle, QWidget *parent) : SignVerifyMessageDialog::SignVerifyMessageDialog(const PlatformStyle *_platformStyle, QWidget *parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::SignVerifyMessageDialog), ui(new Ui::SignVerifyMessageDialog),
model(0), model(nullptr),
platformStyle(_platformStyle) platformStyle(_platformStyle)
{ {
ui->setupUi(this); ui->setupUi(this);

View file

@ -26,7 +26,7 @@
SplashScreen::SplashScreen(interfaces::Node& node, Qt::WindowFlags f, const NetworkStyle *networkStyle) : SplashScreen::SplashScreen(interfaces::Node& node, Qt::WindowFlags f, const NetworkStyle *networkStyle) :
QWidget(0, f), curAlignment(0), m_node(node) QWidget(nullptr, f), curAlignment(0), m_node(node)
{ {
// set reference point, paddings // set reference point, paddings
int paddingRight = 50; int paddingRight = 50;

View file

@ -19,14 +19,14 @@
TrafficGraphWidget::TrafficGraphWidget(QWidget *parent) : TrafficGraphWidget::TrafficGraphWidget(QWidget *parent) :
QWidget(parent), QWidget(parent),
timer(0), timer(nullptr),
fMax(0.0f), fMax(0.0f),
nMins(0), nMins(0),
vSamplesIn(), vSamplesIn(),
vSamplesOut(), vSamplesOut(),
nLastBytesIn(0), nLastBytesIn(0),
nLastBytesOut(0), nLastBytesOut(0),
clientModel(0) clientModel(nullptr)
{ {
timer = new QTimer(this); timer = new QTimer(this);
connect(timer, &QTimer::timeout, this, &TrafficGraphWidget::updateRates); connect(timer, &QTimer::timeout, this, &TrafficGraphWidget::updateRates);

View file

@ -20,7 +20,7 @@ class TrafficGraphWidget : public QWidget
Q_OBJECT Q_OBJECT
public: public:
explicit TrafficGraphWidget(QWidget *parent = 0); explicit TrafficGraphWidget(QWidget *parent = nullptr);
void setClientModel(ClientModel *model); void setClientModel(ClientModel *model);
int getGraphRangeMins() const; int getGraphRangeMins() const;

View file

@ -21,7 +21,7 @@ class TransactionDescDialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit TransactionDescDialog(const QModelIndex &idx, QWidget *parent = 0); explicit TransactionDescDialog(const QModelIndex &idx, QWidget *parent = nullptr);
~TransactionDescDialog(); ~TransactionDescDialog();
private: private:

View file

@ -16,7 +16,7 @@ class TransactionFilterProxy : public QSortFilterProxyModel
Q_OBJECT Q_OBJECT
public: public:
explicit TransactionFilterProxy(QObject *parent = 0); explicit TransactionFilterProxy(QObject *parent = nullptr);
/** Earliest date that can be represented (far in the past) */ /** Earliest date that can be represented (far in the past) */
static const QDateTime MIN_DATE; static const QDateTime MIN_DATE;

View file

@ -197,7 +197,7 @@ public:
} }
return rec; return rec;
} }
return 0; return nullptr;
} }
QString describe(interfaces::Node& node, interfaces::Wallet& wallet, TransactionRecord *rec, int unit) QString describe(interfaces::Node& node, interfaces::Wallet& wallet, TransactionRecord *rec, int unit)

View file

@ -28,7 +28,7 @@ class TransactionTableModel : public QAbstractTableModel
Q_OBJECT Q_OBJECT
public: public:
explicit TransactionTableModel(const PlatformStyle *platformStyle, WalletModel *parent = 0); explicit TransactionTableModel(const PlatformStyle *platformStyle, WalletModel *parent = nullptr);
~TransactionTableModel(); ~TransactionTableModel();
enum ColumnIndex { enum ColumnIndex {

View file

@ -38,8 +38,8 @@
#include <QVBoxLayout> #include <QVBoxLayout>
TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *parent) : TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *parent) :
QWidget(parent), model(0), transactionProxyModel(0), QWidget(parent), model(nullptr), transactionProxyModel(nullptr),
transactionView(0), abandonAction(0), bumpFeeAction(0), columnResizingFixer(0) transactionView(nullptr), abandonAction(nullptr), bumpFeeAction(nullptr), columnResizingFixer(nullptr)
{ {
// Build filter row // Build filter row
setContentsMargins(0,0,0,0); setContentsMargins(0,0,0,0);

View file

@ -35,7 +35,7 @@ class TransactionView : public QWidget
Q_OBJECT Q_OBJECT
public: public:
explicit TransactionView(const PlatformStyle *platformStyle, QWidget *parent = 0); explicit TransactionView(const PlatformStyle *platformStyle, QWidget *parent = nullptr);
void setModel(WalletModel *model); void setModel(WalletModel *model);

View file

@ -45,7 +45,7 @@ class ShutdownWindow : public QWidget
Q_OBJECT Q_OBJECT
public: public:
explicit ShutdownWindow(QWidget *parent=0, Qt::WindowFlags f=0); explicit ShutdownWindow(QWidget *parent=nullptr, Qt::WindowFlags f=Qt::Widget);
static QWidget *showShutdownWindow(BitcoinGUI *window); static QWidget *showShutdownWindow(BitcoinGUI *window);
protected: protected:

View file

@ -31,7 +31,7 @@ class WalletFrame : public QFrame
Q_OBJECT Q_OBJECT
public: public:
explicit WalletFrame(const PlatformStyle *platformStyle, BitcoinGUI *_gui = 0); explicit WalletFrame(const PlatformStyle *platformStyle, BitcoinGUI *_gui = nullptr);
~WalletFrame(); ~WalletFrame();
void setClientModel(ClientModel *clientModel); void setClientModel(ClientModel *clientModel);

View file

@ -33,9 +33,9 @@
WalletModel::WalletModel(std::unique_ptr<interfaces::Wallet> wallet, interfaces::Node& node, const PlatformStyle *platformStyle, OptionsModel *_optionsModel, QObject *parent) : WalletModel::WalletModel(std::unique_ptr<interfaces::Wallet> wallet, interfaces::Node& node, const PlatformStyle *platformStyle, OptionsModel *_optionsModel, QObject *parent) :
QObject(parent), m_wallet(std::move(wallet)), m_node(node), optionsModel(_optionsModel), addressTableModel(0), QObject(parent), m_wallet(std::move(wallet)), m_node(node), optionsModel(_optionsModel), addressTableModel(nullptr),
transactionTableModel(0), transactionTableModel(nullptr),
recentRequestsTableModel(0), recentRequestsTableModel(nullptr),
cachedEncryptionStatus(Unencrypted), cachedEncryptionStatus(Unencrypted),
cachedNumBlocks(0) cachedNumBlocks(0)
{ {
@ -510,7 +510,7 @@ bool WalletModel::bumpFee(uint256 hash, uint256& new_hash)
CAmount new_fee; CAmount new_fee;
CMutableTransaction mtx; CMutableTransaction mtx;
if (!m_wallet->createBumpTransaction(hash, coin_control, 0 /* totalFee */, errors, old_fee, new_fee, mtx)) { if (!m_wallet->createBumpTransaction(hash, coin_control, 0 /* totalFee */, errors, old_fee, new_fee, mtx)) {
QMessageBox::critical(0, tr("Fee bump error"), tr("Increasing transaction fee failed") + "<br />(" + QMessageBox::critical(nullptr, tr("Fee bump error"), tr("Increasing transaction fee failed") + "<br />(" +
(errors.size() ? QString::fromStdString(errors[0]) : "") +")"); (errors.size() ? QString::fromStdString(errors[0]) : "") +")");
return false; return false;
} }
@ -549,12 +549,12 @@ bool WalletModel::bumpFee(uint256 hash, uint256& new_hash)
// sign bumped transaction // sign bumped transaction
if (!m_wallet->signBumpTransaction(mtx)) { if (!m_wallet->signBumpTransaction(mtx)) {
QMessageBox::critical(0, tr("Fee bump error"), tr("Can't sign transaction.")); QMessageBox::critical(nullptr, tr("Fee bump error"), tr("Can't sign transaction."));
return false; return false;
} }
// commit the bumped transaction // commit the bumped transaction
if(!m_wallet->commitBumpTransaction(hash, std::move(mtx), errors, new_hash)) { if(!m_wallet->commitBumpTransaction(hash, std::move(mtx), errors, new_hash)) {
QMessageBox::critical(0, tr("Fee bump error"), tr("Could not commit transaction") + "<br />(" + QMessageBox::critical(nullptr, tr("Fee bump error"), tr("Could not commit transaction") + "<br />(" +
QString::fromStdString(errors[0])+")"); QString::fromStdString(errors[0])+")");
return false; return false;
} }

View file

@ -127,7 +127,7 @@ class WalletModel : public QObject
Q_OBJECT Q_OBJECT
public: public:
explicit WalletModel(std::unique_ptr<interfaces::Wallet> wallet, interfaces::Node& node, const PlatformStyle *platformStyle, OptionsModel *optionsModel, QObject *parent = 0); explicit WalletModel(std::unique_ptr<interfaces::Wallet> wallet, interfaces::Node& node, const PlatformStyle *platformStyle, OptionsModel *optionsModel, QObject *parent = nullptr);
~WalletModel(); ~WalletModel();
enum StatusCode // Returned by sendCoins enum StatusCode // Returned by sendCoins

View file

@ -32,8 +32,8 @@
WalletView::WalletView(const PlatformStyle *_platformStyle, QWidget *parent): WalletView::WalletView(const PlatformStyle *_platformStyle, QWidget *parent):
QStackedWidget(parent), QStackedWidget(parent),
clientModel(0), clientModel(nullptr),
walletModel(0), walletModel(nullptr),
platformStyle(_platformStyle) platformStyle(_platformStyle)
{ {
// Create tabs // Create tabs

View file

@ -105,13 +105,13 @@ BOOST_AUTO_TEST_CASE(arena_tests)
// Go entirely wild: free and alloc interleaved, // Go entirely wild: free and alloc interleaved,
// generate targets and sizes using pseudo-randomness. // generate targets and sizes using pseudo-randomness.
for (int x=0; x<2048; ++x) for (int x=0; x<2048; ++x)
addr.push_back(0); addr.push_back(nullptr);
uint32_t s = 0x12345678; uint32_t s = 0x12345678;
for (int x=0; x<5000; ++x) { for (int x=0; x<5000; ++x) {
int idx = s & (addr.size()-1); int idx = s & (addr.size()-1);
if (s & 0x80000000) { if (s & 0x80000000) {
b.free(addr[idx]); b.free(addr[idx]);
addr[idx] = 0; addr[idx] = nullptr;
} else if(!addr[idx]) { } else if(!addr[idx]) {
addr[idx] = b.alloc((s >> 16) & 2047); addr[idx] = b.alloc((s >> 16) & 2047);
} }
@ -146,7 +146,7 @@ public:
return reinterpret_cast<void*>(0x08000000 + (count<<24)); // Fake address, do not actually use this memory return reinterpret_cast<void*>(0x08000000 + (count<<24)); // Fake address, do not actually use this memory
} }
return 0; return nullptr;
} }
void FreeLocked(void* addr, size_t len) override void FreeLocked(void* addr, size_t len) override
{ {

View file

@ -338,7 +338,7 @@ bool BerkeleyBatch::VerifyEnvironment(const fs::path& file_path, std::string& er
BerkeleyEnvironment* env = GetWalletEnv(file_path, walletFile); BerkeleyEnvironment* env = GetWalletEnv(file_path, walletFile);
fs::path walletDir = env->Directory(); fs::path walletDir = env->Directory();
LogPrintf("Using BerkeleyDB version %s\n", DbEnv::version(0, 0, 0)); LogPrintf("Using BerkeleyDB version %s\n", DbEnv::version(nullptr, nullptr, nullptr));
LogPrintf("Using wallet %s\n", walletFile); LogPrintf("Using wallet %s\n", walletFile);
// Wallet file must be a plain filename without a directory // Wallet file must be a plain filename without a directory