Browse Source

fix -datadir=./subdir relative path,

autostart off by default except on windows,
fix occasional "vector iterator not dereferencable" assertion with msvc,
fix readlink compile warning on linux build,
use sys/param.h and BSD define instead of __BSD__,
-paytxfee switch
miguelfreitas
Satoshi Nakamoto 14 years ago committed by Gavin Andresen
parent
commit
7f71fd13ae
  1. 16
      headers.h
  2. 16
      init.cpp
  3. BIN
      locale/de/LC_MESSAGES/bitcoin.mo
  4. 12
      locale/de/LC_MESSAGES/bitcoin.po
  5. BIN
      locale/es/LC_MESSAGES/bitcoin.mo
  6. 12
      locale/es/LC_MESSAGES/bitcoin.po
  7. BIN
      locale/fr/LC_MESSAGES/bitcoin.mo
  8. 12
      locale/fr/LC_MESSAGES/bitcoin.po
  9. BIN
      locale/it/LC_MESSAGES/bitcoin.mo
  10. 12
      locale/it/LC_MESSAGES/bitcoin.po
  11. BIN
      locale/nl/LC_MESSAGES/bitcoin.mo
  12. 12
      locale/nl/LC_MESSAGES/bitcoin.po
  13. BIN
      locale/pt/LC_MESSAGES/bitcoin.mo
  14. 12
      locale/pt/LC_MESSAGES/bitcoin.po
  15. 2
      main.cpp
  16. 30
      net.cpp
  17. 4
      rpc.cpp
  18. 2
      serialize.h
  19. 14
      ui.cpp
  20. 15
      util.h

16
headers.h

@ -18,6 +18,14 @@
#define _WIN32_IE 0x0400 #define _WIN32_IE 0x0400
#define WIN32_LEAN_AND_MEAN 1 #define WIN32_LEAN_AND_MEAN 1
#define __STDC_LIMIT_MACROS // to enable UINT64_MAX from stdint.h #define __STDC_LIMIT_MACROS // to enable UINT64_MAX from stdint.h
#if (defined(__unix__) || defined(unix)) && !defined(USG)
#include <sys/param.h> // to get BSD define
#endif
#ifdef __WXMAC_OSX__
#ifndef BSD
#define BSD 1
#endif
#endif
#ifdef GUI #ifdef GUI
#include <wx/wx.h> #include <wx/wx.h>
#include <wx/stdpaths.h> #include <wx/stdpaths.h>
@ -25,12 +33,6 @@
#include <wx/utils.h> #include <wx/utils.h>
#include <wx/clipbrd.h> #include <wx/clipbrd.h>
#include <wx/taskbar.h> #include <wx/taskbar.h>
#else
#ifdef __WXMAC_OSX__
#define __WXMAC__ 1
#define __WXOSX__ 1
#define __BSD__ 1
#endif
#endif #endif
#include <openssl/buffer.h> #include <openssl/buffer.h>
#include <openssl/ecdsa.h> #include <openssl/ecdsa.h>
@ -98,7 +100,7 @@
#include <ifaddrs.h> #include <ifaddrs.h>
#include <fcntl.h> #include <fcntl.h>
#endif #endif
#ifdef __BSD__ #ifdef BSD
#include <netinet/in.h> #include <netinet/in.h>
#endif #endif

16
init.cpp

@ -137,7 +137,10 @@ bool AppInit2(int argc, char* argv[])
ParseParameters(argc, argv); ParseParameters(argc, argv);
if (mapArgs.count("-datadir")) if (mapArgs.count("-datadir"))
strlcpy(pszSetDataDir, mapArgs["-datadir"].c_str(), sizeof(pszSetDataDir)); {
filesystem::path pathDataDir = filesystem::system_complete(mapArgs["-datadir"]);
strlcpy(pszSetDataDir, pathDataDir.string().c_str(), sizeof(pszSetDataDir));
}
ReadConfigFile(mapArgs, mapMultiArgs); // Must be done after processing datadir ReadConfigFile(mapArgs, mapMultiArgs); // Must be done after processing datadir
@ -363,6 +366,15 @@ bool AppInit2(int argc, char* argv[])
} }
} }
if (mapArgs.count("-paytxfee"))
{
if (!ParseMoney(mapArgs["-paytxfee"], nTransactionFee))
{
wxMessageBox(_("Invalid amount for -paytxfee=<amount>"), "Bitcoin");
return false;
}
}
// //
// Create the main window and start the node // Create the main window and start the node
// //
@ -382,7 +394,7 @@ bool AppInit2(int argc, char* argv[])
if (mapArgs.count("-server") || fDaemon) if (mapArgs.count("-server") || fDaemon)
CreateThread(ThreadRPCServer, NULL); CreateThread(ThreadRPCServer, NULL);
#ifdef GUI #if defined(__WXMSW__) && defined(GUI)
if (fFirstRun) if (fFirstRun)
SetStartOnSystemStartup(true); SetStartOnSystemStartup(true);
#endif #endif

