Image size exceprions applied.
authorOleksandr Kaspruk <a.kaspruk@samsung.com>
Tue, 25 Jun 2013 17:03:00 +0000 (20:03 +0300)
committerOleksandr Kaspruk <a.kaspruk@samsung.com>
Wed, 26 Jun 2013 08:53:01 +0000 (11:53 +0300)
Change-Id: Ic02e582ce0f2ccf545b18c329b2d32b9dfd276cc
Signed-off-by: Oleksandr Kaspruk <a.kaspruk@samsung.com>
src/FUixVision_ImageFeatureManagerImpl.cpp

index ffd9b89..ac1dd44 100644 (file)
@@ -71,20 +71,25 @@ _ImageFeatureManagerImpl::AddFeature(const Tizen::Base::String& filepath)
     Tizen::Media::ImageFormat imgFormat;
     int imgWidth = 0, imgHeight = 0;
     result r = Tizen::Media::ImageBuffer::GetImageInfo(filepath, imgFormat, imgWidth, imgHeight);
+
     if (IsFailed(r))
     {
-       return -1;
+        SetLastResult(E_INVALID_ARG);
+        return -1;
     }
 
-    if ((imgWidth < __minSupportedSize || imgHeight < __minSupportedSize) || (imgWidth*imgHeight > __maxSupportedResolution))
+    if ((imgWidth < __minSupportedSize || imgHeight < __minSupportedSize) || (imgWidth * imgHeight > __maxSupportedResolution))
     {
-       return -1;
+        SetLastResult(E_INVALID_ARG); 
+        return -1;
     }
 
     Tizen::Media::ImageBuffer imBuf;
     r = imBuf.Construct(filepath, null, false);
-    if (IsFailed(r))
+
+    if(IsFailed(r))
     {
+        SetLastResult(E_INVALID_ARG);
         return -1;
     }
 
@@ -108,9 +113,10 @@ _ImageFeatureManagerImpl::AddFeature(const unsigned char* data, int width, int h
         return -1;
     }
 
-    if ((width < __minSupportedSize || height < __minSupportedSize) || (width*height > __maxSupportedResolution))
+    if ((width < __minSupportedSize || height < __minSupportedSize) || (width * height > __maxSupportedResolution))
     {
-       return -1;
+        SetLastResult(E_INVALID_ARG); 
+        return -1;
     }
 
     Tizen::Text::Utf8Encoding utf8;