diff options
author | Ulrich Drepper <drepper@redhat.com> | 2006-08-12 20:19:55 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2006-08-12 20:19:55 +0000 |
commit | 9a5c46e834fa303274983d7c4a4e4b667d0415c1 (patch) | |
tree | b55f92394b60b2b0904eca85e9771d30ea0120a0 /locale/programs/ld-ctype.c | |
parent | cd8e60cead61e56e310e2c14f31052f7649ea533 (diff) | |
download | glibc-9a5c46e834fa303274983d7c4a4e4b667d0415c1.tar.gz glibc-9a5c46e834fa303274983d7c4a4e4b667d0415c1.tar.xz glibc-9a5c46e834fa303274983d7c4a4e4b667d0415c1.zip |
[BZ #3013]
* locale/programs/ld-ctype.c (ctype_output): Adjust alignments, fix lenght of one output field, correct bitmask creation. * locale/programs/ld-time.c: Add alignment.
Diffstat (limited to 'locale/programs/ld-ctype.c')
-rw-r--r-- | locale/programs/ld-ctype.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c index b0b2e3f805..f38231f984 100644 --- a/locale/programs/ld-ctype.c +++ b/locale/programs/ld-ctype.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2002, 2003, 2004, 2005 Free Software Foundation, Inc. +/* Copyright (C) 1995-2005, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.org>, 1995. @@ -992,8 +992,8 @@ ctype_output (struct localedef_t *locale, const struct charmap_t *charmap, total += iov[2 + elem + offset].iov_len; } iov[2 + elem + offset].iov_base = (void *) nulbytes; - iov[2 + elem + offset].iov_len = 1 + (4 - ((total + 1) % 4)); - total += 1 + (4 - ((total + 1) % 4)); + iov[2 + elem + offset].iov_len = 4 - (total % 4); + total += 4 - (total % 4); idx[elem + 1] = idx[elem] + total; break; @@ -1010,8 +1010,8 @@ ctype_output (struct localedef_t *locale, const struct charmap_t *charmap, total += iov[2 + elem + offset].iov_len; } iov[2 + elem + offset].iov_base = (void *) nulbytes; - iov[2 + elem + offset].iov_len = 1 + (4 - ((total + 1) % 4)); - total += 1 + (4 - ((total + 1) % 4)); + iov[2 + elem + offset].iov_len = 4 - (total % 4); + total += 4 - (total % 4); idx[elem + 1] = idx[elem] + total; break; @@ -1153,7 +1153,7 @@ ctype_output (struct localedef_t *locale, const struct charmap_t *charmap, iov[2 + elem + offset].iov_base = ctype->default_missing ?: (uint32_t *) L""; iov[2 + elem + offset].iov_len = - wcslen (iov[2 + elem + offset].iov_base); + wcslen (iov[2 + elem + offset].iov_base) * sizeof (uint32_t); idx[elem + 1] = idx[elem] + iov[2 + elem + offset].iov_len; break; @@ -3844,9 +3844,14 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap, { ctype->class_b[nr] = (uint32_t *) xcalloc (256 / 32, sizeof (uint32_t)); - for (idx = 0; idx < 256; ++idx) - if (ctype->class256_collection[idx] & _ISbit (nr)) - ctype->class_b[nr][idx >> 5] |= (uint32_t)1 << (idx & 0x1f); + /* We only set CLASS_B for the bits in the ISO C classes, not + the user defined classes. The number should not change but + who knows. */ +#define LAST_ISO_C_BIT 11 + if (nr <= LAST_ISO_C_BIT) + for (idx = 0; idx < 256; ++idx) + if (ctype->class256_collection[idx] & _ISbit (nr)) + ctype->class_b[nr][idx >> 5] |= (uint32_t) 1 << (idx & 0x1f); } for (nr = 0; nr < ctype->nr_charclass; nr++) |