mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-28 17:04:58 -04:00
added generic function to return the correct string for scanf for unsigned ints depending on the size of the actual variable that is scanned. Shoudl fix the rehash bug and bugs corrupting timestamps on 32bits systems
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6987 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
50ebd781e5
commit
7bb561d9e0
3 changed files with 27 additions and 13 deletions
|
@ -159,6 +159,23 @@ bool RsDirUtil::crc32File(FILE *fd, uint64_t file_size,uint32_t chunk_size, CRC3
|
|||
return true ;
|
||||
}
|
||||
|
||||
const char *RsDirUtil::scanf_string_for_uint(int bytes)
|
||||
{
|
||||
const char *strgs[3] = { "%u","%lu","%llu" } ;
|
||||
|
||||
std::cerr << "RsDirUtil::scanf_string_for_uint(): returning for bytes=" << bytes << std::endl;
|
||||
|
||||
if(sizeof(unsigned int) == bytes)
|
||||
return strgs[0] ;
|
||||
if(sizeof(long unsigned int) == bytes)
|
||||
return strgs[1] ;
|
||||
if(sizeof(long long unsigned int) == bytes)
|
||||
return strgs[2] ;
|
||||
|
||||
std::cerr << "RsDirUtil::scanf_string_for_uint(): no corresponding scan string for "<< bytes << " bytes. This will probably cause inconsistencies." << std::endl;
|
||||
return strgs[0] ;
|
||||
}
|
||||
|
||||
void RsDirUtil::removeTopDir(const std::string& dir, std::string& path)
|
||||
{
|
||||
path.clear();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue