]> git.street.me.uk Git - andy/viking.git/commitdiff
Portability: use of g_ascii_dtostr to format google url
authorMathieu Albinet <mathieu17@gmail.com>
Thu, 8 May 2008 21:19:46 +0000 (21:19 +0000)
committerMathieu Albinet <mathieu17@gmail.com>
Thu, 8 May 2008 21:19:46 +0000 (21:19 +0000)
This allows a LOCALE independant formatting

Submitted by Mathieu Albinet

ChangeLog
src/google.c

index 319cd91a66a0ea7218f4a536cb7ef788cf1ce993..82f26327e110ff3404059b051fc25ba3cd1e404c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
 Mathieu Albinet <mathieu17@gmail.com>:
        * 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 <guilhem.bonnefille@gmail.com>:
index f3876c1f213e0671a7205bec9f749396070dbc5d..dd500f61a427240db45cf6f5c95605db5018a81e 100644 (file)
@@ -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 */