summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llfilesystem/llfilesystem.cpp13
-rw-r--r--indra/llfilesystem/llfilesystem.h2
-rw-r--r--indra/newview/llfloaterauction.cpp8
-rw-r--r--indra/newview/llfloaterreporter.cpp6
-rw-r--r--indra/newview/llsnapshotlivepreview.cpp3
5 files changed, 17 insertions, 15 deletions
diff --git a/indra/llfilesystem/llfilesystem.cpp b/indra/llfilesystem/llfilesystem.cpp
index ffc3dee12b..6d6ff3d7e1 100644
--- a/indra/llfilesystem/llfilesystem.cpp
+++ b/indra/llfilesystem/llfilesystem.cpp
@@ -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)
diff --git a/indra/llfilesystem/llfilesystem.h b/indra/llfilesystem/llfilesystem.h
index 789f9456c7..5d87de9bf8 100644
--- a/indra/llfilesystem/llfilesystem.h
+++ b/indra/llfilesystem/llfilesystem.h
@@ -1,4 +1,5 @@
/**
+/**
* @file filesystem.h
* @brief Simulate local file system operations.
* @Note The initial implementation does actually use standard C++
@@ -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;
diff --git a/indra/newview/llfloaterauction.cpp b/indra/newview/llfloaterauction.cpp
index 1b9814883e..9813156bf2 100644
--- a/indra/newview/llfloaterauction.cpp
+++ b/indra/newview/llfloaterauction.cpp
@@ -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);
diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp
index 3ef80300ef..5d0e2bbc55 100644
--- a/indra/newview/llfloaterreporter.cpp
+++ b/indra/newview/llfloaterreporter.cpp
@@ -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 =
diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp
index 795563e295..7255ab77a4 100644
--- a/indra/newview/llsnapshotlivepreview.cpp
+++ b/indra/newview/llsnapshotlivepreview.cpp
@@ -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;