diff options
-rw-r--r-- | gyp/common_conditions.gypi | 8 | ||||
-rw-r--r-- | src/images/SkImageDecoder_libjpeg.cpp | 13 |
2 files changed, 15 insertions, 6 deletions
diff --git a/gyp/common_conditions.gypi b/gyp/common_conditions.gypi index 2dcd36c2ba..6828660444 100644 --- a/gyp/common_conditions.gypi +++ b/gyp/common_conditions.gypi @@ -308,6 +308,14 @@ ], }, }], +# This old compiler is really bad at figuring out when things are uninitialized, so ignore it. + [ '<(mac_sdk)==10.6', { + 'xcode_settings': { + 'OTHER_CPLUSPLUSFLAGS': [ + '-Wno-uninitialized', + ], + }, + }], ], 'configurations': { 'Debug': { diff --git a/src/images/SkImageDecoder_libjpeg.cpp b/src/images/SkImageDecoder_libjpeg.cpp index 0a016e5cd2..e0783c9fb5 100644 --- a/src/images/SkImageDecoder_libjpeg.cpp +++ b/src/images/SkImageDecoder_libjpeg.cpp @@ -917,11 +917,6 @@ protected: SkAutoTime atm("JPEG Encode"); #endif - const WriteScanline writer = ChooseWriter(bm); - if (NULL == writer) { - return false; - } - SkAutoLockPixels alp(bm); if (NULL == bm.getPixels()) { return false; @@ -940,8 +935,14 @@ protected: if (setjmp(sk_err.fJmpBuf)) { return false; } - jpeg_create_compress(&cinfo); + // Keep after setjmp or mark volatile. + const WriteScanline writer = ChooseWriter(bm); + if (NULL == writer) { + return false; + } + + jpeg_create_compress(&cinfo); cinfo.dest = &sk_wstream; cinfo.image_width = bm.width(); cinfo.image_height = bm.height(); |