VC2010 compile fixes

This commit is contained in:
Wladimir J. van der Laan 2012-03-18 23:14:03 +01:00
parent 703d64469e
commit 52d3a48128
11 changed files with 53 additions and 19 deletions

View File

@ -2371,13 +2371,13 @@ void ThreadRPCServer2(void* parg)
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());

View File

@ -18,7 +18,9 @@
#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>

View File

@ -24,6 +24,10 @@ Q_IMPORT_PLUGIN(qkrcodecs)
Q_IMPORT_PLUGIN(qtaccessiblewidgets)
#endif
#ifdef WIN32
#define strncasecmp strnicmp
#endif
using namespace std;
using namespace boost;

View File

@ -11,6 +11,10 @@
#include "script.h"
#include "db.h"
#ifdef WIN32
#include <io.h> /* for _commit */
#endif
#include <list>
class CBlock;
@ -161,7 +165,7 @@ public:
std::string ToString() const
{
if (IsNull())
return strprintf("null");
return "null";
else
return strprintf("(nFile=%d, nBlockPos=%d, nTxPos=%d)", nFile, nBlockPos, nTxPos);
}
@ -288,7 +292,7 @@ public:
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());

View File

@ -9,6 +9,10 @@
#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>
@ -29,6 +33,10 @@
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

View File

@ -123,6 +123,9 @@ std::string _(const char* psz)
return QCoreApplication::translate("bitcoin-core", psz).toStdString();
}
#ifdef WIN32
#define strncasecmp strnicmp
#endif
#ifndef BITCOIN_QT_TEST
int main(int argc, char *argv[])
{

View File

@ -1,4 +1,4 @@
#include <transactiondesc.h>
#include "transactiondesc.h"
#include "guiutil.h"
#include "bitcoinunits.h"

View File

@ -10,8 +10,9 @@ class AddressTableModel;
class TransactionTableModel;
class CWallet;
struct SendCoinsRecipient
class SendCoinsRecipient
{
public:
QString address;
QString label;
qint64 amount;

View File

@ -24,12 +24,15 @@ typedef unsigned long long uint64;
#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

View File

@ -265,7 +265,7 @@ int my_snprintf(char* buffer, size_t limit, const char* format, ...)
return ret;
}
string strprintf(const std::string &format, ...)
string real_strprintf(const std::string &format, int dummy, ...)
{
char buffer[50000];
char* p = buffer;
@ -274,7 +274,7 @@ string strprintf(const std::string &format, ...)
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)
@ -292,13 +292,13 @@ string strprintf(const std::string &format, ...)
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)
{

View File

@ -11,6 +11,8 @@
#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>
@ -128,8 +130,15 @@ void RandAddSeed();
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);