--- a/trb f509ae7a8cc87a239b5640d1da96bb6c93e19da35d78bf8ec82ada89e5cb8663faddb3576faa86ddc32a4bab0dd0f9f70ba280f349bfddc9bbf2992800882768 +++ b/trb 0f001f3d19c9dcbaaf30450d656a95af86bfa1926a9efc217a7662bff29e77e7b56ac812d02a1cc6abecc35d33c2cbf7669e2d9ec1fb9a5b7022657970b67d94 @@ -3384,106 +3384,7 @@ BOOST_AUTO_TEST_SUITE_END() ############################################################################## -2201 @ ./bitcoin/src/makefile.linux-mingw -############################################################################## -# Copyright (c) 2009-2010 Satoshi Nakamoto -# Distributed under the MIT/X11 software license, see the accompanying -# file license.txt or http://www.opensource.org/licenses/mit-license.php. - -DEPSDIR:=/usr/i586-mingw32msvc - -INCLUDEPATHS= \ - -I"$(DEPSDIR)/boost_1_47_0" \ - -I"$(DEPSDIR)/db-4.8.30.NC/build_unix" \ - -I"$(DEPSDIR)/openssl-1.0.0e/include" \ - -I"$(DEPSDIR)" - -LIBPATHS= \ - -L"$(DEPSDIR)/boost_1_47_0/stage/lib" \ - -L"$(DEPSDIR)/db-4.8.30.NC/build_unix" \ - -L"$(DEPSDIR)/openssl-1.0.0e" - -LIBS= \ - -l boost_system-mt-s \ - -l boost_filesystem-mt-s \ - -l boost_program_options-mt-s \ - -l boost_thread_win32-mt-s \ - -l db_cxx \ - -l ssl \ - -l crypto - -DEFS=-D_MT -DWIN32 -D_WINDOWS -DNOPCH -DBOOST_THREAD_USE_LIB -DEBUGFLAGS=-g -CFLAGS=-O2 -w -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS) -HEADERS = \ - base58.h \ - bignum.h \ - checkpoints.h \ - crypter.h \ - db.h \ - headers.h \ - init.h \ - irc.h \ - key.h \ - keystore.h \ - main.h \ - net.h \ - noui.h \ - protocol.h \ - bitcoinrpc.h \ - script.h \ - serialize.h \ - strlcpy.h \ - uint256.h \ - util.h \ - wallet.h - - - -LIBS += -l mingwthrd -l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell32 -l comctl32 -l ole32 -l oleaut32 -l uuid -l rpcrt4 -l advapi32 -l ws2_32 -l shlwapi - -OBJS= \ - obj/checkpoints.o \ - obj/crypter.o \ - obj/db.o \ - obj/init.o \ - obj/irc.o \ - obj/keystore.o \ - obj/main.o \ - obj/net.o \ - obj/protocol.o \ - obj/bitcoinrpc.o \ - obj/script.o \ - obj/util.o \ - obj/wallet.o - -all: bitcoind.exe - -obj/nogui/%.o: %.cpp $(HEADERS) - i586-mingw32msvc-g++ -c $(CFLAGS) -o $@ $< - -bitcoind.exe: $(OBJS:obj/%=obj/nogui/%) - i586-mingw32msvc-g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS) - - -obj/test/%.o: obj/test/%.cpp $(HEADERS) - i586-mingw32msvc-g++ -c $(CFLAGS) -o $@ $< - -test_bitcoin.exe: obj/test/test_bitcoin.o $(filter-out obj/nogui/init.o,$(OBJS:obj/%=obj/nogui/%)) - i586-mingw32msvc-g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS) -lboost_unit_test_framework-mt-s - - -clean: - -rm -f obj/*.o - -rm -f obj/nogui/*.o - -rm -f obj/test/*.o - -rm -f test/*.o - -rm -f headers.h.gch - -rm -f bitcoind.exe - -rm -f test_bitcoin.exe - -############################################################################## -24641 @ ./bitcoin/src/uint256.h +24439 @ ./bitcoin/src/uint256.h ############################################################################## // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2011 The Bitcoin developers @@ -3498,17 +3399,8 @@ #include #include -#if defined(_MSC_VER) || defined(__BORLANDC__) -typedef __int64 int64; -typedef unsigned __int64 uint64; -#else typedef long long int64; typedef unsigned long long uint64; -#endif -#if defined(_MSC_VER) && _MSC_VER < 1300 -#define for if (false) ; else for -#endif - inline int Testuint256AdHoc(std::vector vArg); @@ -4674,7 +4566,7 @@ #endif ############################################################################## -19195 @ ./bitcoin/src/net.h +19150 @ ./bitcoin/src/net.h ############################################################################## // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers @@ -4688,10 +4580,6 @@ #include #include -#ifndef WIN32 -#include -#endif - #include "protocol.h" class CAddrDB; @@ -6886,29 +6774,13 @@ ############################################################################## -1996 @ ./bitcoin/src/headers.h +1494 @ ./bitcoin/src/headers.h ############################################################################## // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file license.txt or http://www.opensource.org/licenses/mit-license.php. -#ifdef _MSC_VER -#pragma warning(disable:4786) -#pragma warning(disable:4804) -#pragma warning(disable:4805) -#pragma warning(disable:4717) -#endif -#ifdef _WIN32_WINNT -#undef _WIN32_WINNT -#endif -#define _WIN32_WINNT 0x0500 -#ifdef _WIN32_IE -#undef _WIN32_IE -#endif -#define _WIN32_IE 0x0400 -#define WIN32_LEAN_AND_MEAN 1 - // Include boost/foreach here as it defines __STDC_LIMIT_MACROS on some systems. #include #ifndef __STDC_LIMIT_MACROS @@ -6945,16 +6817,6 @@ #include #include -#ifdef WIN32 -#include -#include -#include -#include -#include -#include -#include -#include -#else #include #include #include @@ -6967,7 +6829,7 @@ #include #include #include -#endif + #ifdef BSD #include #endif @@ -7136,7 +6998,7 @@ #endif // __INCLUDED_PROTOCOL_H__ ############################################################################## -83028 @ ./bitcoin/src/bitcoinrpc.cpp +82812 @ ./bitcoin/src/bitcoinrpc.cpp ############################################################################## // Copyright (c) 2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers @@ -9562,11 +9424,6 @@ #ifdef TEST int main(int argc, char *argv[]) { -#ifdef _MSC_VER - // Turn off microsoft heap dump noise - _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); - _CrtSetReportFile(_CRT_WARN, CreateFile("NUL", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0)); -#endif setbuf(stdin, NULL); setbuf(stdout, NULL); setbuf(stderr, NULL); @@ -12755,7 +12612,7 @@ int CommandLineRPC(int argc, char *argv[]); ############################################################################## -20115 @ ./bitcoin/src/script.h +20091 @ ./bitcoin/src/script.h ############################################################################## // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2011 The Bitcoin developers @@ -13143,9 +13000,7 @@ CScript() { } CScript(const CScript& b) : std::vector(b.begin(), b.end()) { } CScript(const_iterator pbegin, const_iterator pend) : std::vector(pbegin, pend) { } -#ifndef _MSC_VER CScript(const unsigned char* pbegin, const unsigned char* pend) : std::vector(pbegin, pend) { } -#endif CScript& operator+=(const CScript& b) { @@ -13462,7 +13317,7 @@ #endif ############################################################################## -32913 @ ./bitcoin/src/db.cpp +32892 @ ./bitcoin/src/db.cpp ############################################################################## // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers @@ -14234,11 +14089,9 @@ bool fIsEncrypted = false; // Modify defaults -#ifndef WIN32 // Tray icon sometimes disappears on 9.10 karmic koala 64-bit, leaving no way to access the program fMinimizeToTray = false; fMinimizeOnClose = false; -#endif //// todo: shouldn't we catch exceptions and try to recover and continue? CRITICAL_BLOCK(pwallet->cs_wallet) @@ -15320,7 +15173,7 @@ #endif ############################################################################## -4559 @ ./bitcoin/src/crypter.cpp +4518 @ ./bitcoin/src/crypter.cpp ############################################################################## // Copyright (c) 2011 The Bitcoin Developers // Distributed under the MIT/X11 software license, see the accompanying @@ -15331,9 +15184,6 @@ #include #include #include "headers.h" -#ifdef WIN32 -#include -#endif #include "crypter.h" #include "main.h" @@ -15456,7 +15306,7 @@ } ############################################################################## -59687 @ ./bitcoin/src/net.cpp +57900 @ ./bitcoin/src/net.cpp ############################################################################## // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers @@ -15470,10 +15320,6 @@ #include "init.h" #include "strlcpy.h" -#ifdef WIN32 -#include -#endif - using namespace std; using namespace boost; @@ -15554,13 +15400,9 @@ bool fProxy = (fUseProxy && addrConnect.IsRoutable()); struct sockaddr_in sockaddr = (fProxy ? addrProxy.GetSockAddr() : addrConnect.GetSockAddr()); -#ifdef WIN32 - u_long fNonblock = 1; - if (ioctlsocket(hSocket, FIONBIO, &fNonblock) == SOCKET_ERROR) -#else int fFlags = fcntl(hSocket, F_GETFL, 0); if (fcntl(hSocket, F_SETFL, fFlags | O_NONBLOCK) == -1) -#endif + { closesocket(hSocket); return false; @@ -15593,11 +15435,7 @@ return false; } socklen_t nRetSize = sizeof(nRet); -#ifdef WIN32 - if (getsockopt(hSocket, SOL_SOCKET, SO_ERROR, (char*)(&nRet), &nRetSize) == SOCKET_ERROR) -#else if (getsockopt(hSocket, SOL_SOCKET, SO_ERROR, &nRet, &nRetSize) == SOCKET_ERROR) -#endif { printf("getsockopt() for connection failed: %i\n",WSAGetLastError()); closesocket(hSocket); @@ -15610,11 +15448,7 @@ return false; } } -#ifdef WIN32 - else if (WSAGetLastError() != WSAEISCONN) -#else else -#endif { printf("connect() failed: %i\n",WSAGetLastError()); closesocket(hSocket); @@ -15627,13 +15461,8 @@ CNode::ConnectNode immediately turns the socket back to non-blocking but we'll turn it back to blocking just in case */ -#ifdef WIN32 - fNonblock = 0; - if (ioctlsocket(hSocket, FIONBIO, &fNonblock) == SOCKET_ERROR) -#else fFlags = fcntl(hSocket, F_GETFL, 0); if (fcntl(hSocket, F_SETFL, fFlags & !O_NONBLOCK) == SOCKET_ERROR) -#endif { closesocket(hSocket); return false; @@ -16130,14 +15959,8 @@ printf("connected %s\n", addrConnect.ToString().c_str()); // Set to nonblocking -#ifdef WIN32 - u_long nOne = 1; - if (ioctlsocket(hSocket, FIONBIO, &nOne) == SOCKET_ERROR) - printf("ConnectSocket() : ioctlsocket nonblocking setting failed, error %d\n", WSAGetLastError()); -#else if (fcntl(hSocket, F_SETFL, O_NONBLOCK) == SOCKET_ERROR) printf("ConnectSocket() : fcntl nonblocking setting failed, error %d\n", errno); -#endif // Add node CNode* pnode = new CNode(hSocket, addrConnect, false); @@ -17024,18 +16847,6 @@ int nOne = 1; addrLocalHost.port = htons(GetListenPort()); -#ifdef WIN32 - // Initialize Windows Sockets - WSADATA wsadata; - int ret = WSAStartup(MAKEWORD(2,2), &wsadata); - if (ret != NO_ERROR) - { - strError = strprintf("Error: TCP/IP socket library failed to start (WSAStartup returned error %d)", ret); - printf("%s\n", strError.c_str()); - return false; - } -#endif - // Create socket for listening for incoming connections hListenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (hListenSocket == INVALID_SOCKET) @@ -17050,18 +16861,11 @@ setsockopt(hListenSocket, SOL_SOCKET, SO_NOSIGPIPE, (void*)&nOne, sizeof(int)); #endif -#ifndef WIN32 // Allow binding if the port is still in TIME_WAIT state after // the program was closed and restarted. Not an issue on windows. setsockopt(hListenSocket, SOL_SOCKET, SO_REUSEADDR, (void*)&nOne, sizeof(int)); -#endif -#ifdef WIN32 - // Set to nonblocking, incoming connections will also inherit this - if (ioctlsocket(hListenSocket, FIONBIO, (u_long*)&nOne) == SOCKET_ERROR) -#else if (fcntl(hListenSocket, F_SETFL, O_NONBLOCK) == SOCKET_ERROR) -#endif { strError = strprintf("Error: Couldn't set properties on socket for incoming connections (error %d)", WSAGetLastError()); printf("%s\n", strError.c_str()); @@ -17103,21 +16907,6 @@ if (pnodeLocalHost == NULL) pnodeLocalHost = new CNode(INVALID_SOCKET, CAddress("127.0.0.1", 0, false, nLocalServices)); -#ifdef WIN32 - // Get local host ip - char pszHostName[1000] = ""; - if (gethostname(pszHostName, sizeof(pszHostName)) != SOCKET_ERROR) - { - vector vaddr; - if (Lookup(pszHostName, vaddr, nLocalServices, -1, true)) - BOOST_FOREACH (const CAddress &addr, vaddr) - if (addr.GetByte(3) != 127) - { - addrLocalHost = addr; - break; - } - } -#else // Get local host ip struct ifaddrs* myaddrs; if (getifaddrs(&myaddrs) == 0) @@ -17152,7 +16941,7 @@ } freeifaddrs(myaddrs); } -#endif + printf("addrLocalHost = %s\n", addrLocalHost.ToString().c_str()); if (fUseProxy || mapArgs.count("-connect") || fNoListen) @@ -17238,16 +17027,12 @@ if (closesocket(hListenSocket) == SOCKET_ERROR) printf("closesocket(hListenSocket) failed with error %d\n", WSAGetLastError()); -#ifdef WIN32 - // Shutdown Windows Sockets - WSACleanup(); -#endif } } instance_of_cnetcleanup; ############################################################################## -8063 @ ./bitcoin/src/protocol.cpp +7874 @ ./bitcoin/src/protocol.cpp ############################################################################## // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2011 The Bitcoin developers @@ -17256,10 +17041,8 @@ #include "protocol.h" #include "util.h" +#include -#ifndef WIN32 -# include -#endif // Prototypes from net.h, but that header (currently) stinks, can't #include it without breaking things bool Lookup(const char *pszName, std::vector& vaddr, int nServices, int nMaxSolutions, bool fAllowLookup = false, int portDefault = 0, bool fAllowPort = false); @@ -17416,11 +17199,7 @@ ss.reserve(18); ss << FLATDATA(pchReserved) << ip << port; - #if defined(_MSC_VER) && _MSC_VER < 1300 - return std::vector((unsigned char*)&ss.begin()[0], (unsigned char*)&ss.end()[0]); - #else return std::vector(ss.begin(), ss.end()); - #endif } struct sockaddr_in CAddress::GetSockAddr() const @@ -17581,7 +17360,7 @@ #endif ############################################################################## -34615 @ ./bitcoin/src/main.h +34550 @ ./bitcoin/src/main.h ############################################################################## // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers @@ -18508,11 +18287,7 @@ fflush(fileout); if (!IsInitialBlockDownload() || (nBestHeight+1) % 500 == 0) { -#ifdef WIN32 - _commit(_fileno(fileout)); -#else fsync(fileno(fileout)); -#endif } return true; @@ -20234,7 +20009,7 @@ } ############################################################################## -20598 @ ./bitcoin/src/util.h +17609 @ ./bitcoin/src/util.h ############################################################################## // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers @@ -20245,11 +20020,10 @@ #include "uint256.h" -#ifndef WIN32 + #include #include #include -#endif #include #include #include @@ -20263,19 +20037,10 @@ #include -#if defined(_MSC_VER) || defined(__BORLANDC__) -typedef __int64 int64; -typedef unsigned __int64 uint64; -#else typedef long long int64; typedef unsigned long long uint64; -#endif -#if defined(_MSC_VER) && _MSC_VER < 1300 -#define for if (false) ; else for -#endif -#ifndef _MSC_VER + #define __forceinline inline -#endif #define loop for (;;) #define BEGIN(a) ((char*)&(a)) @@ -20291,16 +20056,10 @@ #define snprintf my_snprintf #ifndef PRI64d -#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__MSVCRT__) -#define PRI64d "I64d" -#define PRI64u "I64u" -#define PRI64x "I64x" -#else #define PRI64d "lld" #define PRI64u "llu" #define PRI64x "llx" #endif -#endif // This is needed because the foreach macro can't get over the comma in pair #define PAIRTYPE(t1, t2) std::pair @@ -20319,21 +20078,6 @@ return u.ptr; } -#ifdef WIN32 -#define MSG_NOSIGNAL 0 -#define MSG_DONTWAIT 0 -#ifndef UINT64_MAX -#define UINT64_MAX _UI64_MAX -#define INT64_MAX _I64_MAX -#define INT64_MIN _I64_MIN -#endif -#ifndef S_IRUSR -#define S_IRUSR 0400 -#define S_IWUSR 0200 -#endif -#define unlink _unlink -typedef int socklen_t; -#else #define WSAGetLastError() errno #define WSAEINVAL EINVAL #define WSAEALREADY EALREADY @@ -20357,17 +20101,13 @@ So we clamp our sleeps here to 10 years and hope that boost is fixed by 2028.*/ boost::thread::sleep(boost::get_system_time() + boost::posix_time::milliseconds(n>315576000000LL?315576000000LL:n)); } -#endif + inline int myclosesocket(SOCKET& hSocket) { if (hSocket == INVALID_SOCKET) return WSAENOTSOCK; -#ifdef WIN32 - int ret = closesocket(hSocket); -#else int ret = close(hSocket); -#endif hSocket = INVALID_SOCKET; return ret; } @@ -20378,14 +20118,6 @@ } - - - - - - - - extern std::map mapArgs; extern std::map > mapMultiArgs; extern bool fDebug; @@ -20431,9 +20163,6 @@ std::string GetPidFile(); void CreatePidFile(std::string pidFile, pid_t pid); void ReadConfigFile(std::map& mapSettingsRet, std::map >& mapMultiSettingsRet); -#ifdef WIN32 -std::string MyGetSpecialFolderPath(int nFolder, bool fCreate); -#endif std::string GetDefaultDataDir(); std::string GetDataDir(); void ShrinkDebugFile(); @@ -20561,20 +20290,12 @@ inline int64 atoi64(const char* psz) { -#ifdef _MSC_VER - return _atoi64(psz); -#else return strtoll(psz, NULL, 10); -#endif } inline int64 atoi64(const std::string& str) { -#ifdef _MSC_VER - return _atoi64(str.c_str()); -#else return strtoll(str.c_str(), NULL, 10); -#endif } inline int atoi(const std::string& str) @@ -20649,13 +20370,9 @@ inline int64 GetPerformanceCounter() { int64 nCounter = 0; -#ifdef WIN32 - QueryPerformanceCounter((LARGE_INTEGER*)&nCounter); -#else timeval t; gettimeofday(&t, NULL); nCounter = t.tv_sec * 1000000 + t.tv_usec; -#endif return nCounter; } @@ -20683,11 +20400,7 @@ inline bool IsSwitchChar(char c) { -#ifdef WIN32 - return c == '-' || c == '/'; -#else return c == '-'; -#endif } inline std::string GetArg(const std::string& strArg, const std::string& strDefault) @@ -20743,11 +20456,6 @@ inline void heapchk() { -#ifdef WIN32 - /// for debugging - //if (_heapchk() != _HEAPOK) - // DebugBreak(); -#endif } // Randomize the stack to help protect against buffer overrun exploits @@ -20902,38 +20610,6 @@ // Note: It turns out we might have been able to use boost::thread // by using TerminateThread(boost::thread.native_handle(), 0); -#ifdef WIN32 -typedef HANDLE pthread_t; - -inline pthread_t CreateThread(void(*pfn)(void*), void* parg, bool fWantHandle=false) -{ - DWORD nUnused = 0; - HANDLE hthread = - CreateThread( - NULL, // default security - 0, // inherit stack size from parent - (LPTHREAD_START_ROUTINE)pfn, // function pointer - parg, // argument - 0, // creation option, start immediately - &nUnused); // thread identifier - if (hthread == NULL) - { - printf("Error: CreateThread() returned %d\n", GetLastError()); - return (pthread_t)0; - } - if (!fWantHandle) - { - CloseHandle(hthread); - return (pthread_t)-1; - } - return hthread; -} - -inline void SetThreadPriority(int nPriority) -{ - SetThreadPriority(GetCurrentThread(), nPriority); -} -#else inline pthread_t CreateThread(void(*pfn)(void*), void* parg, bool fWantHandle=false) { pthread_t hthread = 0; @@ -20976,29 +20652,11 @@ { pthread_exit((void*)nExitCode); } -#endif - - inline bool AffinityBugWorkaround(void(*pfn)(void*)) { -#ifdef WIN32 - // Sometimes after a few hours affinity gets stuck on one processor - DWORD_PTR dwProcessAffinityMask = -1; - DWORD_PTR dwSystemAffinityMask = -1; - GetProcessAffinityMask(GetCurrentProcess(), &dwProcessAffinityMask, &dwSystemAffinityMask); - DWORD dwPrev1 = SetThreadAffinityMask(GetCurrentThread(), dwProcessAffinityMask); - DWORD dwPrev2 = SetThreadAffinityMask(GetCurrentThread(), dwProcessAffinityMask); - if (dwPrev2 != dwProcessAffinityMask) - { - printf("AffinityBugWorkaround() : SetThreadAffinityMask=%d, ProcessAffinityMask=%d, restarting thread\n", dwPrev2, dwProcessAffinityMask); - if (!CreateThread(pfn, NULL)) - printf("Error: CreateThread() failed\n"); - return true; - } -#endif return false; } @@ -21231,7 +20889,7 @@ } ############################################################################## -16463 @ ./bitcoin/src/init.cpp +15775 @ ./bitcoin/src/init.cpp ############################################################################## // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers @@ -21260,10 +20918,6 @@ void ExitTimeout(void* parg) { -#ifdef WIN32 - Sleep(5000); - ExitProcess(0); -#endif } void Shutdown(void* parg) @@ -21348,19 +21002,8 @@ bool AppInit2(int argc, char* argv[]) { -#ifdef _MSC_VER - // Turn off microsoft heap dump noise - _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); - _CrtSetReportFile(_CRT_WARN, CreateFileA("NUL", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0)); -#endif -#if _MSC_VER >= 1400 - // Disable confusing "helpful" text message on abort, ctrl-c - _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT); -#endif -#ifndef WIN32 umask(077); -#endif -#ifndef WIN32 + // Clean shutdown on SIGTERM struct sigaction sa; sa.sa_handler = HandleSIGTERM; @@ -21369,7 +21012,6 @@ sigaction(SIGTERM, &sa, NULL); sigaction(SIGINT, &sa, NULL); sigaction(SIGHUP, &sa, NULL); -#endif // // Parameters @@ -21424,16 +21066,11 @@ " -maxreceivebuffer=\t " + _("Maximum per-connection receive buffer, *1000 bytes (default: 10000)\n") + " -maxsendbuffer=\t " + _("Maximum per-connection send buffer, *1000 bytes (default: 10000)\n") + " -paytxfee= \t " + _("Fee per kB to add to transactions you send\n") + -#if !defined(WIN32) " -daemon \t\t " + _("Run in the background as a daemon and accept commands\n") + -#endif " -testnet \t\t " + _("Use the test network\n") + " -debug \t\t " + _("Output extra debugging information\n") + " -logtimestamps \t " + _("Prepend debug output with timestamp\n") + " -printtoconsole \t " + _("Send trace/debug info to console instead of debug.log file\n") + -#ifdef WIN32 - " -printtodebugger \t " + _("Send trace/debug info to debugger\n") + -#endif " -rpcuser= \t " + _("Username for JSON-RPC connections\n") + " -rpcpassword=\t " + _("Password for JSON-RPC connections\n") + " -rpcport= \t\t " + _("Listen for JSON-RPC connections on (default: 8332)\n") + @@ -21453,12 +21090,7 @@ fTestNet = GetBoolArg("-testnet"); fDebug = GetBoolArg("-debug"); - -#if !defined(WIN32) fDaemon = GetBoolArg("-daemon"); -#else - fDaemon = false; -#endif if (fDaemon) fServer = true; @@ -21481,7 +21113,6 @@ exit(ret); } -#if !defined(WIN32) if (fDaemon) { // Daemonize @@ -21501,7 +21132,6 @@ if (sid < 0) fprintf(stderr, "Error: setsid() returned %d errno %d\n", sid, errno); } -#endif if (!fDebug && !pszSetDataDir[0]) ShrinkDebugFile(); @@ -21839,7 +21469,7 @@ #endif ############################################################################## -46725 @ ./bitcoin/src/serialize.h +45968 @ ./bitcoin/src/serialize.h ############################################################################## // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers @@ -21862,27 +21492,9 @@ #include #include -#if defined(_MSC_VER) || defined(__BORLANDC__) -typedef __int64 int64; -typedef unsigned __int64 uint64; -#else typedef long long int64; typedef unsigned long long uint64; -#endif -#if defined(_MSC_VER) && _MSC_VER < 1300 -#define for if (false) ; else for -#endif -#ifdef WIN32 -#include -// This is used to attempt to keep keying material out of swap -// Note that VirtualLock does not provide this as a guarantee on Windows, -// but, in practice, memory that has been VirtualLock'd almost never gets written to -// the pagefile except in rare circumstances where memory is extremely low. -#include -#define mlock(p, n) VirtualLock((p), (n)); -#define munlock(p, n) VirtualUnlock((p), (n)); -#else #include #include /* This comes from limits.h if it's not defined there set a sane default */ @@ -21896,7 +21508,6 @@ #define munlock(a,b) \ munlock(((void *)(((size_t)(a)) & (~((PAGESIZE)-1)))),\ (((((size_t)(a)) + (b) - 1) | ((PAGESIZE) - 1)) + 1) - (((size_t)(a)) & (~((PAGESIZE) - 1)))) -#endif class CScript; class CDataStream; @@ -22745,12 +22356,10 @@ Init(nTypeIn, nVersionIn); } -#if !defined(_MSC_VER) || _MSC_VER >= 1300 CDataStream(const char* pbegin, const char* pend, int nTypeIn=SER_NETWORK, int nVersionIn=VERSION) : vch(pbegin, pend) { Init(nTypeIn, nVersionIn); } -#endif CDataStream(const vector_type& vchIn, int nTypeIn=SER_NETWORK, int nVersionIn=VERSION) : vch(vchIn.begin(), vchIn.end()) { @@ -22836,7 +22445,6 @@ vch.insert(it, first, last); } -#if !defined(_MSC_VER) || _MSC_VER >= 1300 void insert(iterator it, const char* first, const char* last) { if (it == vch.begin() + nReadPos && last - first <= nReadPos) @@ -22848,7 +22456,6 @@ else vch.insert(it, first, last); } -#endif iterator erase(iterator it) { @@ -24723,7 +24330,7 @@ #endif ############################################################################## -31489 @ ./bitcoin/src/util.cpp +27811 @ ./bitcoin/src/util.cpp ############################################################################## // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers @@ -24791,11 +24398,6 @@ ppmutexOpenSSL[i] = new boost::interprocess::interprocess_mutex(); CRYPTO_set_locking_callback(locking_callback); -#ifdef WIN32 - // Seed random number generator with screen scrape and other hardware sources - RAND_screen(); -#endif - // Seed random number generator with performance counter RandAddSeed(); } @@ -24835,21 +24437,6 @@ return; nLastPerfmon = GetTime(); -#ifdef WIN32 - // Don't need this on Linux, OpenSSL automatically uses /dev/urandom - // Seed with the entire set of perfmon data - unsigned char pdata[250000]; - memset(pdata, 0, sizeof(pdata)); - unsigned long nSize = sizeof(pdata); - long ret = RegQueryValueExA(HKEY_PERFORMANCE_DATA, "Global", NULL, NULL, pdata, &nSize); - RegCloseKey(HKEY_PERFORMANCE_DATA); - if (ret == ERROR_SUCCESS) - { - RAND_add(pdata, nSize, nSize/100.0); - memset(pdata, 0, nSize); - printf("%s RandAddSeed() %d bytes\n", DateTimeStrFormat("%x %H:%M", GetTime()).c_str(), nSize); - } -#endif } uint64 GetRand(uint64 nMax) @@ -24925,48 +24512,6 @@ } } -#ifdef WIN32 - if (fPrintToDebugger) - { - static CCriticalSection cs_OutputDebugStringF; - - // accumulate a line at a time - CRITICAL_BLOCK(cs_OutputDebugStringF) - { - static char pszBuffer[50000]; - static char* pend; - if (pend == NULL) - pend = pszBuffer; - va_list arg_ptr; - va_start(arg_ptr, pszFormat); - int limit = END(pszBuffer) - pend - 2; - int ret = _vsnprintf(pend, limit, pszFormat, arg_ptr); - va_end(arg_ptr); - if (ret < 0 || ret >= limit) - { - pend = END(pszBuffer) - 2; - *pend++ = '\n'; - } - else - pend += ret; - *pend = '\0'; - char* p1 = pszBuffer; - char* p2; - while (p2 = strchr(p1, '\n')) - { - p2++; - char c = *p2; - *p2 = '\0'; - OutputDebugStringA(p1); - *p2 = c; - p1 = p2; - } - if (p1 != pszBuffer) - memmove(pszBuffer, p1, pend - p1 + 1); - pend -= (p1 - pszBuffer); - } - } -#endif return ret; } @@ -25184,11 +24729,6 @@ pszValue = strchr(psz, '='); *pszValue++ = '\0'; } - #ifdef WIN32 - _strlwr(psz); - if (psz[0] == '/') - psz[0] = '-'; - #endif if (psz[0] != '-') break; mapArgs[psz] = pszValue; @@ -25392,13 +24932,7 @@ void FormatException(char* pszMessage, std::exception* pex, const char* pszThread) { -#ifdef WIN32 - char pszModule[MAX_PATH]; - pszModule[0] = '\0'; - GetModuleFileNameA(NULL, pszModule, sizeof(pszModule)); -#else const char* pszModule = "bitcoin"; -#endif if (pex) snprintf(pszMessage, 1000, "EXCEPTION: %s \n%s \n%s in %s \n", typeid(*pex).name(), pex->what(), pszModule, pszThread); @@ -25444,67 +24978,10 @@ strMiscWarning = pszMessage; } - - - - - - - -#ifdef WIN32 -typedef WINSHELLAPI BOOL (WINAPI *PSHGETSPECIALFOLDERPATHA)(HWND hwndOwner, LPSTR lpszPath, int nFolder, BOOL fCreate); - -string MyGetSpecialFolderPath(int nFolder, bool fCreate) -{ - char pszPath[MAX_PATH+100] = ""; - - // SHGetSpecialFolderPath isn't always available on old Windows versions - HMODULE hShell32 = LoadLibraryA("shell32.dll"); - if (hShell32) - { - PSHGETSPECIALFOLDERPATHA pSHGetSpecialFolderPath = - (PSHGETSPECIALFOLDERPATHA)GetProcAddress(hShell32, "SHGetSpecialFolderPathA"); - bool fSuccess = false; - if (pSHGetSpecialFolderPath) - fSuccess = - (*pSHGetSpecialFolderPath)(NULL, pszPath, nFolder, fCreate); - FreeModule(hShell32); - if (fSuccess) - return pszPath; - } - - // Backup option - std::string strPath; - { - const char *pszEnv; - if (nFolder == CSIDL_STARTUP) - { - pszEnv = getenv("USERPROFILE"); - if (pszEnv) - strPath = pszEnv; - strPath += "\\Start Menu\\Programs\\Startup"; - } - else if (nFolder == CSIDL_APPDATA) - { - pszEnv = getenv("APPDATA"); - if (pszEnv) - strPath = pszEnv; - } - } - - return strPath; -} -#endif - string GetDefaultDataDir() { - // Windows: C:\Documents and Settings\username\Application Data\Bitcoin // Mac: ~/Library/Application Support/Bitcoin // Unix: ~/.bitcoin -#ifdef WIN32 - // Windows - return MyGetSpecialFolderPath(CSIDL_APPDATA, true) + "\\Bitcoin"; -#else char* pszHome = getenv("HOME"); if (pszHome == NULL || strlen(pszHome) == 0) pszHome = (char*)"/"; @@ -25520,7 +24997,6 @@ // Unix return strHome + ".bitcoin"; #endif -#endif } void GetDataDir(char* pszDir)