diff options
Diffstat (limited to 'indra/llimage/llimagetga.cpp')
-rw-r--r-- | indra/llimage/llimagetga.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/indra/llimage/llimagetga.cpp b/indra/llimage/llimagetga.cpp index adc98cd81d..25232b77aa 100644 --- a/indra/llimage/llimagetga.cpp +++ b/indra/llimage/llimagetga.cpp @@ -108,6 +108,8 @@ bool LLImageTGA::updateData() { resetLastError(); + LLImageDataLock lock(this); + // Check to make sure that this instance has been initialized with data if (!getData() || (0 == getDataSize())) { @@ -328,6 +330,9 @@ bool LLImageTGA::decode(LLImageRaw* raw_image, F32 decode_time) { llassert_always(raw_image); + LLImageDataSharedLock lockIn(this); + LLImageDataLock lockOut(raw_image); + // Check to make sure that this instance has been initialized with data if (!getData() || (0 == getDataSize())) { @@ -462,7 +467,7 @@ bool LLImageTGA::decodeTruecolorNonRle( LLImageRaw* raw_image, bool &alpha_opaqu S32 pixels = getWidth() * getHeight(); - if (pixels * (mIs15Bit ? 2 : getComponents()) > getDataSize() - mDataOffset) + if (pixels * (mIs15Bit ? 2 : getComponents()) > getDataSize() - (S32)mDataOffset) { //here we have situation when data size in src less than actually needed return false; } @@ -644,6 +649,9 @@ bool LLImageTGA::encode(const LLImageRaw* raw_image, F32 encode_time) { llassert_always(raw_image); + LLImageDataSharedLock lockIn(raw_image); + LLImageDataLock lockOut(this); + deleteData(); setSize(raw_image->getWidth(), raw_image->getHeight(), raw_image->getComponents()); @@ -1062,6 +1070,9 @@ bool LLImageTGA::decodeAndProcess( LLImageRaw* raw_image, F32 domain, F32 weight // --+---Input-------------------------------- // | + LLImageDataSharedLock lockIn(this); + LLImageDataLock lockOut(raw_image); + if (!getData() || (0 == getDataSize())) { setLastError("LLImageTGA trying to decode an image with no data!"); @@ -1168,7 +1179,7 @@ bool LLImageTGA::decodeAndProcess( LLImageRaw* raw_image, F32 domain, F32 weight // Reads a .tga file and creates an LLImageTGA with its data. bool LLImageTGA::loadFile( const std::string& path ) { - S32 len = path.size(); + auto len = path.size(); if( len < 5 ) { return false; @@ -1195,7 +1206,7 @@ bool LLImageTGA::loadFile( const std::string& path ) } U8* buffer = allocateData(file_size); - S32 bytes_read = fread(buffer, 1, file_size, file); + S32 bytes_read = static_cast<S32>(fread(buffer, 1, file_size, file)); if( bytes_read != file_size ) { deleteData(); |