diff --git a/src/alert.cpp b/src/alert.cpp index 4dd3716e8..4429ecadc 100644 --- a/src/alert.cpp +++ b/src/alert.cpp @@ -11,7 +11,6 @@ #include "util.h" #include -#include #include #include diff --git a/src/db.cpp b/src/db.cpp index 592512c94..591d4ed47 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -10,7 +10,6 @@ #include "protocol.h" #include "util.h" -#include #include #ifndef WIN32 diff --git a/src/init.cpp b/src/init.cpp index c05ed4356..4cc04f520 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -24,7 +24,6 @@ #include "walletdb.h" #endif -#include #include #ifndef WIN32 diff --git a/src/main.cpp b/src/main.cpp index f46375aa9..4c98345d6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,7 +17,6 @@ #include "ui_interface.h" #include "util.h" -#include #include #include diff --git a/src/net.h b/src/net.h index 8995f70da..da590f89e 100644 --- a/src/net.h +++ b/src/net.h @@ -18,7 +18,6 @@ #include "util.h" #include -#include #include #ifndef WIN32 diff --git a/src/rpcnet.cpp b/src/rpcnet.cpp index b76434933..738b966b8 100644 --- a/src/rpcnet.cpp +++ b/src/rpcnet.cpp @@ -15,8 +15,6 @@ #include "wallet.h" // for getinfo #endif -#include - #include #include "json/json_spirit_value.h" diff --git a/src/util.h b/src/util.h index 6f7627e09..6ef93021f 100644 --- a/src/util.h +++ b/src/util.h @@ -16,7 +16,6 @@ #include #include -#include #include #include #include @@ -45,13 +44,25 @@ static const int64_t CENT = 1000000; #define UEND(a) ((unsigned char*)&((&(a))[1])) #define ARRAYLEN(array) (sizeof(array)/sizeof((array)[0])) -/* Format characters for (s)size_t and ptrdiff_t (C99 standard) */ -#define PRIszx "zx" -#define PRIszu "zu" -#define PRIszd "zd" -#define PRIpdx "tx" -#define PRIpdu "tu" -#define PRIpdd "td" +/* Format characters for (s)size_t, ptrdiff_t, uint64_t. + * + * As the tinyformat-based formatting system is type-safe, no special format + * characters are really needed to specify sizes. Tinyformat can support + * (ignores) the C99 prefixes such as "ll" but chokes on MSVC's inttypes + * defines prefixes such as "I64X". So don't include inttypes.h and define our + * own for compatibility. + * If you get a warning here about a redefine of PRI?64, make sure that + * inttypes.h is not included. + */ +#define PRIszx "x" +#define PRIszu "u" +#define PRIszd "d" +#define PRIpdx "x" +#define PRIpdu "u" +#define PRIpdd "d" +#define PRIx64 "x" +#define PRIu64 "u" +#define PRId64 "d" // This is needed because the foreach macro can't get over the comma in pair #define PAIRTYPE(t1, t2) std::pair diff --git a/src/wallet.cpp b/src/wallet.cpp index 823c96949..211909859 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -9,8 +9,6 @@ #include "coincontrol.h" #include "net.h" -#include - #include #include diff --git a/src/walletdb.cpp b/src/walletdb.cpp index b3816a54b..b5b523740 100644 --- a/src/walletdb.cpp +++ b/src/walletdb.cpp @@ -11,8 +11,6 @@ #include "sync.h" #include "wallet.h" -#include - #include #include