Reinforce code for coverage 79/189579/1 accepted/tizen/5.0/unified/20181102.014553 accepted/tizen/unified/20180920.063835 submit/tizen/20180919.063447 submit/tizen_5.0/20181101.000002
authorMinje Ahn <minje.ahn@samsung.com>
Wed, 19 Sep 2018 01:58:41 +0000 (10:58 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Wed, 19 Sep 2018 01:58:41 +0000 (10:58 +0900)
Change-Id: Ib0b2f7930c9cf718b2242886ce0f6ca13c6835d6
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
packaging/capi-media-thumbnail-util.spec
src/thumbnail_util.c

index 64c7550..9296444 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-media-thumbnail-util
 Summary:    A media thumbnail util library in Tizen Native API
-Version: 0.1.17
+Version: 0.1.18
 Release:    1
 Group:      Multimedia/API
 License:    Apache-2.0
index eb83aa9..329b759 100755 (executable)
@@ -475,45 +475,13 @@ int _thumbnail_util_check_media_type(const char *path, thumbnail_util_media_type
 
        // Check media type
        ret = aul_get_mime_from_file(path, mimetype, sizeof(mimetype));
-       if (ret < 0) {
-               thumbnail_util_warn("aul_get_mime_from_file fail.. Now trying to get type by extension");
-
-               char ext[255] = { 0 };
-               ret = __thumbnail_util_get_file_ext(path, ext, sizeof(ext));
-               thumbnail_util_retvm_if(ret != THUMBNAIL_UTIL_ERROR_NONE, ret, "__thumbnail_util_get_file_ext failed");
-
-               if (strcasecmp(ext, "JPG") == 0 ||
-                       strcasecmp(ext, "JPEG") == 0 ||
-                       strcasecmp(ext, "PNG") == 0 ||
-                       strcasecmp(ext, "GIF") == 0 ||
-                       strcasecmp(ext, "AGIF") == 0 ||
-                       strcasecmp(ext, "XWD") == 0 ||
-                       strcasecmp(ext, "BMP") == 0 ||
-                       strcasecmp(ext, "WBMP") == 0) {
-                       *type = THUMBNAIL_UTIL_IMAGE;
-                       return THUMBNAIL_UTIL_ERROR_NONE;
-               } else if (strcasecmp(ext, "AVI") == 0 ||
-                       strcasecmp(ext, "MPEG") == 0 ||
-                       strcasecmp(ext, "MP4") == 0 ||
-                       strcasecmp(ext, "DCF") == 0 ||
-                       strcasecmp(ext, "WMV") == 0 ||
-                       strcasecmp(ext, "3GPP") == 0 ||
-                       strcasecmp(ext, "3GP") == 0) {
-                       *type = THUMBNAIL_UTIL_VIDEO;
-                       return THUMBNAIL_UTIL_ERROR_NONE;
-               } else {
-                       return THUMBNAIL_UTIL_ERROR_INVALID_PARAMETER;
-               }
-       }
+       thumbnail_util_retvm_if(ret < 0, THUMBNAIL_UTIL_ERROR_INVALID_OPERATION, "aul_get_mime_from_file failed");
 
        thumbnail_util_debug("mime type : %s", mimetype);
 
        /* categorize from mimetype */
        if (strstr(mimetype, "image") != NULL) {
-               if (!strcmp(mimetype, unsupported_type)) {
-                       thumbnail_util_warn("This is unsupport file type");
-                       return THUMBNAIL_UTIL_ERROR_UNSUPPORTED_CONTENT;
-               }
+               thumbnail_util_retvm_if(!strcmp(mimetype, unsupported_type), THUMBNAIL_UTIL_ERROR_UNSUPPORTED_CONTENT, "This is unsupport file type");
                *type = THUMBNAIL_UTIL_IMAGE;
                return THUMBNAIL_UTIL_ERROR_NONE;
        } else if (strstr(mimetype, "video") != NULL) {