aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@exmulti.com>2012-05-08 13:50:27 -0700
committerJeff Garzik <jgarzik@exmulti.com>2012-05-08 13:50:27 -0700
commita2ea7975936cab4c56dd737de37004ae3298104d (patch)
treeb3ab8e38d3f52085d5389a2f85341c4cbdd8b02a /src
parent2f1dca645bece3a8422659a0bc0b1481242b8f3a (diff)
parent024fa1cb44b8ec577fef07e7b37a4e5b0501dbea (diff)
Merge pull request #1180 from jgarzik/sign-compare
Fix final sign comparison warnings
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp2
-rw-r--r--src/main.h12
-rw-r--r--src/net.cpp2
-rw-r--r--src/script.cpp6
4 files changed, 11 insertions, 11 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 0e0fd28c40..a357079baf 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1860,7 +1860,7 @@ bool CheckDiskSpace(uint64 nAdditionalBytes)
FILE* OpenBlockFile(unsigned int nFile, unsigned int nBlockPos, const char* pszMode)
{
- if (nFile == -1)
+ if ((nFile < 1) || (nFile == (unsigned int) -1))
return NULL;
FILE* file = fopen((GetDataDir() / strprintf("blk%04d.dat", nFile)).string().c_str(), pszMode);
if (!file)
diff --git a/src/main.h b/src/main.h
index c48b57b93c..965100d6d4 100644
--- a/src/main.h
+++ b/src/main.h
@@ -138,8 +138,8 @@ public:
}
IMPLEMENT_SERIALIZE( READWRITE(FLATDATA(*this)); )
- void SetNull() { nFile = -1; nBlockPos = 0; nTxPos = 0; }
- bool IsNull() const { return (nFile == -1); }
+ void SetNull() { nFile = (unsigned int) -1; nBlockPos = 0; nTxPos = 0; }
+ bool IsNull() const { return (nFile == (unsigned int) -1); }
friend bool operator==(const CDiskTxPos& a, const CDiskTxPos& b)
{
@@ -178,8 +178,8 @@ public:
CInPoint() { SetNull(); }
CInPoint(CTransaction* ptxIn, unsigned int nIn) { ptx = ptxIn; n = nIn; }
- void SetNull() { ptx = NULL; n = -1; }
- bool IsNull() const { return (ptx == NULL && n == -1); }
+ void SetNull() { ptx = NULL; n = (unsigned int) -1; }
+ bool IsNull() const { return (ptx == NULL && n == (unsigned int) -1); }
};
@@ -194,8 +194,8 @@ public:
COutPoint() { SetNull(); }
COutPoint(uint256 hashIn, unsigned int nIn) { hash = hashIn; n = nIn; }
IMPLEMENT_SERIALIZE( READWRITE(FLATDATA(*this)); )
- void SetNull() { hash = 0; n = -1; }
- bool IsNull() const { return (hash == 0 && n == -1); }
+ void SetNull() { hash = 0; n = (unsigned int) -1; }
+ bool IsNull() const { return (hash == 0 && n == (unsigned int) -1); }
friend bool operator<(const COutPoint& a, const COutPoint& b)
{
diff --git a/src/net.cpp b/src/net.cpp
index 92b4a3173f..745b51252e 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -621,7 +621,7 @@ void ThreadSocketHandler2(void* parg)
if (nSelect == SOCKET_ERROR)
{
int nErr = WSAGetLastError();
- if (hSocketMax > -1)
+ if (hSocketMax > (SOCKET) -1)
{
printf("socket select error %d\n", nErr);
for (unsigned int i = 0; i <= hSocketMax; i++)
diff --git a/src/script.cpp b/src/script.cpp
index 65e9b7c9a2..0b103a80bc 100644
--- a/src/script.cpp
+++ b/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)
int i = 1;
- if (stack.size() < i)
+ if ((int)stack.size() < i)
return false;
int nKeysCount = CastToBigNum(stacktop(-i)).getint();
@@ -951,7 +951,7 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, co
return false;
int ikey = ++i;
i += nKeysCount;
- if (stack.size() < i)
+ if ((int)stack.size() < i)
return false;
int nSigsCount = CastToBigNum(stacktop(-i)).getint();
@@ -959,7 +959,7 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, co
return false;
int isig = ++i;
i += nSigsCount;
- if (stack.size() < i)
+ if ((int)stack.size() < i)
return false;
// Subset of script starting at the most recent codeseparator