LLAPRFile cleaned up
This commit is contained in:
@@ -225,8 +225,7 @@ ELoadStatus LLBVHLoader::loadTranslationTable(const char *fileName)
|
||||
//--------------------------------------------------------------------
|
||||
std::string path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,fileName);
|
||||
|
||||
LLAPRFile infile ;
|
||||
infile.open(path, LL_APR_R);
|
||||
LLAPRFile infile(path, LL_APR_R);
|
||||
apr_file_t *fp = infile.getFileHandle();
|
||||
if (!fp)
|
||||
return E_ST_NO_XLT_FILE;
|
||||
|
||||
@@ -357,8 +357,7 @@ BOOL LLKeyframeMotionParam::loadMotions()
|
||||
// open the file
|
||||
//-------------------------------------------------------------------------
|
||||
S32 fileSize = 0;
|
||||
LLAPRFile infile ;
|
||||
infile.open(path, LL_APR_R, LLAPRFile::global, &fileSize);
|
||||
LLAPRFile infile(path, LL_APR_R, &fileSize);
|
||||
apr_file_t* fp = infile.getFileHandle() ;
|
||||
if (!fp || fileSize == 0)
|
||||
{
|
||||
|
||||
@@ -210,8 +210,7 @@ LLFSMState* LLStateDiagram::getState(U32 state_id)
|
||||
|
||||
BOOL LLStateDiagram::saveDotFile(const std::string& filename)
|
||||
{
|
||||
LLAPRFile outfile ;
|
||||
outfile.open(filename, LL_APR_W);
|
||||
LLAPRFile outfile(filename, LL_APR_W);
|
||||
apr_file_t* dot_file = outfile.getFileHandle() ;
|
||||
|
||||
if (!dot_file)
|
||||
|
||||
@@ -102,12 +102,12 @@ LLAPRFile::LLAPRFile()
|
||||
{
|
||||
}
|
||||
|
||||
LLAPRFile::LLAPRFile(const std::string& filename, apr_int32_t flags, access_t access_type)
|
||||
LLAPRFile::LLAPRFile(const std::string& filename, apr_int32_t flags, S32* sizep, access_t access_type)
|
||||
: mFile(NULL),
|
||||
mVolatileFilePoolp(NULL),
|
||||
mRegularFilePoolp(NULL)
|
||||
{
|
||||
open(filename, flags, access_type);
|
||||
open(filename, flags, access_type, sizep);
|
||||
}
|
||||
|
||||
LLAPRFile::~LLAPRFile()
|
||||
@@ -147,7 +147,8 @@ apr_status_t LLAPRFile::open(std::string const& filename, apr_int32_t flags, acc
|
||||
apr_status_t status;
|
||||
{
|
||||
apr_pool_t* apr_file_open_pool;
|
||||
if (access_type == local)
|
||||
// This is a temporary variable for a pool that is passed directly to apr_file_open below.
|
||||
if (access_type == short_lived)
|
||||
{
|
||||
// Use a "volatile" thread-local pool.
|
||||
mVolatileFilePoolp = &AIThreadLocalData::tldata().mVolatileAPRPool;
|
||||
@@ -193,7 +194,7 @@ apr_status_t LLAPRFile::open(std::string const& filename, apr_int32_t flags, acc
|
||||
|
||||
apr_status_t LLAPRFile::open(const std::string& filename, apr_int32_t flags, BOOL use_global_pool)
|
||||
{
|
||||
return open(filename, flags, use_global_pool ? LLAPRFile::global : LLAPRFile::local);
|
||||
return open(filename, flags, use_global_pool ? LLAPRFile::long_lived : LLAPRFile::short_lived);
|
||||
}
|
||||
// File I/O
|
||||
S32 LLAPRFile::read(void *buf, S32 nbytes)
|
||||
|
||||
@@ -145,15 +145,15 @@ private:
|
||||
|
||||
public:
|
||||
enum access_t {
|
||||
global, // Use a global pool for long-lived file accesses. This should really only happen from the main thread.
|
||||
local // Use a thread-local volatile pool for short file accesses.
|
||||
long_lived, // Use a global pool for long-lived file accesses.
|
||||
short_lived // Use a volatile pool for short-lived file accesses.
|
||||
};
|
||||
|
||||
LLAPRFile() ;
|
||||
LLAPRFile(const std::string& filename, apr_int32_t flags, access_t access_type = LLAPRFile::global);
|
||||
LLAPRFile(const std::string& filename, apr_int32_t flags, S32* sizep = NULL, access_t access_type = short_lived);
|
||||
~LLAPRFile() ;
|
||||
|
||||
apr_status_t open(const std::string& filename, apr_int32_t flags, access_t access_type = LLAPRFile::global, S32* sizep = NULL);
|
||||
apr_status_t open(const std::string& filename, apr_int32_t flags, access_t access_type = short_lived, S32* sizep = NULL);
|
||||
apr_status_t open(const std::string& filename, apr_int32_t flags, BOOL use_global_pool); //use global pool.
|
||||
apr_status_t close() ;
|
||||
|
||||
|
||||
@@ -1580,8 +1580,7 @@ BOOL LLImageFormatted::load(const std::string &filename)
|
||||
resetLastError();
|
||||
|
||||
S32 file_size = 0;
|
||||
LLAPRFile infile ;
|
||||
infile.open(filename, LL_APR_RB, LLAPRFile::global, &file_size);
|
||||
LLAPRFile infile(filename, LL_APR_RB, &file_size);
|
||||
apr_file_t* apr_file = infile.getFileHandle();
|
||||
if (!apr_file)
|
||||
{
|
||||
@@ -1616,8 +1615,7 @@ BOOL LLImageFormatted::save(const std::string &filename)
|
||||
{
|
||||
resetLastError();
|
||||
|
||||
LLAPRFile outfile ;
|
||||
outfile.open(filename, LL_APR_WB, LLAPRFile::global);
|
||||
LLAPRFile outfile(filename, LL_APR_WB);
|
||||
if (!outfile.getFileHandle())
|
||||
{
|
||||
setLastError("Unable to open file for writing", filename);
|
||||
|
||||
@@ -473,8 +473,7 @@ BOOL LLImageJ2C::loadAndValidate(const std::string &filename)
|
||||
resetLastError();
|
||||
|
||||
S32 file_size = 0;
|
||||
LLAPRFile infile ;
|
||||
infile.open(filename, LL_APR_RB, LLAPRFile::global, &file_size);
|
||||
LLAPRFile infile(filename, LL_APR_RB, &file_size);
|
||||
apr_file_t* apr_file = infile.getFileHandle() ;
|
||||
if (!apr_file)
|
||||
{
|
||||
|
||||
@@ -184,8 +184,7 @@ bool LLLFSThread::Request::processRequest()
|
||||
if (mOperation == FILE_READ)
|
||||
{
|
||||
llassert(mOffset >= 0);
|
||||
LLAPRFile infile ; // auto-closes
|
||||
infile.open(mFileName, LL_APR_RB, LLAPRFile::local);
|
||||
LLAPRFile infile(mFileName, LL_APR_RB);
|
||||
if (!infile.getFileHandle())
|
||||
{
|
||||
llwarns << "LLLFS: Unable to read file: " << mFileName << llendl;
|
||||
@@ -207,8 +206,7 @@ bool LLLFSThread::Request::processRequest()
|
||||
apr_int32_t flags = APR_CREATE|APR_WRITE|APR_BINARY;
|
||||
if (mOffset < 0)
|
||||
flags |= APR_APPEND;
|
||||
LLAPRFile outfile ;
|
||||
outfile.open(mFileName, flags, LLAPRFile::local);
|
||||
LLAPRFile outfile(mFileName, flags);
|
||||
if (!outfile.getFileHandle())
|
||||
{
|
||||
llwarns << "LLLFS: Unable to write file: " << mFileName << llendl;
|
||||
|
||||
@@ -2098,8 +2098,7 @@ void LLVFS::dumpFiles()
|
||||
std::string filename = id.asString() + extension;
|
||||
llinfos << " Writing " << filename << llendl;
|
||||
|
||||
LLAPRFile outfile;
|
||||
outfile.open(filename, LL_APR_WB, LLAPRFile::local);
|
||||
LLAPRFile outfile(filename, LL_APR_WB);
|
||||
outfile.write(&buffer[0], size);
|
||||
outfile.close();
|
||||
|
||||
|
||||
@@ -2677,8 +2677,7 @@ void LLAppViewer::handleViewerCrash()
|
||||
else crash_file_name = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,ERROR_MARKER_FILE_NAME);
|
||||
llinfos << "Creating crash marker file " << crash_file_name << llendl;
|
||||
|
||||
LLAPRFile crash_file ;
|
||||
crash_file.open(crash_file_name, LL_APR_W, LLAPRFile::local);
|
||||
LLAPRFile crash_file(crash_file_name, LL_APR_W);
|
||||
if (crash_file.getFileHandle())
|
||||
{
|
||||
LL_INFOS("MarkerFile") << "Created crash marker file " << crash_file_name << LL_ENDL;
|
||||
@@ -2749,8 +2748,7 @@ bool LLAppViewer::anotherInstanceRunning()
|
||||
if (LLAPRFile::isExist(marker_file, LL_APR_RB))
|
||||
{
|
||||
// File exists, try opening with write permissions
|
||||
LLAPRFile outfile ;
|
||||
outfile.open(marker_file, LL_APR_WB, LLAPRFile::global);
|
||||
LLAPRFile outfile(marker_file, LL_APR_WB);
|
||||
apr_file_t* fMarker = outfile.getFileHandle() ;
|
||||
if (!fMarker)
|
||||
{
|
||||
@@ -2827,7 +2825,7 @@ void LLAppViewer::initMarkerFile()
|
||||
|
||||
// Create the marker file for this execution & lock it
|
||||
apr_status_t s;
|
||||
s = mMarkerFile.open(mMarkerFileName, LL_APR_W, LLAPRFile::global);
|
||||
s = mMarkerFile.open(mMarkerFileName, LL_APR_W, LLAPRFile::long_lived);
|
||||
|
||||
if (s == APR_SUCCESS && mMarkerFile.getFileHandle())
|
||||
{
|
||||
@@ -4027,8 +4025,7 @@ void LLAppViewer::sendLogoutRequest()
|
||||
gLogoutInProgress = TRUE;
|
||||
mLogoutMarkerFileName = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,LOGOUT_MARKER_FILE_NAME);
|
||||
|
||||
LLAPRFile outfile ;
|
||||
outfile.open(mLogoutMarkerFileName, LL_APR_W, LLAPRFile::global);
|
||||
LLAPRFile outfile(mLogoutMarkerFileName, LL_APR_W);
|
||||
mLogoutMarkerFile = outfile.getFileHandle() ;
|
||||
if (mLogoutMarkerFile)
|
||||
{
|
||||
|
||||
@@ -8,177 +8,105 @@
|
||||
#include "llvorbisencode.h"
|
||||
#include "llwearable.h"
|
||||
#include "llbvhloader.h"
|
||||
#include <boost/bind.hpp>
|
||||
struct
|
||||
{
|
||||
std::string extension;
|
||||
LLAssetType::EType type;
|
||||
boost::function<bool(const std::string&, const std::string&)> conv_fn;
|
||||
}conversion_list[] =
|
||||
{
|
||||
{ "bmp", LLAssetType::AT_TEXTURE, boost::bind(&LLViewerTextureList::createUploadFile,_1,_2,IMG_CODEC_BMP) },
|
||||
{ "tga", LLAssetType::AT_TEXTURE, boost::bind(&LLViewerTextureList::createUploadFile,_1,_2,IMG_CODEC_TGA) },
|
||||
{ "jpg", LLAssetType::AT_TEXTURE, boost::bind(&LLViewerTextureList::createUploadFile,_1,_2,IMG_CODEC_JPEG)},
|
||||
{ "jpeg", LLAssetType::AT_TEXTURE, boost::bind(&LLViewerTextureList::createUploadFile,_1,_2,IMG_CODEC_JPEG)},
|
||||
{ "png", LLAssetType::AT_TEXTURE, boost::bind(&LLViewerTextureList::createUploadFile,_1,_2,IMG_CODEC_PNG) },
|
||||
{ "jp2", LLAssetType::AT_TEXTURE, &LLAssetConverter::copyFile },
|
||||
{ "j2k", LLAssetType::AT_TEXTURE, &LLAssetConverter::copyFile },
|
||||
{ "j2c", LLAssetType::AT_TEXTURE, &LLAssetConverter::copyFile },
|
||||
{ "wav", LLAssetType::AT_SOUND, &encode_vorbis_file },
|
||||
{ "ogg", LLAssetType::AT_SOUND, &LLAssetConverter::copyFile },
|
||||
{ "bvh", LLAssetType::AT_ANIMATION, &LLAssetConverter::copyBVH },
|
||||
{ "animatn", LLAssetType::AT_ANIMATION, &LLAssetConverter::copyFile },
|
||||
{ "gesture", LLAssetType::AT_GESTURE, &LLAssetConverter::copyFile },
|
||||
{ "notecard", LLAssetType::AT_NOTECARD, &LLAssetConverter::copyFile },
|
||||
{ "lsl", LLAssetType::AT_LSL_TEXT, &LLAssetConverter::copyFile },
|
||||
//tmp ?
|
||||
};
|
||||
|
||||
// static
|
||||
extern std::string STATUS[];
|
||||
LLAssetType::EType LLAssetConverter::convert(std::string src_filename, std::string filename)
|
||||
LLAssetType::EType LLAssetConverter::convert(const std::string &src_filename, const std::string &filename)
|
||||
{
|
||||
std::string exten = gDirUtilp->getExtension(src_filename);
|
||||
LLAssetType::EType asset_type = LLAssetType::AT_NONE;
|
||||
if (exten.empty())
|
||||
return LLAssetType::AT_NONE;
|
||||
else if(exten == "bmp")
|
||||
for(U32 i = 0;i < sizeof(conversion_list) / sizeof(conversion_list[0]); ++i)
|
||||
{
|
||||
asset_type = LLAssetType::AT_TEXTURE;
|
||||
if (!LLViewerTextureList::createUploadFile(src_filename,
|
||||
filename,
|
||||
IMG_CODEC_BMP ))
|
||||
if(conversion_list[i].extension == exten)
|
||||
{
|
||||
return LLAssetType::AT_NONE;
|
||||
return conversion_list[i].conv_fn(src_filename, filename) ?
|
||||
conversion_list[i].type : LLAssetType::AT_NONE;
|
||||
}
|
||||
}
|
||||
else if( exten == "tga")
|
||||
EWearableType wear_type = LLWearable::typeNameToType(exten);
|
||||
if(wear_type != WT_NONE && copyFile(src_filename, filename))
|
||||
{
|
||||
asset_type = LLAssetType::AT_TEXTURE;
|
||||
if (!LLViewerTextureList::createUploadFile(src_filename,
|
||||
filename,
|
||||
IMG_CODEC_TGA ))
|
||||
{
|
||||
return LLAssetType::AT_NONE;
|
||||
}
|
||||
return LLWearable::typeToAssetType(wear_type);
|
||||
}
|
||||
else if( exten == "jpg" || exten == "jpeg")
|
||||
{
|
||||
asset_type = LLAssetType::AT_TEXTURE;
|
||||
if (!LLViewerTextureList::createUploadFile(src_filename,
|
||||
filename,
|
||||
IMG_CODEC_JPEG ))
|
||||
{
|
||||
return LLAssetType::AT_NONE;
|
||||
}
|
||||
}
|
||||
else if( exten == "png")
|
||||
{
|
||||
asset_type = LLAssetType::AT_TEXTURE;
|
||||
if (!LLViewerTextureList::createUploadFile(src_filename,
|
||||
filename,
|
||||
IMG_CODEC_PNG ))
|
||||
{
|
||||
return LLAssetType::AT_NONE;
|
||||
}
|
||||
}
|
||||
else if(exten == "wav")
|
||||
{
|
||||
asset_type = LLAssetType::AT_SOUND;
|
||||
if(encode_vorbis_file(src_filename, filename) != LLVORBISENC_NOERR)
|
||||
{
|
||||
return LLAssetType::AT_NONE;
|
||||
}
|
||||
}
|
||||
else if(exten == "ogg")
|
||||
{
|
||||
asset_type = LLAssetType::AT_SOUND;
|
||||
if(!copyFile(src_filename, filename))
|
||||
{
|
||||
return LLAssetType::AT_NONE;
|
||||
}
|
||||
}
|
||||
//else if(exten == "tmp") FIXME
|
||||
else if (exten == "bvh")
|
||||
{
|
||||
|
||||
asset_type = LLAssetType::AT_ANIMATION;
|
||||
S32 file_size;
|
||||
LLAPRFile fp;
|
||||
fp.open(src_filename, LL_APR_RB, LLAPRFile::global, &file_size);
|
||||
if(!fp.getFileHandle()) return LLAssetType::AT_NONE;
|
||||
char* file_buffer = new char[file_size + 1];
|
||||
ELoadStatus load_status = E_ST_OK;
|
||||
S32 line_number = 0;
|
||||
LLBVHLoader* loaderp = new LLBVHLoader(file_buffer, load_status, line_number);
|
||||
|
||||
if(load_status == E_ST_NO_XLT_FILE)
|
||||
{
|
||||
llwarns << "NOTE: No translation table found." << llendl;
|
||||
}
|
||||
else
|
||||
{
|
||||
llwarns << "ERROR: [line: " << line_number << "] " << STATUS[load_status].c_str() << llendl;
|
||||
}
|
||||
S32 buffer_size = loaderp->getOutputSize();
|
||||
U8* buffer = new U8[buffer_size];
|
||||
LLDataPackerBinaryBuffer dp(buffer, buffer_size);
|
||||
loaderp->serialize(dp);
|
||||
LLAPRFile apr_file(filename, LL_APR_WB, LLAPRFile::global);
|
||||
apr_file.write(buffer, buffer_size);
|
||||
delete[] file_buffer;
|
||||
delete[] buffer;
|
||||
fp.close();
|
||||
apr_file.close();
|
||||
}
|
||||
else if (exten == "animatn")
|
||||
{
|
||||
asset_type = LLAssetType::AT_ANIMATION;
|
||||
if(!copyFile(src_filename, filename))
|
||||
{
|
||||
return LLAssetType::AT_NONE;
|
||||
}
|
||||
}
|
||||
else if(exten == "jp2" || exten == "j2k" || exten == "j2c")
|
||||
{
|
||||
asset_type = LLAssetType::AT_TEXTURE;
|
||||
if(!copyFile(src_filename, filename))
|
||||
{
|
||||
return LLAssetType::AT_NONE;
|
||||
}
|
||||
}
|
||||
else if(exten == "gesture")
|
||||
{
|
||||
asset_type = LLAssetType::AT_GESTURE;
|
||||
if(!copyFile(src_filename, filename))
|
||||
{
|
||||
return LLAssetType::AT_NONE;
|
||||
}
|
||||
}
|
||||
else if(exten == "notecard")
|
||||
{
|
||||
asset_type = LLAssetType::AT_NOTECARD;
|
||||
if(!copyFile(src_filename, filename))
|
||||
{
|
||||
return LLAssetType::AT_NONE;
|
||||
}
|
||||
}
|
||||
else if(exten == "lsl")
|
||||
{
|
||||
asset_type = LLAssetType::AT_LSL_TEXT;
|
||||
if(!copyFile(src_filename, filename))
|
||||
{
|
||||
return LLAssetType::AT_NONE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EWearableType wear_type = LLWearable::typeNameToType(exten);
|
||||
if(wear_type != WT_NONE)
|
||||
{
|
||||
asset_type = LLWearable::typeToAssetType(wear_type);
|
||||
if(!copyFile(src_filename, filename))
|
||||
{
|
||||
return LLAssetType::AT_NONE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
llwarns << "Unhandled extension" << llendl;
|
||||
return LLAssetType::AT_NONE;
|
||||
}
|
||||
}
|
||||
return asset_type;
|
||||
llwarns << "Unhandled extension" << llendl;
|
||||
return LLAssetType::AT_NONE;
|
||||
}
|
||||
BOOL LLAssetConverter::copyFile(std::string src_filename, std::string dst_filename)
|
||||
bool LLAssetConverter::copyFile(const std::string &src_filename, const std::string &dst_filename)
|
||||
{
|
||||
S32 src_size;
|
||||
LLAPRFile src_fp;
|
||||
src_fp.open(src_filename, LL_APR_RB, LLAPRFile::global, &src_size);
|
||||
if(!src_fp.getFileHandle()) return FALSE;
|
||||
LLAPRFile dst_fp;
|
||||
dst_fp.open(dst_filename, LL_APR_WB, LLAPRFile::global);
|
||||
if(!dst_fp.getFileHandle()) return FALSE;
|
||||
char* buffer = new char[src_size + 1];
|
||||
src_fp.read(buffer, src_size);
|
||||
dst_fp.write(buffer, src_size);
|
||||
src_fp.close();
|
||||
dst_fp.close();
|
||||
delete[] buffer;
|
||||
return TRUE;
|
||||
|
||||
LLAPRFile src_fp(src_filename, LL_APR_RB, &src_size);
|
||||
if(!src_fp.getFileHandle()) return false;
|
||||
|
||||
LLAPRFile dst_fp(dst_filename, LL_APR_WB);
|
||||
if(!dst_fp.getFileHandle()) return false;
|
||||
|
||||
std::vector<char> buffer(src_size + 1);
|
||||
|
||||
src_fp.read(&buffer[0], src_size);
|
||||
dst_fp.write(&buffer[0], src_size);
|
||||
|
||||
return true;
|
||||
}
|
||||
bool LLAssetConverter::copyBVH(const std::string &src_filename, const std::string &dst_filename)
|
||||
{
|
||||
S32 file_size;
|
||||
|
||||
LLAPRFile fp(src_filename, LL_APR_RB, &file_size);
|
||||
if(!fp.getFileHandle()) return false;
|
||||
|
||||
std::vector<char> buffer(file_size + 1);
|
||||
|
||||
ELoadStatus load_status = E_ST_OK;
|
||||
S32 line_number = 0;
|
||||
|
||||
LLBVHLoader* loaderp = new LLBVHLoader(&buffer[0], load_status, line_number);
|
||||
|
||||
if(load_status == E_ST_NO_XLT_FILE)
|
||||
{
|
||||
llwarns << "NOTE: No translation table found." << llendl;
|
||||
}
|
||||
else if(load_status != E_ST_OK)
|
||||
{
|
||||
llwarns << "ERROR: [line: " << line_number << "] " << STATUS[load_status].c_str() << llendl;
|
||||
}
|
||||
|
||||
buffer.resize(loaderp->getOutputSize());
|
||||
|
||||
LLDataPackerBinaryBuffer dp((U8*)&buffer[0], buffer.size());
|
||||
loaderp->serialize(dp);
|
||||
|
||||
delete loaderp;
|
||||
|
||||
LLAPRFile apr_file(dst_filename, LL_APR_RB, &file_size);
|
||||
if(!apr_file.getFileHandle()) return false;
|
||||
|
||||
apr_file.write(&buffer[0], buffer.size());
|
||||
return true;
|
||||
}
|
||||
// </edit>
|
||||
|
||||
@@ -8,8 +8,9 @@
|
||||
class LLAssetConverter
|
||||
{
|
||||
public:
|
||||
static LLAssetType::EType convert(std::string src_filename, std::string filename);
|
||||
static BOOL copyFile(std::string src_filename, std::string dest_filename);
|
||||
static LLAssetType::EType convert(const std::string &src_filename, const std::string &filename);
|
||||
static bool copyFile(const std::string &src_filename, const std::string &dest_filename);
|
||||
static bool copyBVH(const std::string &src_filename, const std::string &dst_filename);
|
||||
};
|
||||
#endif
|
||||
// </edit>
|
||||
|
||||
@@ -325,8 +325,7 @@ BOOL LLFloaterAnimPreview::postBuild()
|
||||
// now load bvh file
|
||||
S32 file_size;
|
||||
|
||||
LLAPRFile infile ;
|
||||
infile.open(mFilenameAndPath, LL_APR_RB, LLAPRFile::global, &file_size);
|
||||
LLAPRFile infile(mFilenameAndPath, LL_APR_RB, &file_size);
|
||||
|
||||
if (!infile.getFileHandle())
|
||||
{
|
||||
@@ -422,8 +421,7 @@ BOOL LLFloaterAnimPreview::postBuild()
|
||||
else if(exten == "animatn")
|
||||
{
|
||||
S32 file_size;
|
||||
LLAPRFile raw_animatn;
|
||||
raw_animatn.open(mFilenameAndPath, LL_APR_RB, LLAPRFile::global, &file_size);
|
||||
LLAPRFile raw_animatn(mFilenameAndPath, LL_APR_RB, &file_size);
|
||||
|
||||
if (!raw_animatn.getFileHandle())
|
||||
{
|
||||
|
||||
@@ -103,8 +103,7 @@ void LLFloaterVFS::reloadEntry(entry file)
|
||||
gVFS->removeFile(file.mID, file.mType);
|
||||
std::string file_name = file.mFilename;
|
||||
S32 file_size;
|
||||
LLAPRFile fp;
|
||||
fp.open(file_name, LL_APR_RB, LLAPRFile::global, &file_size);
|
||||
LLAPRFile fp(file_name, LL_APR_RB, &file_size);
|
||||
if(fp.getFileHandle())
|
||||
{
|
||||
LLVFile file(gVFS, asset_id, asset_type, LLVFile::WRITE);
|
||||
@@ -256,8 +255,7 @@ void LLFloaterVFS::onClickAdd_continued(void* user_data, AIFilePicker* filepicke
|
||||
LLUUID asset_id;
|
||||
asset_id.generate();
|
||||
S32 file_size;
|
||||
LLAPRFile fp;
|
||||
fp.open(temp_filename, LL_APR_RB, LLAPRFile::global, &file_size);
|
||||
LLAPRFile fp(temp_filename, LL_APR_RB, &file_size);
|
||||
if(fp.getFileHandle())
|
||||
{
|
||||
if(asset_type == LLAssetType::AT_TEXTURE)
|
||||
|
||||
@@ -994,7 +994,9 @@ LLAPRFile* LLTextureCache::openHeaderEntriesFile(bool readonly, S32 offset)
|
||||
{
|
||||
llassert_always(mHeaderAPRFile == NULL);
|
||||
apr_int32_t flags = readonly ? APR_READ|APR_BINARY : APR_READ|APR_WRITE|APR_BINARY;
|
||||
mHeaderAPRFile = new LLAPRFile(mHeaderEntriesFileName, flags, LLAPRFile::local);
|
||||
// All code calling openHeaderEntriesFile, immediately calls closeHeaderEntriesFile,
|
||||
// so this file is very short-lived.
|
||||
mHeaderAPRFile = new LLAPRFile(mHeaderEntriesFileName, flags);
|
||||
if(offset > 0)
|
||||
{
|
||||
mHeaderAPRFile->seek(APR_SET, offset);
|
||||
|
||||
@@ -901,8 +901,7 @@ void upload_new_resource(const std::string& src_filename, std::string name,
|
||||
uuid = tid.makeAssetID(gAgent.getSecureSessionID());
|
||||
// copy this file into the vfs for upload
|
||||
S32 file_size;
|
||||
LLAPRFile infile ;
|
||||
infile.open(filename, LL_APR_RB, LLAPRFile::local, &file_size);
|
||||
LLAPRFile infile(filename, LL_APR_RB, &file_size);
|
||||
if (infile.getFileHandle())
|
||||
{
|
||||
LLVFile file(gVFS, uuid, asset_type, LLVFile::WRITE);
|
||||
|
||||
@@ -1252,8 +1252,7 @@ void LLObjectBackup::uploadNextAsset()
|
||||
uuid = tid.makeAssetID(gAgent.getSecureSessionID());
|
||||
|
||||
S32 file_size;
|
||||
LLAPRFile outfile;
|
||||
outfile.open(filename, LL_APR_RB, LLAPRFile::local, &file_size);
|
||||
LLAPRFile outfile(filename, LL_APR_RB, &file_size);
|
||||
if (outfile.getFileHandle())
|
||||
{
|
||||
const S32 buf_size = 65536;
|
||||
|
||||
@@ -9939,8 +9939,7 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id )
|
||||
void LLVOAvatar::dumpArchetypeXML( void* )
|
||||
{
|
||||
LLVOAvatar* avatar = gAgent.getAvatarObject();
|
||||
LLAPRFile outfile ;
|
||||
outfile.open(gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,"new archetype.xml"), LL_APR_WB, LLAPRFile::global);
|
||||
LLAPRFile outfile(gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER, "new archetype.xml"), LL_APR_WB);
|
||||
apr_file_t* file = outfile.getFileHandle() ;
|
||||
if( !file )
|
||||
{
|
||||
|
||||
@@ -287,8 +287,6 @@ LLVOCache::~LLVOCache()
|
||||
|
||||
void LLVOCache::setDirNames(ELLPath location)
|
||||
{
|
||||
std::string delem = gDirUtilp->getDirDelimiter();
|
||||
|
||||
mHeaderFileName = gDirUtilp->getExpandedFilename(location, object_cache_dirname, header_filename);
|
||||
mObjectCacheDirName = gDirUtilp->getExpandedFilename(location, object_cache_dirname);
|
||||
}
|
||||
@@ -460,7 +458,7 @@ void LLVOCache::readCacheHeader()
|
||||
bool success = true ;
|
||||
if (LLAPRFile::isExist(mHeaderFileName))
|
||||
{
|
||||
LLAPRFile apr_file(mHeaderFileName, APR_READ|APR_BINARY, LLAPRFile::local);
|
||||
LLAPRFile apr_file(mHeaderFileName, APR_READ|APR_BINARY);
|
||||
|
||||
//read the meta element
|
||||
success = check_read(&apr_file, &mMetaInfo, sizeof(HeaderMetaInfo)) ;
|
||||
@@ -545,7 +543,7 @@ void LLVOCache::writeCacheHeader()
|
||||
|
||||
bool success = true ;
|
||||
{
|
||||
LLAPRFile apr_file(mHeaderFileName, APR_CREATE|APR_WRITE|APR_BINARY, LLAPRFile::local);
|
||||
LLAPRFile apr_file(mHeaderFileName, APR_CREATE|APR_WRITE|APR_BINARY);
|
||||
|
||||
//write the meta element
|
||||
success = check_write(&apr_file, &mMetaInfo, sizeof(HeaderMetaInfo)) ;
|
||||
@@ -583,7 +581,7 @@ void LLVOCache::writeCacheHeader()
|
||||
|
||||
BOOL LLVOCache::updateEntry(const HeaderEntryInfo* entry)
|
||||
{
|
||||
LLAPRFile apr_file(mHeaderFileName, APR_WRITE|APR_BINARY, LLAPRFile::local);
|
||||
LLAPRFile apr_file(mHeaderFileName, APR_WRITE|APR_BINARY);
|
||||
apr_file.seek(APR_SET, entry->mIndex * sizeof(HeaderEntryInfo) + sizeof(HeaderMetaInfo)) ;
|
||||
|
||||
return check_write(&apr_file, (void*)entry, sizeof(HeaderEntryInfo)) ;
|
||||
@@ -609,7 +607,7 @@ void LLVOCache::readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::voca
|
||||
{
|
||||
std::string filename;
|
||||
getObjectCacheFilename(handle, filename);
|
||||
LLAPRFile apr_file(filename, APR_READ|APR_BINARY, LLAPRFile::local);
|
||||
LLAPRFile apr_file(filename, APR_READ|APR_BINARY);
|
||||
|
||||
LLUUID cache_id ;
|
||||
success = check_read(&apr_file, cache_id.mData, UUID_BYTES) ;
|
||||
@@ -728,7 +726,7 @@ void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry:
|
||||
{
|
||||
std::string filename;
|
||||
getObjectCacheFilename(handle, filename);
|
||||
LLAPRFile apr_file(filename, APR_CREATE|APR_WRITE|APR_BINARY, LLAPRFile::local);
|
||||
LLAPRFile apr_file(filename, APR_CREATE|APR_WRITE|APR_BINARY);
|
||||
|
||||
success = check_write(&apr_file, (void*)id.mData, UUID_BYTES) ;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user