Skip to content

Commit

Permalink
scripted-diff: Replace deprecated C headers
Browse files Browse the repository at this point in the history
-BEGIN VERIFY SCRIPT-
find src -not \( -path src/crypto/ctaes -prune \) -not \( -path src/leveldb -prune \) -not \( -path src/secp256k1 -prune \) -not \( -path src/univalue -prune \) \( -name "*.h" -o -name "*.cpp" \) -exec sed -i 's/#include <assert\.h>/#include <cassert>/g' '{}' \;
find src -not \( -path src/crypto/ctaes -prune \) -not \( -path src/leveldb -prune \) -not \( -path src/secp256k1 -prune \) -not \( -path src/univalue -prune \) \( -name "*.h" -o -name "*.cpp" \) -exec sed -i 's/#include <errno\.h>/#include <cerrno>/g' '{}' \;
find src -not \( -path src/crypto/ctaes -prune \) -not \( -path src/leveldb -prune \) -not \( -path src/secp256k1 -prune \) -not \( -path src/univalue -prune \) \( -name "*.h" -o -name "*.cpp" \) -exec sed -i 's/#include <limits\.h>/#include <climits>/g' '{}' \;
find src -not \( -path src/crypto/ctaes -prune \) -not \( -path src/leveldb -prune \) -not \( -path src/secp256k1 -prune \) -not \( -path src/univalue -prune \) \( -name "*.h" -o -name "*.cpp" \) -exec sed -i 's/#include <math\.h>/#include <cmath>/g' '{}' \;
find src -not \( -path src/crypto/ctaes -prune \) -not \( -path src/leveldb -prune \) -not \( -path src/secp256k1 -prune \) -not \( -path src/univalue -prune \) \( -name "*.h" -o -name "*.cpp" \) -exec sed -i 's/#include <signal\.h>/#include <csignal>/g' '{}' \;
find src -not \( -path src/crypto/ctaes -prune \) -not \( -path src/leveldb -prune \) -not \( -path src/secp256k1 -prune \) -not \( -path src/univalue -prune \) \( -name "*.h" -o -name "*.cpp" \) -exec sed -i 's/#include <stdarg\.h>/#include <cstdarg>/g' '{}' \;
find src -not \( -path src/crypto/ctaes -prune \) -not \( -path src/leveldb -prune \) -not \( -path src/secp256k1 -prune \) -not \( -path src/univalue -prune \) \( -name "*.h" -o -name "*.cpp" \) -exec sed -i 's/#include <stddef\.h>/#include <cstddef>/g' '{}' \;
find src -not \( -path src/crypto/ctaes -prune \) -not \( -path src/leveldb -prune \) -not \( -path src/secp256k1 -prune \) -not \( -path src/univalue -prune \) \( -name "*.h" -o -name "*.cpp" \) -exec sed -i 's/#include <stdint\.h>/#include <cstdint>/g' '{}' \;
find src -not \( -path src/crypto/ctaes -prune \) -not \( -path src/leveldb -prune \) -not \( -path src/secp256k1 -prune \) -not \( -path src/univalue -prune \) \( -name "*.h" -o -name "*.cpp" \) -exec sed -i 's/#include <stdio\.h>/#include <cstdio>/g' '{}' \;
find src -not \( -path src/crypto/ctaes -prune \) -not \( -path src/leveldb -prune \) -not \( -path src/secp256k1 -prune \) -not \( -path src/univalue -prune \) \( -name "*.h" -o -name "*.cpp" \) -exec sed -i 's/#include <stdlib\.h>/#include <cstdlib>/g' '{}' \;
find src -not \( -path src/crypto/ctaes -prune \) -not \( -path src/leveldb -prune \) -not \( -path src/secp256k1 -prune \) -not \( -path src/univalue -prune \) \( -name "*.h" -o -name "*.cpp" \) -exec sed -i 's/#include <string\.h>/#include <cstring>/g' '{}' \;
git diff -U0 | ./contrib/devtools/clang-format-diff.py -p1 -i -v
-END VERIFY SCRIPT-
  • Loading branch information
hebasto committed Dec 10, 2018
1 parent 0eb65aa commit 03b645b
Show file tree
Hide file tree
Showing 129 changed files with 218 additions and 218 deletions.
2 changes: 1 addition & 1 deletion src/addrman.h
Expand Up @@ -13,9 +13,9 @@
#include <timedata.h>
#include <util/system.h>

