if ((mmf_error == FILEINFO_ERROR_NONE) && (size > 0)) {
if (content_info->media_type == MEDIA_SVC_MEDIA_TYPE_VIDEO) {
/*Creation time format is 2013-01-01 00:00:00. change it to 2013:01:01 00:00:00 like exif time format*/
- char time_info[64] = {0, };
- char p_value[64] = {0, };
- int idx = 0;
- memset(time_info, 0x00, sizeof(time_info));
- memset(p_value, 0x00, sizeof(p_value));
- strncpy(p_value, p, size);
- for (idx = 0; idx < size; idx++) {
- if (p_value[idx] == '-') {
- time_info[idx] = ':';
- } else if (p_value[idx] != '\0') {
- time_info[idx] = p_value[idx];
- } else {
- media_svc_error("strcpy error");
- break;
+ char *time_info = (char*)calloc(1, (size + 1));
+ char *p_value = p;
+ char *time_value = time_info;
+ if (time_info != NULL) {
+ while(*p_value != '\0') {
+ if (*p_value == '-')
+ *time_value = ':';
+ else
+ *time_value = *p_value;
+ time_value++;
+ p_value++;
}
+ *time_value = '\0';
+ ret = __media_svc_malloc_and_strncpy(&content_info->media_meta.recorded_date, time_info);
+ SAFE_FREE(time_info);
+ } else {
+ media_svc_error("memory allocation error");
+ ret = MS_MEDIA_ERR_OUT_OF_MEMORY;
}
- ret = __media_svc_malloc_and_strncpy(&content_info->media_meta.recorded_date, time_info);
} else {
ret = __media_svc_malloc_and_strncpy(&content_info->media_meta.recorded_date, p);
}