Timechain
Search Donate
Sponsors
Cake Wallet, private Bitcoin and Monero walletSideShift.ai, no-signup crypto exchangeOrangeRock, non-custodial bitcoin spot and perps tradingBraiins Hashpower, buy and sell Bitcoin hashrateLayer Two Labs, drivechains for Bitcoin

Re: Bitcoind

To: mmalmi@cc.hut.fi Martti Malmi
I put it at bitcoin.org/download/linux64-0.2.7.1.tar.gz.  You can delete
it when you've got it.

I thought about what might cause the problem you're having and made a
change that this build includes.  This might have been unsafe code,
although it would probably always get lucky.

in util.cpp, old:
const char\* wxGetTranslation(const char\* pszEnglish)
{
// 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
const char\* pszTranslated =
wxGetTranslation(wxString(pszEnglish, wxConvUTF8)).utf8\_str();

// 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, pszTranslated) == 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(pszTranslated)+1\];
strcpy(pszCached, pszTranslated);
mapCache\[pszEnglish\] = pszCached;
return pszCached;
}
return NULL;
}

new:
const char\* wxGetTranslation(const char\* pszEnglish)
{
// 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;
}

If you still suspect this code, for testing you could change it to:
const char\* wxGetTranslation(const char\* pszEnglish)
{
return pszEnglish;
}

mmalmi@cc.hut.fi wrote:

All writings · Satoshi era timeline

0:000:00