mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-18 10:57:18 -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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef OPENDHT_DEBUG
|
||||||
|
std::cerr << "Parsing expression :$$$$$$$$$-" << response << "-$$$$$$$$" << std::endl ;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* search through the response for <base64> ... </base64> */
|
/* search through the response for <base64> ... </base64> */
|
||||||
|
|
||||||
uint32_t start = 0;
|
std::string::size_type start = 0;
|
||||||
uint32_t loc = 0;
|
std::string::size_type loc = 0;
|
||||||
uint32_t end = 0;
|
std::string::size_type end = 0;
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
loc = response.find("<base64>", start);
|
loc = response.find("<base64>", start);
|
||||||
if (loc == std::string::npos)
|
if (loc == std::string::npos)
|
||||||
return true; /* finished */
|
return true; /* finished */
|
||||||
|
#ifdef OPENDHT_DEBUG
|
||||||
|
std::cerr << "found loc=" << loc << std::endl ;
|
||||||
|
#endif
|
||||||
loc += 8; /* shift to end of <base64> */
|
loc += 8; /* shift to end of <base64> */
|
||||||
|
|
||||||
end = response.find("</base64>", loc);
|
end = response.find("</base64>", loc);
|
||||||
if (end == std::string::npos)
|
if (end == std::string::npos)
|
||||||
return true; /* finished */
|
return true; /* finished */
|
||||||
|
#ifdef OPENDHT_DEBUG
|
||||||
|
std::cerr << "found end=" << end << std::endl ;
|
||||||
|
#endif
|
||||||
|
|
||||||
std::string value = response.substr(loc, end-loc);
|
std::string value = response.substr(loc, end-loc);
|
||||||
|
#ifdef OPENDHT_DEBUG
|
||||||
|
std::cerr << "found value=" << value << std::endl ;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* clear out whitespace */
|
/* 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]))
|
if (isspace(value[i]))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user