Use standard C99 (and Qt) types for 64-bit integers

This commit is contained in:
Luke Dashjr
2011-12-20 16:52:59 -05:00
parent 781c06c0f5
commit 21d9f36781
58 changed files with 526 additions and 442 deletions

View File

@@ -9,6 +9,7 @@
#include "headers.h"
#include "init.h"
#include <QtGlobal>
#include <QApplication>
#include <QMessageBox>
#include <QThread>
@@ -56,7 +57,7 @@ int ThreadSafeMessageBox(const std::string& message, const std::string& caption,
return 4;
}
bool ThreadSafeAskFee(int64 nFeeRequired, const std::string& strCaption, wxWindow* parent)
bool ThreadSafeAskFee(qint64 nFeeRequired, const std::string& strCaption, wxWindow* parent)
{
if(!guiref)
return false;

View File

@@ -4,6 +4,7 @@
#include "guiconstants.h"
#include <QtGlobal>
#include <QLabel>
#include <QLineEdit>
#include <QRegExpValidator>

View File

@@ -1,6 +1,7 @@
#ifndef BITCOINFIELD_H
#define BITCOINFIELD_H
#include <QtGlobal>
#include <QWidget>
QT_BEGIN_NAMESPACE

View File

@@ -27,6 +27,7 @@
#include "macdockiconhandler.h"
#endif
#include <QtGlobal>
#include <QApplication>
#include <QMainWindow>
#include <QMenuBar>

View File

@@ -1,6 +1,7 @@
#ifndef BITCOINGUI_H
#define BITCOINGUI_H
#include <QtGlobal>
#include <QMainWindow>
#include <QSystemTrayIcon>

View File

@@ -82,4 +82,4 @@ QT_TRANSLATE_NOOP("bitcoin-core", ""
"Warning: Please check that your computer's date and time are correct. If "
"your clock is wrong Bitcoin will not work properly."),
QT_TRANSLATE_NOOP("bitcoin-core", "beta"),
};
};

View File

@@ -1,5 +1,6 @@
#include "bitcoinunits.h"
#include <QtGlobal>
#include <QStringList>
BitcoinUnits::BitcoinUnits(QObject *parent):

View File

@@ -1,6 +1,7 @@
#ifndef BITCOINUNITS_H
#define BITCOINUNITS_H
#include <QtGlobal>
#include <QString>
#include <QAbstractListModel>

View File

@@ -5,6 +5,7 @@
#include "headers.h"
#include <QtGlobal>
#include <QString>
#include <QDateTime>
#include <QDoubleValidator>

View File

@@ -1,6 +1,7 @@
#ifndef GUIUTIL_H
#define GUIUTIL_H
#include <QtGlobal>
#include <QString>
QT_BEGIN_NAMESPACE

View File

@@ -1,5 +1,6 @@
#include "notificator.h"
#include <QtGlobal>
#include <QMetaType>
#include <QVariant>
#include <QIcon>

View File

@@ -1,3 +1,5 @@
#include <QtGlobal>
#include "optionsmodel.h"
#include "bitcoinunits.h"

View File

@@ -1,6 +1,7 @@
#ifndef OPTIONSMODEL_H
#define OPTIONSMODEL_H
#include <QtGlobal>
#include <QAbstractListModel>
class CWallet;

View File

@@ -9,6 +9,7 @@
#include "guiutil.h"
#include "guiconstants.h"
#include <QtGlobal>
#include <QAbstractItemDelegate>
#include <QPainter>

View File

@@ -1,6 +1,7 @@
#ifndef OVERVIEWPAGE_H
#define OVERVIEWPAGE_H
#include <QtGlobal>
#include <QWidget>
QT_BEGIN_NAMESPACE

View File

@@ -8,6 +8,7 @@
#include "guiutil.h"
#include "askpassphrasedialog.h"
#include <QtGlobal>
#include <QMessageBox>
#include <QLocale>
#include <QTextDocument>