BIN
locale/de/LC_MESSAGES/bitcoin.mo

Binary file not shown.

12
locale/de/LC_MESSAGES/bitcoin.po

@ -184,8 +184,8 @@ msgid "From: "
msgstr "Von: " msgstr "Von: "
#: ../../../ui.cpp:634 #: ../../../ui.cpp:634
msgid "From: unknown, Received with: " msgid "Received with: "
msgstr "Von: Unbekannt, Empfangen durch: " msgstr "Empfangen durch: "
#: ../../../ui.cpp:676 #: ../../../ui.cpp:676
msgid "Payment to yourself" msgid "Payment to yourself"
@ -328,6 +328,14 @@ msgstr "Version 0.%d.%d Beta"
msgid "Will appear as \"From: Unknown\"" msgid "Will appear as \"From: Unknown\""
msgstr "Wird als \"Von: Unbekannt\" erscheinen" msgstr "Wird als \"Von: Unbekannt\" erscheinen"
#: ../../../ui.cpp:1681
msgid "n/a"
msgstr "Unbekannt"
#: ../../../ui.cpp:1681
msgid "Unknown"
msgstr "Unbekannt"
#: ../../../ui.cpp:1682 #: ../../../ui.cpp:1682
msgid "Can't include a message when sending to a Bitcoin address" msgid "Can't include a message when sending to a Bitcoin address"
msgstr "Beim überweisen an eine Bitcoin-Adresse kann keine Nachricht angegeben werden." msgstr "Beim überweisen an eine Bitcoin-Adresse kann keine Nachricht angegeben werden."

BIN
locale/es/LC_MESSAGES/bitcoin.mo

Binary file not shown.

12
locale/es/LC_MESSAGES/bitcoin.po

@ -210,8 +210,8 @@ msgid "From: "
msgstr "De: " msgstr "De: "
#: ../../../ui.cpp:634 #: ../../../ui.cpp:634
msgid "From: unknown, Received with: " msgid "Received with: "
msgstr "De: desconocido, Recibido con: " msgstr "Recibido con: "
#: ../../../ui.cpp:676 #: ../../../ui.cpp:676
msgid "Payment to yourself" msgid "Payment to yourself"
@ -357,6 +357,14 @@ msgstr "version %d.%d.%d beta"
msgid "Will appear as \"From: Unknown\"" msgid "Will appear as \"From: Unknown\""
msgstr "Aparecera como \"De: Desconocido\"" msgstr "Aparecera como \"De: Desconocido\""
#: ../../../ui.cpp:1696
msgid "n/a"
msgstr "Desconocido"
#: ../../../ui.cpp:1696
msgid "Unknown"
msgstr "Desconocido"
#: ../../../ui.cpp:1697 #: ../../../ui.cpp:1697
msgid "Can't include a message when sending to a Bitcoin address" msgid "Can't include a message when sending to a Bitcoin address"
msgstr "No se ha podido incluir un mensaje mientras se enviaba la direccion Bitcoin" msgstr "No se ha podido incluir un mensaje mientras se enviaba la direccion Bitcoin"

BIN
locale/fr/LC_MESSAGES/bitcoin.mo

Binary file not shown.

12
locale/fr/LC_MESSAGES/bitcoin.po

