diff options
author | Jacek Antonelli | 2008-08-15 23:44:50 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:50 -0500 |
commit | 89fe5dab825a62a0e3fd8d248cbc91c65eb2a426 (patch) | |
tree | bcff14b7888d04a2fec799c59369f6095224bd08 /linden/indra/llimage/llimagebmp.cpp | |
parent | Second Life viewer sources 1.13.3.2 (diff) | |
download | meta-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/llimagebmp.cpp')
-rw-r--r-- | linden/indra/llimage/llimagebmp.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/linden/indra/llimage/llimagebmp.cpp b/linden/indra/llimage/llimagebmp.cpp index fc9532e..e8cada5 100644 --- a/linden/indra/llimage/llimagebmp.cpp +++ b/linden/indra/llimage/llimagebmp.cpp | |||
@@ -142,7 +142,10 @@ BOOL LLImageBMP::updateData() | |||
142 | LLBMPHeader header; | 142 | LLBMPHeader header; |
143 | llassert( sizeof( header ) == BITMAP_HEADER_SIZE ); | 143 | llassert( sizeof( header ) == BITMAP_HEADER_SIZE ); |
144 | 144 | ||
145 | memcpy((void *)&header, mdata + FILE_HEADER_SIZE, BITMAP_HEADER_SIZE); | 145 | memcpy( /* Flawfinder: ignore */ |
146 | (void*)&header, | ||
147 | mdata + FILE_HEADER_SIZE, | ||
148 | BITMAP_HEADER_SIZE); | ||
146 | 149 | ||
147 | // convert BMP header from little endian (no-op on little endian builds) | 150 | // convert BMP header from little endian (no-op on little endian builds) |
148 | llendianswizzleone(header.mSize); | 151 | llendianswizzleone(header.mSize); |
@@ -276,7 +279,7 @@ BOOL LLImageBMP::updateData() | |||
276 | 279 | ||
277 | 280 | ||
278 | extension_size = 4 * 3; | 281 | extension_size = 4 * 3; |
279 | memcpy( mBitfieldMask, mdata + FILE_HEADER_SIZE + BITMAP_HEADER_SIZE, extension_size); | 282 | memcpy( mBitfieldMask, mdata + FILE_HEADER_SIZE + BITMAP_HEADER_SIZE, extension_size); /* Flawfinder: ignore */ |
280 | } | 283 | } |
281 | else | 284 | else |
282 | if( windows_95_version ) | 285 | if( windows_95_version ) |
@@ -285,11 +288,11 @@ BOOL LLImageBMP::updateData() | |||
285 | extension_size = sizeof( win_95_extension ); | 288 | extension_size = sizeof( win_95_extension ); |
286 | 289 | ||
287 | llassert( sizeof( win_95_extension ) + BITMAP_HEADER_SIZE == 108 ); | 290 | llassert( sizeof( win_95_extension ) + BITMAP_HEADER_SIZE == 108 ); |
288 | memcpy( &win_95_extension, mdata + FILE_HEADER_SIZE + BITMAP_HEADER_SIZE, sizeof( win_95_extension ) ); | 291 | memcpy( &win_95_extension, mdata + FILE_HEADER_SIZE + BITMAP_HEADER_SIZE, sizeof( win_95_extension ) ); /* Flawfinder: ignore */ |
289 | 292 | ||
290 | if( 3 == header.mCompression ) | 293 | if( 3 == header.mCompression ) |
291 | { | 294 | { |
292 | memcpy( mBitfieldMask, mdata + FILE_HEADER_SIZE + BITMAP_HEADER_SIZE, 4 * 4); | 295 | memcpy( mBitfieldMask, mdata + FILE_HEADER_SIZE + BITMAP_HEADER_SIZE, 4 * 4); /* Flawfinder: ignore */ |
293 | } | 296 | } |
294 | 297 | ||
295 | // Color correction ignored for now | 298 | // Color correction ignored for now |
@@ -317,7 +320,12 @@ BOOL LLImageBMP::updateData() | |||
317 | if( 0 != mColorPaletteColors ) | 320 | if( 0 != mColorPaletteColors ) |
318 | { | 321 | { |
319 | mColorPalette = new U8[color_palette_size]; | 322 | mColorPalette = new U8[color_palette_size]; |
320 | memcpy( mColorPalette, mdata + FILE_HEADER_SIZE + BITMAP_HEADER_SIZE + extension_size, color_palette_size ); | 323 | if (!mColorPalette) |
324 | { | ||
325 | llerrs << "Out of memory in LLImageBMP::updateData()" << llendl; | ||
326 | return FALSE; | ||
327 | } | ||
328 | memcpy( mColorPalette, mdata + FILE_HEADER_SIZE + BITMAP_HEADER_SIZE + extension_size, color_palette_size ); /* Flawfinder: ignore */ | ||
321 | } | 329 | } |
322 | 330 | ||
323 | return TRUE; | 331 | return TRUE; |
@@ -587,7 +595,7 @@ BOOL LLImageBMP::encode(const LLImageRaw* raw_image, F32 encode_time) | |||
587 | U32 cur_pos = 0; | 595 | U32 cur_pos = 0; |
588 | memcpy(mdata, magic, 14); | 596 | memcpy(mdata, magic, 14); |
589 | cur_pos += 14; | 597 | cur_pos += 14; |
590 | memcpy(mdata+cur_pos, &header, 40); | 598 | memcpy(mdata+cur_pos, &header, 40); /* Flawfinder: ignore */ |
591 | cur_pos += 40; | 599 | cur_pos += 40; |
592 | if (getComponents() == 1) | 600 | if (getComponents() == 1) |
593 | { | 601 | { |