aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bitcoin-qt.pro2
-rw-r--r--src/addrman.cpp5
-rw-r--r--src/addrman.h2
-rw-r--r--src/main.cpp6
-rw-r--r--src/main.h2
-rw-r--r--src/makefile.linux-mingw2
-rw-r--r--src/makefile.mingw2
-rw-r--r--src/makefile.osx2
-rw-r--r--src/makefile.unix13
-rw-r--r--src/netbase.cpp6
-rw-r--r--src/qt/transactionrecord.cpp2
-rw-r--r--src/test/base58_tests.cpp4
-rw-r--r--src/test/base64_tests.cpp2
13 files changed, 24 insertions, 26 deletions
diff --git a/bitcoin-qt.pro b/bitcoin-qt.pro
index c1f0c452ad..112e8e9389 100644
--- a/bitcoin-qt.pro
+++ b/bitcoin-qt.pro
@@ -90,7 +90,7 @@ contains(BITCOIN_NEED_QT_PLUGINS, 1) {
DEFINES += HAVE_BUILD_INFO
}
-QMAKE_CXXFLAGS_WARN_ON = -fdiagnostics-show-option -Wall -Wextra -Wformat -Wformat-security -Wno-invalid-offsetof -Wno-sign-compare -Wno-unused-parameter
+QMAKE_CXXFLAGS_WARN_ON = -fdiagnostics-show-option -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter
# Input
DEPENDPATH += src src/json src/qt
diff --git a/src/addrman.cpp b/src/addrman.cpp
index 10d005aae9..56ac9ca12c 100644
--- a/src/addrman.cpp
+++ b/src/addrman.cpp
@@ -102,12 +102,11 @@ CAddrInfo* CAddrMan::Create(const CAddress &addr, const CNetAddr &addrSource, in
return &mapInfo[nId];
}
-void CAddrMan::SwapRandom(int nRndPos1, int nRndPos2)
+void CAddrMan::SwapRandom(unsigned int nRndPos1, unsigned int nRndPos2)
{
if (nRndPos1 == nRndPos2)
return;
- assert(nRndPos1 >= 0 && nRndPos2 >= 0);
assert(nRndPos1 < vRandom.size() && nRndPos2 < vRandom.size());
int nId1 = vRandom[nRndPos1];
@@ -149,7 +148,7 @@ int CAddrMan::SelectTried(int nKBucket)
int CAddrMan::ShrinkNew(int nUBucket)
{
- assert(nUBucket >= 0 && nUBucket < vvNew.size());
+ assert(nUBucket >= 0 && (unsigned int)nUBucket < vvNew.size());
std::set<int> &vNew = vvNew[nUBucket];
// first look for deletable items
diff --git a/src/addrman.h b/src/addrman.h
index 3768614cfe..43b6d35ed8 100644
--- a/src/addrman.h
+++ b/src/addrman.h
@@ -204,7 +204,7 @@ protected:
CAddrInfo* Create(const CAddress &addr, const CNetAddr &addrSource, int *pnId = NULL);
// Swap two elements in vRandom.
- void SwapRandom(int nRandomPos1, int nRandomPos2);
+ void SwapRandom(unsigned int nRandomPos1, unsigned int nRandomPos2);
// Return position in given bucket to replace.
int SelectTried(int nKBucket);
diff --git a/src/main.cpp b/src/main.cpp
index b337993cc2..b0ed28aa14 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2060,7 +2060,7 @@ bool LoadExternalBlockFile(FILE* fileIn)
try {
CAutoFile blkdat(fileIn, SER_DISK, CLIENT_VERSION);
unsigned int nPos = 0;
- while (nPos != -1 && blkdat.good() && !fRequestShutdown)
+ while (nPos != (unsigned int)-1 && blkdat.good() && !fRequestShutdown)
{
unsigned char pchData[65536];
do {
@@ -2068,7 +2068,7 @@ bool LoadExternalBlockFile(FILE* fileIn)
int nRead = fread(pchData, 1, sizeof(pchData), blkdat);
if (nRead <= 8)
{
- nPos = -1;
+ nPos = (unsigned int)-1;
break;
}
void* nFind = memchr(pchData, pchMessageStart[0], nRead+1-sizeof(pchMessageStart));
@@ -2084,7 +2084,7 @@ bool LoadExternalBlockFile(FILE* fileIn)
else
nPos += sizeof(pchData) - sizeof(pchMessageStart) + 1;
} while(!fRequestShutdown);
- if (nPos == -1)
+ if (nPos == (unsigned int)-1)
break;
fseek(blkdat, nPos, SEEK_SET);
unsigned int nSize;
diff --git a/src/main.h b/src/main.h
index 965100d6d4..194d9fdc66 100644
--- a/src/main.h
+++ b/src/main.h
@@ -36,7 +36,7 @@ static const int64 MAX_MONEY = 21000000 * COIN;
inline bool MoneyRange(int64 nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
static const int COINBASE_MATURITY = 100;
// Threshold for nLockTime: below this value it is interpreted as block number, otherwise as UNIX timestamp.
-static const int LOCKTIME_THRESHOLD = 500000000; // Tue Nov 5 00:53:20 1985 UTC
+static const unsigned int LOCKTIME_THRESHOLD = 500000000; // Tue Nov 5 00:53:20 1985 UTC
#ifdef USE_UPNP
static const int fHaveUPnP = true;
#else
diff --git a/src/makefile.linux-mingw b/src/makefile.linux-mingw
index 81934187e2..645f0a16e4 100644
--- a/src/makefile.linux-mingw
+++ b/src/makefile.linux-mingw
@@ -29,7 +29,7 @@ LIBS= \
DEFS=-D_MT -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB
DEBUGFLAGS=-g
-CFLAGS=-O2 -w -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
+CFLAGS=-O2 -w -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
TESTDEFS = -DTEST_DATA_DIR=$(abspath test/data)
diff --git a/src/makefile.mingw b/src/makefile.mingw
index 917eb12fcf..bb6466954f 100644
--- a/src/makefile.mingw
+++ b/src/makefile.mingw
@@ -25,7 +25,7 @@ LIBS= \
DEFS=-DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB
DEBUGFLAGS=-g
-CFLAGS=-mthreads -O2 -w -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
+CFLAGS=-mthreads -O2 -w -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
TESTDEFS = -DTEST_DATA_DIR=$(abspath test/data)
diff --git a/src/makefile.osx b/src/makefile.osx
index be95aab446..7582da0472 100644
--- a/src/makefile.osx
+++ b/src/makefile.osx
@@ -65,7 +65,7 @@ CFLAGS = -g
endif
# ppc doesn't work because we don't support big-endian
-CFLAGS += -Wextra -Wno-sign-compare -Wno-invalid-offsetof -Wformat-security \
+CFLAGS += -Wall -Wextra -Wformat -Wformat-security -Wno-unused-paramter \
$(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
OBJS= \
diff --git a/src/makefile.unix b/src/makefile.unix
index 36860be299..53fb1f0b8d 100644
--- a/src/makefile.unix
+++ b/src/makefile.unix
@@ -82,9 +82,8 @@ LIBS+= \
DEBUGFLAGS=-g
-CXXFLAGS=-O2
-xCXXFLAGS=-pthread -Wall -Wextra -Wno-invalid-offsetof -Wno-unused-parameter -Wformat -Wformat-security \
- $(DEBUGFLAGS) $(DEFS) $(HARDENING) $(CXXFLAGS)
+CXXFLAGS=-O2 -pthread -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter \
+ $(DEBUGFLAGS) $(DEFS) $(HARDENING)
OBJS= \
obj/version.o \
@@ -121,26 +120,26 @@ version.cpp: obj/build.h
DEFS += -DHAVE_BUILD_INFO
obj/%.o: %.cpp
- $(CXX) -c $(xCXXFLAGS) -MMD -o $@ $<
+ $(CXX) -c $(CXXFLAGS) -MMD -o $@ $<
@cp $(@:%.o=%.d) $(@:%.o=%.P); \
sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
-e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
rm -f $(@:%.o=%.d)
bitcoind: $(OBJS:obj/%=obj/%)
- $(CXX) $(xCXXFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)
+ $(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)
TESTOBJS := $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp))
obj-test/%.o: test/%.cpp
- $(CXX) -c $(TESTDEFS) $(xCXXFLAGS) -MMD -o $@ $<
+ $(CXX) -c $(TESTDEFS) $(CXXFLAGS) -MMD -o $@ $<
@cp $(@:%.o=%.d) $(@:%.o=%.P); \
sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
-e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
rm -f $(@:%.o=%.d)
test_bitcoin: $(TESTOBJS) $(filter-out obj/init.o,$(OBJS:obj/%=obj/%))
- $(CXX) $(xCXXFLAGS) -o $@ $(LIBPATHS) $^ -Wl,-B$(LMODE) -lboost_unit_test_framework $(LDFLAGS) $(LIBS)
+ $(CXX) $(CXXFLAGS) -o $@ $(LIBPATHS) $^ -Wl,-B$(LMODE) -lboost_unit_test_framework $(LDFLAGS) $(LIBS)
clean:
-rm -f bitcoind test_bitcoin
diff --git a/src/netbase.cpp b/src/netbase.cpp
index 4fe3fb61da..48709dc5c6 100644
--- a/src/netbase.cpp
+++ b/src/netbase.cpp
@@ -208,9 +208,9 @@ bool static Socks5(string strDest, int port, SOCKET& hSocket)
}
char pszSocks5Init[] = "\5\1\0";
char *pszSocks5 = pszSocks5Init;
- int nSize = sizeof(pszSocks5Init);
+ ssize_t nSize = sizeof(pszSocks5Init);
- int ret = send(hSocket, pszSocks5, nSize, MSG_NOSIGNAL);
+ ssize_t ret = send(hSocket, pszSocks5, nSize, MSG_NOSIGNAL);
if (ret != nSize)
{
closesocket(hSocket);
@@ -234,7 +234,7 @@ bool static Socks5(string strDest, int port, SOCKET& hSocket)
strSocks5 += static_cast<char>((port >> 8) & 0xFF);
strSocks5 += static_cast<char>((port >> 0) & 0xFF);
ret = send(hSocket, strSocks5.c_str(), strSocks5.size(), MSG_NOSIGNAL);
- if (ret != strSocks5.size())
+ if (ret != (ssize_t)strSocks5.size())
{
closesocket(hSocket);
return error("Error sending to proxy");
diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp
index 90fc5b7da3..53cfb409ff 100644
--- a/src/qt/transactionrecord.cpp
+++ b/src/qt/transactionrecord.cpp
@@ -102,7 +102,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet *
//
int64 nTxFee = nDebit - wtx.GetValueOut();
- for (int nOut = 0; nOut < wtx.vout.size(); nOut++)
+ for (unsigned int nOut = 0; nOut < wtx.vout.size(); nOut++)
{
const CTxOut& txout = wtx.vout[nOut];
TransactionRecord sub(hash, nTime);
diff --git a/src/test/base58_tests.cpp b/src/test/base58_tests.cpp
index d52ac74982..de4096cd39 100644
--- a/src/test/base58_tests.cpp
+++ b/src/test/base58_tests.cpp
@@ -67,7 +67,7 @@ const char *vstrOut[] = {
BOOST_AUTO_TEST_CASE(base58_EncodeBase58)
{
- for (int i=0; i<sizeof(vstrIn)/sizeof(vstrIn[0]); i++)
+ for (unsigned int i=0; i<sizeof(vstrIn)/sizeof(vstrIn[0]); i++)
{
BOOST_CHECK_EQUAL(EncodeBase58(vstrIn[i].data, vstrIn[i].data + vstrIn[i].size), vstrOut[i]);
}
@@ -76,7 +76,7 @@ BOOST_AUTO_TEST_CASE(base58_EncodeBase58)
BOOST_AUTO_TEST_CASE(base58_DecodeBase58)
{
std::vector<unsigned char> result;
- for (int i=0; i<sizeof(vstrIn)/sizeof(vstrIn[0]); i++)
+ for (unsigned int i=0; i<sizeof(vstrIn)/sizeof(vstrIn[0]); i++)
{
std::vector<unsigned char> expected(vstrIn[i].data, vstrIn[i].data + vstrIn[i].size);
BOOST_CHECK(DecodeBase58(vstrOut[i], result));
diff --git a/src/test/base64_tests.cpp b/src/test/base64_tests.cpp
index fff30ef5eb..c5a053e2eb 100644
--- a/src/test/base64_tests.cpp
+++ b/src/test/base64_tests.cpp
@@ -10,7 +10,7 @@ BOOST_AUTO_TEST_CASE(base64_testvectors)
{
static const std::string vstrIn[] = {"","f","fo","foo","foob","fooba","foobar"};
static const std::string vstrOut[] = {"","Zg==","Zm8=","Zm9v","Zm9vYg==","Zm9vYmE=","Zm9vYmFy"};
- for (int i=0; i<sizeof(vstrIn)/sizeof(vstrIn[0]); i++)
+ for (unsigned int i=0; i<sizeof(vstrIn)/sizeof(vstrIn[0]); i++)
{
std::string strEnc = EncodeBase64(vstrIn[i]);
BOOST_CHECK(strEnc == vstrOut[i]);