From a26eeddef9022ffdcdcc6bc5b301346d2da22f7a Mon Sep 17 00:00:00 2001 From: Frank Warmerdam Date: Thu, 24 Sep 2009 02:14:06 +0000 Subject: temporarily set locale to C to avoid locale numeric issues (#49) git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1630 4e78687f-474d-0410-85f9-8d5e500ac6b2 --- ChangeLog | 3 +++ src/pj_init.c | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/ChangeLog b/ChangeLog index 240bbc41..c43d062c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2009-09-23 Frank Warmerdam + * src/pj_init.c: Temporarily set locale to "C" to avoid locale + specific number parsing (#49). + * src/pj_rho.c: move rho out of structure, threadsafety issue (#41). * nmake.opt: improve comments (#50). diff --git a/src/pj_init.c b/src/pj_init.c index 6b70d62b..2d84ef3f 100644 --- a/src/pj_init.c +++ b/src/pj_init.c @@ -34,6 +34,7 @@ #include #include #include +#include PJ_CVSID("$Id$"); @@ -225,10 +226,14 @@ pj_init(int argc, char **argv) { paralist *curr; int i; PJ *PIN = 0; + const char *old_locale; errno = pj_errno = 0; start = NULL; + old_locale = setlocale(LC_NUMERIC, NULL); + setlocale(LC_NUMERIC,"C"); + /* put arguments into internal linked list */ if (argc <= 0) { pj_errno = -1; goto bum_call; } for (i = 0; i < argc; ++i) @@ -377,6 +382,8 @@ bum_call: /* cleanup error return */ } PIN = 0; } + setlocale(LC_NUMERIC,old_locale); + return PIN; } -- cgit v1.2.3