31
31
#include " llerror.h"
32
32
#include " llexception.h"
33
33
34
+ #if !LL_ARM64
34
35
jmp_buf LLImageJPEG::sSetjmpBuffer ;
36
+ #endif
35
37
LLImageJPEG::LLImageJPEG (S32 quality)
36
38
: LLImageFormatted(IMG_CODEC_JPEG),
37
39
mOutputBuffer( NULL ),
@@ -78,12 +80,15 @@ bool LLImageJPEG::updateData()
78
80
//
79
81
// try/catch will crash on Mac and Linux if LLImageJPEG::errorExit throws an error
80
82
// so as instead, we use setjmp/longjmp to avoid this crash, which is the best we can get. --bao
83
+ // except in the case of AARCH64/ARM64 where setjmp will crash
81
84
//
85
+ #if !LL_ARM64
82
86
if (setjmp (sSetjmpBuffer ))
83
87
{
84
88
jpeg_destroy_decompress (&cinfo);
85
89
return false ;
86
90
}
91
+ #endif
87
92
try
88
93
{
89
94
// Now we can initialize the JPEG decompression object.
@@ -223,11 +228,13 @@ bool LLImageJPEG::decode(LLImageRaw* raw_image, F32 decode_time)
223
228
// try/catch will crash on Mac and Linux if LLImageJPEG::errorExit throws an error
224
229
// so as instead, we use setjmp/longjmp to avoid this crash, which is the best we can get. --bao
225
230
//
231
+ #if !LL_ARM64
226
232
if (setjmp (sSetjmpBuffer ))
227
233
{
228
234
jpeg_destroy_decompress (&cinfo);
229
235
return true ; // done
230
236
}
237
+ #endif
231
238
try
232
239
{
233
240
// Now we can initialize the JPEG decompression object.
@@ -431,9 +438,10 @@ void LLImageJPEG::errorExit( j_common_ptr cinfo )
431
438
432
439
// Let the memory manager delete any temp files
433
440
jpeg_destroy (cinfo);
434
-
441
+ # if !LL_ARM64
435
442
// Return control to the setjmp point
436
443
longjmp (sSetjmpBuffer , 1 ) ;
444
+ #endif
437
445
}
438
446
439
447
// Decide whether to emit a trace or warning message.
@@ -545,6 +553,7 @@ bool LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time )
545
553
// try/catch will crash on Mac and Linux if LLImageJPEG::errorExit throws an error
546
554
// so as instead, we use setjmp/longjmp to avoid this crash, which is the best we can get. --bao
547
555
//
556
+ #if !LL_ARM64
548
557
if ( setjmp (sSetjmpBuffer ) )
549
558
{
550
559
// If we get here, the JPEG code has signaled an error.
@@ -555,7 +564,7 @@ bool LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time )
555
564
mOutputBufferSize = 0 ;
556
565
return false ;
557
566
}
558
-
567
+ # endif
559
568
try
560
569
{
561
570
0 commit comments