public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Handle multibyte decimapl point in strtold.
@ 2015-11-21 15:51 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2015-11-21 15:51 UTC (permalink / raw)
  To: newlib-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=666a3482a5a24f93cf691b7b38c395241d38b34c

commit 666a3482a5a24f93cf691b7b38c395241d38b34c
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Sat Nov 21 16:40:21 2015 +0100

    Handle multibyte decimapl point in strtold.
    
    	* libc/stdlib/strtodg.c: Define USE_LOCALE.
    	(_strtodg_r): Handle multibyte decimal point.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 newlib/ChangeLog             | 5 +++++
 newlib/libc/stdlib/strtodg.c | 9 ++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index 7bc7b1d..af52b1b 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -1,3 +1,8 @@
+2015-11-21  Corinna Vinschen  <corinna@vinschen.de>
+
+	* libc/stdlib/strtodg.c: Define USE_LOCALE.
+	(_strtodg_r): Handle multibyte decimal point.
+
 2015-11-20  Corinna Vinschen  <corinna@vinschen.de>
 
 	* libc/stdlib/Makefile.am (GENERAL_SOURCES): Add strtodg.c and
diff --git a/newlib/libc/stdlib/strtodg.c b/newlib/libc/stdlib/strtodg.c
index 70ec179..594238a 100644
--- a/newlib/libc/stdlib/strtodg.c
+++ b/newlib/libc/stdlib/strtodg.c
@@ -39,6 +39,8 @@ THIS SOFTWARE.
 
 #include "locale.h"
 
+#define USE_LOCALE
+
  static const int
 fivesbits[] = {	 0,  3,  5,  7, 10, 12, 14, 17, 19, 21,
 		24, 26, 28, 31, 33, 35, 38, 40, 42, 45,
@@ -516,13 +518,18 @@ _strtodg_r
 			z = 10*z + c - '0';
 	nd0 = nd;
 #ifdef USE_LOCALE
-	if (c == *localeconv()->decimal_point)
+	if (strncmp (s, _localeconv_r (p)->decimal_point,
+		     strlen (_localeconv_r (p)->decimal_point)) == 0)
 #else
 	if (c == '.')
 #endif
 		{
 		decpt = 1;
+#ifdef USE_LOCALE
+		c = *(s += strlen (_localeconv_r (p)->decimal_point));
+#else
 		c = *++s;
+#endif
 		if (!nd) {
 			for(; c == '0'; c = *++s)
 				nz++;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-11-21 15:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-21 15:51 [newlib-cygwin] Handle multibyte decimapl point in strtold Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).