Linux alternatives for the Windows headers and PerformanceCounter. Some typedefs and #defines for the Linux build. Fixed GetDataDir.
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@23 1a98c847-1fd6-4fd8-948a-caf3550aa51b
This commit is contained in:
parent
32d490313b
commit
fe9f3d626d
23
headers.h
23
headers.h
@ -26,19 +26,12 @@
|
|||||||
#include <openssl/rand.h>
|
#include <openssl/rand.h>
|
||||||
#include <openssl/sha.h>
|
#include <openssl/sha.h>
|
||||||
#include <openssl/ripemd.h>
|
#include <openssl/ripemd.h>
|
||||||
#include <windows.h>
|
|
||||||
#include <winsock2.h>
|
|
||||||
#include <mswsock.h>
|
|
||||||
#include <shlobj.h>
|
|
||||||
#include <shlwapi.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <io.h>
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <process.h>
|
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#define BOUNDSCHECK 1
|
#define BOUNDSCHECK 1
|
||||||
@ -57,6 +50,22 @@
|
|||||||
#include <boost/tuple/tuple_comparison.hpp>
|
#include <boost/tuple/tuple_comparison.hpp>
|
||||||
#include <boost/tuple/tuple_io.hpp>
|
#include <boost/tuple/tuple_io.hpp>
|
||||||
#include <boost/array.hpp>
|
#include <boost/array.hpp>
|
||||||
|
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
#include <windows.h>
|
||||||
|
#include <winsock2.h>
|
||||||
|
#include <mswsock.h>
|
||||||
|
#include <shlobj.h>
|
||||||
|
#include <shlwapi.h>
|
||||||
|
#include <io.h>
|
||||||
|
#include <process.h>
|
||||||
|
#else
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace boost;
|
using namespace boost;
|
||||||
|
5
irc.h
5
irc.h
@ -2,6 +2,11 @@
|
|||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
#ifndef __WXMSW__
|
||||||
|
#define closesocket(s) close(s)
|
||||||
|
typedef u_int SOCKET;
|
||||||
|
#endif
|
||||||
|
|
||||||
extern bool RecvLine(SOCKET hSocket, string& strLine);
|
extern bool RecvLine(SOCKET hSocket, string& strLine);
|
||||||
extern void ThreadIRCSeed(void* parg);
|
extern void ThreadIRCSeed(void* parg);
|
||||||
extern bool fRestartIRCSeed;
|
extern bool fRestartIRCSeed;
|
||||||
|
2
main.cpp
2
main.cpp
@ -1399,7 +1399,7 @@ string GetAppDir()
|
|||||||
bool CheckDiskSpace(int64 nAdditionalBytes)
|
bool CheckDiskSpace(int64 nAdditionalBytes)
|
||||||
{
|
{
|
||||||
wxLongLong nFreeBytesAvailable = 0;
|
wxLongLong nFreeBytesAvailable = 0;
|
||||||
if (!wxGetDiskSpace(GetDataDir(), NULL, &nFreeBytesAvailable))
|
if (!wxGetDiskSpace(wxStandardPaths::Get().GetDataDir(), NULL, &nFreeBytesAvailable))
|
||||||
{
|
{
|
||||||
printf("ERROR: wxGetDiskSpace() failed\n");
|
printf("ERROR: wxGetDiskSpace() failed\n");
|
||||||
return true;
|
return true;
|
||||||
|
6
net.h
6
net.h
@ -2,6 +2,12 @@
|
|||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
#ifndef __WXMSW__
|
||||||
|
#define closesocket(s) close(s)
|
||||||
|
#define INVALID_SOCKET (SOCKET)(~0)
|
||||||
|
typedef u_int SOCKET;
|
||||||
|
#endif
|
||||||
|
|
||||||
class CMessageHeader;
|
class CMessageHeader;
|
||||||
class CAddress;
|
class CAddress;
|
||||||
class CInv;
|
class CInv;
|
||||||
|
8
util.h
8
util.h
@ -322,10 +322,18 @@ inline void PrintHex(vector<unsigned char> vch, const char* pszFormat="%s", bool
|
|||||||
printf(pszFormat, HexStr(vch, fSpaces).c_str());
|
printf(pszFormat, HexStr(vch, fSpaces).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline int64 PerformanceCounter()
|
inline int64 PerformanceCounter()
|
||||||
{
|
{
|
||||||
int64 nCounter = 0;
|
int64 nCounter = 0;
|
||||||
|
#ifdef __WXMSW__
|
||||||
QueryPerformanceCounter((LARGE_INTEGER*)&nCounter);
|
QueryPerformanceCounter((LARGE_INTEGER*)&nCounter);
|
||||||
|
#else
|
||||||
|
// this could be changed to reading /dev/urandom
|
||||||
|
timeval t;
|
||||||
|
gettimeofday(&t, NULL);
|
||||||
|
nCounter += t.tv_sec * 1000000 + t.tv_usec;
|
||||||
|
#endif
|
||||||
return nCounter;
|
return nCounter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user