mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-15 10:54:22 -05:00
suppressed uninitialized memory due to empty cache file
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2274 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
467f8f7287
commit
d00739ce7b
@ -679,25 +679,28 @@ void FileIndexMonitor::locked_saveFileIndexes()
|
|||||||
fi.saveIndex(fname_total, calchash, sizetmp,std::set<std::string>()); // save all files
|
fi.saveIndex(fname_total, calchash, sizetmp,std::set<std::string>()); // save all files
|
||||||
fi.saveIndex(fname_browsable, calchash, size,forbidden_dirs); // save only browsable files
|
fi.saveIndex(fname_browsable, calchash, size,forbidden_dirs); // save only browsable files
|
||||||
|
|
||||||
|
if(size > 0)
|
||||||
|
{
|
||||||
#ifdef FIM_DEBUG
|
#ifdef FIM_DEBUG
|
||||||
std::cerr << "FileIndexMonitor::updateCycle() saved with hash:" << calchash;
|
std::cerr << "FileIndexMonitor::updateCycle() saved with hash:" << calchash;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* should clean up the previous cache.... */
|
/* should clean up the previous cache.... */
|
||||||
|
|
||||||
/* flag as new info */
|
/* flag as new info */
|
||||||
CacheData data;
|
CacheData data;
|
||||||
data.pid = fi.root->id;
|
data.pid = fi.root->id;
|
||||||
data.cid.type = getCacheType();
|
data.cid.type = getCacheType();
|
||||||
data.cid.subid = 0;
|
data.cid.subid = 0;
|
||||||
data.path = path;
|
data.path = path;
|
||||||
data.name = tmpname_browsable;
|
data.name = tmpname_browsable;
|
||||||
data.hash = calchash;
|
data.hash = calchash;
|
||||||
data.size = size;
|
data.size = size;
|
||||||
data.recvd = time(NULL);
|
data.recvd = time(NULL);
|
||||||
|
|
||||||
updateCache(data);
|
updateCache(data);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef FIM_DEBUG
|
#ifdef FIM_DEBUG
|
||||||
std::cerr << "FileIndexMonitor::updateCycle() called updateCache()";
|
std::cerr << "FileIndexMonitor::updateCycle() called updateCache()";
|
||||||
|
@ -923,6 +923,9 @@ int FileIndex::saveIndex(std::string filename, std::string &fileHash, uint64_t &
|
|||||||
std::ofstream file (filenametmp.c_str(), std::ofstream::binary);
|
std::ofstream file (filenametmp.c_str(), std::ofstream::binary);
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
|
|
||||||
|
size = 0 ;
|
||||||
|
fileHash = "" ;
|
||||||
|
|
||||||
if (!file)
|
if (!file)
|
||||||
{
|
{
|
||||||
#ifdef FI_DEBUG
|
#ifdef FI_DEBUG
|
||||||
|
Loading…
Reference in New Issue
Block a user