Browse Source

VC2010 compile fixes

miguelfreitas
Wladimir J. van der Laan 13 years ago
parent
commit
52d3a48128
  1. 6
      src/bitcoinrpc.cpp
  2. 4
      src/headers.h
  3. 4
      src/init.cpp
  4. 8
      src/main.h
  5. 8
      src/netbase.h
  6. 3
      src/qt/bitcoin.cpp
  7. 2
      src/qt/transactiondesc.cpp
  8. 3
      src/qt/walletmodel.h
  9. 5
      src/serialize.h
  10. 8
      src/util.cpp
  11. 13
      src/util.h

6
src/bitcoinrpc.cpp

@ -2371,13 +2371,13 @@ void ThreadRPCServer2(void* parg)
strWhatAmI = strprintf(_("To use the %s option"), "\"-server\""); strWhatAmI = strprintf(_("To use the %s option"), "\"-server\"");
else if (mapArgs.count("-daemon")) else if (mapArgs.count("-daemon"))
strWhatAmI = strprintf(_("To use the %s option"), "\"-daemon\""); strWhatAmI = strprintf(_("To use the %s option"), "\"-daemon\"");
::error( std::string strMessage = _("%s, you must set a rpcpassword in the configuration file:\n %s\n"
_("%s, you must set a rpcpassword in the configuration file:\n %s\n"
"It is recommended you use the following random password:\n" "It is recommended you use the following random password:\n"
"rpcuser=bitcoinrpc\n" "rpcuser=bitcoinrpc\n"
"rpcpassword=%s\n" "rpcpassword=%s\n"
"(you do not need to remember this password)\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"), "If the file does not exist, create it with owner-readable-only file permissions.\n");
fprintf(stderr, strMessage.c_str(),
strWhatAmI.c_str(), strWhatAmI.c_str(),
GetConfigFile().c_str(), GetConfigFile().c_str(),
EncodeBase58(&rand_pwd[0],&rand_pwd[0]+32).c_str()); EncodeBase58(&rand_pwd[0],&rand_pwd[0]+32).c_str());

4
src/headers.h

@ -18,7 +18,9 @@
#endif #endif
#define _WIN32_IE 0x0400 #define _WIN32_IE 0x0400
#define WIN32_LEAN_AND_MEAN 1 #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 here as it defines __STDC_LIMIT_MACROS on some systems.
#include <boost/foreach.hpp> #include <boost/foreach.hpp>

4
src/init.cpp

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

8
src/main.h

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

8
src/netbase.h

@ -9,6 +9,10 @@
#ifdef WIN32 #ifdef WIN32
#define _WIN32_WINNT 0x0501 #define _WIN32_WINNT 0x0501
#define WIN32_LEAN_AND_MEAN 1
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <winsock2.h> #include <winsock2.h>
#include <mswsock.h> #include <mswsock.h>
#include <ws2tcpip.h> #include <ws2tcpip.h>
@ -29,6 +33,10 @@
extern int nConnectTimeout; 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)) */ /** IP address (IPv6, or IPv4 using mapped IPv6 range (::FFFF:0:0/96)) */
class CNetAddr class CNetAddr

3
src/qt/bitcoin.cpp

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

2
src/qt/transactiondesc.cpp

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

3
src/qt/walletmodel.h

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

5
src/serialize.h

@ -24,12 +24,15 @@ typedef unsigned long long uint64;
#ifdef WIN32 #ifdef WIN32
#define _WIN32_WINNT 0x0501 #define _WIN32_WINNT 0x0501
#define WIN32_LEAN_AND_MEAN 1
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <windows.h> #include <windows.h>
// This is used to attempt to keep keying material out of swap // This is used to attempt to keep keying material out of swap
// Note that VirtualLock does not provide this as a guarantee on Windows, // 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 // 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. // the pagefile except in rare circumstances where memory is extremely low.
#include <windows.h>
#define mlock(p, n) VirtualLock((p), (n)); #define mlock(p, n) VirtualLock((p), (n));
#define munlock(p, n) VirtualUnlock((p), (n)); #define munlock(p, n) VirtualUnlock((p), (n));
#else #else

8
src/util.cpp

@ -265,7 +265,7 @@ int my_snprintf(char* buffer, size_t limit, const char* format, ...)
return ret; return ret;
} }
string strprintf(const std::string &format, ...) string real_strprintf(const std::string &format, int dummy, ...)
{ {
char buffer[50000]; char buffer[50000];
char* p = buffer; char* p = buffer;
@ -274,7 +274,7 @@ string strprintf(const std::string &format, ...)
loop loop
{ {
va_list arg_ptr; va_list arg_ptr;
va_start(arg_ptr, format); va_start(arg_ptr, dummy);
ret = _vsnprintf(p, limit, format.c_str(), arg_ptr); ret = _vsnprintf(p, limit, format.c_str(), arg_ptr);
va_end(arg_ptr); va_end(arg_ptr);
if (ret >= 0 && ret < limit) if (ret >= 0 && ret < limit)
@ -292,13 +292,13 @@ string strprintf(const std::string &format, ...)
return str; return str;
} }
bool error(const std::string &format, ...) bool error(const char *format, ...)
{ {
char buffer[50000]; char buffer[50000];
int limit = sizeof(buffer); int limit = sizeof(buffer);
va_list arg_ptr; va_list arg_ptr;
va_start(arg_ptr, format); 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); va_end(arg_ptr);
if (ret < 0 || ret >= limit) if (ret < 0 || ret >= limit)
{ {

13
src/util.h

@ -11,6 +11,8 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/resource.h> #include <sys/resource.h>
#else
typedef int pid_t; /* define for windows compatiblity */
#endif #endif
#include <map> #include <map>
#include <vector> #include <vector>
@ -128,8 +130,15 @@ void RandAddSeed();
void RandAddSeedPerfmon(); void RandAddSeedPerfmon();
int OutputDebugStringF(const char* pszFormat, ...); int OutputDebugStringF(const char* pszFormat, ...);
int my_snprintf(char* buffer, size_t limit, const char* format, ...); 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 LogException(std::exception* pex, const char* pszThread);
void PrintException(std::exception* pex, const char* pszThread); void PrintException(std::exception* pex, const char* pszThread);
void PrintExceptionContinue(std::exception* pex, const char* pszThread); void PrintExceptionContinue(std::exception* pex, const char* pszThread);

Loading…
Cancel
Save