From 71797d6f708333d2edc11886f3dae9becdba135c Mon Sep 17 00:00:00 2001 From: drbob Date: Thu, 20 Nov 2008 22:59:58 +0000 Subject: [PATCH] Fixed compatibility bug in file transfer... can now communicate between V0.4.9b and V0.4.11+ git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@827 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/ft/ftfilecreator.cc | 2 +- libretroshare/src/ft/ftfilecreator.h | 2 +- libretroshare/src/ft/ftfileprovider.cc | 3 ++- libretroshare/src/ft/ftfileprovider.h | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/libretroshare/src/ft/ftfilecreator.cc b/libretroshare/src/ft/ftfilecreator.cc index 631fe18db..bc232ac4a 100644 --- a/libretroshare/src/ft/ftfilecreator.cc +++ b/libretroshare/src/ft/ftfilecreator.cc @@ -40,7 +40,7 @@ hash, uint64_t recvd): ftFileProvider(path,size,hash) } bool ftFileCreator::getFileData(uint64_t offset, - uint32_t chunk_size, void *data) + uint32_t &chunk_size, void *data) { { RsStackMutex stack(ftcMutex); /********** STACK LOCKED MTX ******/ diff --git a/libretroshare/src/ft/ftfilecreator.h b/libretroshare/src/ft/ftfilecreator.h index 0451c25b5..2968b0ca9 100644 --- a/libretroshare/src/ft/ftfilecreator.h +++ b/libretroshare/src/ft/ftfilecreator.h @@ -45,7 +45,7 @@ public: ~ftFileCreator(); /* overloaded from FileProvider */ -virtual bool getFileData(uint64_t offset, uint32_t chunk_size, void *data); +virtual bool getFileData(uint64_t offset, uint32_t &chunk_size, void *data); bool finished() { return getRecvd() == getFileSize(); } uint64_t getRecvd(); diff --git a/libretroshare/src/ft/ftfileprovider.cc b/libretroshare/src/ft/ftfileprovider.cc index 38cef8651..cea9146d9 100644 --- a/libretroshare/src/ft/ftfileprovider.cc +++ b/libretroshare/src/ft/ftfileprovider.cc @@ -46,7 +46,7 @@ bool ftFileProvider::FileDetails(FileInfo &info) } -bool ftFileProvider::getFileData(uint64_t offset, uint32_t chunk_size, void *data) +bool ftFileProvider::getFileData(uint64_t offset, uint32_t &chunk_size, void *data) { /* dodgey checking outside of mutex... * much check again inside FileAttrs(). @@ -71,6 +71,7 @@ bool ftFileProvider::getFileData(uint64_t offset, uint32_t chunk_size, void *dat if (base_loc + data_size > mSize) { data_size = mSize - base_loc; + chunk_size = mSize - base_loc; std::cerr <<"Chunk Size greater than total file size, adjusting chunk size " << data_size << std::endl; } diff --git a/libretroshare/src/ft/ftfileprovider.h b/libretroshare/src/ft/ftfileprovider.h index 0d446a21e..1001c6e97 100644 --- a/libretroshare/src/ft/ftfileprovider.h +++ b/libretroshare/src/ft/ftfileprovider.h @@ -41,7 +41,7 @@ public: ftFileProvider(std::string path, uint64_t size, std::string hash); virtual ~ftFileProvider(); - virtual bool getFileData(uint64_t offset, uint32_t chunk_size, void *data); + virtual bool getFileData(uint64_t offset, uint32_t &chunk_size, void *data); virtual bool FileDetails(FileInfo &info); std::string getHash(); uint64_t getFileSize();