[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r1504 - in /fsf/trunk/libc: ./ localedata/ localedata/locales/ nptl/ nptl/sysdeps/pthread/ stdio-common/ sysdeps/i386/fpu/ s...
- To: commits@xxxxxxxxxx
- Subject: [commits] r1504 - in /fsf/trunk/libc: ./ localedata/ localedata/locales/ nptl/ nptl/sysdeps/pthread/ stdio-common/ sysdeps/i386/fpu/ s...
- From: eglibc@xxxxxxxxxx
- Date: Mon, 19 Feb 2007 08:01:39 -0000
Author: eglibc
Date: Mon Feb 19 00:01:39 2007
New Revision: 1504
Log:
Import glibc-mainline for 2007-02-19
Added:
fsf/trunk/libc/localedata/tst-sscanf.c
fsf/trunk/libc/stdio-common/tst-swscanf.c
Modified:
fsf/trunk/libc/ChangeLog
fsf/trunk/libc/localedata/ChangeLog
fsf/trunk/libc/localedata/Makefile
fsf/trunk/libc/localedata/da_DK.in
fsf/trunk/libc/localedata/locales/vi_VN
fsf/trunk/libc/nptl/ChangeLog
fsf/trunk/libc/nptl/sysdeps/pthread/pthread-functions.h
fsf/trunk/libc/stdio-common/Makefile
fsf/trunk/libc/stdio-common/tst-sscanf.c
fsf/trunk/libc/stdio-common/vfscanf.c
fsf/trunk/libc/sysdeps/i386/fpu/e_fmod.S
fsf/trunk/libc/sysdeps/i386/fpu/e_fmodf.S
fsf/trunk/libc/sysdeps/i386/fpu/e_fmodl.c
fsf/trunk/libc/sysdeps/unix/closedir.c
fsf/trunk/libc/sysdeps/unix/opendir.c
fsf/trunk/libc/sysdeps/unix/readdir.c
Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Mon Feb 19 00:01:39 2007
@@ -1,3 +1,32 @@
+2007-02-18 Ulrich Drepper <drepper@xxxxxxxxxx>
+
+ [BZ #3325]
+ * sysdeps/i386/fpu/e_fmodf.S: Use fprem1 instead of fprem.
+ * sysdeps/i386/fpu/e_fmodl.c: Likewise.
+ * sysdeps/i386/fpu/e_fmod.S: Likewise.
+ Patch by Jared Casper <jaredcasper@xxxxxxxxx>.
+
+ * sysdeps/unix/closedir.c: Outside libc don't use locking.
+ * sysdeps/unix/opendir.c: Likewise.
+ * sysdeps/unix/readdir.c: Likewise.
+
+ [BZ #2211]
+ * stdio-common/vfscanf.c: Handle localized digits etc for floating
+ point numbers.
+ Patch mostly by Hamed Malek <hamed@xxxxxxxxxxxxx>.
+
+ * stdio-common/vfscanf.c: Fix problems in width accounting.
+ * stdio-common/tst-sscanf.c (double_tests): New tests.
+ (main): Hook them up.
+
+ * stdio-common/vfscanf.c: Remove unused WIDTH handling.
+ More simplifications of floating-point reader.
+
+ * stdio-common/Makefile (tests): Add tst-swscanf.
+ * stdio-common/tst-sscanf.c: Make tests usable for swscanf
+ testing.
+ * stdio-common/tst-swscanf.c: New file.
+
2007-02-17 Ulrich Drepper <drepper@xxxxxxxxxx>
[BZ #2633]
Modified: fsf/trunk/libc/localedata/ChangeLog
==============================================================================
--- fsf/trunk/libc/localedata/ChangeLog (original)
+++ fsf/trunk/libc/localedata/ChangeLog Mon Feb 19 00:01:39 2007
@@ -1,3 +1,13 @@
+2007-02-18 Ulrich Drepper <drepper@xxxxxxxxxx>
+
+ * Makefile (tests): Add tst-sscanf.
+ (LOCALES): Add fa_IR.UTF-8.
+ * tst-sscanf.c: New file.
+
+ * da_DK.in: Adjust for unified collation.
+
+ * locales/vi_VN: Don't define HOK here as well.
+
2007-02-17 Ulrich Drepper <drepper@xxxxxxxxxx>
* SUPPORTED (SUPPORTED-LOCALES): Remove sr_CS locales.
Modified: fsf/trunk/libc/localedata/Makefile
==============================================================================
--- fsf/trunk/libc/localedata/Makefile (original)
+++ fsf/trunk/libc/localedata/Makefile Mon Feb 19 00:01:39 2007
@@ -1,4 +1,4 @@
-# Copyright (C) 1996-2002, 2003, 2005 Free Software Foundation, Inc.
+# Copyright (C) 1996-2002, 2003, 2005, 2007 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -93,7 +93,7 @@
tests = $(locale_test_suite) tst-digits tst-setlocale bug-iconv-trans \
tst-leaks tst-mbswcs6 tst-xlocale1 tst-xlocale2 bug-usesetlocale \
- tst-strfmon1
+ tst-strfmon1 tst-sscanf
ifeq (yes,$(build-shared))
ifneq (no,$(PERL))
tests: $(objpfx)mtrace-tst-leaks
@@ -133,7 +133,7 @@
en_US.ISO-8859-1 ja_JP.EUC-JP da_DK.ISO-8859-1 \
hr_HR.ISO-8859-2 sv_SE.ISO-8859-1 ja_JP.SJIS fr_FR.ISO-8859-1 \
vi_VN.TCVN5712-1 nb_NO.ISO-8859-1 nn_NO.ISO-8859-1 \
- tr_TR.UTF-8 cs_CZ.UTF-8 zh_TW.EUC-TW
+ tr_TR.UTF-8 cs_CZ.UTF-8 zh_TW.EUC-TW fa_IR.UTF-8
LOCALE_SRCS := $(shell echo "$(LOCALES)"|sed 's/\([^ .]*\)[^ ]*/\1/g')
CHARMAPS := $(shell echo "$(LOCALES)" | \
sed -e 's/[^ .]*[.]\([^ ]*\)/\1/g' -e s/SJIS/SHIFT_JIS/g)
Modified: fsf/trunk/libc/localedata/da_DK.in
==============================================================================
--- fsf/trunk/libc/localedata/da_DK.in (original)
+++ fsf/trunk/libc/localedata/da_DK.in Mon Feb 19 00:01:39 2007
@@ -1,9 +1,9 @@
A
-A/S
ANDRE
ANDRÉ
ANDREAS
AS
+A/S
CA
ÇA
CB
@@ -23,9 +23,9 @@
HAANDVÆRKSBANKEN
Karl
karl
+NIELSEN
NIELS JØRGEN
NIELS-JØRGEN
-NIELSEN
RÉE, A
REE, B
RÉE, L
@@ -39,10 +39,10 @@
SS
ß
SSA
+STOREKÆR
STORE VILDMOSE
-STOREKÆR
+STORMLY
STORM PETERSEN
-STORMLY
SÅ
SAA
Saa
Modified: fsf/trunk/libc/localedata/locales/vi_VN
==============================================================================
--- fsf/trunk/libc/localedata/locales/vi_VN (original)
+++ fsf/trunk/libc/localedata/locales/vi_VN Mon Feb 19 00:01:39 2007
@@ -73,8 +73,6 @@
collating-symbol <o/>>
collating-symbol <o9>
collating-symbol <u9>
-
-collating-symbol <HOK>
reorder-after <BAS>
<GRA>
Added: fsf/trunk/libc/localedata/tst-sscanf.c
==============================================================================
--- fsf/trunk/libc/localedata/tst-sscanf.c (added)
+++ fsf/trunk/libc/localedata/tst-sscanf.c Mon Feb 19 00:01:39 2007
@@ -1,0 +1,56 @@
+#include <stdio.h>
+#include <locale.h>
+#include <assert.h>
+
+#define P0 "\xDB\xB0"
+#define P1 "\xDB\xB1"
+#define P2 "\xDB\xB2"
+#define P3 "\xDB\xB3"
+#define P4 "\xDB\xB4"
+#define P5 "\xDB\xB5"
+#define P6 "\xDB\xB6"
+#define P7 "\xDB\xB7"
+#define P8 "\xDB\xB8"
+#define P9 "\xDB\xB9"
+#define PD "\xd9\xab"
+#define PT "\xd9\xac"
+
+static int
+check_sscanf (const char *s, const char *format, const float n)
+{
+ float f;
+
+ if (sscanf (s, format, &f) != 1)
+ {
+ printf ("nothing found for \"%s\"\n", s);
+ return 1;
+ }
+ if (f != n)
+ {
+ printf ("got %f expected %f from \"%s\"\n", f, n, s);
+ return 1;
+ }
+ return 0;
+}
+
+static int
+do_test (void)
+{
+ if (setlocale (LC_ALL, "fa_IR") == NULL)
+ {
+ puts ("cannot set fa_IR locale");
+ return 1;
+ }
+
+ int r = check_sscanf (P3 PD P1 P4, "%I8f", 3.14);
+ r |= check_sscanf (P3 PT P1 P4 P5, "%I'f", 3145);
+ r |= check_sscanf (P3 PD P1 P4 P1 P5 P9, "%If", 3.14159);
+ r |= check_sscanf ("-" P3 PD P1 P4 P1 P5, "%If", -3.1415);
+ r |= check_sscanf ("+" PD P1 P4 P1 P5, "%If", +.1415);
+ r |= check_sscanf (P3 PD P1 P4 P1 P5 "e+" P2, "%Ie", 3.1415e+2);
+
+ return r;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
Modified: fsf/trunk/libc/nptl/ChangeLog
==============================================================================
--- fsf/trunk/libc/nptl/ChangeLog (original)
+++ fsf/trunk/libc/nptl/ChangeLog Mon Feb 19 00:01:39 2007
@@ -1,3 +1,8 @@
+2007-02-18 Ulrich Drepper <drepper@xxxxxxxxxx>
+
+ * sysdeps/pthread/pthread-functions.h: If PTR_DEMANGLE is not
+ available, don't use it.
+
2007-02-09 Jakub Jelinek <jakub@xxxxxxxxxx>
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
Modified: fsf/trunk/libc/nptl/sysdeps/pthread/pthread-functions.h
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/pthread/pthread-functions.h (original)
+++ fsf/trunk/libc/nptl/sysdeps/pthread/pthread-functions.h Mon Feb 19 00:01:39 2007
@@ -97,16 +97,22 @@
void (*ptr__nptl_deallocate_tsd) (void);
int (*ptr__nptl_setxid) (struct xid_command *);
void (*ptr_freeres) (void);
+ void (*ptr_wait_lookup_done) (int);
};
/* Variable in libc.so. */
extern struct pthread_functions __libc_pthread_functions attribute_hidden;
extern int __libc_pthread_functions_init attribute_hidden;
-#define PTHFCT_CALL(fct, params) \
+#ifdef PTR_DEMANGLE
+# define PTHFCT_CALL(fct, params) \
+ __libc_pthread_functions.fct params
+#else
+# define PTHFCT_CALL(fct, params) \
({ __typeof (__libc_pthread_functions.fct) __p; \
__p = __libc_pthread_functions.fct; \
PTR_DEMANGLE (__p); \
__p params; })
+#endif
#endif /* pthread-functions.h */
Modified: fsf/trunk/libc/stdio-common/Makefile
==============================================================================
--- fsf/trunk/libc/stdio-common/Makefile (original)
+++ fsf/trunk/libc/stdio-common/Makefile Mon Feb 19 00:01:39 2007
@@ -54,7 +54,7 @@
tst-swprintf tst-fseek tst-fmemopen test-vfprintf tst-gets \
tst-perror tst-sprintf tst-rndseek tst-fdopen tst-fphex bug14 bug15 \
tst-popen tst-unlockedio tst-fmemopen2 tst-put-error tst-fgets \
- tst-fwrite bug16 bug17
+ tst-fwrite bug16 bug17 tst-swscanf
test-srcs = tst-unbputc tst-printf
Modified: fsf/trunk/libc/stdio-common/tst-sscanf.c
==============================================================================
--- fsf/trunk/libc/stdio-common/tst-sscanf.c (original)
+++ fsf/trunk/libc/stdio-common/tst-sscanf.c Mon Feb 19 00:01:39 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2002, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2002, 2004, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@xxxxxxxxxx>, 2000.
@@ -21,12 +21,18 @@
#include <stdio.h>
#include <locale.h>
-const char *str_double[] =
-{
- "-.10000E+020.20000E+020.25000E+010.40000E+010.50000E+010.12500E+01",
- "0.10000E+020.20000E+020.25000E+010.40000E+010.50000E+010.12500E+01",
- "-1234567E0198765432E0912345678901987654321091234567890198765432109",
- "-0.1000E+020.20000E+020.25000E+010.40000E+010.50000E+010.12500E+01"
+#ifndef CHAR
+# define CHAR char
+# define L(str) str
+# define SSCANF sscanf
+#endif
+
+const CHAR *str_double[] =
+{
+ L("-.10000E+020.20000E+020.25000E+010.40000E+010.50000E+010.12500E+01"),
+ L("0.10000E+020.20000E+020.25000E+010.40000E+010.50000E+010.12500E+01"),
+ L("-1234567E0198765432E0912345678901987654321091234567890198765432109"),
+ L("-0.1000E+020.20000E+020.25000E+010.40000E+010.50000E+010.12500E+01")
};
const double val_double[] =
@@ -38,20 +44,20 @@
-0.1000E+02, 0.20000E+02, 0.25000E+01, 0.40000E+01, 0.50000E+01, 0.12500E+01
};
-const char *str_long[] =
-{
- "-12345678987654321123456789987654321123456789987654321",
- "-12345678987654321123456789987654321123456789987654321",
- "-12,345,678987,654,321123,456,789987,654,321123,456,789987,654,321",
- "-12,345,678987,654,321123,456,789987,654,321123,456,789987,654,321"
-};
-
-const char *fmt_long[] =
-{
- "%9ld%9ld%9ld%9ld%9ld%9ld",
- "%I9ld%I9ld%I9ld%I9ld%I9ld%I9ld",
- "%'11ld%'11ld%'11ld%'11ld%'11ld%'11ld",
- "%I'11ld%I'11ld%I'11ld%I'11ld%I'11ld%I'11ld"
+const CHAR *str_long[] =
+{
+ L("-12345678987654321123456789987654321123456789987654321"),
+ L("-12345678987654321123456789987654321123456789987654321"),
+ L("-12,345,678987,654,321123,456,789987,654,321123,456,789987,654,321"),
+ L("-12,345,678987,654,321123,456,789987,654,321123,456,789987,654,321")
+};
+
+const CHAR *fmt_long[] =
+{
+ L("%9ld%9ld%9ld%9ld%9ld%9ld"),
+ L("%I9ld%I9ld%I9ld%I9ld%I9ld%I9ld"),
+ L("%'11ld%'11ld%'11ld%'11ld%'11ld%'11ld"),
+ L("%I'11ld%I'11ld%I'11ld%I'11ld%I'11ld%I'11ld")
};
const long int val_long[] =
@@ -59,38 +65,49 @@
-12345678, 987654321, 123456789, 987654321, 123456789, 987654321
};
-struct int_test
-{
- const char *str;
- const char *fmt;
+struct test
+{
+ const CHAR *str;
+ const CHAR *fmt;
int retval;
-} int_tests[] =
-{
- { "foo\n", "foo\nbar", -1 },
- { "foo\n", "foo bar", -1 },
- { "foo\n", "foo %d", -1 },
- { "foo\n", "foo\n%d", -1 },
- { "foon", "foonbar", -1 },
- { "foon", "foon%d", -1 },
- { "foo ", "foo bar", -1 },
- { "foo ", "foo %d", -1 },
- { "foo\t", "foo\tbar", -1 },
- { "foo\t", "foo bar", -1 },
- { "foo\t", "foo %d", -1 },
- { "foo\t", "foo\t%d", -1 },
- { "foo", "foo", 0 },
- { "foon", "foo bar", 0 },
- { "foon", "foo %d", 0 },
- { "foo ", "fooxbar", 0 },
- { "foo ", "foox%d", 0 },
- { "foo bar", "foon", 0 },
- { "foo bar", "foo bar", 0 },
- { "foo bar", "foo %d", 0 },
- { "foo bar", "foon%d", 0 },
- { "foo ", "foo %n", 0 },
- { "foo%bar1", "foo%%bar%d", 1 },
+} int_tests[] =
+{
+ { L("foo\n"), L("foo\nbar"), -1 },
+ { L("foo\n"), L("foo bar"), -1 },
+ { L("foo\n"), L("foo %d"), -1 },
+ { L("foo\n"), L("foo\n%d"), -1 },
+ { L("foon"), L("foonbar"), -1 },
+ { L("foon"), L("foon%d"), -1 },
+ { L("foo "), L("foo bar"), -1 },
+ { L("foo "), L("foo %d"), -1 },
+ { L("foo\t"), L("foo\tbar"), -1 },
+ { L("foo\t"), L("foo bar"), -1 },
+ { L("foo\t"), L("foo %d"), -1 },
+ { L("foo\t"), L("foo\t%d"), -1 },
+ { L("foo"), L("foo"), 0 },
+ { L("foon"), L("foo bar"), 0 },
+ { L("foon"), L("foo %d"), 0 },
+ { L("foo "), L("fooxbar"), 0 },
+ { L("foo "), L("foox%d"), 0 },
+ { L("foo bar"), L("foon"), 0 },
+ { L("foo bar"), L("foo bar"), 0 },
+ { L("foo bar"), L("foo %d"), 0 },
+ { L("foo bar"), L("foon%d"), 0 },
+ { L("foo "), L("foo %n"), 0 },
+ { L("foo%bar1"), L("foo%%bar%d"), 1 },
/* Some OSes skip whitespace here while others don't. */
- { "foo \t %bar1", "foo%%bar%d", 1 }
+ { L("foo \t %bar1"), L("foo%%bar%d"), 1 }
+};
+
+struct test double_tests[] =
+{
+ { L("-1"), L("%1g"), 0 },
+ { L("-.1"), L("%2g"), 0 },
+ { L("-inf"), L("%3g"), 0 },
+ { L("+0"), L("%1g"), },
+ { L("-0x1p0"), L("%2g"), 1 },
+ { L("-..1"), L("%g"), 0 },
+ { L("-inf"), L("%g"), 1 }
};
int
@@ -112,7 +129,7 @@
for (i = 0; i < 4; ++i)
{
- if (sscanf (str_double[i], "%11lf%11lf%11lf%11lf%11lf%11lf",
+ if (SSCANF (str_double[i], L("%11lf%11lf%11lf%11lf%11lf%11lf"),
&d[0], &d[1], &d[2], &d[3], &d[4], &d[5]) != 6)
{
printf ("Double sscanf test %d wrong number of "
@@ -132,7 +149,7 @@
for (i = 0; i < 4; ++i)
{
- if (sscanf (str_long[i], fmt_long[i],
+ if (SSCANF (str_long[i], fmt_long[i],
&l[0], &l[1], &l[2], &l[3], &l[4], &l[5]) != 6)
{
printf ("Integer sscanf test %d wrong number of "
@@ -157,7 +174,7 @@
{
int dummy, ret;
- if ((ret = sscanf (int_tests[i].str, int_tests[i].fmt,
+ if ((ret = SSCANF (int_tests[i].str, int_tests[i].fmt,
&dummy)) != int_tests[i].retval)
{
printf ("int_tests[%d] returned %d != %d\n",
@@ -166,5 +183,19 @@
}
}
+ for (i = 0; i < sizeof (double_tests) / sizeof (double_tests[0]); ++i)
+ {
+ double dummy;
+ int ret;
+
+ if ((ret = SSCANF (double_tests[i].str, double_tests[i].fmt,
+ &dummy)) != double_tests[i].retval)
+ {
+ printf ("double_tests[%d] returned %d != %d\n",
+ i, ret, double_tests[i].retval);
+ result = 1;
+ }
+ }
+
return result;
}
Added: fsf/trunk/libc/stdio-common/tst-swscanf.c
==============================================================================
--- fsf/trunk/libc/stdio-common/tst-swscanf.c (added)
+++ fsf/trunk/libc/stdio-common/tst-swscanf.c Mon Feb 19 00:01:39 2007
@@ -1,0 +1,5 @@
+#define CHAR wchar_t
+#define L(str) L##str
+#define SSCANF swscanf
+#include <wchar.h>
+#include "tst-sscanf.c"
Modified: fsf/trunk/libc/stdio-common/vfscanf.c
==============================================================================
--- fsf/trunk/libc/stdio-common/vfscanf.c (original)
+++ fsf/trunk/libc/stdio-common/vfscanf.c Mon Feb 19 00:01:39 2007
@@ -1,5 +1,4 @@
-/* Copyright (C) 1991-2002, 2003, 2004, 2005, 2006
- Free Software Foundation, Inc.
+/* Copyright (C) 1991-2006, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -59,7 +58,6 @@
#define SUPPRESS 0x008 /* *: suppress assignment */
#define POINTER 0x010 /* weird %p pointer (`fake hex') */
#define NOSKIP 0x020 /* do not skip blanks */
-#define WIDTH 0x040 /* width was given */
#define GROUP 0x080 /* ': group numbers */
#define MALLOC 0x100 /* a: malloc strings */
#define CHAR 0x200 /* hh: char */
@@ -424,7 +422,6 @@
{
/* Oops; that was actually the field width. */
width = argpos;
- flags |= WIDTH;
argpos = 0;
goto got_width;
}
@@ -445,10 +442,6 @@
flags |= I18N;
break;
}
-
- /* We have seen width. */
- if (ISDIGIT ((UCHAR_T) *f))
- flags |= WIDTH;
/* Find the maximum field width. */
width = 0;
@@ -1270,13 +1263,13 @@
mbdigits[n] = strchr (mbdigits[n], '\0') + 1;
cmpp = mbdigits[n];
- while ((unsigned char) *cmpp == c && avail > 0)
+ while ((unsigned char) *cmpp == c && avail >= 0)
{
if (*++cmpp == '\0')
break;
else
{
- if ((c = inchar ()) == EOF)
+ if (avail == 0 || inchar () == EOF)
break;
--avail;
}
@@ -1323,13 +1316,13 @@
int avail = width > 0 ? width : INT_MAX;
cmpp = mbdigits[n];
- while ((unsigned char) *cmpp == c && avail > 0)
+ while ((unsigned char) *cmpp == c && avail >= 0)
{
if (*++cmpp == '\0')
break;
else
{
- if ((c = inchar ()) == EOF)
+ if (avail == 0 || inchar () == EOF)
break;
--avail;
}
@@ -1384,14 +1377,14 @@
const char *cmpp = thousands;
int avail = width > 0 ? width : INT_MAX;
- while ((unsigned char) *cmpp == c && avail > 0)
+ while ((unsigned char) *cmpp == c && avail >= 0)
{
ADDW (c);
if (*++cmpp == '\0')
break;
else
{
- if ((c = inchar ()) == EOF)
+ if (avail == 0 || inchar () == EOF)
break;
--avail;
}
@@ -1456,14 +1449,14 @@
const char *cmpp = thousands;
int avail = width > 0 ? width : INT_MAX;
- while ((unsigned char) *cmpp == c && avail > 0)
+ while ((unsigned char) *cmpp == c && avail >= 0)
{
ADDW (c);
if (*++cmpp == '\0')
break;
else
{
- if ((c = inchar ()) == EOF)
+ if (avail == 0 || inchar () == EOF)
break;
--avail;
}
@@ -1591,6 +1584,8 @@
case L_('a'):
case L_('A'):
c = inchar ();
+ if (width > 0)
+ --width;
if (__builtin_expect (c == EOF, 0))
input_error ();
@@ -1603,63 +1598,6 @@
if (__builtin_expect (width == 0 || inchar () == EOF, 0))
/* EOF is only an input error before we read any chars. */
conv_error ();
- if (! ISDIGIT (c) && TOLOWER (c) != L_('i')
- && TOLOWER (c) != L_('n'))
- {
-#ifdef COMPILE_WSCANF
- if (__builtin_expect (c != decimal, 0))
- {
- /* This is no valid number. */
- ungetc (c, s);
- conv_error ();
- }
-#else
- /* Match against the decimal point. At this point
- we are taking advantage of the fact that we can
- push more than one character back. This is
- (almost) never necessary since the decimal point
- string hopefully never contains more than one
- byte. */
- const char *cmpp = decimal;
- int avail = width > 0 ? width : INT_MAX;
-
- while ((unsigned char) *cmpp == c && avail-- > 0)
- if (*++cmpp == '\0')
- break;
- else
- {
- if (inchar () == EOF)
- break;
- }
-
- if (__builtin_expect (*cmpp != '\0', 0))
- {
- /* This is no valid number. */
- while (1)
- {
- ungetc (c, s);
- if (cmpp == decimal)
- break;
- c = (unsigned char) *--cmpp;
- }
-
- conv_error ();
- }
- else
- {
- /* Add all the characters. */
- for (cmpp = decimal; *cmpp != '\0'; ++cmpp)
- ADDW ((unsigned char) *cmpp);
- if (width > 0)
- width = avail;
- got_dot = 1;
-
- c = inchar ();
- }
- if (width > 0)
- width = avail;
-#endif
- }
if (width > 0)
--width;
}
@@ -1775,7 +1713,7 @@
}
}
- do
+ while (1)
{
if (ISDIGIT (c))
ADDW (c);
@@ -1814,12 +1752,12 @@
if (! got_dot)
{
- while ((unsigned char) *cmpp == c && avail > 0)
+ while ((unsigned char) *cmpp == c && avail >= 0)
if (*++cmpp == '\0')
break;
else
{
- if (inchar () == EOF)
+ if (avail == 0 || inchar () == EOF)
break;
--avail;
}
@@ -1851,12 +1789,12 @@
++cmp2p;
if (cmp2p - thousands == cmpp - decimal)
{
- while ((unsigned char) *cmp2p == c && avail > 0)
+ while ((unsigned char) *cmp2p == c && avail >= 0)
if (*++cmp2p == '\0')
break;
else
{
- if (inchar () == EOF)
+ if (avail == 0 || inchar () == EOF)
break;
--avail;
}
@@ -1881,10 +1819,228 @@
}
#endif
}
+
+ if (width == 0 || inchar () == EOF)
+ break;
+
if (width > 0)
--width;
}
- while (width != 0 && inchar () != EOF);
+
+ wctrans_t map;
+ if (__builtin_expect ((flags & I18N) != 0, 0)
+ /* Hexadecimal floats make no sense, fixing localized
+ digits with ASCII letters. */
+ && !is_hexa
+ /* Minimum requirement. */
+ && (wpsize == 0 || got_dot)
+ && (map = __wctrans ("to_inpunct")) != NULL)
+ {
+ /* Reget the first character. */
+ inchar ();
+
+ /* Localized digits, decimal points, and thousands
+ separator. */
+ wint_t wcdigits[12];
+
+ /* First get decimal equivalent to check if we read it
+ or not. */
+ wcdigits[11] = __towctrans (L'.', map);
+
+ /* If we have not read any character or have just read
+ locale decimal point which matches the decimal point
+ for localized FP numbers, then we may have localized
+ digits. Note, we test GOT_DOT above. */
+#ifdef COMPILE_WSCANF
+ if (wpsize == 0 || (wpsize == 1 && wcdigits[11] == decimal))
+#else
+ char mbdigits[12][MB_LEN_MAX + 1];
+
+ mbstate_t state;
+ memset (&state, '\0', sizeof (state));
+
+ bool match_so_far = wpsize == 0;
+ size_t mblen = __wcrtomb (mbdigits[11], wcdigits[11], &state);
+ if (mblen != (size_t) -1)
+ {
+ mbdigits[11][mblen] = '\0';
+ match_so_far |= (wpsize == strlen (decimal)
+ && strcmp (decimal, mbdigits[11]) == 0);
+ }
+ else
+ {
+ size_t decimal_len = strlen (decimal);
+ /* This should always be the case but the data comes
+ from a file. */
+ if (decimal_len <= MB_LEN_MAX)
+ {
+ match_so_far |= wpsize == decimal_len;
+ memcpy (mbdigits[11], decimal, decimal_len + 1);
+ }
+ else
+ match_so_far = false;
+ }
+
+ if (match_so_far)
+#endif
+ {
+ int have_locthousands = true;
+ /* Now get the digits and the thousands-sep equivalents. */
+ for (int n = 0; n < 11; ++n)
+ {
+ if (n < 10)
+ wcdigits[n] = __towctrans (L'0' + n, map);
+ else if (n == 10)
+ wcdigits[10] = __towctrans (L',', map);
+
+#ifndef COMPILE_WSCANF
+ memset (&state, '\0', sizeof (state));
+
+ size_t mblen = __wcrtomb (mbdigits[n], wcdigits[n],
+ &state);
+ if (mblen == (size_t) -1)
+ {
+ if (n == 10)
+ {
+ if (thousands == NULL || (flags & GROUP) == 0)
+ have_locthousands = false;
+ else
+ {
+ size_t thousands_len = strlen (thousands);
+ if (thousands_len <= MB_LEN_MAX)
+ memcpy (mbdigits[10], thousands,
+ thousands_len + 1);
+ else
+ have_locthousands = false;
+ }
+ }
+ else
+ /* Ignore checking against localized digits. */
+ goto no_i18nflt;
+ }
+ else
+ mbdigits[n][mblen] = '\0';
+#endif
+ }
+
+ /* Start checking against localized digits, if
+ convertion is done correctly. */
+ while (1)
+ {
+ if (got_e && wp[wpsize - 1] == exp_char
+ && (c == L_('-') || c == L_('+')))
+ ADDW (c);
+ else if (wpsize > 0 && !got_e
+ && (CHAR_T) TOLOWER (c) == exp_char)
+ {
+ ADDW (exp_char);
+ got_e = got_dot = 1;
+ }
+ else
+ {
+ /* Check against localized digits, decimal point,
+ and thousands separator. */
+ int n;
+ for (n = 0; n < 12; ++n)
+ {
+#ifdef COMPILE_WSCANF
+ if (c == wcdigits[n])
+ {
+ if (n < 10)
+ ADDW (L_('0') + n);
+ else if (n == 11 && !got_dot)
+ {
+ ADDW (decimal);
+ got_dot = 1;
+ }
+ else if (n == 10 && have_locthousands
+ && ! got_dot)
+ ADDW (thousands);
+ else
+ /* The last read character is not part
+ of the number anymore. */
+ n = 12;
+
+ break;
+ }
+#else
+ const char *cmpp = mbdigits[n];
+ int avail = width > 0 ? width : INT_MAX;
+
+ while ((unsigned char) *cmpp == c && avail >= 0)
+ if (*++cmpp == '\0')
+ break;
+ else
+ {
+ if (avail == 0 || inchar () == EOF)
+ break;
+ --avail;
+ }
+ if (*cmpp == '\0')
+ {
+ if (width > 0)
+ width = avail;
+
+ if (n < 10)
+ ADDW (L_('0') + n);
+ else if (n == 11 && !got_dot)
+ {
+ /* Add all the characters. */
+ for (cmpp = decimal; *cmpp != '\0';
+ ++cmpp)
+ ADDW ((unsigned char) *cmpp);
+
+ got_dot = 1;
+ }
+ else if (n == 10 && (flags & GROUP) != 0
+ && thousands != NULL && ! got_dot)
+ {
+ /* Add all the characters. */
+ for (cmpp = thousands; *cmpp != '\0';
+ ++cmpp)
+ ADDW ((unsigned char) *cmpp);
+ }
+ else
+ /* The last read character is not part
+ of the number anymore. */
+ n = 12;
+
+ break;
+ }
+
+ /* We are pushing all read characters back. */
+ if (cmpp > mbdigits[n])
+ {
+ ungetc (c, s);
+ while (--cmpp > mbdigits[n])
+ ungetc_not_eof ((unsigned char) *cmpp, s);
+ c = (unsigned char) *cmpp;
+ }
+#endif
+ }
+
+ if (n >= 12)
+ {
+ /* The last read character is not part
+ of the number anymore. */
+ ungetc (c, s);
+ break;
+ }
+ }
+
+ if (width == 0 || inchar () == EOF)
+ break;
+
+ if (width > 0)
+ --width;
+ }
+ }
+
+#ifndef COMPILE_WSCANF
+ no_i18nflt:
+ ;
+#endif
+ }
/* Have we read any character? If we try to read a number
in hexadecimal notation and we have read only the `0x'
Modified: fsf/trunk/libc/sysdeps/i386/fpu/e_fmod.S
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/fpu/e_fmod.S (original)
+++ fsf/trunk/libc/sysdeps/i386/fpu/e_fmod.S Mon Feb 19 00:01:39 2007
@@ -10,7 +10,7 @@
ENTRY(__ieee754_fmod)
fldl 12(%esp)
fldl 4(%esp)
-1: fprem
+1: fprem1
fstsw %ax
sahf
jp 1b
Modified: fsf/trunk/libc/sysdeps/i386/fpu/e_fmodf.S
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/fpu/e_fmodf.S (original)
+++ fsf/trunk/libc/sysdeps/i386/fpu/e_fmodf.S Mon Feb 19 00:01:39 2007
@@ -11,7 +11,7 @@
ENTRY(__ieee754_fmodf)
flds 8(%esp)
flds 4(%esp)
-1: fprem
+1: fprem1
fstsw %ax
sahf
jp 1b
Modified: fsf/trunk/libc/sysdeps/i386/fpu/e_fmodl.c
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/fpu/e_fmodl.c (original)
+++ fsf/trunk/libc/sysdeps/i386/fpu/e_fmodl.c Mon Feb 19 00:01:39 2007
@@ -12,7 +12,7 @@
{
long double res;
- asm ("1:\tfprem\n"
+ asm ("1:\tfprem1\n"
"fstsw %%ax\n"
"sahf\n"
"jp 1b\n"
Modified: fsf/trunk/libc/sysdeps/unix/closedir.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/closedir.c (original)
+++ fsf/trunk/libc/sysdeps/unix/closedir.c Mon Feb 19 00:01:39 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,1993,1995,1996,1998,2002,2003
+/* Copyright (C) 1991,1993,1995,1996,1998,2002,2003, 2007
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -45,7 +45,9 @@
fd = dirp->fd;
+#ifndef NOT_IN_libc
__libc_lock_fini (dirp->lock);
+#endif
free ((void *) dirp);
Modified: fsf/trunk/libc/sysdeps/unix/opendir.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/opendir.c (original)
+++ fsf/trunk/libc/sysdeps/unix/opendir.c Mon Feb 19 00:01:39 2007
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991-1996,98,2000-2003,2005 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1996,98,2000-2003,2005,2007
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -173,7 +174,9 @@
dirp->allocation = allocation;
dirp->fd = fd;
+#ifndef NOT_IN_libc
__libc_lock_init (dirp->lock);
+#endif
return dirp;
}
Modified: fsf/trunk/libc/sysdeps/unix/readdir.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/readdir.c (original)
+++ fsf/trunk/libc/sysdeps/unix/readdir.c Mon Feb 19 00:01:39 2007
@@ -1,5 +1,4 @@
-/* Copyright (C) 1991,92,93,94,95,96,97,99,2000,02
- Free Software Foundation, Inc.
+/* Copyright (C) 1991-1997,1999,2000,2002,2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -42,7 +41,9 @@
DIRENT_TYPE *dp;
int saved_errno = errno;
+#ifndef NOT_IN_libc
__libc_lock_lock (dirp->lock);
+#endif
do
{
@@ -110,7 +111,9 @@
/* Skip deleted files. */
} while (dp->d_ino == 0);
+#ifndef NOT_IN_libc
__libc_lock_unlock (dirp->lock);
+#endif
return dp;
}