#include <stdio.h>
#include "SkJpegUtility.h"
-// Same as setjmp, but introduces a new empty scope.
-// This way we can avoid GCC's overactive warnings about clobbered locals.
-static int setjmp_no_locals(jmp_buf env) {
- return setjmp(env);
-}
-
extern "C" {
#include "jerror.h"
#include "jpeglib.h"
SkAutoTDelete<JpegDecoderMgr> decoderMgr(new JpegDecoderMgr(stream));
// libjpeg errors will be caught and reported here
- if (setjmp_no_locals(decoderMgr->getJmpBuf())) {
+ if (setjmp(decoderMgr->getJmpBuf())) {
return decoderMgr->returnFalse("setjmp");
}
* dimensions if possible
*/
bool SkJpegCodec::onDimensionsSupported(const SkISize& size) {
- if (setjmp_no_locals(fDecoderMgr->getJmpBuf())) {
+ if (setjmp(fDecoderMgr->getJmpBuf())) {
return fDecoderMgr->returnFalse("onDimensionsSupported/setjmp");
}
jpeg_decompress_struct* dinfo = fDecoderMgr->dinfo();
// Set the jump location for libjpeg errors
- if (setjmp_no_locals(fDecoderMgr->getJmpBuf())) {
+ if (setjmp(fDecoderMgr->getJmpBuf())) {
return fDecoderMgr->returnFailure("setjmp", kInvalidInput);
}
SkCodec::Result SkJpegCodec::onStartScanlineDecode(const SkImageInfo& dstInfo,
const Options& options, SkPMColor ctable[], int* ctableCount) {
// Set the jump location for libjpeg errors
- if (setjmp_no_locals(fDecoderMgr->getJmpBuf())) {
+ if (setjmp(fDecoderMgr->getJmpBuf())) {
SkCodecPrintf("setjmp: Error from libjpeg\n");
return kInvalidInput;
}
int SkJpegCodec::onGetScanlines(void* dst, int count, size_t dstRowBytes) {
// Set the jump location for libjpeg errors
- if (setjmp_no_locals(fDecoderMgr->getJmpBuf())) {
+ if (setjmp(fDecoderMgr->getJmpBuf())) {
return fDecoderMgr->returnFailure("setjmp", kInvalidInput);
}
// Read rows one at a time
bool SkJpegCodec::onSkipScanlines(int count) {
// Set the jump location for libjpeg errors
- if (setjmp_no_locals(fDecoderMgr->getJmpBuf())) {
+ if (setjmp(fDecoderMgr->getJmpBuf())) {
return fDecoderMgr->returnFalse("setjmp");
}
}
// Set the jump location for libjpeg errors
- if (setjmp_no_locals(fDecoderMgr->getJmpBuf())) {
+ if (setjmp(fDecoderMgr->getJmpBuf())) {
return fDecoderMgr->returnFailure("setjmp", kInvalidInput);
}