aboutsummaryrefslogtreecommitdiff
path: root/src/util.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2011-09-28 21:52:32 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2011-09-28 21:52:32 +0200
commit002a4dcad0c0f74b1063cf27f0a9550d5e56c3f0 (patch)
tree58a16a226571a80537bfa7e3b1147aa4d0ee8767 /src/util.cpp
parenta8b95ce6ed5e84d34748ecdd0ff1db4d03377cf0 (diff)
parent4dcad1d294e264a81280fd007d1508d9bd4f0273 (diff)
downloadbitcoin-002a4dcad0c0f74b1063cf27f0a9550d5e56c3f0.tar.xz
Merge branch 'master' of https://github.com/bitcoin/bitcoin
Conflicts: .gitignore (used upstream version) bitcoin-qt.pro
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp51
1 files changed, 9 insertions, 42 deletions
diff --git a/src/util.cpp b/src/util.cpp
index 03b3d73e62..a5e3d30995 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -471,40 +471,6 @@ void ParseParameters(int argc, char* argv[])
}
-const char* wxGetTranslation(const char* pszEnglish)
-{
-#ifdef GUI
- // Wrapper of wxGetTranslation returning the same const char* type as was passed in
- static CCriticalSection cs;
- CRITICAL_BLOCK(cs)
- {
- // Look in cache
- static map<string, char*> mapCache;
- map<string, char*>::iterator mi = mapCache.find(pszEnglish);
- if (mi != mapCache.end())
- return (*mi).second;
-
- // wxWidgets translation
- wxString strTranslated = wxGetTranslation(wxString(pszEnglish, wxConvUTF8));
-
- // We don't cache unknown strings because caller might be passing in a
- // dynamic string and we would keep allocating memory for each variation.
- if (strcmp(pszEnglish, strTranslated.utf8_str()) == 0)
- return pszEnglish;
-
- // Add to cache, memory doesn't need to be freed. We only cache because
- // we must pass back a pointer to permanently allocated memory.
- char* pszCached = new char[strlen(strTranslated.utf8_str())+1];
- strcpy(pszCached, strTranslated.utf8_str());
- mapCache[pszEnglish] = pszCached;
- return pszCached;
- }
- return NULL;
-#else
- return pszEnglish;
-#endif
-}
-
bool WildcardMatch(const char* psz, const char* mask)
{
@@ -573,10 +539,6 @@ void PrintException(std::exception* pex, const char* pszThread)
printf("\n\n************************\n%s\n", pszMessage);
fprintf(stderr, "\n\n************************\n%s\n", pszMessage);
strMiscWarning = pszMessage;
-#ifdef GUI
- if (wxTheApp && !fDaemon)
- MyMessageBox(pszMessage, "Bitcoin", wxOK | wxICON_ERROR);
-#endif
throw;
}
@@ -598,10 +560,6 @@ void PrintExceptionContinue(std::exception* pex, const char* pszThread)
printf("\n\n************************\n%s\n", pszMessage);
fprintf(stderr, "\n\n************************\n%s\n", pszMessage);
strMiscWarning = pszMessage;
-#ifdef GUI
- if (wxTheApp && !fDaemon)
- boost::thread(boost::bind(ThreadOneMessageBox, string(pszMessage)));
-#endif
}
@@ -813,11 +771,20 @@ void ShrinkDebugFile()
// - Median of other nodes's clocks
// - The user (asking the user to fix the system clock if the first two disagree)
//
+static int64 nMockTime = 0; // For unit testing
+
int64 GetTime()
{
+ if (nMockTime) return nMockTime;
+
return time(NULL);
}
+void SetMockTime(int64 nMockTimeIn)
+{
+ nMockTime = nMockTimeIn;
+}
+
static int64 nTimeOffset = 0;
int64 GetAdjustedTime()