mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Merge pull request #1 from hunbernd/v0.6-FileLists
Fixed compilation on Windows and with 32 bit compiler
This commit is contained in:
commit
96b333d67e
@ -23,6 +23,7 @@
|
||||
*
|
||||
*/
|
||||
#include <sstream>
|
||||
#include <time.h>
|
||||
#include "util/rsdir.h"
|
||||
#include "util/rsprint.h"
|
||||
#include "retroshare/rsexpr.h"
|
||||
|
@ -23,6 +23,7 @@
|
||||
*
|
||||
*/
|
||||
#include <set>
|
||||
#include <time.h>
|
||||
#include "serialiser/rstlvbinary.h"
|
||||
#include "retroshare/rspeers.h"
|
||||
#include "util/rsdir.h"
|
||||
|
@ -29,17 +29,17 @@
|
||||
#include "filelist_io.h"
|
||||
|
||||
template<> bool FileListIO::serialise(unsigned char *buff,uint32_t size,uint32_t& offset,const uint32_t & val) { return setRawUInt32(buff,size,&offset,val) ; }
|
||||
template<> bool FileListIO::serialise(unsigned char *buff,uint32_t size,uint32_t& offset,const size_t & val) { return setRawUInt64(buff,size,&offset,val) ; }
|
||||
template<> bool FileListIO::serialise(unsigned char *buff,uint32_t size,uint32_t& offset,const uint64_t & val) { return setRawUInt64(buff,size,&offset,val) ; }
|
||||
template<> bool FileListIO::serialise(unsigned char *buff,uint32_t size,uint32_t& offset,const std::string & val) { return setRawString(buff,size,&offset,val) ; }
|
||||
template<> bool FileListIO::serialise(unsigned char *buff,uint32_t size,uint32_t& offset,const Sha1CheckSum & val) { return val.serialise(buff,size,offset) ; }
|
||||
|
||||
template<> bool FileListIO::deserialise(const unsigned char *buff,uint32_t size,uint32_t& offset,uint32_t & val) { return getRawUInt32(const_cast<uint8_t*>(buff),size,&offset,&val) ; }
|
||||
template<> bool FileListIO::deserialise(const unsigned char *buff,uint32_t size,uint32_t& offset,size_t & val) { return getRawUInt64(const_cast<uint8_t*>(buff),size,&offset,&val) ; }
|
||||
template<> bool FileListIO::deserialise(const unsigned char *buff,uint32_t size,uint32_t& offset,uint64_t & val) { return getRawUInt64(const_cast<uint8_t*>(buff),size,&offset,&val) ; }
|
||||
template<> bool FileListIO::deserialise(const unsigned char *buff,uint32_t size,uint32_t& offset,std::string & val) { return getRawString(const_cast<uint8_t*>(buff),size,&offset,val) ; }
|
||||
template<> bool FileListIO::deserialise(const unsigned char *buff,uint32_t size,uint32_t& offset,Sha1CheckSum & val) { return val.deserialise(const_cast<uint8_t*>(buff),size,offset) ; }
|
||||
|
||||
template<> uint32_t FileListIO::serial_size(const uint32_t & ) { return 4 ; }
|
||||
template<> uint32_t FileListIO::serial_size(const size_t & ) { return 8 ; }
|
||||
template<> uint32_t FileListIO::serial_size(const uint64_t & ) { return 8 ; }
|
||||
template<> uint32_t FileListIO::serial_size(const std::string & val) { return getRawStringSize(val) ; }
|
||||
template<> uint32_t FileListIO::serial_size(const Sha1CheckSum & ) { return Sha1CheckSum::serial_size(); }
|
||||
|
||||
|
@ -146,7 +146,7 @@ void HashStorage::data_tick()
|
||||
std::cerr << "Hashing file " << job.full_path << "..." ; std::cerr.flush();
|
||||
|
||||
std::string tmpout;
|
||||
rs_sprintf(tmpout, "%lu/%lu (%s - %d%%) : %s", mHashCounter+1, mTotalFilesToHash, friendlyUnit(mTotalHashedSize).c_str(), int(mTotalHashedSize/double(mTotalSizeToHash)*100.0), job.full_path.c_str()) ;
|
||||
rs_sprintf(tmpout, "%lu/%lu (%s - %d%%) : %s", (unsigned long int)mHashCounter+1, (unsigned long int)mTotalFilesToHash, friendlyUnit(mTotalHashedSize).c_str(), int(mTotalHashedSize/double(mTotalSizeToHash)*100.0), job.full_path.c_str()) ;
|
||||
|
||||
RsServer::notify()->notifyHashingInfo(NOTIFY_HASHTYPE_HASH_FILE, tmpout) ;
|
||||
|
||||
|
@ -129,7 +129,7 @@ private:
|
||||
|
||||
RsMutex mHashMtx ;
|
||||
bool mRunning;
|
||||
uint32_t mHashCounter;
|
||||
uint64_t mHashCounter;
|
||||
uint32_t mInactivitySleepTime ;
|
||||
uint64_t mTotalSizeToHash ;
|
||||
uint64_t mTotalHashedSize ;
|
||||
|
@ -4,6 +4,10 @@
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef WINDOWS_SYS
|
||||
#include "util/rswin.h"
|
||||
#endif
|
||||
|
||||
#include "folderiterator.h"
|
||||
#include "rsstring.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user