From: Minje Ahn Date: Wed, 19 Sep 2018 01:58:41 +0000 (+0900) Subject: Reinforce code for coverage X-Git-Tag: submit/tizen/20180919.063447^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F79%2F189579%2F1;p=platform%2Fcore%2Fapi%2Fthumbnail-util.git Reinforce code for coverage Change-Id: Ib0b2f7930c9cf718b2242886ce0f6ca13c6835d6 Signed-off-by: Minje Ahn --- diff --git a/packaging/capi-media-thumbnail-util.spec b/packaging/capi-media-thumbnail-util.spec index 64c7550..9296444 100755 --- a/packaging/capi-media-thumbnail-util.spec +++ b/packaging/capi-media-thumbnail-util.spec @@ -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 diff --git a/src/thumbnail_util.c b/src/thumbnail_util.c index eb83aa9..329b759 100755 --- a/src/thumbnail_util.c +++ b/src/thumbnail_util.c @@ -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) {