mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-03 14:45:12 -04:00
added large file support
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1575 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
70a5cbf107
commit
2597e6a61e
3 changed files with 27 additions and 16 deletions
|
@ -94,14 +94,14 @@ bool ftFileCreator::addFileData(uint64_t offset, uint32_t chunk_size, void *data
|
|||
/*
|
||||
* go to the offset of the file
|
||||
*/
|
||||
if (0 != fseek(this->fd, offset, SEEK_SET))
|
||||
if (0 != fseeko64(this->fd, offset, SEEK_SET))
|
||||
{
|
||||
std::cerr << "ftFileCreator::addFileData() Bad fseek" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
long int pos;
|
||||
pos = ftell(fd);
|
||||
uint64_t pos;
|
||||
pos = ftello64(fd);
|
||||
/*
|
||||
* add the data
|
||||
*/
|
||||
|
@ -117,7 +117,7 @@ bool ftFileCreator::addFileData(uint64_t offset, uint32_t chunk_size, void *data
|
|||
return 0;
|
||||
}
|
||||
|
||||
pos = ftell(fd);
|
||||
pos = ftello64(fd);
|
||||
|
||||
#ifdef FILE_DEBUG
|
||||
std::cerr << "ftFileCreator::addFileData() added Data...";
|
||||
|
@ -166,7 +166,7 @@ int ftFileCreator::initializeFileAttrs()
|
|||
* attempt to open file
|
||||
*/
|
||||
|
||||
fd = fopen(file_name.c_str(), "r+b");
|
||||
fd = fopen64(file_name.c_str(), "r+b");
|
||||
if (!fd)
|
||||
{
|
||||
std::cerr << "ftFileCreator::initializeFileAttrs() Failed to open (r+b): ";
|
||||
|
@ -176,7 +176,7 @@ int ftFileCreator::initializeFileAttrs()
|
|||
std::cerr << std::endl;
|
||||
|
||||
/* try opening for write */
|
||||
fd = fopen(file_name.c_str(), "w+b");
|
||||
fd = fopen64(file_name.c_str(), "w+b");
|
||||
if (!fd)
|
||||
{
|
||||
std::cerr << "ftFileCreator::initializeFileAttrs()";
|
||||
|
@ -193,13 +193,13 @@ int ftFileCreator::initializeFileAttrs()
|
|||
* move to the end
|
||||
*/
|
||||
|
||||
if (0 != fseek(fd, 0L, SEEK_END))
|
||||
if (0 != fseeko64(fd, 0L, SEEK_END))
|
||||
{
|
||||
std::cerr << "ftFileCreator::initializeFileAttrs() Seek Failed" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t recvdsize = ftell(fd);
|
||||
uint64_t recvdsize = ftello64(fd);
|
||||
|
||||
std::cerr << "ftFileCreator::initializeFileAttrs() File Expected Size: " << mSize << " RecvdSize: " << recvdsize << std::endl;
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ bool ftFileProvider::getFileData(uint64_t offset, uint32_t &chunk_size, void *da
|
|||
/*
|
||||
* seek for base_loc
|
||||
*/
|
||||
fseek(fd, base_loc, SEEK_SET);
|
||||
fseeko64(fd, base_loc, SEEK_SET);
|
||||
|
||||
// Data space allocated by caller.
|
||||
//void *data = malloc(chunk_size);
|
||||
|
@ -191,14 +191,14 @@ int ftFileProvider::initializeFileAttrs()
|
|||
* attempt to open file
|
||||
*/
|
||||
|
||||
fd = fopen(file_name.c_str(), "rb");
|
||||
fd = fopen64(file_name.c_str(), "rb");
|
||||
if (!fd)
|
||||
{
|
||||
std::cerr << "ftFileProvider::initializeFileAttrs() Failed to open (r+b): ";
|
||||
std::cerr << file_name << std::endl;
|
||||
|
||||
/* try opening read only */
|
||||
fd = fopen(file_name.c_str(), "rb");
|
||||
fd = fopen64(file_name.c_str(), "rb");
|
||||
if (!fd)
|
||||
{
|
||||
std::cerr << "ftFileProvider::initializeFileAttrs() Failed to open (rb): ";
|
||||
|
@ -214,13 +214,13 @@ int ftFileProvider::initializeFileAttrs()
|
|||
* move to the end
|
||||
*/
|
||||
|
||||
if (0 != fseek(fd, 0L, SEEK_END))
|
||||
if (0 != fseeko64(fd, 0L, SEEK_END))
|
||||
{
|
||||
std::cerr << "ftFileProvider::initializeFileAttrs() Seek Failed" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t recvdsize = ftell(fd);
|
||||
uint64_t recvdsize = ftello64(fd);
|
||||
|
||||
std::cerr << "ftFileProvider::initializeFileAttrs() File Expected Size: " << mSize << " RecvdSize: " << recvdsize << std::endl;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue