From a98642dab5ba54a7c058ed0958d19f8431d3b027 Mon Sep 17 00:00:00 2001 From: csoler Date: Mon, 26 Aug 2013 17:44:38 +0000 Subject: [PATCH] avoid corrupting file cache on 64bits architectures that store time_t as 32 bits git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6619 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/dbase/fimonitor.cc | 4 ++-- libretroshare/src/dbase/fimonitor.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libretroshare/src/dbase/fimonitor.cc b/libretroshare/src/dbase/fimonitor.cc index 6cb29aa9c..b475225f3 100644 --- a/libretroshare/src/dbase/fimonitor.cc +++ b/libretroshare/src/dbase/fimonitor.cc @@ -199,7 +199,7 @@ bool HashCache::find(const std::string& full_path,uint64_t size,time_t time_stam time_t now = time(NULL) ; std::map::iterator it(_files.find(full_path)) ; - if(it != _files.end() && time_stamp == it->second.modf_stamp && size == it->second.size) + if(it != _files.end() && (uint64_t)time_stamp == it->second.modf_stamp && size == it->second.size) { hash = it->second.hash ; it->second.time_stamp = now ; @@ -244,7 +244,7 @@ void HashCache::clean() #endif for(std::map::iterator it(_files.begin());it!=_files.end();) - if(it->second.time_stamp + duration < now) + if(it->second.time_stamp + duration < (uint64_t)now) { #ifdef FIM_DEBUG std::cerr << " Entry too old: " << it->first << ", ts=" << it->second.time_stamp << std::endl ; diff --git a/libretroshare/src/dbase/fimonitor.h b/libretroshare/src/dbase/fimonitor.h index 8d9f1a1f2..f725c5ee3 100644 --- a/libretroshare/src/dbase/fimonitor.h +++ b/libretroshare/src/dbase/fimonitor.h @@ -84,8 +84,8 @@ class HashCache typedef struct { uint64_t size ; - time_t time_stamp ; - time_t modf_stamp ; + uint64_t time_stamp ; + uint64_t modf_stamp ; std::string hash ; } HashCacheInfo ;