summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeongmo Yang <jm80.yang@samsung.com>2017-02-21 13:28:35 +0900
committerJeongmo Yang <jm80.yang@samsung.com>2017-03-07 14:42:37 +0900
commit73753e8eb674f21ef79534ffa558419ad75cd19a (patch)
tree4ff4371e8db75f45e67b2964d7a1d759400090b4
parentb4fc503db483f3ab82544d8962ed8f431fdb53e1 (diff)
downloadcamera-73753e8eb674f21ef79534ffa558419ad75cd19a.tar.gz
camera-73753e8eb674f21ef79534ffa558419ad75cd19a.tar.bz2
camera-73753e8eb674f21ef79534ffa558419ad75cd19a.zip
Fix Svace issue - INTEGER_OVERFLOW
[Version] 0.2.97 [Profile] Common [Issue Type] Svace [Dependency module] N/A [Test] [M(T) - Boot=(OK), sdb=(OK), Home=(OK), Touch=(OK), Version=] Change-Id: I7da94e83dad992411684372d145d97915631cfc4 Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
-rw-r--r--packaging/capi-media-camera.spec2
-rw-r--r--test/camera_test.c40
2 files changed, 28 insertions, 14 deletions
diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec
index b739a3c..4eb5276 100644
--- a/packaging/capi-media-camera.spec
+++ b/packaging/capi-media-camera.spec
@@ -1,6 +1,6 @@
Name: capi-media-camera
Summary: A Camera API
-Version: 0.2.96
+Version: 0.2.97
Release: 0
Group: Multimedia/API
License: Apache-2.0
diff --git a/test/camera_test.c b/test/camera_test.c
index a6177ba..4066f90 100644
--- a/test/camera_test.c
+++ b/test/camera_test.c
@@ -1006,9 +1006,12 @@ static void setting_menu(gchar buf)
g_print("\n Select Display visible \n");
flush_stdin();
for (i = 0 ; i < 2 ; i++)
- g_print("\t %d. %s\n", i+1, visible_mode[i]);
- err = scanf("%d", &value);
- bret = camera_set_display_visible(hcamcorder->camera, idx-1);
+ g_print("\t %d. %s\n", i, visible_mode[i]);
+ err = scanf("%d", &idx);
+ if (idx == 0 || idx == 1)
+ bret = camera_set_display_visible(hcamcorder->camera, idx);
+ else
+ g_print("invalid input %d", idx);
break;
case 'o': /* Setting > Display Mode */
g_print("* Display mode!\n");
@@ -1137,9 +1140,12 @@ static void setting_menu(gchar buf)
g_print("\nSelect HDR capture mode\n");
flush_stdin();
for (i = 0 ; i < 3 ; i++)
- g_print("\t %d. %s\n", i+1, hdr_mode[i]);
+ g_print("\t %d. %s\n", i, hdr_mode[i]);
err = scanf("%d", &idx);
- bret = camera_attr_set_hdr_mode(hcamcorder->camera, idx-1);
+ if (idx >= CAMERA_ATTR_HDR_MODE_DISABLE && idx <= CAMERA_ATTR_HDR_MODE_KEEP_ORIGINAL)
+ bret = camera_attr_set_hdr_mode(hcamcorder->camera, idx);
+ else
+ g_print("invalid input %d\n", idx);
break;
default:
g_print("Wrong input, select again!!\n");
@@ -1173,26 +1179,34 @@ static void setting_menu(gchar buf)
if (idx == 0 || idx == 1)
bret = camera_attr_enable_anti_shake(hcamcorder->camera, idx);
else
- g_print("invalid input %d", idx);
+ g_print("invalid input %d\n", idx);
break;
case 'K': /* Setting > Video-stabilization */
g_print("*Video-stabilization !\n");
g_print("\n Select Video-stabilization mode \n");
flush_stdin();
for (i = 0 ; i < 2 ; i++)
- g_print("\t %d. %s\n", i+1, vs_mode[i]);
+ g_print("\t %d. %s\n", i, vs_mode[i]);
err = scanf("%d", &idx);
+
+ if (idx < 0 || idx > 1) {
+ g_print("invalid input %d\n", idx);
+ break;
+ }
+
if (idx == 1) {
g_print("\n Restart preview with NV12 and 720p resolution\n");
err = camera_stop_preview(hcamcorder->camera);
camera_set_preview_resolution(hcamcorder->camera, 1280, 720);
camera_set_preview_format(hcamcorder->camera, CAMERA_PIXEL_FORMAT_NV12);
- camera_attr_enable_video_stabilization(hcamcorder->camera, idx-1);
- if (err == 0) {
- err = camera_start_preview(hcamcorder->camera);
- if (err != 0)
- g_print("\n Restart FAILED! %x\n", err);
- }
+ }
+
+ bret = camera_attr_enable_video_stabilization(hcamcorder->camera, idx);
+
+ if (idx == 1) {
+ err = camera_start_preview(hcamcorder->camera);
+ if (err != CAMERA_ERROR_NONE)
+ g_print("\n Restart FAILED! 0x%x\n", err);
}
break;
case 'u': /* Touch AF area */