@ -210,8 +210,8 @@ msgid "From: "
msgstr "De: " msgstr "De: "
#: ../../../ui.cpp:634 #: ../../../ui.cpp:634
msgid "From: unknown, Received with: " msgid "Received with: "
msgstr "De: Inconnu, reçu depuis: " msgstr "Reçu depuis: "
#: ../../../ui.cpp:676 #: ../../../ui.cpp:676
msgid "Payment to yourself" msgid "Payment to yourself"
@ -358,6 +358,14 @@ msgstr "version %d.%d.%d beta"
msgid "Will appear as \"From: Unknown\"" msgid "Will appear as \"From: Unknown\""
msgstr "Apparaîtra ainsi \"De: Inconnu\"" msgstr "Apparaîtra ainsi \"De: Inconnu\""
#: ../../../ui.cpp:1681
msgid "n/a"
msgstr "Inconnu"
#: ../../../ui.cpp:1681
msgid "Unknown"
msgstr "Inconnu"
#: ../../../ui.cpp:1697 #: ../../../ui.cpp:1697
msgid "Can't include a message when sending to a Bitcoin address" msgid "Can't include a message when sending to a Bitcoin address"
msgstr "Impossible d'inclure un message lors d'un envoi à une adresse Bitcoin" msgstr "Impossible d'inclure un message lors d'un envoi à une adresse Bitcoin"

BIN
locale/it/LC_MESSAGES/bitcoin.mo

Binary file not shown.

12
locale/it/LC_MESSAGES/bitcoin.po

@ -184,8 +184,8 @@ msgid "From: "
msgstr "Da: " msgstr "Da: "
#: ../../../ui.cpp:634 #: ../../../ui.cpp:634
msgid "From: unknown, Received with: " msgid "Received with: "
msgstr "Da: sconosciuto, Ricevuto con: " msgstr "Ricevuto con: "
#: ../../../ui.cpp:676 #: ../../../ui.cpp:676
msgid "Payment to yourself" msgid "Payment to yourself"
@ -326,6 +326,14 @@ msgstr "versione 0.%d.%d beta"
msgid "Will appear as \"From: Unknown\"" msgid "Will appear as \"From: Unknown\""
msgstr "Apparirà come \"Da: Sconosciuto\"" msgstr "Apparirà come \"Da: Sconosciuto\""
#: ../../../ui.cpp:1681
msgid "n/a"
msgstr "Sconosciuto"
#: ../../../ui.cpp:1681
msgid "Unknown"
msgstr "Sconosciuto"
#: ../../../ui.cpp:1682 #: ../../../ui.cpp:1682
msgid "Can't include a message when sending to a Bitcoin address" msgid "Can't include a message when sending to a Bitcoin address"
msgstr "Non si può includere un messaggio quando si invia attraverso l'indirizzo Bitcoin" msgstr "Non si può includere un messaggio quando si invia attraverso l'indirizzo Bitcoin"

BIN
locale/nl/LC_MESSAGES/bitcoin.mo

Binary file not shown.

12
locale/nl/LC_MESSAGES/bitcoin.po

@ -184,8 +184,8 @@ msgid "From: "
msgstr "Van: " msgstr "Van: "
#: ../../../ui.cpp:634 #: ../../../ui.cpp:634
msgid "From: unknown, Received with: " msgid "Received with: "
msgstr "Van: onbekend, Ontvangen met: " msgstr "Ontvangen met: "
#: ../../../ui.cpp:676 #: ../../../ui.cpp:676
msgid "Payment to yourself" msgid "Payment to yourself"
@ -327,6 +327,14 @@ msgstr "versie 0.%d.%d beta"
msgid "Will appear as \"From: Unknown\"" msgid "Will appear as \"From: Unknown\""
msgstr "Word vertoont als \"Van: Onbekend\"" msgstr "Word vertoont als \"Van: Onbekend\""
#: ../../../ui.cpp:1681
msgid "n/a"
msgstr "Onbekend"
#: ../../../ui.cpp:1681
msgid "Unknown"
msgstr "Onbekend"
#: ../../../ui.cpp:1682 #: ../../../ui.cpp:1682
msgid "Can't include a message when sending to a Bitcoin address" msgid "Can't include a message when sending to a Bitcoin address"
msgstr "Kan geen mededeling versturen bij gebruik van Bitcoin adressen" msgstr "Kan geen mededeling versturen bij gebruik van Bitcoin adressen"

BIN
locale/pt/LC_MESSAGES/bitcoin.mo

Binary file not shown.

12
locale/pt/LC_MESSAGES/bitcoin.po

