From: hj kim Date: Thu, 7 May 2020 08:27:48 +0000 (+0900) Subject: Use defines for mime X-Git-Tag: accepted/tizen/unified/20200605.020426~26 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F18%2F232718%2F3;p=platform%2Fcore%2Fapi%2Fmetadata-editor.git Use defines for mime Change-Id: I5de8de8a0f6325dab8850bd25c8ac99be79c56e9 --- diff --git a/src/metadata_editor.cpp b/src/metadata_editor.cpp index 0d6f146..9a60fcb 100755 --- a/src/metadata_editor.cpp +++ b/src/metadata_editor.cpp @@ -699,8 +699,6 @@ int __metadata_editor_get_file_type(const char *path) { static int __metadata_editor_get_picture_type(const char *path, char **type) { int ret = 0; char mimetype[255] = {0, }; - const char *type_jpeg = "image/jpeg"; - const char *type_png = "image/png"; /* get content type and mime type from file. */ ret = aul_get_mime_from_file(path, mimetype, sizeof(mimetype)); @@ -712,10 +710,10 @@ static int __metadata_editor_get_picture_type(const char *path, char **type) { metadata_editor_retvm_if(ret < 0, METADATA_EDITOR_ERROR_OPERATION_FAILED, "__metadata_editor_get_file_ext failed"); if (strcasecmp(ext, "JPG") == 0 || strcasecmp(ext, "JPEG") == 0) { - *type = g_strndup(type_jpeg, strlen(type_jpeg)); + *type = g_strdup(MIME_TYPE_JPEG); return METADATA_EDITOR_ERROR_NONE; } else if (strcasecmp(ext, "PNG") == 0) { - *type = g_strndup(type_png, strlen(type_png)); + *type = g_strdup(MIME_TYPE_JPEG); return METADATA_EDITOR_ERROR_NONE; } else { return METADATA_EDITOR_ERROR_NOT_SUPPORTED; @@ -1580,9 +1578,9 @@ extern "C" int metadata_editor_append_picture(metadata_editor_h metadata, const metadata_editor_info("The item exists. Adding picture"); TagLib::MP4::CoverArtList lst = it->second.toCoverArtList(); TagLib::MP4::CoverArt::Format format; - if (strncmp(type, "image/jpeg", strlen("image/jpeg")) == 0) + if (strncmp(type, MIME_TYPE_JPEG, strlen(MIME_TYPE_JPEG)) == 0) format = TagLib::MP4::CoverArt::JPEG; - else if (strncmp(type, "image/png", strlen("image/jpeg")) == 0) + else if (strncmp(type, MIME_TYPE_PNG, strlen(MIME_TYPE_PNG)) == 0) format = TagLib::MP4::CoverArt::PNG; else format = (TagLib::MP4::CoverArt::Format)0xFFFF; @@ -1595,9 +1593,9 @@ extern "C" int metadata_editor_append_picture(metadata_editor_h metadata, const } else { // Item was not found metadata_editor_info("The item does not exist. Adding picture"); TagLib::MP4::CoverArt::Format format; - if (strncmp(type, "image/jpeg", strlen("image/jpeg")) == 0) + if (strncmp(type, MIME_TYPE_JPEG, strlen(MIME_TYPE_JPEG)) == 0) format = TagLib::MP4::CoverArt::JPEG; - else if (strncmp(type, "image/png", strlen("image/jpeg")) == 0) + else if (strncmp(type, MIME_TYPE_PNG, strlen(MIME_TYPE_PNG)) == 0) format = TagLib::MP4::CoverArt::PNG; else format = (TagLib::MP4::CoverArt::Format)0xFFFF;