aboutsummaryrefslogtreecommitdiff
path: root/util.cpp
diff options
context:
space:
mode:
authors_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2010-08-25 00:05:37 +0000
committers_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2010-08-25 00:05:37 +0000
commit401926283a200994ecd7df8eae8ced8e0b067c46 (patch)
tree4b3e85c5afc7886f1d1461bee0d075db4daaec6f /util.cpp
parent2201a0808ea240617a66823f98dda3433d2546b0 (diff)
alert system
-- version 0.3.11 git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@142 1a98c847-1fd6-4fd8-948a-caf3550aa51b
Diffstat (limited to 'util.cpp')
-rw-r--r--util.cpp37
1 files changed, 13 insertions, 24 deletions
diff --git a/util.cpp b/util.cpp
index 2be841d07c..2068e8a9e1 100644
--- a/util.cpp
+++ b/util.cpp
@@ -14,7 +14,7 @@ char pszSetDataDir[MAX_PATH] = "";
bool fShutdown = false;
bool fDaemon = false;
bool fCommandLine = false;
-string strWarning;
+string strMiscWarning;
@@ -104,12 +104,8 @@ void RandAddSeedPerfmon()
RegCloseKey(HKEY_PERFORMANCE_DATA);
if (ret == ERROR_SUCCESS)
{
- uint256 hash;
- SHA256(pdata, nSize, (unsigned char*)&hash);
- RAND_add(&hash, sizeof(hash), min(nSize/500.0, (double)sizeof(hash)));
- hash = 0;
+ RAND_add(pdata, nSize, nSize/100.0);
memset(pdata, 0, nSize);
-
printf("%s RandAddSeed() %d bytes\n", DateTimeStrFormat("%x %H:%M", GetTime()).c_str(), nSize);
}
#endif
@@ -371,11 +367,6 @@ bool ParseMoney(const char* pszIn, int64& nRet)
vector<unsigned char> ParseHex(const char* psz)
{
- vector<unsigned char> vch;
- while (isspace(*psz))
- psz++;
- vch.reserve((strlen(psz)+1)/3);
-
static char phexdigit[256] =
{ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
@@ -394,24 +385,22 @@ vector<unsigned char> ParseHex(const char* psz)
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, };
- while (*psz)
+ // convert hex dump to vector
+ vector<unsigned char> vch;
+ loop
{
+ while (isspace(*psz))
+ psz++;
char c = phexdigit[(unsigned char)*psz++];
if (c == -1)
break;
unsigned char n = (c << 4);
- if (*psz)
- {
- char c = phexdigit[(unsigned char)*psz++];
- if (c == -1)
- break;
- n |= c;
- vch.push_back(n);
- }
- while (isspace(*psz))
- psz++;
+ c = phexdigit[(unsigned char)*psz++];
+ if (c == -1)
+ break;
+ n |= c;
+ vch.push_back(n);
}
-
return vch;
}
@@ -761,7 +750,7 @@ void AddTimeData(unsigned int ip, int64 nTime)
{
fDone = true;
string strMessage = _("Warning: Check your system date and time, you may not be able to generate or receive the most recent blocks!");
- strWarning = strMessage;
+ strMiscWarning = strMessage;
printf("*** %s\n", strMessage.c_str());
boost::thread(bind(ThreadSafeMessageBox, strMessage+" ", string("Bitcoin"), wxOK | wxICON_EXCLAMATION, (wxWindow*)NULL, -1, -1));
}