mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-18 02:47:12 -05:00
Corrected a bug in openDHT for 64 bits systems: a 64 bit string::size_type was returned into a uint32_t variable and further compared the 64 bits string::npos
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@937 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
38396c6123
commit
c7adb4907c
@ -464,28 +464,40 @@ bool OpenDHTClient::searchKey(std::string key, std::list<std::string> &values)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef OPENDHT_DEBUG
|
||||
std::cerr << "Parsing expression :$$$$$$$$$-" << response << "-$$$$$$$$" << std::endl ;
|
||||
#endif
|
||||
|
||||
/* search through the response for <base64> ... </base64> */
|
||||
|
||||
uint32_t start = 0;
|
||||
uint32_t loc = 0;
|
||||
uint32_t end = 0;
|
||||
std::string::size_type start = 0;
|
||||
std::string::size_type loc = 0;
|
||||
std::string::size_type end = 0;
|
||||
|
||||
while(1)
|
||||
{
|
||||
loc = response.find("<base64>", start);
|
||||
if (loc == std::string::npos)
|
||||
return true; /* finished */
|
||||
#ifdef OPENDHT_DEBUG
|
||||
std::cerr << "found loc=" << loc << std::endl ;
|
||||
#endif
|
||||
loc += 8; /* shift to end of <base64> */
|
||||
|
||||
end = response.find("</base64>", loc);
|
||||
if (end == std::string::npos)
|
||||
return true; /* finished */
|
||||
#ifdef OPENDHT_DEBUG
|
||||
std::cerr << "found end=" << end << std::endl ;
|
||||
#endif
|
||||
|
||||
std::string value = response.substr(loc, end-loc);
|
||||
#ifdef OPENDHT_DEBUG
|
||||
std::cerr << "found value=" << value << std::endl ;
|
||||
#endif
|
||||
|
||||
/* clear out whitespace */
|
||||
for(uint32_t i = 0; i < value.length();)
|
||||
for(std::string::size_type i = 0; i < value.length();)
|
||||
{
|
||||
if (isspace(value[i]))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user