Browse Source

Merge pull request #1180 from jgarzik/sign-compare

Fix final sign comparison warnings
0.8
Jeff Garzik 13 years ago
parent
commit
a2ea797593
  1. 2
      src/main.cpp
  2. 12
      src/main.h
  3. 2
      src/net.cpp
  4. 6
      src/script.cpp

2
src/main.cpp

@ -1860,7 +1860,7 @@ bool CheckDiskSpace(uint64 nAdditionalBytes)
FILE* OpenBlockFile(unsigned int nFile, unsigned int nBlockPos, const char* pszMode) FILE* OpenBlockFile(unsigned int nFile, unsigned int nBlockPos, const char* pszMode)
{ {
if (nFile == -1) if ((nFile < 1) || (nFile == (unsigned int) -1))
return NULL; return NULL;
FILE* file = fopen((GetDataDir() / strprintf("blk%04d.dat", nFile)).string().c_str(), pszMode); FILE* file = fopen((GetDataDir() / strprintf("blk%04d.dat", nFile)).string().c_str(), pszMode);
if (!file) if (!file)

12
src/main.h

@ -138,8 +138,8 @@ public:
} }
IMPLEMENT_SERIALIZE( READWRITE(FLATDATA(*this)); ) IMPLEMENT_SERIALIZE( READWRITE(FLATDATA(*this)); )
void SetNull() { nFile = -1; nBlockPos = 0; nTxPos = 0; } void SetNull() { nFile = (unsigned int) -1; nBlockPos = 0; nTxPos = 0; }
bool IsNull() const { return (nFile == -1); } bool IsNull() const { return (nFile == (unsigned int) -1); }
friend bool operator==(const CDiskTxPos& a, const CDiskTxPos& b) friend bool operator==(const CDiskTxPos& a, const CDiskTxPos& b)
{ {
@ -178,8 +178,8 @@ public:
CInPoint() { SetNull(); } CInPoint() { SetNull(); }
CInPoint(CTransaction* ptxIn, unsigned int nIn) { ptx = ptxIn; n = nIn; } CInPoint(CTransaction* ptxIn, unsigned int nIn) { ptx = ptxIn; n = nIn; }
void SetNull() { ptx = NULL; n = -1; } void SetNull() { ptx = NULL; n = (unsigned int) -1; }
bool IsNull() const { return (ptx == NULL && n == -1); } bool IsNull() const { return (ptx == NULL && n == (unsigned int) -1); }
}; };
@ -194,8 +194,8 @@ public:
COutPoint() { SetNull(); } COutPoint() { SetNull(); }
COutPoint(uint256 hashIn, unsigned int nIn) { hash = hashIn; n = nIn; } COutPoint(uint256 hashIn, unsigned int nIn) { hash = hashIn; n = nIn; }
IMPLEMENT_SERIALIZE( READWRITE(FLATDATA(*this)); ) IMPLEMENT_SERIALIZE( READWRITE(FLATDATA(*this)); )
void SetNull() { hash = 0; n = -1; } void SetNull() { hash = 0; n = (unsigned int) -1; }
bool IsNull() const { return (hash == 0 && n == -1); } bool IsNull() const { return (hash == 0 && n == (unsigned int) -1); }
friend bool operator<(const COutPoint& a, const COutPoint& b) friend bool operator<(const COutPoint& a, const COutPoint& b)
{ {

2
src/net.cpp

@ -621,7 +621,7 @@ void ThreadSocketHandler2(void* parg)
if (nSelect == SOCKET_ERROR) if (nSelect == SOCKET_ERROR)
{ {
int nErr = WSAGetLastError(); int nErr = WSAGetLastError();
if (hSocketMax > -1) if (hSocketMax > (SOCKET) -1)
{ {
printf("socket select error %d\n", nErr); printf("socket select error %d\n", nErr);
for (unsigned int i = 0; i <= hSocketMax; i++) for (unsigned int i = 0; i <= hSocketMax; i++)

6
src/script.cpp

@ -940,7 +940,7 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, co
// ([sig ...] num_of_signatures [pubkey ...] num_of_pubkeys -- bool) // ([sig ...] num_of_signatures [pubkey ...] num_of_pubkeys -- bool)
int i = 1; int i = 1;
if (stack.size() < i) if ((int)stack.size() < i)
return false; return false;
int nKeysCount = CastToBigNum(stacktop(-i)).getint(); int nKeysCount = CastToBigNum(stacktop(-i)).getint();
@ -951,7 +951,7 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, co
return false; return false;
int ikey = ++i; int ikey = ++i;
i += nKeysCount; i += nKeysCount;
if (stack.size() < i) if ((int)stack.size() < i)
return false; return false;
int nSigsCount = CastToBigNum(stacktop(-i)).getint(); int nSigsCount = CastToBigNum(stacktop(-i)).getint();
@ -959,7 +959,7 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, co
return false; return false;
int isig = ++i; int isig = ++i;
i += nSigsCount; i += nSigsCount;
if (stack.size() < i) if ((int)stack.size() < i)
return false; return false;
// Subset of script starting at the most recent codeseparator // Subset of script starting at the most recent codeseparator

Loading…
Cancel
Save