Replace references to static writefile with write so we end up with only a single read and a single write function

master
Callum Prentice 2020-10-06 18:18:18 -07:00
parent 56e3061553
commit a0ea119623
5 changed files with 17 additions and 15 deletions

View File

@ -230,6 +230,12 @@ BOOL LLFileSystem::read(U8 *buffer, S32 bytes, BOOL async, F32 priority)
mReadComplete = TRUE;
}
// update the last access time for the file - this is required
// even though we are reading and not writing because this is the
// way the cache works - it relies on a valid "last accessed time" for
// each file so it knows how to remove the oldest, unused files
LLFileSystem::mDiskCache->updateFileAccessTime(filename);
return success;
}
@ -287,13 +293,6 @@ BOOL LLFileSystem::write(const U8 *buffer, S32 bytes)
return success;
}
//static
BOOL LLFileSystem::writeFile(const U8 *buffer, S32 bytes, const LLUUID &uuid, LLAssetType::EType type)
{
LLFileSystem file(uuid, type, LLFileSystem::WRITE);
return file.write(buffer, bytes);
}
BOOL LLFileSystem::seek(S32 offset, S32 origin)
{
if (-1 == origin)

View File

@ -1,3 +1,4 @@
/**
/**
* @file filesystem.h
* @brief Simulate local file system operations.
@ -46,7 +47,6 @@ public:
BOOL eof();
BOOL write(const U8 *buffer, S32 bytes);
static BOOL writeFile(const U8 *buffer, S32 bytes, const LLUUID &uuid, LLAssetType::EType type);
BOOL seek(S32 offset, S32 origin = -1);
S32 tell() const;

View File

@ -201,7 +201,9 @@ void LLFloaterAuction::onClickSnapshot(void* data)
LLPointer<LLImageTGA> tga = new LLImageTGA;
tga->encode(raw);
LLFileSystem::writeFile(tga->getData(), tga->getDataSize(), self->mImageID, LLAssetType::AT_IMAGE_TGA);
LLFileSystem tga_file(self->mImageID, LLAssetType::AT_IMAGE_TGA, LLFileSystem::WRITE);
tga_file.write(tga->getData(), tga->getDataSize());
raw->biasedScaleToPowerOfTwo(LLViewerTexture::MAX_IMAGE_SIZE_DEFAULT);
@ -209,7 +211,9 @@ void LLFloaterAuction::onClickSnapshot(void* data)
LLPointer<LLImageJ2C> j2c = new LLImageJ2C;
j2c->encode(raw, 0.0f);
LLFileSystem::writeFile(j2c->getData(), j2c->getDataSize(), self->mImageID, LLAssetType::AT_TEXTURE);
LLFileSystem j2c_file(self->mImageID, LLAssetType::AT_TEXTURE, LLFileSystem::WRITE);
j2c_file.write(j2c->getData(), j2c->getDataSize());
self->mImage = LLViewerTextureManager::getLocalTexture((LLImageRaw*)raw, FALSE);
gGL.getTexUnit(0)->bind(self->mImage);

View File

@ -899,10 +899,8 @@ void LLFloaterReporter::takeScreenshot(bool use_prev_screenshot)
mResourceDatap->mAssetInfo.setDescription("screenshot_descr");
// store in cache
LLFileSystem::writeFile(upload_data->getData(),
upload_data->getDataSize(),
mResourceDatap->mAssetInfo.mUuid,
mResourceDatap->mAssetInfo.mType);
LLFileSystem j2c_file(mResourceDatap->mAssetInfo.mUuid, mResourceDatap->mAssetInfo.mType, LLFileSystem::WRITE);
j2c_file.write(upload_data->getData(), upload_data->getDataSize());
// store in the image list so it doesn't try to fetch from the server
LLPointer<LLViewerFetchedTexture> image_in_list =

View File

@ -1005,7 +1005,8 @@ void LLSnapshotLivePreview::saveTexture(BOOL outfit_snapshot, std::string name)
if (formatted->encode(scaled, 0.0f))
{
LLFileSystem::writeFile(formatted->getData(), formatted->getDataSize(), new_asset_id, LLAssetType::AT_TEXTURE);
LLFileSystem fmt_file(new_asset_id, LLAssetType::AT_TEXTURE, LLFileSystem::WRITE);
fmt_file.write(formatted->getData(), formatted->getDataSize());
std::string pos_string;
LLAgentUI::buildLocationString(pos_string, LLAgentUI::LOCATION_FORMAT_FULL);
std::string who_took_it;