Fix build warning for format string check 73/133673/1
authorGilbok Lee <gilbok.lee@samsung.com>
Tue, 13 Jun 2017 05:40:18 +0000 (14:40 +0900)
committerGilbok Lee <gilbok.lee@samsung.com>
Tue, 13 Jun 2017 05:40:18 +0000 (14:40 +0900)
[Version] 0.1.10
[Profile] Mobile, TV
[Issue Type] Fix bugs

Change-Id: I694db89e9ffad451cf8176b192a3291b78acabc8

packaging/capi-media-video-util.spec
src/video_util.c
test/video_util_test.c

index 81859df..01a2d73 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-media-video-util
 Summary:    A Video Utility library in Tizen Native API
-Version:    0.1.9
+Version:    0.1.10
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index 6fe67c1..bb2fbbd 100755 (executable)
@@ -18,6 +18,7 @@
 #include <string.h>
 #include <stdbool.h>
 #include <dlog.h>
+#include <unistd.h>
 #include <mm_transcode.h>
 #include <mm_error.h>
 #include <video_util.h>
@@ -382,6 +383,17 @@ int video_util_set_file_path(video_util_h handle, const char *file_path)
                video_util_secure_info("file_path [%s]\n", file_path);
 
                if (_handle->input_path != NULL) {
+                       int exist = 0;
+                       exist = open(file_path, O_RDONLY);
+                       if (exist < 0) {
+                               video_util_error("Fail to open original_path[%s]", file_path);
+                               if (errno == EACCES || errno == EPERM)
+                                       return VIDEO_UTIL_ERROR_PERMISSION_DENIED;
+                               else
+                                       return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
+                       }
+                       close(exist);
+
                        ret = __video_util_check_transcode_is_busy(_handle, &is_busy);
                        if (ret != VIDEO_UTIL_ERROR_NONE)
                                return ret;
@@ -628,7 +640,7 @@ int video_util_start_transcoding(video_util_h handle, unsigned long start, unsig
        }
 
        _handle = (video_util_s *)handle;
-       video_util_debug("start [%d] duration [%d]\n", start, duration);
+       video_util_debug("start [%lu] duration [%lu]\n", start, duration);
 
        if (_handle && (__video_util_check_duration(duration)) && (UTIL_STRING_VALID(_handle->input_path)) && (UTIL_STRING_VALID(out_path)) && completed_cb) {
                if (!_handle->transcode_h) {
index c6b341c..97f7a73 100644 (file)
@@ -89,10 +89,10 @@ bool test_transcode_spec_cb(int value, void *user_data)
        if (!strcmp(user_data, "format_check")) {
                switch (value) {
                case 0:
-                       LOGI("[%s] --- [3gp]", user_data);
+                       LOGI("[%s] --- [3gp]", (const char *)user_data);
                        break;
                case 1:
-                       LOGI("[%s] --- [mp4]", user_data);
+                       LOGI("[%s] --- [mp4]", (const char *)user_data);
                        break;
                default:
                        break;
@@ -100,13 +100,13 @@ bool test_transcode_spec_cb(int value, void *user_data)
        } else if (!strcmp(user_data, "video_codec_check")) {
                switch (value) {
                case 0:
-                       LOGI("[%s] --- [m4v]", user_data);
+                       LOGI("[%s] --- [m4v]", (const char *)user_data);
                        break;
                case 1:
-                       LOGI("[%s] --- [h263]", user_data);
+                       LOGI("[%s] --- [h263]", (const char *)user_data);
                        break;
                case 2:
-                       LOGI("[%s] --- [h264]", user_data);
+                       LOGI("[%s] --- [h264]", (const char *)user_data);
                        break;
                default:
                        break;
@@ -114,10 +114,10 @@ bool test_transcode_spec_cb(int value, void *user_data)
        } else if (!strcmp(user_data, "audio_codec_check")) {
                switch (value) {
                case 0:
-                       LOGI("[%s] --- [aac]", user_data);
+                       LOGI("[%s] --- [aac]", (const char *)user_data);
                        break;
                case 1:
-                       LOGI("[%s] --- [amrnb]", user_data);
+                       LOGI("[%s] --- [amrnb]", (const char *)user_data);
                        break;
                default:
                        break;