aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@mines-paris.org>2018-09-28 13:52:10 +0200
committerGitHub <noreply@github.com>2018-09-28 13:52:10 +0200
commitda0e7f9fd5c259aecde19aaab7758e9545b0ecfa (patch)
treebc139f6787ab6ce1820b78dce5175015180b75c6 /src
parent0b32b840d3161c64d8f1f487b153178528c8c124 (diff)
parentb65cc5d50414212efa0029e7715c92e880967a4f (diff)
downloadPROJ-da0e7f9fd5c259aecde19aaab7758e9545b0ecfa.tar.gz
PROJ-da0e7f9fd5c259aecde19aaab7758e9545b0ecfa.zip
Merge pull request #1136 from rouault/fix_locale_issue_cs2cs_emulation_setup
cs2cs_emulation_setup: fix issue with non C-locale
Diffstat (limited to 'src')
-rw-r--r--src/pj_utils.c2
-rw-r--r--src/proj_4D_api.c11
2 files changed, 13 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 == ',' )
diff --git a/src/proj_4D_api.c b/src/proj_4D_api.c
index 74cf45d6..81967a1d 100644
--- a/src/proj_4D_api.c
+++ b/src/proj_4D_api.c
@@ -519,6 +519,17 @@ Returns 1 on success, 0 on failure
if (P->is_geocent || P->helmert || do_cart) {
char def[150];
sprintf (def, "break_cs2cs_recursion proj=cart a=%40.20g es=%40.20g", P->a_orig, P->es_orig);
+ {
+ /* In case the current locale does not use dot but comma as decimal */
+ /* separator, replace it with dot, so that proj_atof() behaves */
+ /* correctly. */
+ /* TODO later: use C++ ostringstream with imbue(std::locale::classic()) */
+ /* to be locale unaware */
+ char* next_pos;
+ for (next_pos = def; (next_pos = strchr (next_pos, ',')) != NULL; next_pos++) {
+ *next_pos = '.';
+ }
+ }
Q = proj_create (P->ctx, def);
if (0==Q)
return 0;