#include <cstdint>
#include <map>
#include <set>
#include <stdint.h>
#include <vector>

/**
Expand Down
2 changes: 1 addition & 1 deletion src/amount.h
Expand Up @@ -6,7 +6,7 @@
#ifndef BITCOIN_AMOUNT_H
#define BITCOIN_AMOUNT_H

#include <stdint.h>
#include <cstdint>

/** Amount in satoshis (Can be negative) */
typedef int64_t CAmount;
Expand Down
4 changes: 2 additions & 2 deletions src/arith_uint256.cpp
Expand Up @@ -9,8 +9,8 @@
#include <util/strencodings.h>
#include <crypto/common.h>

#include <stdio.h>
#include <string.h>
#include <cstdio>
#include <cstring>

template <unsigned int BITS>
base_uint<BITS>::base_uint(const std::string& str)
Expand Down
4 changes: 2 additions & 2 deletions src/arith_uint256.h
Expand Up @@ -6,11 +6,11 @@
#ifndef BITCOIN_ARITH_UINT256_H
#define BITCOIN_ARITH_UINT256_H

#include <assert.h>
#include <cassert>
#include <cstdint>
#include <cstring>
#include <limits>
#include <stdexcept>
#include <stdint.h>
#include <string>
#include <vector>

Expand Down
4 changes: 2 additions & 2 deletions src/base58.cpp
Expand Up @@ -8,8 +8,8 @@
#include <uint256.h>
#include <util/strencodings.h>

#include <assert.h>
#include <string.h>
#include <cassert>
#include <cstring>

/** All alphanumeric characters except for "0", "I", "O", and "l" */
static const char* pszBase58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
Expand Down
2 changes: 1 addition & 1 deletion src/bech32.h
Expand Up @@ -12,7 +12,7 @@
#ifndef BITCOIN_BECH32_H
#define BITCOIN_BECH32_H

#include <stdint.h>
#include <cstdint>
#include <string>
#include <vector>

Expand Down
8 changes: 4 additions & 4 deletions src/bench/bench.cpp
Expand Up @@ -4,12 +4,12 @@

#include <bench/bench.h>

#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <regex>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <regex>

