[libgdata] freebase: Fix locale-dependent issues in geolocated queries



commit 021370e3bf24ffdbf22e7d168a7487d51c519d93
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Sep 28 19:18:04 2014 +0200

    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

 .../freebase/gdata-freebase-search-query.c         |   10 ++++++++--
 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 4d6badb..4c666fd 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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]