[tracker-miners/wip/carlosg/parallel-installable: 41/41] libtracker-extract: Use g_ascii_dtostr for GPS coordinates in XMP
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/wip/carlosg/parallel-installable: 41/41] libtracker-extract: Use g_ascii_dtostr for GPS coordinates in XMP
- Date: Sun, 5 Apr 2020 17:22:44 +0000 (UTC)
commit d6ad9611b0a1d2533ebb2f7c0a803d62b23e24b3
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Mar 23 16:09:23 2020 +0100
libtracker-extract: Use g_ascii_dtostr for GPS coordinates in XMP
g_strdup_printf() use of separators is locale-specific. Not what we
want here.
src/libtracker-extract/tracker-xmp.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/libtracker-extract/tracker-xmp.c b/src/libtracker-extract/tracker-xmp.c
index 20bb0a65f..af45436ab 100644
--- a/src/libtracker-extract/tracker-xmp.c
+++ b/src/libtracker-extract/tracker-xmp.c
@@ -135,8 +135,9 @@ gps_coordinate_dup (const gchar *coordinates)
}
if (g_regex_match (reg, coordinates, 0, &info)) {
- gchar *deg,*min,*ref;
- gdouble r,d,m;
+ gchar buf[G_ASCII_DTOSTR_BUF_SIZE];
+ gchar *deg, *min, *ref;
+ gdouble r, d, m;
deg = g_match_info_fetch (info, 1);
min = g_match_info_fetch (info, 2);
@@ -156,7 +157,7 @@ gps_coordinate_dup (const gchar *coordinates)
g_free (ref);
g_match_info_free (info);
- return g_strdup_printf ("%f", r);
+ return g_strdup (g_ascii_dtostr (buf, sizeof (buf), r));
} else {
g_match_info_free (info);
return NULL;
@@ -213,7 +214,10 @@ div_str_dup (const gchar *value)
b = atoi (cpy + (ptr - value) + 1);
if (b != 0) {
- ret = g_strdup_printf ("%G", ((gdouble)((gdouble) a / (gdouble) b)));
+ gchar buf[G_ASCII_DTOSTR_BUF_SIZE];
+
+ ret = g_strdup (g_ascii_dtostr (buf, sizeof (buf),
+ ((gdouble) a / b)));
} else {
ret = NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]