View File

@@ -1,6 +1,7 @@
#ifndef SENDCOINSDIALOG_H
#define SENDCOINSDIALOG_H
#include <QtGlobal>
#include <QDialog>
namespace Ui {

View File

@@ -6,6 +6,7 @@
#include "headers.h"
#include "qtui.h"
#include <QtGlobal>
#include <QString>
#include <QTextDocument> // For Qt::escape
@@ -55,10 +56,10 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx)
strHTML.reserve(4000);
strHTML += "<html><font face='verdana, arial, helvetica, sans-serif'>";
int64 nTime = wtx.GetTxTime();
int64 nCredit = wtx.GetCredit();
int64 nDebit = wtx.GetDebit();
int64 nNet = nCredit - nDebit;
qint64 nTime = wtx.GetTxTime();
qint64 nCredit = wtx.GetCredit();
qint64 nDebit = wtx.GetDebit();
qint64 nNet = nCredit - nDebit;
strHTML += tr("<b>Status:</b> ") + FormatTxStatus(wtx);
int nRequests = wtx.GetRequestCount();
@@ -141,7 +142,7 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx)
//
// Coinbase
//
int64 nUnmatured = 0;
qint64 nUnmatured = 0;
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
nUnmatured += wallet->GetCredit(txout);
strHTML += tr("<b>Credit:</b> ");
@@ -200,13 +201,13 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx)
if (fAllToMe)
{
// Payment to self
int64 nChange = wtx.GetChange();
int64 nValue = nCredit - nChange;
qint64 nChange = wtx.GetChange();
qint64 nValue = nCredit - nChange;
strHTML += tr("<b>Debit:</b> ") + BitcoinUnits::formatWithUnit(BitcoinUnits::BTC, -nValue) + "<br>";
strHTML += tr("<b>Credit:</b> ") + BitcoinUnits::formatWithUnit(BitcoinUnits::BTC, nValue) + "<br>";
}
int64 nTxFee = nDebit - wtx.GetValueOut();
qint64 nTxFee = nDebit - wtx.GetValueOut();
if (nTxFee > 0)
strHTML += tr("<b>Transaction fee:</b> ") + BitcoinUnits::formatWithUnit(BitcoinUnits::BTC,-nTxFee) + "<br>";
}

View File

@@ -1,6 +1,7 @@
#include "transactionfilterproxy.h"
#include "transactiontablemodel.h"
#include <QtGlobal>
#include <QDateTime>
#include <cstdlib>

View File

@@ -1,6 +1,7 @@
#ifndef TRANSACTIONFILTERPROXY_H
#define TRANSACTIONFILTERPROXY_H
#include <QtGlobal>
#include <QSortFilterProxyModel>
#include <QDateTime>

View File

