Use g_strdup instead of __media_svc_malloc_and_strncpy_with_size
Change-Id: I34df062c9b2c4b933a792ff78c34857e0f0dcb4f
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
return MS_MEDIA_ERR_NONE;
}
return MS_MEDIA_ERR_NONE;
}
-int __media_svc_malloc_and_strncpy_with_size(char **dst, const char *src, int copysize)
-{
- if (!STRING_VALID(src)) {
- media_svc_error("invalid src");
- return MS_MEDIA_ERR_INVALID_PARAMETER;
- }
-
- SAFE_FREE(*dst);
-
- *dst = malloc(copysize + 1);
-
- if (*dst == NULL) {
- media_svc_error("malloc failed");
- return MS_MEDIA_ERR_INTERNAL;
- }
-
- strncpy(*dst, src, copysize);
- char *p = *dst;
- p[copysize] = '\0';
-
- return MS_MEDIA_ERR_NONE;
-}
-
static int __media_svc_split_to_double(char *input, double *arr)
{
char tmp_arr[255] = {0, };
static int __media_svc_split_to_double(char *input, double *arr)
{
char tmp_arr[255] = {0, };
if (strlen(buf) == 0) {
/*media_svc_debug("time is NULL"); */
} else {
if (strlen(buf) == 0) {
/*media_svc_debug("time is NULL"); */
} else {
- ret = __media_svc_malloc_and_strncpy_with_size(&content_info->media_meta.datetaken, buf, MEDIA_SVC_DATATAKEN_SIZE);
- if (ret != MS_MEDIA_ERR_NONE) {
- media_svc_error("strcpy error");
- } else {
- has_datetaken = TRUE;
- /* This is same as recorded_date */
- ret = __media_svc_malloc_and_strncpy(&content_info->media_meta.recorded_date, buf);
- if (ret != MS_MEDIA_ERR_NONE)
- media_svc_error("strcpy error");
- }
+ has_datetaken = TRUE;
+ content_info->media_meta.datetaken = g_strdup(buf);
+
+ /* This is same as recorded_date */
+ content_info->media_meta.recorded_date = g_strdup(buf);
if (strlen(buf) == 0) {
/*media_svc_debug("time is NULL"); */
} else {
if (strlen(buf) == 0) {
/*media_svc_debug("time is NULL"); */
} else {
- ret = __media_svc_malloc_and_strncpy_with_size(&content_info->media_meta.datetaken, buf, MEDIA_SVC_DATATAKEN_SIZE);
- if (ret != MS_MEDIA_ERR_NONE) {
- media_svc_error("strcpy error");
- } else {
- has_datetaken = TRUE;
- /* This is same as recorded_date */
- ret = __media_svc_malloc_and_strncpy(&content_info->media_meta.recorded_date, buf);
- if (ret != MS_MEDIA_ERR_NONE)
- media_svc_error("strcpy error");
- }
+ has_datetaken = TRUE;
+ content_info->media_meta.datetaken = g_strdup(buf);
+
+ /* This is same as recorded_date */
+ content_info->media_meta.recorded_date = g_strdup(buf);
media_svc_error("strcpy error");
} else {
/* This is same as datetaken */
media_svc_error("strcpy error");
} else {
/* This is same as datetaken */
-#if 0
- ret = __media_svc_malloc_and_strncpy(&content_info->media_meta.datetaken, content_info->media_meta.recorded_date);
-#else
- ret = __media_svc_malloc_and_strncpy_with_size(&content_info->media_meta.datetaken, content_info->media_meta.recorded_date, MEDIA_SVC_DATATAKEN_SIZE);
-#endif
- if (ret != MS_MEDIA_ERR_NONE)
- media_svc_error("strcpy error");
+ content_info->media_meta.datetaken = g_strdup(content_info->media_meta.recorded_date);
content_info->timeline = __media_svc_get_timeline_from_str(content_info->media_meta.recorded_date);
if (content_info->timeline == 0)
content_info->timeline = __media_svc_get_timeline_from_str(content_info->media_meta.recorded_date);
if (content_info->timeline == 0)
#define MEDIA_SVC_METADATA_LEN_MAX 512 /**< Length of metadata*/
#define MEDIA_SVC_METADATA_LEN_MAX 512 /**< Length of metadata*/
-#define MEDIA_SVC_DATATAKEN_SIZE 19 /**< Length of datataken */
#define MEDIA_SVC_PATHNAME_SIZE 4096 /**< Length of Path name. */
#define MEDIA_SVC_UUID_SIZE 36 /**< Length of UUID*/
#define MEDIA_SVC_QUERY_LEN_MAX 4096*2 /**< Max Query length*/
#define MEDIA_SVC_PATHNAME_SIZE 4096 /**< Length of Path name. */
#define MEDIA_SVC_UUID_SIZE 36 /**< Length of UUID*/
#define MEDIA_SVC_QUERY_LEN_MAX 4096*2 /**< Max Query length*/