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";
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;
/* 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;
}
}
META_SAFE_FREE(picture);
- META_SAFE_FREE(type);
+ g_free(type);
return ret;
}