LLVFile::readFile must return LLPrivateMemoryPool allocated data.
This commit is contained in:
@@ -130,7 +130,7 @@ BOOL LLVFile::read(U8 *buffer, S32 bytes, BOOL async, F32 priority)
|
||||
}
|
||||
|
||||
//static
|
||||
U8* LLVFile::readFile(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType type, S32* bytes_read)
|
||||
U8* LLVFile::readFile(LLVFS *vfs, LLPrivateMemoryPool* poolp, const LLUUID &uuid, LLAssetType::EType type, S32* bytes_read)
|
||||
{
|
||||
U8 *data;
|
||||
LLVFile file(vfs, uuid, type, LLVFile::READ);
|
||||
@@ -142,12 +142,12 @@ U8* LLVFile::readFile(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType type, S
|
||||
}
|
||||
else
|
||||
{
|
||||
data = new U8[file_size];
|
||||
data = (U8*)ALLOCATE_MEM(poolp, file_size);
|
||||
file.read(data, file_size); /* Flawfinder: ignore */
|
||||
|
||||
if (file.getLastBytesRead() != (S32)file_size)
|
||||
{
|
||||
delete[] data;
|
||||
FREE_MEM(poolp, data);
|
||||
data = NULL;
|
||||
file_size = 0;
|
||||
}
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
#include "llvfs.h"
|
||||
#include "llvfsthread.h"
|
||||
|
||||
class LLPrivateMemoryPool;
|
||||
|
||||
class LLVFile
|
||||
{
|
||||
public:
|
||||
@@ -45,7 +47,7 @@ public:
|
||||
~LLVFile();
|
||||
|
||||
BOOL read(U8 *buffer, S32 bytes, BOOL async = FALSE, F32 priority = 128.f); /* Flawfinder: ignore */
|
||||
static U8* readFile(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType type, S32* bytes_read = 0);
|
||||
static U8* readFile(LLVFS *vfs, LLPrivateMemoryPool* poolp, const LLUUID &uuid, LLAssetType::EType type, S32* bytes_read = 0);
|
||||
void setReadPriority(const F32 priority);
|
||||
BOOL isReadComplete();
|
||||
S32 getLastBytesRead();
|
||||
|
||||
@@ -402,7 +402,7 @@ void LLTexLayerSetBuffer::readBackAndUpload()
|
||||
BOOL valid = FALSE;
|
||||
LLPointer<LLImageJ2C> integrity_test = new LLImageJ2C;
|
||||
S32 file_size = 0;
|
||||
U8* data = LLVFile::readFile(gVFS, asset_id, LLAssetType::AT_TEXTURE, &file_size);
|
||||
U8* data = LLVFile::readFile(gVFS, LLImageBase::getPrivatePool(), asset_id, LLAssetType::AT_TEXTURE, &file_size);
|
||||
if (data)
|
||||
{
|
||||
valid = integrity_test->validate(data, file_size); // integrity_test will delete 'data'
|
||||
|
||||
Reference in New Issue
Block a user