return g_strdup(uuid_unparsed);
}
-static int __media_svc_split_to_double(char *input, double *arr)
-{
- char tmp_arr[255] = {0, };
- int len = 0, idx = 0, arr_idx = 0, str_idx = 0;
-
- if (!STRING_VALID(input)) {
- media_svc_error("Invalid parameter");
- return MS_MEDIA_ERR_INVALID_PARAMETER;
- }
- memset(tmp_arr, 0x0, sizeof(tmp_arr));
-
- /*media_svc_debug("input: [%s]", input); */
-
- len = strlen(input);
-
- for (idx = 0; idx < (len + 1); idx++) {
- if (input[idx] == ' ') {
- continue;
- } else if ((input[idx] == ',') || (idx == len)) {
- arr[arr_idx] = atof(tmp_arr);
- arr_idx++;
- str_idx = 0;
- /*media_svc_debug("idx=[%d] arr_idx=[%d] tmp_attr[%s] atof(tmp_arr)=[%f]", idx, arr_idx, tmp_arr, atof(tmp_arr)); */
- memset(tmp_arr, 0x0, sizeof(tmp_arr));
- } else {
- tmp_arr[str_idx] = input[idx];
- str_idx++;
- }
- }
-
- if (arr_idx != 3) {
- media_svc_debug("Error when parsing GPS [%d]", arr_idx);
- return MS_MEDIA_ERR_INTERNAL;
- }
-
- return MS_MEDIA_ERR_NONE;
-}
-
/* GPS information is not ExifTag member */
static int __media_svc_get_exif_gps_double(ExifData *ed, double *value, long tagtype)
{
- int ret = MS_MEDIA_ERR_NONE;
ExifEntry *entry;
char gps_buf[MEDIA_SVC_METADATA_LEN_MAX + 1] = {0, };
double tmp_arr[3] = { 0.0, 0.0, 0.0 };
+ int i = 0;
+ char **tmp_split = NULL;
media_svc_retv_if(!ed, MS_MEDIA_ERR_INVALID_PARAMETER);
media_svc_retv_if(!value, MS_MEDIA_ERR_INVALID_PARAMETER);
exif_entry_get_value(entry, gps_buf, sizeof(gps_buf));
gps_buf[strlen(gps_buf)] = '\0';
- ret = __media_svc_split_to_double(gps_buf, tmp_arr);
- media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
+ tmp_split = g_strsplit(gps_buf, ",", -1);
+ if (g_strv_length(tmp_split) != 3) {
+ g_strfreev(tmp_split);
+ media_svc_error("Wrong GPS format");
+ return MS_MEDIA_ERR_INTERNAL;
+ }
+
+ for (i = 0; i < 3; i++)
+ tmp_arr[i] = g_strtod(tmp_split[i], NULL);
+
+ g_strfreev(tmp_split);
*value = tmp_arr[0] + tmp_arr[1] / 60 + tmp_arr[2] / 3600;