@ -184,8 +184,8 @@ msgid "From: "
msgstr "Remetente: " msgstr "Remetente: "
#: ../../../ui.cpp:634 #: ../../../ui.cpp:634
msgid "From: unknown, Received with: " msgid "Received with: "
msgstr "Remetente: desconhecido, Recebido por: " msgstr "Recebido por: "
#: ../../../ui.cpp:676 #: ../../../ui.cpp:676
msgid "Payment to yourself" msgid "Payment to yourself"
@ -326,6 +326,14 @@ msgstr "versão 0.%d.%d beta"
msgid "Will appear as \"From: Unknown\"" msgid "Will appear as \"From: Unknown\""
msgstr "Irá aparecer como \"De: Desconhecido\"" msgstr "Irá aparecer como \"De: Desconhecido\""
#: ../../../ui.cpp:1681
msgid "n/a"
msgstr "Desconhecido"
#: ../../../ui.cpp:1681
msgid "Unknown"
msgstr "Desconhecido"
#: ../../../ui.cpp:1682 #: ../../../ui.cpp:1682
msgid "Can't include a message when sending to a Bitcoin address" msgid "Can't include a message when sending to a Bitcoin address"
msgstr "Não é possível incluir uma mensagem ao enviar para um endereço Bitcoin" msgstr "Não é possível incluir uma mensagem ao enviar para um endereço Bitcoin"

2
main.cpp

