]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
[BZ #3664]
authorUlrich Drepper <drepper@redhat.com>
Sun, 10 Dec 2006 01:52:21 +0000 (01:52 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sun, 10 Dec 2006 01:52:21 +0000 (01:52 +0000)
* stdlib/strtod_l.c (____STRTOF_INTERNAL): Fix test to recognize
empty parsed strings.
* stdlib/Makefile (tests): Add tst-strtod2.
* stdlib/tst-strtod2.c: New file.

ChangeLog
stdlib/Makefile
stdlib/strtod_l.c

index 2c37e52341b935894a295385923ec7db65299b5a..e3e2f977d45e1dfba86ee8d49540060faa2dc19a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2006-12-09  Ulrich Drepper  <drepper@redhat.com>
 
+       [BZ #3664]
+       * stdlib/strtod_l.c (____STRTOF_INTERNAL): Fix test to recognize
+       empty parsed strings.
+       * stdlib/Makefile (tests): Add tst-strtod2.
+       * stdlib/tst-strtod2.c: New file.
+
        [BZ #3673]
        * stdlib/strtod_l.c (____STRTOF_INTERNAL): Fix exp_limit
        computation.
index 5387475400a34d22698559f24e9c065ce3697e5d..37400ec5472989d87a0fdbf797cfdb267a255b8f 100644 (file)
@@ -67,7 +67,7 @@ tests         := tst-strtol tst-strtod testmb testrand testsort testdiv   \
                   tst-xpg-basename tst-random tst-random2 tst-bsearch      \
                   tst-limits tst-rand48 bug-strtod tst-setcontext          \
                   test-a64l tst-qsort tst-system testmb2 bug-strtod2       \
-                  tst-atof1 tst-atof2
+                  tst-atof1 tst-atof2 tst-strtod2
 
 include ../Makeconfig
 
index 6f7e62fbb8c58a3088e8c853b5a86676c74c9176..b926aeba56e264b13d0fb8171307f612f931aab2 100644 (file)
@@ -662,20 +662,20 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
 
   /* If no other digit but a '0' is found the result is 0.0.
      Return current read pointer.  */
-  if ((c < L_('0') || c > L_('9'))
-      && (base == 16 && (c < (CHAR_TYPE) TOLOWER (L_('a'))
-                        || c > (CHAR_TYPE) TOLOWER (L_('f'))))
+  if (!((c >= L_('0') && c <= L_('9'))
+       || (base == 16 && ((CHAR_TYPE) TOLOWER (c) >= L_('a')
+                          && (CHAR_TYPE) TOLOWER (c) <= L_('f')))
 #ifdef USE_WIDE_CHAR
-      && c != (wint_t) decimal
+       || c == (wint_t) decimal
 #else
-      && ({ for (cnt = 0; decimal[cnt] != '\0'; ++cnt)
+       || ({ for (cnt = 0; decimal[cnt] != '\0'; ++cnt)
              if (decimal[cnt] != cp[cnt])
                break;
-           decimal[cnt] != '\0'; })
+             decimal[cnt] == '\0'; })
 #endif
-      && (base == 16 && (cp == start_of_digits
-                        || (CHAR_TYPE) TOLOWER (c) != L_('p')))
-      && (base != 16 && (CHAR_TYPE) TOLOWER (c) != L_('e')))
+       || (base == 16 && (cp != start_of_digits
+                          && (CHAR_TYPE) TOLOWER (c) == L_('p')))
+       || (base != 16 && (CHAR_TYPE) TOLOWER (c) == L_('e'))))
     {
 #ifdef USE_WIDE_CHAR
       tp = __correctly_grouped_prefixwc (start_of_digits, cp, thousands,