Browse Source

Merge pull request #4174

5248ff4 SetupEnvironment() - clean commit (Stuart Cardall)
0.10
Wladimir J. van der Laan 11 years ago
parent
commit
c26acfc308
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 2
      src/bitcoin-cli.cpp
  2. 2
      src/bitcoind.cpp
  3. 2
      src/qt/bitcoin.cpp
  4. 16
      src/util.cpp
  5. 1
      src/util.h

2
src/bitcoin-cli.cpp

@ -58,6 +58,8 @@ static bool AppInitRPC(int argc, char* argv[]) @@ -58,6 +58,8 @@ static bool AppInitRPC(int argc, char* argv[])
int main(int argc, char* argv[])
{
SetupEnvironment();
try
{
if(!AppInitRPC(argc, argv))

2
src/bitcoind.cpp

@ -172,6 +172,8 @@ bool AppInit(int argc, char* argv[]) @@ -172,6 +172,8 @@ bool AppInit(int argc, char* argv[])
int main(int argc, char* argv[])
{
SetupEnvironment();
bool fRet = false;
// Connect bitcoind signal handlers

2
src/qt/bitcoin.cpp

@ -459,6 +459,8 @@ WId BitcoinApplication::getMainWinId() const @@ -459,6 +459,8 @@ WId BitcoinApplication::getMainWinId() const
#ifndef BITCOIN_QT_TEST
int main(int argc, char *argv[])
{
SetupEnvironment();
/// 1. Parse command-line options. These take precedence over anything else.
// Command-line options take precedence:
ParseParameters(argc, argv);

16
src/util.cpp

@ -1384,3 +1384,19 @@ bool ParseInt32(const std::string& str, int32_t *out) @@ -1384,3 +1384,19 @@ bool ParseInt32(const std::string& str, int32_t *out)
n <= std::numeric_limits<int32_t>::max();
}
void SetupEnvironment()
{
#ifndef WIN32
try
{
#if BOOST_FILESYSTEM_VERSION == 3
boost::filesystem::path::codecvt(); // Raises runtime error if current locale is invalid
#else // boost filesystem v2
std::locale(); // Raises runtime error if current locale is invalid
#endif
} catch(std::runtime_error &e)
{
setenv("LC_ALL", "C", 1); // Force C locale
}
#endif
}

1
src/util.h

@ -106,6 +106,7 @@ extern volatile bool fReopenDebugLog; @@ -106,6 +106,7 @@ extern volatile bool fReopenDebugLog;
void RandAddSeed();
void RandAddSeedPerfmon();
void SetupEnvironment();
/* Return true if log accepts specified category */
bool LogAcceptCategory(const char* category);

Loading…
Cancel
Save