From: CryptoManiac Date: Sat, 18 Apr 2015 21:46:00 +0000 (-0700) Subject: Merge pull request #212 from svost/bitcoin-net X-Git-Tag: nvc-v0.5.3~30 X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=commitdiff_plain;h=4ed847cc0760affee25f8b13c4d7d429d0de0739;hp=17a6c72f2ee4421c07d002983a1f11645b008934 Merge pull request #212 from svost/bitcoin-net Bitcoin net --- diff --git a/src/main.cpp b/src/main.cpp index 83afc78..2f16f57 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2387,7 +2387,7 @@ bool CBlock::AcceptBlock() // Write block to history file if (!CheckDiskSpace(::GetSerializeSize(*this, SER_DISK, CLIENT_VERSION))) return error("AcceptBlock() : out of disk space"); - unsigned int nFile = UINT_MAX; + unsigned int nFile = std::numeric_limits::max(); unsigned int nBlockPos = 0; if (!WriteToDisk(nFile, nBlockPos)) return error("AcceptBlock() : WriteToDisk failed"); diff --git a/src/makefile.linux-mingw b/src/makefile.linux-mingw index e11c66d..594cc99 100644 --- a/src/makefile.linux-mingw +++ b/src/makefile.linux-mingw @@ -127,16 +127,16 @@ ifeq (${USE_ASM}, 1) OBJS += scrypt-asm/obj/scrypt-arm.o scrypt-asm/obj/scrypt-x86.o scrypt-asm/obj/scrypt-x86_64.o scrypt-asm/obj/asm-wrapper.o scrypt-asm/obj/scrypt-x86.o: scrypt-asm/scrypt-x86.S - $(CXX) -c $(xCXXFLAGS) -MMD -o $@ $< + $(CXX) -c $(CFLAGS) -MMD -o $@ $< scrypt-asm/obj/scrypt-x86_64.o: scrypt-asm/scrypt-x86_64.S - $(CXX) -c $(xCXXFLAGS) -MMD -o $@ $< + $(CXX) -c $(CFLAGS) -MMD -o $@ $< scrypt-asm/obj/scrypt-arm.o: scrypt-asm/scrypt-arm.S - $(CXX) -c $(xCXXFLAGS) -MMD -o $@ $< + $(CXX) -c $(CFLAGS) -MMD -o $@ $< scrypt-asm/obj/asm-wrapper.o: scrypt-asm/asm-wrapper.cpp - $(CXX) -c $(xCXXFLAGS) -MMD -o $@ $< + $(CXX) -c $(CFLAGS) -MMD -o $@ $< else ifeq (${USE_SSE2}, 1) # Intrinsic implementation @@ -144,14 +144,14 @@ DEFS += -DUSE_SSE2 OBJS += scrypt-intrin/obj/scrypt-sse2.o scrypt-intrin/obj/scrypt-sse2.o: scrypt-intrin/scrypt-sse2.cpp $(HEADERS) - $(CXX) -c $(xCXXFLAGS) -MMD -o $@ $< + $(CXX) -c $(CFLAGS) -MMD -o $@ $< else ifneq (${USE_ASM}, 1) # Generic implementation OBJS += obj/scrypt-generic.o obj/scrypt-generic.o: scrypt-generic.cpp - $(CXX) -c $(xCXXFLAGS) -MMD -o $@ $< + $(CXX) -c $(CFLAGS) -MMD -o $@ $< endif endif endif diff --git a/src/makefile.mingw b/src/makefile.mingw index 71b7cdf..e6f1ff2 100644 --- a/src/makefile.mingw +++ b/src/makefile.mingw @@ -116,16 +116,16 @@ ifdef USE_ASM OBJS += scrypt-asm/obj/scrypt-arm.o scrypt-asm/obj/scrypt-x86.o scrypt-asm/obj/scrypt-x86_64.o scrypt-asm/obj/asm-wrapper.o scrypt-asm/obj/scrypt-x86.o: scrypt-asm/scrypt-x86.S - $(CXX) -c $(xCXXFLAGS) -MMD -o $@ $< + $(CXX) -c $(CFLAGS) -MMD -o $@ $< scrypt-asm/obj/scrypt-x86_64.o: scrypt-asm/scrypt-x86_64.S - $(CXX) -c $(xCXXFLAGS) -MMD -o $@ $< + $(CXX) -c $(CFLAGS) -MMD -o $@ $< scrypt-asm/obj/scrypt-arm.o: scrypt-asm/scrypt-arm.S - $(CXX) -c $(xCXXFLAGS) -MMD -o $@ $< + $(CXX) -c $(CFLAGS) -MMD -o $@ $< scrypt-asm/obj/asm-wrapper.o: scrypt-asm/asm-wrapper.cpp - $(CXX) -c $(xCXXFLAGS) -MMD -o $@ $< + $(CXX) -c $(CFLAGS) -MMD -o $@ $< else ifdef USE_SSE2 # Intrinsic implementation @@ -133,13 +133,13 @@ DEFS += -DUSE_SSE2 OBJS += scrypt-intrin/obj/scrypt-sse2.o scrypt-intrin/obj/scrypt-sse2.o: scrypt-intrin/scrypt-sse2.cpp - $(CXX) -c $(xCXXFLAGS) -MMD -o $@ $< + $(CXX) -c $(CFLAGS) -MMD -o $@ $< else # Generic implementation OBJS += obj/scrypt-generic.o obj/scrypt-generic.o: scrypt-generic.cpp - $(CXX) -c $(xCXXFLAGS) -MMD -o $@ $< + $(CXX) -c $(CFLAGS) -MMD -o $@ $< endif endif diff --git a/src/net.cpp b/src/net.cpp index 0c166eb..4eacd53 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -307,7 +307,7 @@ extern int GetExternalIPbySTUN(uint64_t rnd, struct sockaddr_in *mapped, const c bool GetMyExternalIP(CNetAddr& ipRet) { struct sockaddr_in mapped; - uint64_t rnd = UINT64_MAX; + uint64_t rnd = std::numeric_limits::max(); const char *srv; int rc = GetExternalIPbySTUN(rnd, &mapped, &srv); if(rc >= 0) { diff --git a/src/net.h b/src/net.h index 7306d13..d1696fc 100644 --- a/src/net.h +++ b/src/net.h @@ -5,6 +5,7 @@ #ifndef BITCOIN_NET_H #define BITCOIN_NET_H +#include #include #ifndef Q_MOC_RUN #include @@ -233,7 +234,7 @@ public: nLastSendEmpty = GetTime(); nTimeConnected = GetTime(); nHeaderStart = -1; - nMessageStart = UINT_MAX; + nMessageStart = std::numeric_limits::max(); addr = addrIn; addrName = addrNameIn == "" ? addr.ToStringIPPort() : addrNameIn; nVersion = 0; @@ -375,7 +376,7 @@ public: return; vSend.resize(nHeaderStart); nHeaderStart = -1; - nMessageStart = UINT_MAX; + nMessageStart = std::numeric_limits::max(); LEAVE_CRITICAL_SECTION(cs_vSend); if (fDebug) @@ -410,7 +411,7 @@ public: } nHeaderStart = -1; - nMessageStart = UINT_MAX; + nMessageStart = std::numeric_limits::max(); LEAVE_CRITICAL_SECTION(cs_vSend); } diff --git a/src/protocol.cpp b/src/protocol.cpp index fc112a5..5a7dd4a 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -23,7 +23,7 @@ CMessageHeader::CMessageHeader() memcpy(pchMessageStart, ::pchMessageStart, sizeof(pchMessageStart)); memset(pchCommand, 0, sizeof(pchCommand)); pchCommand[1] = 1; - nMessageSize = UINT_MAX; + nMessageSize = std::numeric_limits::max(); nChecksum = 0; } diff --git a/src/protocol.h b/src/protocol.h index ed8beab..75c24d8 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -13,6 +13,7 @@ #include "serialize.h" #include "netbase.h" #include +#include #include "uint256.h" extern bool fTestNet; diff --git a/src/stun.cpp b/src/stun.cpp index c1c7d6e..1ab410e 100644 --- a/src/stun.cpp +++ b/src/stun.cpp @@ -28,10 +28,9 @@ * Of course all fields are in network format. */ -#define __STDC_LIMIT_MACROS - #include -#include +#include +#include #include #include #include @@ -339,14 +338,14 @@ static int stun_send(int s, struct sockaddr_in *dst, struct stun_header *resp) } /* helper function to generate a random request id */ -static uint64_t randfiller = GetRand(UINT64_MAX); +static uint64_t randfiller = GetRand(std::numeric_limits::max()); static void stun_req_id(struct stun_header *req) { const uint64_t *S_block = (const uint64_t *)StunSrvList; - req->id.id[0] = GetRandInt(INT32_MAX); - req->id.id[1] = GetRandInt(INT32_MAX); - req->id.id[2] = GetRandInt(INT32_MAX); - req->id.id[3] = GetRandInt(INT32_MAX); + req->id.id[0] = GetRandInt(std::numeric_limits::max()); + req->id.id[1] = GetRandInt(std::numeric_limits::max()); + req->id.id[2] = GetRandInt(std::numeric_limits::max()); + req->id.id[3] = GetRandInt(std::numeric_limits::max()); req->id.id[0] |= 0x55555555; req->id.id[1] &= 0x55555555; diff --git a/src/util.cpp b/src/util.cpp index 03f86e7..8cc62eb 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1271,7 +1271,7 @@ void ShrinkDebugFile() { // Restart the file with some of the end char pch[200000]; - fseek(file, -sizeof(pch), SEEK_END); + fseek(file, (long long)-sizeof(pch), SEEK_END); int nBytes = fread(pch, 1, sizeof(pch), file); fclose(file);