fix multiple minor issues (c-style casts, default branch, etc.)

This commit is contained in:
xiphon 2020-02-28 10:25:57 +00:00
parent b4a65c52cc
commit 9deca92e07
8 changed files with 16 additions and 13 deletions

View file

@ -49,13 +49,15 @@ namespace {
DaemonManager * DaemonManager::m_instance = nullptr;
QStringList DaemonManager::m_clArgs;
DaemonManager *DaemonManager::instance(const QStringList *args)
DaemonManager *DaemonManager::instance(const QStringList *args/* = nullptr*/)
{
if (!m_instance) {
m_instance = new DaemonManager;
// store command line arguments for later use
m_clArgs = *args;
m_clArgs.removeFirst();
if (args != nullptr)
{
m_clArgs = *args;
}
}
return m_instance;

View file

@ -42,7 +42,7 @@ class DaemonManager : public QObject
public:
static DaemonManager * instance(const QStringList *args);
static DaemonManager * instance(const QStringList *args = nullptr);
Q_INVOKABLE bool start(const QString &flags, NetworkType::Type nettype, const QString &dataDir = "", const QString &bootstrapNodeAddress = "", bool noSync = false);
Q_INVOKABLE void stopAsync(NetworkType::Type nettype, const QJSValue& callback);

View file

@ -792,7 +792,7 @@ QString Wallet::signMessage(const QString &message, bool filename) const
file.close();
return "";
}
std::string signature = m_walletImpl->signMessage(std::string((const char*)data, size));
std::string signature = m_walletImpl->signMessage(std::string(reinterpret_cast<const char*>(data), size));
file.unmap(data);
file.close();
return QString::fromStdString(signature);
@ -828,7 +828,7 @@ bool Wallet::verifySignedMessage(const QString &message, const QString &address,
file.close();
return false;
}
bool ret = m_walletImpl->verifySignedMessage(std::string((const char*)data, size), address.toStdString(), signature.toStdString());
bool ret = m_walletImpl->verifySignedMessage(std::string(reinterpret_cast<const char*>(data), size), address.toStdString(), signature.toStdString());
file.unmap(data);
file.close();
return ret;

View file

@ -164,10 +164,10 @@ int main(int argc, char *argv[])
isOpenGL = false;
// disable "QApplication: invalid style override passed" warning
if (isDesktop) putenv((char*)"QT_STYLE_OVERRIDE=fusion");
if (isDesktop) qputenv("QT_STYLE_OVERRIDE", "fusion");
#ifdef Q_OS_LINUX
// force platform xcb
if (isDesktop) putenv((char*)"QT_QPA_PLATFORM=xcb");
if (isDesktop) qputenv("QT_QPA_PLATFORM", "xcb");
#endif
// enable High DPI scaling
@ -393,8 +393,7 @@ int main(int argc, char *argv[])
// Exclude daemon manager from IOS
#ifndef Q_OS_IOS
const QStringList arguments = (QStringList) QCoreApplication::arguments().at(0);
DaemonManager * daemonManager = DaemonManager::instance(&arguments);
DaemonManager * daemonManager = DaemonManager::instance();
engine.rootContext()->setContextProperty("daemonManager", daemonManager);
#endif

View file

@ -71,6 +71,8 @@ QVariant AddressBookModel::data(const QModelIndex &index, int role) const
// Qt doesnt support size_t overload type casting
result.setValue(row.getRowId());
break;
default:
qCritical() << "Unimplemented role " << role;
}
});
if (!found) {

View file

@ -53,7 +53,7 @@ int SubaddressAccountModel::rowCount(const QModelIndex &) const
QVariant SubaddressAccountModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid() || index.row() < 0 || (unsigned)index.row() >= m_subaddressAccount->count())
if (!index.isValid() || index.row() < 0 || static_cast<quint64>(index.row()) >= m_subaddressAccount->count())
return {};
QVariant result;

View file

@ -54,7 +54,7 @@ int SubaddressModel::rowCount(const QModelIndex &) const
QVariant SubaddressModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid() || index.row() < 0 || (unsigned)index.row() >= m_subaddress->count())
if (!index.isValid() || index.row() < 0 || static_cast<quint64>(index.row()) >= m_subaddress->count())
return {};
QVariant result;

View file

@ -157,7 +157,7 @@ QVariant WalletKeysFilesModel::data(const QModelIndex & index, int role) const {
else if (role == PathRole)
return walletKeyFile.path();
else if (role == NetworkTypeRole)
return walletKeyFile.networkType();
return static_cast<uint>(walletKeyFile.networkType());
else if (role == AddressRole)
return walletKeyFile.address();
return QVariant();