From: Mathieu Albinet Date: Thu, 8 May 2008 21:19:46 +0000 (+0000) Subject: Portability: use of g_ascii_dtostr to format google url X-Git-Url: https://git.street.me.uk/andy/viking.git/commitdiff_plain/27c30bbe2080f7f2f578bc55a15c2e9da7ff9adb Portability: use of g_ascii_dtostr to format google url This allows a LOCALE independant formatting Submitted by Mathieu Albinet --- diff --git a/ChangeLog b/ChangeLog index 319cd91a..82f26327 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ Mathieu Albinet : * Windows port: rename interface to source_interface * Portability: replace mmap functions by g_mapped_file* + * Portability: use of g_ascii_dtostr to format google url 2008-05-02: Guilhem Bonnefille : diff --git a/src/google.c b/src/google.c index f3876c1f..dd500f61 100644 --- a/src/google.c +++ b/src/google.c @@ -111,6 +111,7 @@ static const gchar *google_version_number(MapCoord *mapcoord, GoogleType google_ gchar *tmpname; gchar *uri; VikCoord coord; + gchar coord_north_south[G_ASCII_DTOSTR_BUF_SIZE], coord_east_west[G_ASCII_DTOSTR_BUF_SIZE]; gchar *text, *pat, *beg; GMappedFile *mf; gsize len; @@ -133,7 +134,9 @@ static const gchar *google_version_number(MapCoord *mapcoord, GoogleType google_ } google_mapcoord_to_center_coord(mapcoord, &coord); - uri = g_strdup_printf("http://maps.google.com/maps?f=q&hl=en&q=%f,%f", coord.north_south, coord.east_west); + uri = g_strdup_printf("http://maps.google.com/maps?f=q&hl=en&q=%s,%s", + g_ascii_dtostr (coord_north_south, G_ASCII_DTOSTR_BUF_SIZE, (gdouble) coord.north_south), + g_ascii_dtostr (coord_east_west, G_ASCII_DTOSTR_BUF_SIZE, (gdouble) coord.east_west)); tmp_file = fdopen(tmp_fd, "r+"); if (curl_download_uri(uri, tmp_file, &dl_options)) { /* error */