diff options
author | Chris Sutcliffe <ir0nh34d@users.sourceforge.net> | 2008-03-20 02:55:56 +0000 |
---|---|---|
committer | Chris Sutcliffe <ir0nh34d@users.sourceforge.net> | 2008-03-20 02:55:56 +0000 |
commit | b6f8240fa03c4efcf89c335fe5f9db3c9a1480d7 (patch) | |
tree | 61a48ee9bda8b9c469d54e71f19129b74c30c645 /winsup | |
parent | 197dffcbd697a3beb0ee62f76fb053b4ed21f0e2 (diff) | |
download | newlib-b6f8240fa03c4efcf89c335fe5f9db3c9a1480d7.zip newlib-b6f8240fa03c4efcf89c335fe5f9db3c9a1480d7.tar.gz newlib-b6f8240fa03c4efcf89c335fe5f9db3c9a1480d7.tar.bz2 |
2008-02-08 Danny Smith <dannysmith@users.sourceforge.net>
* mingwex/gdtoa/gdtoaimp.h (USE_LOCALE): Define.
* mingwex/gdtoa/mingw_snprintf.c: [USE_LOCALE] Include locale.h.
(x_sprintf): [USE_LOCALE] Use *localeconv()->decimal_point.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/mingw/ChangeLog | 5 | ||||
-rwxr-xr-x | winsup/mingw/mingwex/gdtoa/gdtoaimp.h | 3 | ||||
-rwxr-xr-x | winsup/mingw/mingwex/gdtoa/mingw_snprintf.c | 18 |
3 files changed, 20 insertions, 6 deletions
diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog index 37f23da..9b7ff66 100644 --- a/winsup/mingw/ChangeLog +++ b/winsup/mingw/ChangeLog @@ -1,3 +1,8 @@ +2008-02-08 Danny Smith <dannysmith@users.sourceforge.net> + * mingwex/gdtoa/gdtoaimp.h (USE_LOCALE): Define. + * mingwex/gdtoa/mingw_snprintf.c: [USE_LOCALE] Include locale.h. + (x_sprintf): [USE_LOCALE] Use *localeconv()->decimal_point. + 2008-02-28 Joseph Myers <joseph@codesourcery.com> * include/complex.h: Don't condition contents on C99 or not diff --git a/winsup/mingw/mingwex/gdtoa/gdtoaimp.h b/winsup/mingw/mingwex/gdtoa/gdtoaimp.h index b27524e..04e625c 100755 --- a/winsup/mingw/mingwex/gdtoa/gdtoaimp.h +++ b/winsup/mingw/mingwex/gdtoa/gdtoaimp.h @@ -2,7 +2,7 @@ The author of this software is David M. Gay. -Copyright (C) 1998-2000 by Lucent Technologies +Copyright (C) 1998-2008 by Lucent Technologies All Rights Reserved Permission to use, copy, modify, and distribute this software and @@ -172,6 +172,7 @@ THIS SOFTWARE. #define INFNAN_CHECK 1 #define MULTIPLE_THREADS 1 +#define USE_LOCALE 1 #ifdef DEBUG #include <stdio.h> diff --git a/winsup/mingw/mingwex/gdtoa/mingw_snprintf.c b/winsup/mingw/mingwex/gdtoa/mingw_snprintf.c index 0bdd52f..5df2ab1 100755 --- a/winsup/mingw/mingwex/gdtoa/mingw_snprintf.c +++ b/winsup/mingw/mingwex/gdtoa/mingw_snprintf.c @@ -91,8 +91,10 @@ THIS SOFTWARE. #include <math.h> #include <stdint.h> -#include "gdtoa.h" - +#include "gdtoaimp.h" +#ifdef USE_LOCALE +#include "locale.h" +#endif /* * For a MinGW build, we provide the implementation dependent entries @@ -381,6 +383,12 @@ x_sprintf static char hex[] = "0123456789abcdef"; static char Hex[] = "0123456789ABCDEF"; +#ifdef USE_LOCALE + char decimalpoint = *localeconv()->decimal_point; +#else + static const char decimalpoint = '.'; +#endif + ob0 = outbuf = f->ob0; rv = 0; for(;;) { @@ -751,7 +759,7 @@ x_sprintf if (decpt <= 0) { put('0') if (prec > 0 || alt) - put('.') + put(decimalpoint) while(decpt < 0) { put('0') prec--; @@ -768,7 +776,7 @@ x_sprintf } while(--decpt > 0); if (prec > 0 || alt) - put('.') + put(decimalpoint) } while(--prec >= 0) { if ((c = *s)) @@ -868,7 +876,7 @@ x_sprintf put(sign) put(*s++) if (prec || alt) - put('.') + put(decimalpoint) while(--prec >= 0) { if ((c = *s)) s++; |