aboutsummaryrefslogtreecommitdiff
path: root/src/pj_utils.c
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2018-09-27 19:15:13 +0200
committerEven Rouault <even.rouault@spatialys.com>2018-09-28 13:53:02 +0200
commitb693d210fac7617d94e120e9803079d33c29cac9 (patch)
treeb9a041fb9ff4bcc7c96a929d7358e1b842ef852a /src/pj_utils.c
parent15edf4c41bea992c032736149d4a3c1c8aafdc7c (diff)
downloadPROJ-b693d210fac7617d94e120e9803079d33c29cac9.tar.gz
PROJ-b693d210fac7617d94e120e9803079d33c29cac9.zip
cs2cs_emulation_setup: fix issue with non C-locale
in +towgs84 case, we use sprintf() with floating-point formatter to output the ellipsoid parameters. For a locale with decimal separtor != dot, the resulting string will not be parsed correctly by proj_atof(), leading to wrong numeric result. The fix is similar to the one done in pj_latlong_from_proj() Note for later: if using C++, we could use a locale-independent formatting solution to avoid such issue.
Diffstat (limited to 'src/pj_utils.c')
-rw-r--r--src/pj_utils.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/pj_utils.c b/src/pj_utils.c
index 3f18cc7e..81a80b45 100644
--- a/src/pj_utils.c
+++ b/src/pj_utils.c
@@ -105,6 +105,8 @@ PJ *pj_latlong_from_proj( PJ *pj_in )
{
char* ptr = defn+strlen(defn);
sprintf( ptr, " +es=%.16g", pj_in->es );
+ /* TODO later: use C++ ostringstream with imbue(std::locale::classic()) */
+ /* to be locale unaware */
for(; *ptr; ptr++)
{
if( *ptr == ',' )