Use helper function to write decimal numbers

Never ever use '%f' to write floating point data to a file. The stupid
locale handling creates useless comma-infested output in some locales.
Instead use one of our clever helper functions to do the right thing.

Original patch by Gehad, modified by Linus to be a little more generic.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Gehad 2014-04-05 13:01:34 -07:00 committed by Dirk Hohndel
parent 62e4c4069b
commit cb3436b42e
4 changed files with 17 additions and 17 deletions

View file

@ -94,8 +94,8 @@ void writeMarkers(struct membuffer *b)
if (dive->latitude.udeg == 0 && dive->longitude.udeg == 0)
continue;
put_format(b, "temp = new google.maps.Marker({position: new google.maps.LatLng(%f,%f)});\n",
dive->latitude.udeg / 1000000.0, dive->longitude.udeg / 1000000.0);
put_degrees(b, dive->latitude, "temp = new google.maps.Marker({position: new google.maps.LatLng(", "");
put_degrees(b, dive->longitude, ",", ")});\n");
put_string(b, "markers.push(temp);\ntempinfowindow = new google.maps.InfoWindow({content: '<div id=\"content\">'+'<div id=\"siteNotice\">'+'</div>'+'<div id=\"bodyContent\">");
put_HTML_date(b, dive);
put_duration(b, dive->duration, "<p>duration=", " min</p>");