changed field types in some structures to equivalent unambiguous types

Conflicts:
	src/core.cpp

Rebased-By: Wladimir J. van der Laan
Github-Pull: #4180
This commit is contained in:
Kamil Domanski 2014-08-07 15:39:49 +02:00 committed by Wladimir J. van der Laan
parent ce223e7b7d
commit 9f3d476779
No known key found for this signature in database
GPG key ID: 74810B012346C9A6
2 changed files with 26 additions and 26 deletions

View file

@ -12,14 +12,14 @@ std::string COutPoint::ToString() const
return strprintf("COutPoint(%s, %u)", hash.ToString().substr(0,10), n); return strprintf("COutPoint(%s, %u)", hash.ToString().substr(0,10), n);
} }
CTxIn::CTxIn(COutPoint prevoutIn, CScript scriptSigIn, unsigned int nSequenceIn) CTxIn::CTxIn(COutPoint prevoutIn, CScript scriptSigIn, uint32_t nSequenceIn)
{ {
prevout = prevoutIn; prevout = prevoutIn;
scriptSig = scriptSigIn; scriptSig = scriptSigIn;
nSequence = nSequenceIn; nSequence = nSequenceIn;
} }
CTxIn::CTxIn(uint256 hashPrevTx, unsigned int nOut, CScript scriptSigIn, unsigned int nSequenceIn) CTxIn::CTxIn(uint256 hashPrevTx, uint32_t nOut, CScript scriptSigIn, uint32_t nSequenceIn)
{ {
prevout = COutPoint(hashPrevTx, nOut); prevout = COutPoint(hashPrevTx, nOut);
scriptSig = scriptSigIn; scriptSig = scriptSigIn;

View file

@ -26,13 +26,13 @@ class COutPoint
{ {
public: public:
uint256 hash; uint256 hash;
unsigned int n; uint32_t n;
COutPoint() { SetNull(); } COutPoint() { SetNull(); }
COutPoint(uint256 hashIn, unsigned int nIn) { hash = hashIn; n = nIn; } COutPoint(uint256 hashIn, uint32_t nIn) { hash = hashIn; n = nIn; }
IMPLEMENT_SERIALIZE( READWRITE(FLATDATA(*this)); ) IMPLEMENT_SERIALIZE( READWRITE(FLATDATA(*this)); )
void SetNull() { hash = 0; n = (unsigned int) -1; } void SetNull() { hash = 0; n = (uint32_t) -1; }
bool IsNull() const { return (hash == 0 && n == (unsigned int) -1); } bool IsNull() const { return (hash == 0 && n == (uint32_t) -1); }
friend bool operator<(const COutPoint& a, const COutPoint& b) friend bool operator<(const COutPoint& a, const COutPoint& b)
{ {
@ -57,12 +57,12 @@ class CInPoint
{ {
public: public:
const CTransaction* ptx; const CTransaction* ptx;
unsigned int n; uint32_t n;
CInPoint() { SetNull(); } CInPoint() { SetNull(); }
CInPoint(const CTransaction* ptxIn, unsigned int nIn) { ptx = ptxIn; n = nIn; } CInPoint(const CTransaction* ptxIn, uint32_t nIn) { ptx = ptxIn; n = nIn; }
void SetNull() { ptx = NULL; n = (unsigned int) -1; } void SetNull() { ptx = NULL; n = (uint32_t) -1; }
bool IsNull() const { return (ptx == NULL && n == (unsigned int) -1); } bool IsNull() const { return (ptx == NULL && n == (uint32_t) -1); }
}; };
/** An input of a transaction. It contains the location of the previous /** An input of a transaction. It contains the location of the previous
@ -74,15 +74,15 @@ class CTxIn
public: public:
COutPoint prevout; COutPoint prevout;
CScript scriptSig; CScript scriptSig;
unsigned int nSequence; uint32_t nSequence;
CTxIn() CTxIn()
{ {
nSequence = std::numeric_limits<unsigned int>::max(); nSequence = std::numeric_limits<unsigned int>::max();
} }
explicit CTxIn(COutPoint prevoutIn, CScript scriptSigIn=CScript(), unsigned int nSequenceIn=std::numeric_limits<unsigned int>::max()); explicit CTxIn(COutPoint prevoutIn, CScript scriptSigIn=CScript(), uint32_t nSequenceIn=std::numeric_limits<unsigned int>::max());
CTxIn(uint256 hashPrevTx, unsigned int nOut, CScript scriptSigIn=CScript(), unsigned int nSequenceIn=std::numeric_limits<unsigned int>::max()); CTxIn(uint256 hashPrevTx, uint32_t nOut, CScript scriptSigIn=CScript(), uint32_t nSequenceIn=std::numeric_limits<uint32_t>::max());
IMPLEMENT_SERIALIZE IMPLEMENT_SERIALIZE
( (
@ -93,7 +93,7 @@ public:
bool IsFinal() const bool IsFinal() const
{ {
return (nSequence == std::numeric_limits<unsigned int>::max()); return (nSequence == std::numeric_limits<uint32_t>::max());
} }
friend bool operator==(const CTxIn& a, const CTxIn& b) friend bool operator==(const CTxIn& a, const CTxIn& b)
@ -217,17 +217,17 @@ private:
void UpdateHash() const; void UpdateHash() const;
public: public:
static const int CURRENT_VERSION=1; static const int32_t CURRENT_VERSION=1;
// The local variables are made const to prevent unintended modification // The local variables are made const to prevent unintended modification
// without updating the cached hash value. However, CTransaction is not // without updating the cached hash value. However, CTransaction is not
// actually immutable; deserialization and assignment are implemented, // actually immutable; deserialization and assignment are implemented,
// and bypass the constness. This is safe, as they update the entire // and bypass the constness. This is safe, as they update the entire
// structure, including the hash. // structure, including the hash.
const int nVersion; const int32_t nVersion;
const std::vector<CTxIn> vin; const std::vector<CTxIn> vin;
const std::vector<CTxOut> vout; const std::vector<CTxOut> vout;
const unsigned int nLockTime; const uint32_t nLockTime;
/** Construct a CTransaction that qualifies as IsNull() */ /** Construct a CTransaction that qualifies as IsNull() */
CTransaction(); CTransaction();
@ -238,11 +238,11 @@ public:
CTransaction& operator=(const CTransaction& tx); CTransaction& operator=(const CTransaction& tx);
IMPLEMENT_SERIALIZE( IMPLEMENT_SERIALIZE(
READWRITE(*const_cast<int*>(&this->nVersion)); READWRITE(*const_cast<int32_t*>(&this->nVersion));
nVersion = this->nVersion; nVersion = this->nVersion;
READWRITE(*const_cast<std::vector<CTxIn>*>(&vin)); READWRITE(*const_cast<std::vector<CTxIn>*>(&vin));
READWRITE(*const_cast<std::vector<CTxOut>*>(&vout)); READWRITE(*const_cast<std::vector<CTxOut>*>(&vout));
READWRITE(*const_cast<unsigned int*>(&nLockTime)); READWRITE(*const_cast<uint32_t*>(&nLockTime));
if (fRead) if (fRead)
UpdateHash(); UpdateHash();
) )
@ -284,10 +284,10 @@ public:
/** A mutable version of CTransaction. */ /** A mutable version of CTransaction. */
struct CMutableTransaction struct CMutableTransaction
{ {
int nVersion; int32_t nVersion;
std::vector<CTxIn> vin; std::vector<CTxIn> vin;
std::vector<CTxOut> vout; std::vector<CTxOut> vout;
unsigned int nLockTime; uint32_t nLockTime;
CMutableTransaction(); CMutableTransaction();
CMutableTransaction(const CTransaction& tx); CMutableTransaction(const CTransaction& tx);
@ -399,13 +399,13 @@ class CBlockHeader
{ {
public: public:
// header // header
static const int CURRENT_VERSION=2; static const int32_t CURRENT_VERSION=2;
int nVersion; int32_t nVersion;
uint256 hashPrevBlock; uint256 hashPrevBlock;
uint256 hashMerkleRoot; uint256 hashMerkleRoot;
unsigned int nTime; uint32_t nTime;
unsigned int nBits; uint32_t nBits;
unsigned int nNonce; uint32_t nNonce;
CBlockHeader() CBlockHeader()
{ {