From 0e34fc05bdf1d8fed52c534f3fd588b6eadec3ec Mon Sep 17 00:00:00 2001 From: Andrew Cox Date: Thu, 29 May 2014 18:06:11 +0100 Subject: [PATCH] Fix for incorrect error code checking in JPEG header loading Synchronous loads to cheeck image sizes on event threads were printing false warnings. Change-Id: I97eaa37af6a971c161ae27f4a718cdc158725c63 Signed-off-by: Andrew Cox --- .../slp/resource-loader/loader-jpeg-turbo.cpp | 42 ++++++++++++---------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/platform-abstractions/slp/resource-loader/loader-jpeg-turbo.cpp b/platform-abstractions/slp/resource-loader/loader-jpeg-turbo.cpp index d8cd9a1..f3084f9 100755 --- a/platform-abstractions/slp/resource-loader/loader-jpeg-turbo.cpp +++ b/platform-abstractions/slp/resource-loader/loader-jpeg-turbo.cpp @@ -786,30 +786,36 @@ bool LoadJpegHeader(FILE *fp, const ImageAttributes& attributes, unsigned int &w // Double check we get the same width/height from the header unsigned int headerWidth; unsigned int headerHeight; - LoadJpegHeader( fp, headerWidth, headerHeight ); - - JPGFORM_CODE transform = JPGFORM_NONE; - - if( attributes.GetOrientationCorrection() ) + if( LoadJpegHeader( fp, headerWidth, headerHeight ) ) { - ExifAutoPtr exifData( LoadExifData( fp ) ); - if( exifData.mData ) + JPGFORM_CODE transform = JPGFORM_NONE; + + if( attributes.GetOrientationCorrection() ) { - transform = ConvertExifOrientation(exifData.mData); - } + ExifAutoPtr exifData( LoadExifData( fp ) ); + if( exifData.mData ) + { + transform = ConvertExifOrientation(exifData.mData); + } - int preXformImageWidth = headerWidth; - int preXformImageHeight = headerHeight; - int postXformImageWidth = headerWidth; - int postXformImageHeight = headerHeight; + int preXformImageWidth = headerWidth; + int preXformImageHeight = headerHeight; + int postXformImageWidth = headerWidth; + int postXformImageHeight = headerHeight; - success = TransformSize(requiredWidth, requiredHeight, transform, preXformImageWidth, preXformImageHeight, postXformImageWidth, postXformImageHeight); - if(success) + success = TransformSize(requiredWidth, requiredHeight, transform, preXformImageWidth, preXformImageHeight, postXformImageWidth, postXformImageHeight); + if(success) + { + width = postXformImageWidth; + height = postXformImageHeight; + } + } + else { - width = postXformImageWidth; - height = postXformImageHeight; + success = true; + width = headerWidth; + height = headerHeight; } - success = true; } } return success; -- 2.7.4