Code tidyups, fixing various warnings.
authorLuke Dashjr <luke-jr+git@utopios.org>
Tue, 17 Jan 2012 03:17:48 +0000 (22:17 -0500)
committerLuke Dashjr <luke-jr+git@utopios.org>
Tue, 17 Jan 2012 03:18:51 +0000 (22:18 -0500)
Partial cherry pick of:

Compile with extra warnings turned on. And more makefile/code tidying up.

This turns on most gcc warnings, and removes some unused variables and other code that triggers warnings.
Exceptions are:
 -Wno-sign-compare : triggered by lots of comparisons of signed integer to foo.size(), which is unsigned.
 -Wno-char-subscripts : triggered by the convert-to-hex functions (I may fix this in a future commit).

Conflicts:

src/makefile.osx
src/makefile.unix
src/netbase.cpp
src/rpc.cpp

src/checkpoints.cpp
src/headers.h
src/net.cpp
src/net.h
src/serialize.h

index c7e054d..508f72b 100644 (file)
@@ -52,7 +52,6 @@ namespace Checkpoints
     {
         if (fTestNet) return NULL;
 
-        int64 nResult;
         BOOST_REVERSE_FOREACH(const MapCheckpoints::value_type& i, mapCheckpoints)
         {
             const uint256& hash = i.second;
index ab318cb..96db87d 100644 (file)
@@ -91,8 +91,6 @@
 #endif
 
 
-#pragma hdrstop
-
 #include "serialize.h"
 #include "uint256.h"
 #include "util.h"
index c7475b1..e3c0f8c 100644 (file)
@@ -1082,7 +1082,6 @@ void ThreadMapPort2(void* parg)
     char port[6];
     sprintf(port, "%d", GetListenPort());
 
-    const char * rootdescurl = 0;
     const char * multicastif = 0;
     const char * minissdpdpath = 0;
     struct UPNPDev * devlist = 0;
@@ -1104,8 +1103,6 @@ void ThreadMapPort2(void* parg)
     r = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr));
     if (r == 1)
     {
-        char intClient[16];
-        char intPort[6];
         string strDesc = "Bitcoin " + FormatFullVersion();
 #ifndef UPNPDISCOVER_SUCCESS
     /* miniupnpc 1.5 */
index 741e2a8..03d514c 100644 (file)
--- a/src/net.h
+++ b/src/net.h
@@ -264,7 +264,9 @@ public:
         // Make sure not to reuse time indexes to keep things in the same order
         int64 nNow = (GetTime() - 1) * 1000000;
         static int64 nLastTime;
-        nLastTime = nNow = std::max(nNow, ++nLastTime);
+        ++nLastTime;
+        nNow = std::max(nNow, nLastTime);
+        nLastTime = nNow;
 
         // Each retry is 2 minutes after the last
         nRequestTime = std::max(nRequestTime + 2 * 60 * 1000000, nNow);
index d7b5ec8..385c9ab 100644 (file)
@@ -98,6 +98,7 @@ enum
         const bool fRead = false;               \
         unsigned int nSerSize = 0;              \
         ser_streamplaceholder s;                \
+        assert(fGetSize||fWrite||fRead); /* suppress warning */ \
         s.nType = nType;                        \
         s.nVersion = nVersion;                  \
         {statements}                            \
@@ -111,6 +112,7 @@ enum
         const bool fWrite = true;               \
         const bool fRead = false;               \
         unsigned int nSerSize = 0;              \
+        assert(fGetSize||fWrite||fRead); /* suppress warning */ \
         {statements}                            \
     }                                           \
     template<typename Stream>                   \
@@ -121,6 +123,7 @@ enum
         const bool fWrite = false;              \
         const bool fRead = true;                \
         unsigned int nSerSize = 0;              \
+        assert(fGetSize||fWrite||fRead); /* suppress warning */ \
         {statements}                            \
     }