Fix prevent issue 22/47522/1 accepted/tizen/mobile/20150904.104623 accepted/tizen/tv/20150904.104856 accepted/tizen/wearable/20150904.105052 submit/tizen/20150904.072607
authorMinje Ahn <minje.ahn@samsung.com>
Fri, 4 Sep 2015 07:17:45 +0000 (16:17 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Fri, 4 Sep 2015 07:17:45 +0000 (16:17 +0900)
Change-Id: Ia4c19bf5e5672cd876dfe2340261e74f82874127
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
include/thumbnail_util.h
packaging/capi-media-thumbnail-util.spec
src/thumbnail_util.c

index 588159c..7b1f0b7 100755 (executable)
@@ -57,6 +57,10 @@ int thumbnail_util_create(thumbnail_h *thumb);
  *
  * @since_tizen 2.4
  *
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mediastorage \n
+ *                   %http://tizen.org/privilege/externalstorage
+ *
  * @remarks You must release @a request_id using free(). \n
  *                http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage. \n
  *                http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n
@@ -122,6 +126,7 @@ int thumbnail_util_set_size(thumbnail_h thumb, int width, int height);
 /**
  * @brief Cancels the thumbnail extraction request for the given media.
  * @since_tizen 2.4
+ * @remarks If there is no item you want to cancel, this API return MEDIA_CONTENT_ERROR_INVALID_OPERATION
  *
  * @param[in] thumb         The media thumbnail info handle
  * @param[in] request_id   The generated request id by thumbnail extraction request
@@ -141,6 +146,7 @@ int thumbnail_util_cancel(thumbnail_h thumb, const char *request_id);
 /**
  * @brief Cancels all thumbnail extraction requests associated with the given thumbnail info handle.
  * @since_tizen 2.4
+ * @remarks If there is no item you want to cancel, this API return MEDIA_CONTENT_ERROR_INVALID_OPERATION
  *
  * @param[in] thumb The media thumbnail info handle
  *
index fa76929..fb631a5 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-media-thumbnail-util
 Summary:    A media thumbnail util library in SLP C API
-Version: 0.1.1
+Version: 0.1.2
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0
@@ -30,6 +30,9 @@ A media thumbnail util  library in SLP C API
 
 
 %build
+export CFLAGS+=" -Wextra -Wno-array-bounds"
+export CFLAGS+=" -Wno-ignored-qualifiers -Wno-unused-parameter -Wshadow"
+export CFLAGS+=" -Wwrite-strings -Wswitch-default"
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
 %cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
 make %{?jobs:-j%jobs}
index 8266e3c..fc16c30 100755 (executable)
@@ -25,9 +25,12 @@ void __thumbnail_util_convert_itoa(int request_id, char **req_str)
        char *buf = NULL;
 
        buf = malloc(MAX_SIZE * sizeof(char));
-       snprintf(buf, MAX_SIZE, "%d", request_id);
-       *req_str = strndup(buf, strlen(buf));
-       SAFE_FREE(buf);
+
+       if (buf != NULL) {
+               snprintf(buf, MAX_SIZE, "%d", request_id);
+               *req_str = strndup(buf, strlen(buf));
+               SAFE_FREE(buf);
+       }
 }
 void __thumbnail_util_extract_completed_cb(int error, int request_id, const char *path, int thumb_width, int thumb_height, unsigned char *thumb_data, int thumb_size, void *user_data)
 {
@@ -82,9 +85,12 @@ int thumbnail_util_extract(thumbnail_h thumb, thumbnail_extracted_cb callback, v
                _thumb->request_id = g_thumbnail_req_id;
                __thumbnail_util_convert_itoa(_thumb->request_id, request_id);
                thumbnail_extract_cb_s *_thumb_cb = (thumbnail_extract_cb_s *)calloc(1, sizeof(thumbnail_extract_cb_s));
-               _thumb_cb->handle = _thumb;
-               _thumb_cb->user_data = user_data;
-               _thumb_cb->thumb_extract_cb = callback;
+
+               if (_thumb_cb != NULL) {
+                       _thumb_cb->handle = _thumb;
+                       _thumb_cb->user_data = user_data;
+                       _thumb_cb->thumb_extract_cb = callback;
+               }
 
                if (_thumb->dst_width == 0 || _thumb->dst_height == 0) {
                        _thumb->dst_width = 320;
@@ -154,7 +160,7 @@ int thumbnail_util_cancel_all(thumbnail_h thumb)
        int ret = THUMBNAIL_UTIL_ERROR_NONE;
        thumbnail_s *_thumb = (thumbnail_s *)thumb;
 
-       if(_thumb != NULL)      {
+       if (_thumb != NULL) {
                ret = thumbnail_request_cancel_all(true, tzplatform_getuid(TZ_USER_NAME));
        } else {
                thumbnail_util_error("INVALID_PARAMETER(0x%08x)", THUMBNAIL_UTIL_ERROR_INVALID_PARAMETER);