aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-02-11 22:11:40 +0000
committerUlrich Drepper <drepper@redhat.com>2000-02-11 22:11:40 +0000
commit740c223996c16b90f9f9f4ec21bbcd143f521eb9 (patch)
tree6d6d991bb3d08aa50144cf584087c040d2e83a22
parentf9a7302fd1f88e311dd89e1c9d8b4ad572af6cfa (diff)
downloadglibc-740c223996c16b90f9f9f4ec21bbcd143f521eb9.tar
glibc-740c223996c16b90f9f9f4ec21bbcd143f521eb9.tar.gz
glibc-740c223996c16b90f9f9f4ec21bbcd143f521eb9.tar.bz2
glibc-740c223996c16b90f9f9f4ec21bbcd143f521eb9.zip
Update.
2000-02-08 Shinya Hanataka <hanataka@abyss.rim.or.jp> * locale/weightwc.h: Fix problem with collating-element. * locale/programs/ld-collate.c (collate_finish): Output wide character collating-symbol, which has no wide strings. * locale/programs/ld-collate.c (collate_output): Fix problem with wide character collating-element.
-rw-r--r--ChangeLog10
-rw-r--r--locale/programs/ld-collate.c19
-rw-r--r--locale/weightwc.h61
3 files changed, 45 insertions, 45 deletions
diff --git a/ChangeLog b/ChangeLog
index fee8cdec42..a063eed91c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2000-02-08 Shinya Hanataka <hanataka@abyss.rim.or.jp>
+
+ * locale/weightwc.h: Fix problem with collating-element.
+
+ * locale/programs/ld-collate.c (collate_finish): Output wide
+ character collating-symbol, which has no wide strings.
+
+ * locale/programs/ld-collate.c (collate_output): Fix problem with
+ wide character collating-element.
+
2000-02-09 Andreas Jaeger <aj@suse.de>
* time/strptime.c (strptime_internal): Fix pointer dereference.
diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
index 7b85b760aa..d3f13ada5b 100644
--- a/locale/programs/ld-collate.c
+++ b/locale/programs/ld-collate.c
@@ -2329,14 +2329,14 @@ collate_output (struct localedef_t *locale, struct charmap_t *charmap,
if (sizeof (int32_t) == sizeof (int))
{
obstack_int_grow_fast (&extrapool,
- obstack_object_size (&indirectpool)
- / sizeof (int32_t));
+ -(obstack_object_size (&indirectpool)
+ / sizeof (int32_t)));
obstack_int_grow_fast (&extrapool, runp->nwcs - 1);
}
else
{
- int32_t i = (obstack_object_size (&indirectpool)
- / sizeof (int32_t));
+ int32_t i = -(obstack_object_size (&indirectpool)
+ / sizeof (int32_t));
obstack_grow (&extrapool, &i, sizeof (int32_t));
i = runp->nwcs - 1;
obstack_grow (&extrapool, &i, sizeof (int32_t));
@@ -2367,9 +2367,10 @@ collate_output (struct localedef_t *locale, struct charmap_t *charmap,
{
weightidx = output_weightwc (&weightpool, collate, curp);
if (sizeof (int32_t) == sizeof (int))
- obstack_int_grow (&extrapool, weightidx);
+ obstack_int_grow (&indirectpool, weightidx);
else
- obstack_grow (&extrapool, &weightidx, sizeof (int32_t));
+ obstack_grow (&indirectpool, &weightidx,
+ sizeof (int32_t));
curp = curp->wclast;
}
@@ -2384,11 +2385,11 @@ collate_output (struct localedef_t *locale, struct charmap_t *charmap,
/* And add the end byte sequence. Without length this
time. */
- for (i = 1; i < runp->nwcs; ++i)
+ for (i = 1; i < curp->nwcs; ++i)
if (sizeof (int32_t) == sizeof (int))
- obstack_int_grow (&extrapool, runp->wcs[i]);
+ obstack_int_grow (&extrapool, curp->wcs[i]);
else
- obstack_grow (&extrapool, &runp->wcs[i], sizeof (int32_t));
+ obstack_grow (&extrapool, &curp->wcs[i], sizeof (int32_t));
}
else
{
diff --git a/locale/weightwc.h b/locale/weightwc.h
index fc517eb915..9e5bcf7f4d 100644
--- a/locale/weightwc.h
+++ b/locale/weightwc.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Ulrich Drepper, <drepper@cygnus.com>.
@@ -51,8 +51,8 @@ findidx (const wint_t **cpp)
const wint_t *usrc = *cpp;
/* The first thing is the index. */
- i = *((int32_t *) cp);
- cp += sizeof (int32_t);
+ i = cp;
+ ++cp;
/* Next is the length of the byte sequence. These are always
short byte sequences so there is no reason to call any
@@ -87,47 +87,36 @@ findidx (const wint_t **cpp)
/* This is a range of characters. First decide whether the
current byte sequence lies in the range. */
size_t cnt;
- size_t offset = 0;
+ size_t offset;
- for (cnt = 0; cnt < nhere; ++cnt)
+ for (cnt = 0; cnt < nhere - 1; ++cnt)
if (cp[cnt] != usrc[cnt])
break;
- if (cnt != nhere)
+ if (cnt < nhere - 1)
+ {
+ cp += 2 * nhere;
+ continue;
+ }
+
+ if (cp[nhere - 1] > usrc[nhere -1])
{
- if (cp[cnt] > usrc[cnt])
- {
- /* Cannot be in this range. */
- cp += 2 * nhere;
- continue;
- }
-
- /* Test against the end of the range. */
- for (cnt = 0; cnt < nhere; ++cnt)
- if (cp[nhere + cnt] != usrc[cnt])
- break;
-
- if (cnt != nhere && cp[nhere + cnt] < usrc[cnt])
- {
- /* Cannot be in this range. */
- cp += 2 * nhere;
- continue;
- }
-
- /* This range matches the next characters. Now find
- the offset in the indirect table. */
- for (cnt = 0; cp[cnt] == usrc[cnt]; ++cnt);
-
- do
- {
- offset <<= 8;
- offset += usrc[cnt] - cp[cnt];
- }
- while (++cnt < nhere);
+ cp += 2 * nhere;
+ continue;
}
+ if (cp[2 * nhere - 1] < usrc[nhere -1])
+ {
+ cp += 2 * nhere;
+ continue;
+ }
+
+ /* This range matches the next characters. Now find
+ the offset in the indirect table. */
+ offset = usrc[nhere - 1] - cp[nhere - 1];
*cpp += nhere;
- return offset;
+
+ return indirect[-i + offset];
}
}