Skip to content

Commit 4fd082d

Browse files
committed
Merge pull request #3729
d5f1e72 Don't use PRIx64 formatting derives from inttypes.h (Wladimir J. van der Laan)
2 parents 0f0a706 + d5f1e72 commit 4fd082d

File tree

9 files changed

+19
-19
lines changed

9 files changed

+19
-19
lines changed

src/alert.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include "util.h"
1212

1313
#include <algorithm>
14-
#include <inttypes.h>
1514
#include <map>
1615

1716
#include <boost/algorithm/string/classification.hpp>

src/db.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include "protocol.h"
1111
#include "util.h"
1212

13-
#include <inttypes.h>
1413
#include <stdint.h>
1514

1615
#ifndef WIN32

src/init.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include "walletdb.h"
2525
#endif
2626

27-
#include <inttypes.h>
2827
#include <stdint.h>
2928

3029
#ifndef WIN32

src/main.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "ui_interface.h"
1818
#include "util.h"
1919

20-
#include <inttypes.h>
2120
#include <sstream>
2221

2322
#include <boost/algorithm/string/replace.hpp>

src/net.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include "util.h"
1919

2020
#include <deque>
21-
#include <inttypes.h>
2221
#include <stdint.h>
2322

2423
#ifndef WIN32

src/rpcnet.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
#include "wallet.h" // for getinfo
1616
#endif
1717

18-
#include <inttypes.h>
19-
2018
#include <boost/foreach.hpp>
2119
#include "json/json_spirit_value.h"
2220

src/util.h

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
#include <cstdio>
1818
#include <exception>
19-
#include <inttypes.h>
2019
#include <map>
2120
#include <stdarg.h>
2221
#include <stdint.h>
@@ -45,13 +44,25 @@ static const int64_t CENT = 1000000;
4544
#define UEND(a) ((unsigned char*)&((&(a))[1]))
4645
#define ARRAYLEN(array) (sizeof(array)/sizeof((array)[0]))
4746

48-
/* Format characters for (s)size_t and ptrdiff_t (C99 standard) */
49-
#define PRIszx "zx"
50-
#define PRIszu "zu"
51-
#define PRIszd "zd"
52-
#define PRIpdx "tx"
53-
#define PRIpdu "tu"
54-
#define PRIpdd "td"
47+
/* Format characters for (s)size_t, ptrdiff_t, uint64_t.
48+
*
49+
* As the tinyformat-based formatting system is type-safe, no special format
50+
* characters are really needed to specify sizes. Tinyformat can support
51+
* (ignores) the C99 prefixes such as "ll" but chokes on MSVC's inttypes
52+
* defines prefixes such as "I64X". So don't include inttypes.h and define our
53+
* own for compatibility.
54+
* If you get a warning here about a redefine of PRI?64, make sure that
55+
* inttypes.h is not included.
56+
*/
57+
#define PRIszx "x"
58+
#define PRIszu "u"
59+
#define PRIszd "d"
60+
#define PRIpdx "x"
61+
#define PRIpdu "u"
62+
#define PRIpdd "d"
63+
#define PRIx64 "x"
64+
#define PRIu64 "u"
65+
#define PRId64 "d"
5566

5667
// This is needed because the foreach macro can't get over the comma in pair<t1, t2>
5768
#define PAIRTYPE(t1, t2) std::pair<t1, t2>

src/wallet.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
#include "coincontrol.h"
1010
#include "net.h"
1111

12-
#include <inttypes.h>
13-
1412
#include <boost/algorithm/string/replace.hpp>
1513
#include <openssl/rand.h>
1614

src/walletdb.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
#include "sync.h"
1212
#include "wallet.h"
1313

14-
#include <inttypes.h>
15-
1614
#include <boost/filesystem.hpp>
1715
#include <boost/foreach.hpp>
1816

0 commit comments

Comments
 (0)