summaryrefslogtreecommitdiff
path: root/indra/llvfs/lllfsthread.cpp
diff options
context:
space:
mode:
authorBrad Kittenbrink <brad@lindenlab.com>2009-02-18 21:10:16 +0000
committerBrad Kittenbrink <brad@lindenlab.com>2009-02-18 21:10:16 +0000
commitabdc99f21b542c4fea67030ddbd7166c9d1c6c63 (patch)
tree3e984e405adfdec189ca8a047daca5250737ffbf /indra/llvfs/lllfsthread.cpp
parent34412f0530cf6a411b4de906a8e9da59cbcb3a85 (diff)
Merge of QAR-1267 to trunk. This was a combo merge of QAR-1175 (maint-render-9) and QAR-1236 (dll-msvcrt-2)
svn merge -r 109838:112264 svn+ssh://svn.lindenlab.com/svn/linden/branches/maint-render/maint-render-9-merge-r109833
Diffstat (limited to 'indra/llvfs/lllfsthread.cpp')
-rw-r--r--indra/llvfs/lllfsthread.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/indra/llvfs/lllfsthread.cpp b/indra/llvfs/lllfsthread.cpp
index a55b5402ed..704e1ab142 100644
--- a/indra/llvfs/lllfsthread.cpp
+++ b/indra/llvfs/lllfsthread.cpp
@@ -73,6 +73,10 @@ LLLFSThread::LLLFSThread(bool threaded) :
LLQueuedThread("LFS", threaded),
mPriorityCounter(PRIORITY_LOWBITS)
{
+ if(!mLocalAPRFilePoolp)
+ {
+ mLocalAPRFilePoolp = new LLVolatileAPRPool() ;
+ }
}
LLLFSThread::~LLLFSThread()
@@ -184,8 +188,9 @@ bool LLLFSThread::Request::processRequest()
if (mOperation == FILE_READ)
{
llassert(mOffset >= 0);
- apr_file_t* filep = ll_apr_file_open(mFileName, LL_APR_RB, mThread->mAPRPoolp);
- if (!filep)
+ LLAPRFile infile ;
+ infile.open(mThread->getLocalAPRFilePool(), mFileName, LL_APR_RB);
+ if (!infile.getFileHandle())
{
llwarns << "LLLFS: Unable to read file: " << mFileName << llendl;
mBytesRead = 0; // fail
@@ -193,13 +198,13 @@ bool LLLFSThread::Request::processRequest()
}
S32 off;
if (mOffset < 0)
- off = ll_apr_file_seek(filep, APR_END, 0);
+ off = infile.seek(APR_END, 0);
else
- off = ll_apr_file_seek(filep, APR_SET, mOffset);
+ off = infile.seek(APR_SET, mOffset);
llassert_always(off >= 0);
- mBytesRead = ll_apr_file_read(filep, mBuffer, mBytes );
- apr_file_close(filep);
+ mBytesRead = infile.read(mBuffer, mBytes );
complete = true;
+ infile.close() ;
// llinfos << "LLLFSThread::READ:" << mFileName << " Bytes: " << mBytesRead << llendl;
}
else if (mOperation == FILE_WRITE)
@@ -207,8 +212,9 @@ bool LLLFSThread::Request::processRequest()
apr_int32_t flags = APR_CREATE|APR_WRITE|APR_BINARY;
if (mOffset < 0)
flags |= APR_APPEND;
- apr_file_t* filep = ll_apr_file_open(mFileName, flags, mThread->mAPRPoolp);
- if (!filep)
+ LLAPRFile outfile ;
+ outfile.open(mThread->getLocalAPRFilePool(), mFileName, flags);
+ if (!outfile.getFileHandle())
{
llwarns << "LLLFS: Unable to write file: " << mFileName << llendl;
mBytesRead = 0; // fail
@@ -216,18 +222,17 @@ bool LLLFSThread::Request::processRequest()
}
if (mOffset >= 0)
{
- S32 seek = ll_apr_file_seek(filep, APR_SET, mOffset);
+ S32 seek = outfile.seek(APR_SET, mOffset);
if (seek < 0)
{
- apr_file_close(filep);
llwarns << "LLLFS: Unable to write file (seek failed): " << mFileName << llendl;
mBytesRead = 0; // fail
return true;
}
}
- mBytesRead = ll_apr_file_write(filep, mBuffer, mBytes );
+ mBytesRead = outfile.write(mBuffer, mBytes );
complete = true;
- apr_file_close(filep);
+
// llinfos << "LLLFSThread::WRITE:" << mFileName << " Bytes: " << mBytesRead << "/" << mBytes << " Offset:" << mOffset << llendl;
}
else