strWhatAmI = strprintf(_("To use the %s option"), "\"-server\"");
else if (mapArgs.count("-daemon"))
strWhatAmI = strprintf(_("To use the %s option"), "\"-daemon\"");
- ::error(
- _("%s, you must set a rpcpassword in the configuration file:\n %s\n"
- "It is recommended you use the following random password:\n"
- "rpcuser=bitcoinrpc\n"
- "rpcpassword=%s\n"
- "(you do not need to remember this password)\n"
- "If the file does not exist, create it with owner-readable-only file permissions.\n"),
+ std::string strMessage = _("%s, you must set a rpcpassword in the configuration file:\n %s\n"
+ "It is recommended you use the following random password:\n"
+ "rpcuser=bitcoinrpc\n"
+ "rpcpassword=%s\n"
+ "(you do not need to remember this password)\n"
+ "If the file does not exist, create it with owner-readable-only file permissions.\n");
+ fprintf(stderr, strMessage.c_str(),
strWhatAmI.c_str(),
GetConfigFile().c_str(),
EncodeBase58(&rand_pwd[0],&rand_pwd[0]+32).c_str());
#endif
#define _WIN32_IE 0x0400
#define WIN32_LEAN_AND_MEAN 1
-
+#ifndef NOMINMAX
+#define NOMINMAX
+#endif
// Include boost/foreach here as it defines __STDC_LIMIT_MACROS on some systems.
#include <boost/foreach.hpp>
Q_IMPORT_PLUGIN(qtaccessiblewidgets)
#endif
+#ifdef WIN32
+#define strncasecmp strnicmp
+#endif
+
using namespace std;
using namespace boost;
#include "script.h"
#include "db.h"
+#ifdef WIN32
+#include <io.h> /* for _commit */
+#endif
+
#include <list>
class CBlock;
std::string ToString() const
{
if (IsNull())
- return strprintf("null");
+ return "null";
else
return strprintf("(nFile=%d, nBlockPos=%d, nTxPos=%d)", nFile, nBlockPos, nTxPos);
}
std::string ToString() const
{
std::string str;
- str += strprintf("CTxIn(");
+ str += "CTxIn(";
str += prevout.ToString();
if (prevout.IsNull())
str += strprintf(", coinbase %s", HexStr(scriptSig).c_str());
#ifdef WIN32
#define _WIN32_WINNT 0x0501
+#define WIN32_LEAN_AND_MEAN 1
+#ifndef NOMINMAX
+#define NOMINMAX
+#endif
#include <winsock2.h>
#include <mswsock.h>
#include <ws2tcpip.h>
extern int nConnectTimeout;
+#ifdef WIN32
+// In MSVC, this is defined as a macro, undefine it to prevent a compile and link error
+#undef SetPort
+#endif
/** IP address (IPv6, or IPv4 using mapped IPv6 range (::FFFF:0:0/96)) */
class CNetAddr
return QCoreApplication::translate("bitcoin-core", psz).toStdString();
}
+#ifdef WIN32
+#define strncasecmp strnicmp
+#endif
#ifndef BITCOIN_QT_TEST
int main(int argc, char *argv[])
{
-#include <transactiondesc.h>
+#include "transactiondesc.h"
#include "guiutil.h"
#include "bitcoinunits.h"
class TransactionTableModel;
class CWallet;
-struct SendCoinsRecipient
+class SendCoinsRecipient
{
+public:
QString address;
QString label;
qint64 amount;
#ifdef WIN32
#define _WIN32_WINNT 0x0501
+#define WIN32_LEAN_AND_MEAN 1
+#ifndef NOMINMAX
+#define NOMINMAX
+#endif
#include <windows.h>
// 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 <windows.h>
#define mlock(p, n) VirtualLock((p), (n));
#define munlock(p, n) VirtualUnlock((p), (n));
#else
return ret;
}
-string strprintf(const std::string &format, ...)
+string real_strprintf(const std::string &format, int dummy, ...)
{
char buffer[50000];
char* p = buffer;
loop
{
va_list arg_ptr;
- va_start(arg_ptr, format);
+ va_start(arg_ptr, dummy);
ret = _vsnprintf(p, limit, format.c_str(), arg_ptr);
va_end(arg_ptr);
if (ret >= 0 && ret < limit)
return str;
}
-bool error(const std::string &format, ...)
+bool error(const char *format, ...)
{
char buffer[50000];
int limit = sizeof(buffer);
va_list arg_ptr;
va_start(arg_ptr, format);
- int ret = _vsnprintf(buffer, limit, format.c_str(), arg_ptr);
+ int ret = _vsnprintf(buffer, limit, format, arg_ptr);
va_end(arg_ptr);
if (ret < 0 || ret >= limit)
{
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
+#else
+typedef int pid_t; /* define for windows compatiblity */
#endif
#include <map>
#include <vector>
void RandAddSeedPerfmon();
int OutputDebugStringF(const char* pszFormat, ...);
int my_snprintf(char* buffer, size_t limit, const char* format, ...);
-std::string strprintf(const std::string &format, ...);
-bool error(const std::string &format, ...);
+
+/* It is not allowed to use va_start with a pass-by-reference argument.
+ (C++ standard, 18.7, paragraph 3). Use a dummy argument to work around this, and use a
+ macro to keep similar semantics.
+*/
+std::string real_strprintf(const std::string &format, int dummy, ...);
+#define strprintf(format, ...) real_strprintf(format, 0, __VA_ARGS__)
+
+bool error(const char *format, ...);
void LogException(std::exception* pex, const char* pszThread);
void PrintException(std::exception* pex, const char* pszThread);
void PrintExceptionContinue(std::exception* pex, const char* pszThread);