summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2014-09-28 19:18:04 +0200
committerCarlos Garnacho <carlosg@gnome.org>2014-12-23 11:11:32 +0100
commit021370e3bf24ffdbf22e7d168a7487d51c519d93 (patch)
tree47c9255c59c29ef6ed650db622bf57aeeda6f67a
parent43dd1889c41286b0bce6dd3f1ff86716f9f79775 (diff)
downloadlibgdata-021370e3bf24ffdbf22e7d168a7487d51c519d93.tar.gz
freebase: Fix locale-dependent issues in geolocated queries
Latitude/longitude are really expected with a '.' decimal point by the service, breaking on locales that would use anything different. Use g_ascii_formatd which always uses the '.' decimal point. https://bugzilla.gnome.org/show_bug.cgi?id=737541
-rw-r--r--gdata/services/freebase/gdata-freebase-search-query.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gdata/services/freebase/gdata-freebase-search-query.c b/gdata/services/freebase/gdata-freebase-search-query.c
index 4d6badb4..4c666fd2 100644
--- a/gdata/services/freebase/gdata-freebase-search-query.c
+++ b/gdata/services/freebase/gdata-freebase-search-query.c
@@ -246,9 +246,15 @@ build_filter_string (FilterNode *node,
break;
}
case NODE_LOCATION:
- g_string_append_printf (str, "(within radius:%" G_GUINT64_FORMAT "m lon:%.4f lat:%.4f)",
- node->location.radius, node->location.lon, node->location.lat);
+ {
+ gchar lon_str[G_ASCII_DTOSTR_BUF_SIZE], lat_str[G_ASCII_DTOSTR_BUF_SIZE];
+
+ g_ascii_formatd (lon_str, G_ASCII_DTOSTR_BUF_SIZE, "%.4f", node->location.lon);
+ g_ascii_formatd (lat_str, G_ASCII_DTOSTR_BUF_SIZE, "%.4f", node->location.lat);
+ g_string_append_printf (str, "(within radius:%" G_GUINT64_FORMAT "m lon:%s lat:%s)",
+ node->location.radius, lon_str, lat_str);
break;
+ }
default:
g_assert_not_reached ();
break;