Fix for incorrect error code checking in JPEG header loading
authorAndrew Cox <andrew.cox@partner.samsung.com>
Thu, 29 May 2014 17:06:11 +0000 (18:06 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 10 Jun 2014 15:42:51 +0000 (16:42 +0100)
Synchronous loads to cheeck image sizes on event threads were printing false warnings.

Change-Id: I97eaa37af6a971c161ae27f4a718cdc158725c63
Signed-off-by: Andrew Cox <andrew.cox@partner.samsung.com>
platform-abstractions/slp/resource-loader/loader-jpeg-turbo.cpp

index d8cd9a1..f3084f9 100755 (executable)
@@ -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;