@ -2224,7 +2224,7 @@ bool ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
// This includes all nodes that are currently online, // This includes all nodes that are currently online,
// since they rebroadcast an addr every 24 hours // since they rebroadcast an addr every 24 hours
pfrom->vAddrToSend.clear(); pfrom->vAddrToSend.clear();
int64 nSince = GetAdjustedTime() - 24 * 60 * 60; // in the last 24 hours int64 nSince = GetAdjustedTime() - 12 * 60 * 60; // in the last 12 hours
CRITICAL_BLOCK(cs_mapAddresses) CRITICAL_BLOCK(cs_mapAddresses)
{ {
unsigned int nSize = mapAddresses.size(); unsigned int nSize = mapAddresses.size();

30
net.cpp

@ -66,7 +66,7 @@ bool ConnectSocket(const CAddress& addrConnect, SOCKET& hSocketRet)
SOCKET hSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); SOCKET hSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (hSocket == INVALID_SOCKET) if (hSocket == INVALID_SOCKET)
return false; return false;
#if defined(__BSD__) || defined(__WXMAC_OSX__) #ifdef BSD
int set = 1; int set = 1;
setsockopt(hSocket, SOL_SOCKET, SO_NOSIGPIPE, (void*)&set, sizeof(int)); setsockopt(hSocket, SOL_SOCKET, SO_NOSIGPIPE, (void*)&set, sizeof(int));
#endif #endif
@ -808,6 +808,7 @@ void ThreadSocketHandler2(void* parg)
unsigned int pnSeed[] = unsigned int pnSeed[] =
{ {
// 2010/06
0x35218252, 0x9c9c9618, 0xda6bacad, 0xb9aca862, 0x97c235c6, 0x35218252, 0x9c9c9618, 0xda6bacad, 0xb9aca862, 0x97c235c6,
0x146f9562, 0xb67b9e4b, 0x87cf4bc0, 0xb83945d0, 0x984333ad, 0x146f9562, 0xb67b9e4b, 0x87cf4bc0, 0xb83945d0, 0x984333ad,
0xbbeec555, 0x6f0eb440, 0xe0005318, 0x7797e460, 0xddc60fcc, 0xbbeec555, 0x6f0eb440, 0xe0005318, 0x7797e460, 0xddc60fcc,
@ -818,6 +819,31 @@ unsigned int pnSeed[] =
0xdd3462d0, 0x4e4d1448, 0x171df645, 0x84ee1155, 0xdd3462d0, 0x4e4d1448, 0x171df645, 0x84ee1155,
0x248ac445, 0x0e634444, 0x0ded1b63, 0x30c01e60, 0x248ac445, 0x0e634444, 0x0ded1b63, 0x30c01e60,
0xa2b9a094, 0x29e4fd43, 0x9ce61b4c, 0xdae09744, 0xa2b9a094, 0x29e4fd43, 0x9ce61b4c, 0xdae09744,
// 2010/08
0x5ae6bf43, 0x460be257, 0x7245c0cf, 0x4e0f028d, 0x26501760, 0x38643255, 0x67094f4f, 0x480449b8,
0x16545143, 0x1f082e5a, 0xaa428018, 0xe411e793, 0x14c1f862, 0x2726105b, 0x9b33ea50, 0xeeef86ca,
0xe3210d44, 0x0dca8b63, 0x3f9dfb18, 0x860340ad, 0xf33ba17a, 0x9018375c, 0x1de4e353, 0x0fa52dcb,
0x89c4555b, 0x109cf37b, 0x28c55b40, 0x04c801ae, 0x275c1e80, 0x6f7f745d, 0x7a2a5653, 0xa28e26d8,
0xa4e65db2, 0x99a06580, 0xf253ba44, 0x82cf6ab8, 0x859c2e8e, 0xf71a815d, 0xc18f1454, 0x71c8a943,
0x90d24e18, 0x311789b2, 0x74aba645, 0xde0bbfc3, 0xad724fad, 0xbf1ae15e, 0xbaa6fb54, 0x06e4d145,
0x51528645, 0x72120cd4, 0xd4cfd145, 0x0a7afed8, 0x9b9a5fad, 0x9e9ff45e, 0x10128355, 0xd44e8646,
0x04a07b47, 0x5fc9d547, 0xe0491e45, 0xbac21b41, 0x7aa31bae, 0x10483c5f, 0x94a23055, 0x73d9dc47,
0x1a99c247, 0x822fe847, 0x7e57ba48, 0xb19ea843, 0xa60621b2, 0x778cf163, 0x125c6556, 0xf94ba44f,
0xa61a0948, 0x6c839e4b, 0x29af5348, 0x68d84845, 0x752b95c3, 0xcf0d4663, 0x08e11e56, 0x75109550,
0x5f24b94c, 0x42426d4d, 0xfbbc0a4c, 0x70a9a246, 0xda7837cb, 0xae2a986d, 0xe283c358, 0x0c7ca954,
0x8e9bde59, 0x61521760, 0x6884444c, 0xa194e548, 0x9b8809cc, 0x16e96a8f, 0x956ff859, 0xfad5e555,
0x0ea70c80, 0x5b4ce26d, 0x7984444c, 0x1080d24a, 0x22a686cf, 0x6bf8c2ad, 0xb0f7485f, 0x06b66e56,
0x668373bc, 0x75506279, 0x3868694e, 0x12a5954b, 0x3a8b62d1, 0xb74fcbad, 0xa7dc3360, 0xc070b359,
0xa2b87242, 0xc45cab7c, 0x69882050, 0x14a5464b, 0x386acad5, 0x80b85db2, 0x1f78a062, 0xc608c55b,
0x4257d543, 0x7636ad80, 0x4432d655, 0xb2114d4b, 0x32639bd9, 0xadd75db2, 0x9be5a362, 0x6831bc5e,
0xf7f77046, 0x8f35ba81, 0x09bb4e59, 0xd0fb6b4e, 0xc5daa445, 0x9c611618, 0x355dcc62, 0xf2cf435e,
0x31e72c46, 0xdd8a43ad, 0x171f9c5b, 0xb4c2e355, 0xbe8af945, 0x613d3942, 0xe6f9e863, 0x7a3d855f,
0xa66adc47, 0x261089b2, 0x5a27105b, 0x6c28105b, 0xdd247946, 0xe6c3a445, 0x43a1ec63, 0x99b4dd5f,
0xb6834347, 0x5e9649bc, 0xf9dd545d, 0x6ae4c15b, 0xa5318a47, 0x7984ec47, 0x93a73b63, 0x0c60195f,
0xa5c85e4b, 0xa0a36dc2, 0x0739a95e, 0x3d44c15b, 0xfb940f4b, 0xd67c9148, 0x614f9876, 0x0a241c5f,
0xad9da74c, 0x4459abc8, 0x12e71b5f, 0x1c534a5d, 0x8ff5fc50, 0x2ca8864b, 0xd894fd80, 0x82ab3160,
0x390d804e, 0x2cf310cc, 0x680dad80, 0x691be15e, 0x5a8f4652, 0xaad0784d, 0x0d2431ad,
}; };
@ -1179,7 +1205,7 @@ bool BindListenPort(string& strError)
return false; return false;
} }
#if defined(__BSD__) || defined(__WXMAC_OSX__) #ifdef BSD
// Different way of disabling SIGPIPE on BSD // Different way of disabling SIGPIPE on BSD
setsockopt(hListenSocket, SOL_SOCKET, SO_NOSIGPIPE, (void*)&nOne, sizeof(int)); setsockopt(hListenSocket, SOL_SOCKET, SO_NOSIGPIPE, (void*)&nOne, sizeof(int));
#endif #endif

