From: hj kim Date: Tue, 28 Apr 2020 08:50:25 +0000 (+0900) Subject: Improve __metadata_editor_get_picture_type() API X-Git-Tag: accepted/tizen/unified/20200605.020426~32 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=12eb48d3af8b10463dfa981e3c4b9f139f9cd21c;p=platform%2Fcore%2Fapi%2Fmetadata-editor.git Improve __metadata_editor_get_picture_type() API Change-Id: Ib3fb371c5fd914ca94051f8151bcf4ec035bdff3 --- diff --git a/src/metadata_editor.cpp b/src/metadata_editor.cpp index c2ffd52..7f6000a 100755 --- a/src/metadata_editor.cpp +++ b/src/metadata_editor.cpp @@ -696,7 +696,7 @@ int __metadata_editor_get_file_type(const char *path) { return METADATA_EDITOR_FORMAT_NOTYPE; } -int __metadata_editor_get_picture_type(const char *path, char **type) { +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"; @@ -712,10 +712,10 @@ 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 = strndup(type_jpeg, strlen(type_jpeg)); + *type = g_strndup(type_jpeg, strlen(type_jpeg)); return METADATA_EDITOR_ERROR_NONE; } else if (strcasecmp(ext, "PNG") == 0) { - *type = strndup(type_png, strlen(type_png)); + *type = g_strndup(type_png, strlen(type_png)); return METADATA_EDITOR_ERROR_NONE; } else { return METADATA_EDITOR_ERROR_NOT_SUPPORTED; @@ -726,10 +726,10 @@ int __metadata_editor_get_picture_type(const char *path, char **type) { /* categorize from mimetype */ if (strstr(mimetype, "jpeg") != NULL) { - *type = strndup(mimetype, strlen(mimetype)); + *type = g_strndup(mimetype, strlen(mimetype)); return METADATA_EDITOR_ERROR_NONE; } else if (strstr(mimetype, "png") != NULL) { - *type = strndup(mimetype, strlen(mimetype)); + *type = g_strndup(mimetype, strlen(mimetype)); return METADATA_EDITOR_ERROR_NONE; } @@ -1729,7 +1729,7 @@ extern "C" int metadata_editor_append_picture(metadata_editor_h metadata, const } META_SAFE_FREE(picture); - META_SAFE_FREE(type); + g_free(type); return ret; }