@@ -1,3 +1,5 @@
#include <QtGlobal>
#include "transactionrecord.h"
#include "headers.h"
@@ -33,10 +35,10 @@ bool TransactionRecord::showTransaction(const CWalletTx &wtx)
QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet *wallet, const CWalletTx &wtx)
{
QList<TransactionRecord> parts;
int64 nTime = wtx.nTimeDisplayed = wtx.GetTxTime();
int64 nCredit = wtx.GetCredit(true);
int64 nDebit = wtx.GetDebit();
int64 nNet = nCredit - nDebit;
qint64 nTime = wtx.nTimeDisplayed = wtx.GetTxTime();
qint64 nCredit = wtx.GetCredit(true);
qint64 nDebit = wtx.GetDebit();
qint64 nNet = nCredit - nDebit;
uint256 hash = wtx.GetHash();
std::map<std::string, std::string> mapValue = wtx.mapValue;
@@ -58,7 +60,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet *
if (nCredit == 0)
{
int64 nUnmatured = 0;
qint64 nUnmatured = 0;
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
nUnmatured += wallet->GetCredit(txout);
sub.credit = nUnmatured;
@@ -103,7 +105,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet *
if (fAllFromMe && fAllToMe)
{
// Payment to self
int64 nChange = wtx.GetChange();
qint64 nChange = wtx.GetChange();
parts.append(TransactionRecord(hash, nTime, TransactionRecord::SendToSelf, "",
-(nDebit - nChange), nCredit - nChange));
@@ -113,7 +115,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet *
//
// Debit
//
int64 nTxFee = nDebit - wtx.GetValueOut();
qint64 nTxFee = nDebit - wtx.GetValueOut();
for (int nOut = 0; nOut < wtx.vout.size(); nOut++)
{
@@ -144,7 +146,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet *
}
}
int64 nValue = txout.nValue;
qint64 nValue = txout.nValue;
/* Add fee to first output */
if (nTxFee > 0)
{
@@ -227,7 +229,7 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx)
// For generated transactions, determine maturity
if(type == TransactionRecord::Generated)
{
int64 nCredit = wtx.GetCredit(true);
qint64 nCredit = wtx.GetCredit(true);
if (nCredit == 0)
{
status.maturity = TransactionStatus::Immature;

View File

@@ -3,6 +3,7 @@
#include "uint256.h"
#include <QtGlobal>
#include <QList>
class CWallet;
@@ -46,8 +47,8 @@ public:
/** @name Reported status
@{*/
Status status;
int64 depth;
int64 open_for; /**< Timestamp if status==OpenUntilDate, otherwise number of blocks */
qint64 depth;
qint64 open_for; /**< Timestamp if status==OpenUntilDate, otherwise number of blocks */
/**@}*/
/** Current number of blocks (to know whether cached status is still valid) */
@@ -79,15 +80,15 @@ public:
{
}
TransactionRecord(uint256 hash, int64 time):
TransactionRecord(uint256 hash, qint64 time):
hash(hash), time(time), type(Other), address(""), debit(0),
credit(0), idx(0)
{
}
TransactionRecord(uint256 hash, int64 time,
TransactionRecord(uint256 hash, qint64 time,
Type type, const std::string &address,
int64 debit, int64 credit):
qint64 debit, qint64 credit):
hash(hash), time(time), type(type), address(address), debit(debit), credit(credit),
idx(0)
{
@@ -101,11 +102,11 @@ public:
/** @name Immutable transaction attributes
@{*/
uint256 hash;
int64 time;
qint64 time;
Type type;
std::string address;
int64 debit;
int64 credit;
qint64 debit;
qint64 credit;
/**@}*/
/** Subtransaction index, for sort key */

View File

@@ -11,6 +11,7 @@
#include "editaddressdialog.h"
#include "optionsmodel.h"
#include <QtGlobal>
#include <QScrollBar>
#include <QComboBox>
#include <QDoubleValidator>

View File

@@ -6,6 +6,7 @@
#include "headers.h"
#include <QtGlobal>
#include <QTimer>
#include <QSet>
@@ -120,7 +121,7 @@ WalletModel::SendCoinsReturn WalletModel::sendCoins(const QList<SendCoinsRecipie
CRITICAL_BLOCK(wallet->cs_wallet)
{
// Sendmany
std::vector<std::pair<CScript, int64> > vecSend;
std::vector<std::pair<CScript, qint64> > vecSend;
foreach(const SendCoinsRecipient &rcp, recipients)
{
CScript scriptPubKey;
@@ -130,7 +131,7 @@ WalletModel::SendCoinsReturn WalletModel::sendCoins(const QList<SendCoinsRecipie
CWalletTx wtx;
CReserveKey keyChange(wallet);
int64 nFeeRequired = 0;
qint64 nFeeRequired = 0;
bool fCreated = wallet->CreateTransaction(vecSend, wtx, keyChange, nFeeRequired);
if(!fCreated)

View File

@@ -1,6 +1,7 @@
#ifndef WALLETMODEL_H
#define WALLETMODEL_H
#include <QtGlobal>
#include <QObject>
#include "util.h"