mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
corrected a bug due to reading uint64_t with wrong format on some systems, which caused the hash cache to sometime fail
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4437 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
e4f89892a3
commit
fc05314af0
@ -130,11 +130,22 @@ HashCache::HashCache(const std::string& path)
|
|||||||
f.getline(buff,max_line_size,'\n') ;
|
f.getline(buff,max_line_size,'\n') ;
|
||||||
std::string name(buff) ;
|
std::string name(buff) ;
|
||||||
|
|
||||||
f.getline(buff,max_line_size,'\n') ; if(sscanf(buff,"%lld",&info.size) != 1) break ;
|
f.getline(buff,max_line_size,'\n') ; //if(sscanf(buff,"%llu",&info.size) != 1) break ;
|
||||||
|
|
||||||
|
std::istringstream ss(buff) ;
|
||||||
|
info.size = 0 ;
|
||||||
|
ss >> info.size ;
|
||||||
|
|
||||||
f.getline(buff,max_line_size,'\n') ; if(sscanf(buff,"%ld",&info.time_stamp) != 1) break ;
|
f.getline(buff,max_line_size,'\n') ; if(sscanf(buff,"%ld",&info.time_stamp) != 1) break ;
|
||||||
f.getline(buff,max_line_size,'\n') ; if(sscanf(buff,"%ld",&info.modf_stamp) != 1) break ;
|
f.getline(buff,max_line_size,'\n') ; if(sscanf(buff,"%ld",&info.modf_stamp) != 1) break ;
|
||||||
f.getline(buff,max_line_size,'\n') ; info.hash = std::string(buff) ;
|
f.getline(buff,max_line_size,'\n') ; info.hash = std::string(buff) ;
|
||||||
|
|
||||||
|
if(info.hash.length() != 40)
|
||||||
|
{
|
||||||
|
std::cerr << "Loaded hash is not a hash: " << info.hash << std::endl;
|
||||||
|
break ;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef FIM_DEBUG
|
#ifdef FIM_DEBUG
|
||||||
std::cerr << " (" << name << ", " << info.size << ", " << info.time_stamp << ", " << info.modf_stamp << ", " << info.hash << std::endl ;
|
std::cerr << " (" << name << ", " << info.size << ", " << info.time_stamp << ", " << info.modf_stamp << ", " << info.hash << std::endl ;
|
||||||
++n ;
|
++n ;
|
||||||
|
Loading…
Reference in New Issue
Block a user