aboutsummaryrefslogtreecommitdiff
path: root/util.h
diff options
context:
space:
mode:
authors_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2010-02-12 20:38:44 +0000
committers_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2010-02-12 20:38:44 +0000
commit98500d70a8cf25af4bab80526fd128ccdc36ceeb (patch)
tree61624e0903150505dc09977ae9ff1bc9ab40ee2b /util.h
parentfa9dbd6b62ab161c29c9b8cf97b9c8da8ef4346e (diff)
downloadbitcoin-98500d70a8cf25af4bab80526fd128ccdc36ceeb.tar.xz
command line and JSON-RPC first draft, requires Boost 1.35 or higher for boost::asio,
added SetBitcoinAddress and GetBitcoinAddress methods on CScript, critsect interlocks around mapAddressBook, added some random delays in tx broadcast to improve privacy, now compiles with MSVC 8.0 git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@60 1a98c847-1fd6-4fd8-948a-caf3550aa51b
Diffstat (limited to 'util.h')
-rw-r--r--util.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/util.h b/util.h
index d20648bcd3..6a7fabc5e9 100644
--- a/util.h
+++ b/util.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 Satoshi Nakamoto
+// 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.
@@ -55,6 +55,7 @@ inline T& REF(const T& val)
}
#ifdef __WXMSW__
+static const bool fWindows = true;
#define MSG_NOSIGNAL 0
#define MSG_DONTWAIT 0
#ifndef UINT64_MAX
@@ -66,7 +67,9 @@ inline T& REF(const T& val)
#define S_IRUSR 0400
#define S_IWUSR 0200
#endif
+#define unlink _unlink
#else
+static const bool fWindows = false;
#define WSAGetLastError() errno
#define WSAEWOULDBLOCK EWOULDBLOCK
#define WSAEMSGSIZE EMSGSIZE
@@ -116,6 +119,7 @@ extern bool fPrintToConsole;
extern bool fPrintToDebugger;
extern char pszSetDataDir[MAX_PATH];
extern bool fShutdown;
+extern bool fDaemon;
void RandAddSeed();
void RandAddSeedPerfmon();
@@ -258,6 +262,11 @@ inline int roundint(double d)
return (int)(d > 0 ? d + 0.5 : d - 0.5);
}
+inline int64 roundint64(double d)
+{
+ return (int64)(d > 0 ? d + 0.5 : d - 0.5);
+}
+
template<typename T>
string HexStr(const T itbegin, const T itend, bool fSpaces=true)
{
@@ -323,7 +332,12 @@ inline string DateTimeStrFormat(const char* pszFormat, int64 nTime)
return pszTime;
}
-
+template<typename T>
+void skipspaces(T& it)
+{
+ while (isspace(*it))
+ ++it;
+}