void benchmark::ConsolePrinter::header()
{
Expand Down
2 changes: 1 addition & 1 deletion src/bench/examples.cpp
Expand Up @@ -18,7 +18,7 @@ static void Sleep100ms(benchmark::State& state)
BENCHMARK(Sleep100ms, 10);

// Extremely fast-running benchmark:
#include <math.h>
#include <cmath>

volatile double sum = 0.0; // volatile, global so not optimized away

Expand Down
2 changes: 1 addition & 1 deletion src/bitcoin-cli.cpp
Expand Up @@ -15,8 +15,8 @@
#include <util/system.h>
#include <util/strencodings.h>

#include <cstdio>
#include <memory>
#include <stdio.h>
#include <tuple>

#include <event2/buffer.h>
Expand Down
2 changes: 1 addition & 1 deletion src/bitcoin-tx.cpp
Expand Up @@ -22,8 +22,8 @@
#include <util/moneystr.h>
#include <util/strencodings.h>

#include <cstdio>
#include <memory>
#include <stdio.h>

#include <boost/algorithm/string.hpp>

Expand Down
2 changes: 1 addition & 1 deletion src/bitcoind.cpp
Expand Up @@ -22,7 +22,7 @@
#include <util/strencodings.h>
#include <walletinitinterface.h>

#include <stdio.h>
#include <cstdio>

const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;

Expand Down
2 changes: 1 addition & 1 deletion src/blockfilter.h
Expand Up @@ -5,7 +5,7 @@
#ifndef BITCOIN_BLOCKFILTER_H
#define BITCOIN_BLOCKFILTER_H

#include <stdint.h>
#include <cstdint>
#include <unordered_set>
#include <vector>

Expand Down
4 changes: 2 additions & 2 deletions src/bloom.cpp
Expand Up @@ -11,8 +11,8 @@
#include <random.h>
#include <streams.h>

#include <math.h>
#include <stdlib.h>
#include <cmath>
#include <cstdlib>


#define LN2SQUARED 0.4804530139182014246671025263266649717305529515945455
Expand Down
2 changes: 1 addition & 1 deletion src/chainparams.cpp
Expand Up @@ -12,7 +12,7 @@
#include <util/strencodings.h>
#include <versionbitsinfo.h>

#include <assert.h>
#include <cassert>

#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
Expand Down
2 changes: 1 addition & 1 deletion src/chainparamsbase.cpp
Expand Up @@ -9,7 +9,7 @@
#include <util/system.h>
#include <util/memory.h>

#include <assert.h>
#include <cassert>

const std::string CBaseChainParams::MAIN = "main";
const std::string CBaseChainParams::TESTNET = "test";
Expand Down
2 changes: 1 addition & 1 deletion src/checkpoints.cpp
Expand Up @@ -9,7 +9,7 @@
#include <reverse_iterator.h>
#include <validation.h>

#include <stdint.h>
#include <cstdint>


namespace Checkpoints {
Expand Down
4 changes: 2 additions & 2 deletions src/coins.h
Expand Up @@ -14,8 +14,8 @@
#include <serialize.h>
#include <uint256.h>

#include <assert.h>
#include <stdint.h>
#include <cassert>
#include <cstdint>

#include <unordered_map>

Expand Down
18 changes: 9 additions & 9 deletions src/compat.h
Expand Up @@ -28,29 +28,29 @@

#include <winsock2.h> // Must be included before mswsock.h and windows.h

#include <cstdint>
#include <mswsock.h>
#include <windows.h>
#include <ws2tcpip.h>
#include <stdint.h>
#else
#include <arpa/inet.h>
#include <climits>
#include <fcntl.h>
#include <ifaddrs.h>
#include <net/if.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <sys/mman.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <net/if.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <ifaddrs.h>
#include <limits.h>
#include <netdb.h>
#include <unistd.h>
#endif

#ifndef WIN32
typedef unsigned int SOCKET;
#include <errno.h>
#include <cerrno>
#define WSAGetLastError() errno
#define WSAEINVAL EINVAL
#define WSAEALREADY EALREADY
Expand Down
2 changes: 1 addition & 1 deletion src/compat/byteswap.h
Expand Up @@ -9,7 +9,7 @@
#include <config/bitcoin-config.h>
#endif

#include <stdint.h>
#include <cstdint>

#if defined(HAVE_BYTESWAP_H)
#include <byteswap.h>
Expand Down
2 changes: 1 addition & 1 deletion src/compat/endian.h
Expand Up @@ -11,7 +11,7 @@

#include <compat/byteswap.h>

#include <stdint.h>
#include <cstdint>

#if defined(HAVE_ENDIAN_H)
#include <endian.h>
Expand Down
4 changes: 2 additions & 2 deletions src/consensus/consensus.h
Expand Up @@ -6,8 +6,8 @@
#ifndef BITCOIN_CONSENSUS_CONSENSUS_H
#define BITCOIN_CONSENSUS_CONSENSUS_H

#include <stdlib.h>
#include <stdint.h>
#include <cstdint>
#include <cstdlib>

/** The maximum allowed size for a serialized block, in bytes (only for buffer size limits) */
static const unsigned int MAX_BLOCK_SERIALIZED_SIZE = 4000000;
Expand Down
2 changes: 1 addition & 1 deletion src/consensus/merkle.h
Expand Up @@ -5,7 +5,7 @@
#ifndef BITCOIN_CONSENSUS_MERKLE_H
#define BITCOIN_CONSENSUS_MERKLE_H

#include <stdint.h>
#include <cstdint>
#include <vector>

#include <primitives/transaction.h>
Expand Down
2 changes: 1 addition & 1 deletion src/consensus/tx_verify.h
Expand Up @@ -7,7 +7,7 @@

#include <amount.h>

#include <stdint.h>
#include <cstdint>
#include <vector>

class CBlockIndex;
Expand Down
4 changes: 2 additions & 2 deletions src/crypto/aes.cpp
Expand Up @@ -5,8 +5,8 @@
#include <crypto/aes.h>
#include <crypto/common.h>

#include <assert.h>
#include <string.h>
#include <cassert>
#include <cstring>

extern "C" {
#include <crypto/ctaes/ctaes.c>
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/chacha20.cpp
Expand Up @@ -8,7 +8,7 @@
#include <crypto/common.h>
#include <crypto/chacha20.h>

#include <string.h>
#include <cstring>

constexpr static inline uint32_t rotl32(uint32_t v, int c) { return (v << c) | (v >> (32 - c)); }

Expand Down
4 changes: 2 additions & 2 deletions src/crypto/chacha20.h
Expand Up @@ -5,8 +5,8 @@
#ifndef BITCOIN_CRYPTO_CHACHA20_H
#define BITCOIN_CRYPTO_CHACHA20_H

#include <stdint.h>
#include <stdlib.h>
#include <cstdint>
#include <cstdlib>

/** A PRNG class for ChaCha20. */
class ChaCha20
Expand Down
4 changes: 2 additions & 2 deletions src/crypto/common.h
Expand Up @@ -9,8 +9,8 @@
#include <config/bitcoin-config.h>
#endif

#include <stdint.h>
#include <string.h>
#include <cstdint>
#include <cstring>

#include <compat/endian.h>

Expand Down
2 changes: 1 addition & 1 deletion src/crypto/hmac_sha256.cpp
Expand Up @@ -4,7 +4,7 @@

#include <crypto/hmac_sha256.h>

#include <string.h>
#include <cstring>

CHMAC_SHA256::CHMAC_SHA256(const unsigned char* key, size_t keylen)
{
Expand Down
4 changes: 2 additions & 2 deletions src/crypto/hmac_sha256.h
Expand Up @@ -7,8 +7,8 @@

#include <crypto/sha256.h>

#include <stdint.h>
#include <stdlib.h>
#include <cstdint>
#include <cstdlib>

/** A hasher class for HMAC-SHA-256. */
class CHMAC_SHA256
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/hmac_sha512.cpp
Expand Up @@ -4,7 +4,7 @@

#include <crypto/hmac_sha512.h>

#include <string.h>
#include <cstring>

CHMAC_SHA512::CHMAC_SHA512(const unsigned char* key, size_t keylen)
{
Expand Down
4 changes: 2 additions & 2 deletions src/crypto/hmac_sha512.h
Expand Up @@ -7,8 +7,8 @@

#include <crypto/sha512.h>

#include <stdint.h>
#include <stdlib.h>
#include <cstdint>
#include <cstdlib>

/** A hasher class for HMAC-SHA-512. */
class CHMAC_SHA512
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/ripemd160.cpp
Expand Up @@ -6,7 +6,7 @@

#include <crypto/common.h>

#include <string.h>
#include <cstring>

// Internal implementation code.
namespace
Expand Down
4 changes: 2 additions & 2 deletions src/crypto/ripemd160.h
Expand Up @@ -5,8 +5,8 @@
#ifndef BITCOIN_CRYPTO_RIPEMD160_H
#define BITCOIN_CRYPTO_RIPEMD160_H

#include <stdint.h>
#include <stdlib.h>
#include <cstdint>
#include <cstdlib>

/** A hasher class for RIPEMD-160. */
class CRIPEMD160
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/sha1.cpp
Expand Up @@ -6,7 +6,7 @@

#include <crypto/common.h>

#include <string.h>
#include <cstring>

// Internal implementation code.
namespace
Expand Down
4 changes: 2 additions & 2 deletions src/crypto/sha1.h
Expand Up @@ -5,8 +5,8 @@
#ifndef BITCOIN_CRYPTO_SHA1_H
#define BITCOIN_CRYPTO_SHA1_H

#include <stdint.h>
#include <stdlib.h>
#include <cstdint>
#include <cstdlib>

/** A hasher class for SHA1. */
class CSHA1
Expand Down
4 changes: 2 additions & 2 deletions src/crypto/sha256.cpp
Expand Up @@ -5,9 +5,9 @@
#include <crypto/sha256.h>
#include <crypto/common.h>

#include <assert.h>
#include <string.h>
#include <atomic>
#include <cassert>
#include <cstring>

#if defined(__x86_64__) || defined(__amd64__) || defined(__i386__)
#if defined(USE_ASM)
Expand Down

0 comments on commit 03b645b

Please sign in to comment.