aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llimage/llimagetga.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:50 -0500
committerJacek Antonelli2008-08-15 23:44:50 -0500
commit89fe5dab825a62a0e3fd8d248cbc91c65eb2a426 (patch)
treebcff14b7888d04a2fec799c59369f6095224bd08 /linden/indra/llimage/llimagetga.cpp
parentSecond Life viewer sources 1.13.3.2 (diff)
downloadmeta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.zip
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.gz
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.bz2
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.xz
Second Life viewer sources 1.14.0.0
Diffstat (limited to 'linden/indra/llimage/llimagetga.cpp')
-rw-r--r--linden/indra/llimage/llimagetga.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/linden/indra/llimage/llimagetga.cpp b/linden/indra/llimage/llimagetga.cpp
index 722bd1e..d5d60de 100644
--- a/linden/indra/llimage/llimagetga.cpp
+++ b/linden/indra/llimage/llimagetga.cpp
@@ -202,7 +202,7 @@ BOOL LLImageTGA::updateData()
202 // discard the ID field, if any 202 // discard the ID field, if any
203 if (mIDLength) 203 if (mIDLength)
204 { 204 {
205 memcpy(junk, getData()+mDataOffset, mIDLength); 205 memcpy(junk, getData()+mDataOffset, mIDLength); /* Flawfinder: ignore */
206 mDataOffset += mIDLength; 206 mDataOffset += mIDLength;
207 } 207 }
208 208
@@ -239,7 +239,12 @@ BOOL LLImageTGA::updateData()
239 if ( (1 == mImageType) || (9 == mImageType) ) 239 if ( (1 == mImageType) || (9 == mImageType) )
240 { 240 {
241 mColorMap = new U8[ color_map_bytes ]; 241 mColorMap = new U8[ color_map_bytes ];
242 memcpy( mColorMap, getData() + mDataOffset, color_map_bytes ); 242 if (!mColorMap)
243 {
244 llerrs << "Out of Memory in BOOL LLImageTGA::updateData()" << llendl;
245 return FALSE;
246 }
247 memcpy( mColorMap, getData() + mDataOffset, color_map_bytes ); /* Flawfinder: ignore */
243 } 248 }
244 249
245 mDataOffset += color_map_bytes; 250 mDataOffset += color_map_bytes;
@@ -451,7 +456,7 @@ BOOL LLImageTGA::decodeTruecolorNonRle( LLImageRaw* raw_image, BOOL &alpha_opaqu
451 } 456 }
452 else if (getComponents() == 1) 457 else if (getComponents() == 1)
453 { 458 {
454 memcpy(dst, src, pixels); 459 memcpy(dst, src, pixels); /* Flawfinder: ignore */
455 } 460 }
456 461
457 return TRUE; 462 return TRUE;
@@ -692,7 +697,7 @@ BOOL LLImageTGA::encode(const LLImageRaw* raw_image, F32 encode_time)
692 switch( getComponents() ) 697 switch( getComponents() )
693 { 698 {
694 case 1: 699 case 1:
695 memcpy( dst, src, bytes_per_pixel * pixels ); 700 memcpy( dst, src, bytes_per_pixel * pixels ); /* Flawfinder: ignore */
696 break; 701 break;
697 702
698 case 2: 703 case 2:
@@ -1072,7 +1077,7 @@ bool LLImageTGA::loadFile( const LLString& path )
1072 return false; 1077 return false;
1073 } 1078 }
1074 1079
1075 FILE *file = LLFile::fopen(path.c_str(), "rb"); 1080 FILE* file = LLFile::fopen(path.c_str(), "rb"); /* Flawfinder: ignore */
1076 if( !file ) 1081 if( !file )
1077 { 1082 {
1078 llwarns << "Couldn't open file " << path << llendl; 1083 llwarns << "Couldn't open file " << path << llendl;