4
rpc.cpp

@ -974,8 +974,8 @@ void ThreadRPCServer2(void* parg)
printf("ThreadRPCServer method=%s\n", strMethod.c_str()); printf("ThreadRPCServer method=%s\n", strMethod.c_str());
// Observe lockdown // Observe lockdown
if (IsLockdown() && strMethod != "help" && strMethod != "stop" && strMethod != "getgenerate" && strMethod != "setgenerate") if (IsLockdown() && !mapArgs.count("-overridesafety") && strMethod != "help" && strMethod != "stop" && strMethod != "getgenerate" && strMethod != "setgenerate")
throw runtime_error("WARNING: Displayed transactions may not be correct! You may need to upgrade."); throw runtime_error("WARNING: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.");
// Execute // Execute
map<string, rpcfn_type>::iterator mi = mapCallTable.find(strMethod); map<string, rpcfn_type>::iterator mi = mapCallTable.find(strMethod);

2
serialize.h

@ -20,7 +20,7 @@ class CDataStream;
class CAutoFile; class CAutoFile;
static const int VERSION = 308; static const int VERSION = 308;
static const char* pszSubVer = ".3"; static const char* pszSubVer = ".4";

14
ui.cpp

@ -515,7 +515,7 @@ string SingleLine(const string& strIn)
{ {
string strOut; string strOut;
bool fOneSpace = false; bool fOneSpace = false;
foreach(int c, strIn) foreach(unsigned char c, strIn)
{ {
if (isspace(c)) if (isspace(c))
{ {
@ -640,7 +640,7 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex)
{ {
//strDescription += _("Received payment to "); //strDescription += _("Received payment to ");
//strDescription += _("Received with address "); //strDescription += _("Received with address ");
strDescription += _("From: unknown, Received with: "); strDescription += _("Received with: ");
string strAddress = PubKeyToAddress(vchPubKey); string strAddress = PubKeyToAddress(vchPubKey);
map<string, string>::iterator mi = mapAddressBook.find(strAddress); map<string, string>::iterator mi = mapAddressBook.find(strAddress);
if (mi != mapAddressBook.end() && !(*mi).second.empty()) if (mi != mapAddressBook.end() && !(*mi).second.empty())
@ -1559,6 +1559,11 @@ void SetStartOnSystemStartup(bool fAutoStart)
} }
else else
{ {
char pszExePath[MAX_PATH+1];
memset(pszExePath, 0, sizeof(pszExePath));
if (readlink("/proc/self/exe", pszExePath, sizeof(pszExePath)-1) == -1)
return;
boost::filesystem::create_directories(GetAutostartDir()); boost::filesystem::create_directories(GetAutostartDir());
boost::filesystem::ofstream optionFile(GetAutostartFilePath(), ios_base::out|ios_base::trunc); boost::filesystem::ofstream optionFile(GetAutostartFilePath(), ios_base::out|ios_base::trunc);
@ -1568,9 +1573,6 @@ void SetStartOnSystemStartup(bool fAutoStart)
return; return;
} }
// Write a bitcoin.desktop file to the autostart directory: // Write a bitcoin.desktop file to the autostart directory:
char pszExePath[MAX_PATH+1];
memset(pszExePath, 0, sizeof(pszExePath));
readlink("/proc/self/exe", pszExePath, sizeof(pszExePath)-1);
optionFile << "[Desktop Entry]\n"; optionFile << "[Desktop Entry]\n";
optionFile << "Type=Application\n"; optionFile << "Type=Application\n";
optionFile << "Name=Bitcoin\n"; optionFile << "Name=Bitcoin\n";
@ -1858,7 +1860,7 @@ void CSendDialog::OnTextAddress(wxCommandEvent& event)
{ {
strFromSave = m_textCtrlFrom->GetValue(); strFromSave = m_textCtrlFrom->GetValue();
strMessageSave = m_textCtrlMessage->GetValue(); strMessageSave = m_textCtrlMessage->GetValue();
m_textCtrlFrom->SetValue(_("Will appear as \"From: Unknown\"")); m_textCtrlFrom->SetValue(_("n/a"));
m_textCtrlMessage->SetValue(_("Can't include a message when sending to a Bitcoin address")); m_textCtrlMessage->SetValue(_("Can't include a message when sending to a Bitcoin address"));
} }
else if (fEnable && !fEnabledPrev) else if (fEnable && !fEnabledPrev)

15
util.h

@ -430,8 +430,9 @@ inline void heapchk()
template<typename T1> template<typename T1>
inline uint256 Hash(const T1 pbegin, const T1 pend) inline uint256 Hash(const T1 pbegin, const T1 pend)
{ {
static unsigned char pblank[1];
uint256 hash1; uint256 hash1;
SHA256((unsigned char*)&pbegin[0], (pend - pbegin) * sizeof(pbegin[0]), (unsigned char*)&hash1); SHA256((pbegin == pend ? pblank : (unsigned char*)&pbegin[0]), (pend - pbegin) * sizeof(pbegin[0]), (unsigned char*)&hash1);
uint256 hash2; uint256 hash2;
SHA256((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2); SHA256((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2);
return hash2; return hash2;
@ -441,11 +442,12 @@ template<typename T1, typename T2>
inline uint256 Hash(const T1 p1begin, const T1 p1end, inline uint256 Hash(const T1 p1begin, const T1 p1end,
const T2 p2begin, const T2 p2end) const T2 p2begin, const T2 p2end)
{ {
static unsigned char pblank[1];
uint256 hash1; uint256 hash1;
SHA256_CTX ctx; SHA256_CTX ctx;
SHA256_Init(&ctx); SHA256_Init(&ctx);
SHA256_Update(&ctx, (unsigned char*)&p1begin[0], (p1end - p1begin) * sizeof(p1begin[0])); SHA256_Update(&ctx, (p1begin == p1end ? pblank : (unsigned char*)&p1begin[0]), (p1end - p1begin) * sizeof(p1begin[0]));
SHA256_Update(&ctx, (unsigned char*)&p2begin[0], (p2end - p2begin) * sizeof(p2begin[0])); SHA256_Update(&ctx, (p2begin == p2end ? pblank : (unsigned char*)&p2begin[0]), (p2end - p2begin) * sizeof(p2begin[0]));
SHA256_Final((unsigned char*)&hash1, &ctx); SHA256_Final((unsigned char*)&hash1, &ctx);
uint256 hash2; uint256 hash2;
SHA256((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2); SHA256((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2);
@ -457,12 +459,13 @@ inline uint256 Hash(const T1 p1begin, const T1 p1end,
const T2 p2begin, const T2 p2end, const T2 p2begin, const T2 p2end,
const T3 p3begin, const T3 p3end) const T3 p3begin, const T3 p3end)
{ {
static unsigned char pblank[1];
uint256 hash1; uint256 hash1;
SHA256_CTX ctx; SHA256_CTX ctx;
SHA256_Init(&ctx); SHA256_Init(&ctx);
SHA256_Update(&ctx, (unsigned char*)&p1begin[0], (p1end - p1begin) * sizeof(p1begin[0])); SHA256_Update(&ctx, (p1begin == p1end ? pblank : (unsigned char*)&p1begin[0]), (p1end - p1begin) * sizeof(p1begin[0]));
SHA256_Update(&ctx, (unsigned char*)&p2begin[0], (p2end - p2begin) * sizeof(p2begin[0])); SHA256_Update(&ctx, (p2begin == p2end ? pblank : (unsigned char*)&p2begin[0]), (p2end - p2begin) * sizeof(p2begin[0]));
SHA256_Update(&ctx, (unsigned char*)&p3begin[0], (p3end - p3begin) * sizeof(p3begin[0])); SHA256_Update(&ctx, (p3begin == p3end ? pblank : (unsigned char*)&p3begin[0]), (p3end - p3begin) * sizeof(p3begin[0]));
SHA256_Final((unsigned char*)&hash1, &ctx); SHA256_Final((unsigned char*)&hash1, &ctx);
uint256 hash2; uint256 hash2;
SHA256((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2); SHA256((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2);

Loading…
Cancel
Save