aboutsummaryrefslogtreecommitdiff
path: root/locale/indigits.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-07-28 17:45:15 +0000
committerUlrich Drepper <drepper@redhat.com>2000-07-28 17:45:15 +0000
commiteac4282fa6325e5633bdfee7a6afd9f943b34b1a (patch)
tree05ea52c568ad29879831e555bcf4dfa05d478d9b /locale/indigits.h
parentdab46544a261b41876829905c634a5f5558ceacf (diff)
downloadglibc-eac4282fa6325e5633bdfee7a6afd9f943b34b1a.zip
glibc-eac4282fa6325e5633bdfee7a6afd9f943b34b1a.tar.gz
glibc-eac4282fa6325e5633bdfee7a6afd9f943b34b1a.tar.bz2
Update.
2000-07-27 Jakub Jelinek <jakub@redhat.com> * locale/indigits.h (indigit_value): Correct. * locale/indigitswc.h (indigitwc_value): Correct. * stdio-common/vfscanf.c (__vfscanf): Fix I18N number conversion, add GROUP checking for it, fix GROUP number conversion with strlen(thousands) > 1. Honour width correctly in the presence of floating decimal points and thousands separators. * stdio-common/tst-sscanf.c: New test. * stdio-common/Makefile: Add it to tests. * sysdeps/generic/strtol.c (strtol): Fix conversion if there are thousands separators and group argument is non-zero. Reported by Andi Kleen <ak@suse.de>.
Diffstat (limited to 'locale/indigits.h')
-rw-r--r--locale/indigits.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/locale/indigits.h b/locale/indigits.h
index a5289ce..7a45994 100644
--- a/locale/indigits.h
+++ b/locale/indigits.h
@@ -32,6 +32,7 @@ indigit_value (const char **s, size_t *len, int *decided)
int from_level;
int to_level;
const char *mbdigits[10];
+ int i;
int n;
if (*decided != -1)
@@ -53,11 +54,12 @@ indigit_value (const char **s, size_t *len, int *decided)
mbdigits[n] = _NL_CURRENT (LC_CTYPE, _NL_CTYPE_INDIGITS0_MB + n);
dlen = strlen (mbdigits[n]);
- if (dlen <= len && memcmp (*s, mbdigits[n], dlen) == 0)
+ if (from_level == 0 && dlen <= *len
+ && memcmp (*s, mbdigits[n], dlen) == 0)
{
/* Found it. */
*s += dlen;
- len -= dlen;
+ *len -= dlen;
if (*decided == -1)
*decided = 0;
return n;
@@ -68,18 +70,19 @@ indigit_value (const char **s, size_t *len, int *decided)
}
/* Now perform the remaining tests. */
- while (++from_level <= to_level)
+ for (i = 1; i <= to_level; ++i)
{
/* Search all ten digits of this level. */
for (n = 0; n < 10; ++n)
{
size_t dlen = strlen (mbdigits[n]);
- if (dlen <= len && memcmp (*s, mbdigits[n], dlen) == 0)
+ if (i >= from_level && dlen <= *len
+ && memcmp (*s, mbdigits[n], dlen) == 0)
{
/* Found it. */
*s += dlen;
- len -= dlen;
+ *len -= dlen;
if (*decided == -1)
*decided = from_level;
return n;
@@ -88,9 +91,6 @@ indigit_value (const char **s, size_t *len, int *decided)
/* Advance the pointer to the next string. */
mbdigits[n] += dlen + 1;
}
-
- /* Next level. */
- ++from_level;
}
/* If we reach this point no matching digit was found. */