* 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.
This commit is contained in:
Ulrich Drepper 2006-08-12 20:19:55 +00:00
parent cd8e60cead
commit 9a5c46e834
3 changed files with 27 additions and 11 deletions

View File

@ -1,5 +1,10 @@
2006-08-12 Ulrich Drepper <drepper@redhat.com> 2006-08-12 Ulrich Drepper <drepper@redhat.com>
[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.
[BZ #2997] [BZ #2997]
* misc/error.c: Add space between program name and message if file * misc/error.c: Add space between program name and message if file
name is missing. name is missing.

View File

@ -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. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1995. 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; total += iov[2 + elem + offset].iov_len;
} }
iov[2 + elem + offset].iov_base = (void *) nulbytes; iov[2 + elem + offset].iov_base = (void *) nulbytes;
iov[2 + elem + offset].iov_len = 1 + (4 - ((total + 1) % 4)); iov[2 + elem + offset].iov_len = 4 - (total % 4);
total += 1 + (4 - ((total + 1) % 4)); total += 4 - (total % 4);
idx[elem + 1] = idx[elem] + total; idx[elem + 1] = idx[elem] + total;
break; break;
@ -1010,8 +1010,8 @@ ctype_output (struct localedef_t *locale, const struct charmap_t *charmap,
total += iov[2 + elem + offset].iov_len; total += iov[2 + elem + offset].iov_len;
} }
iov[2 + elem + offset].iov_base = (void *) nulbytes; iov[2 + elem + offset].iov_base = (void *) nulbytes;
iov[2 + elem + offset].iov_len = 1 + (4 - ((total + 1) % 4)); iov[2 + elem + offset].iov_len = 4 - (total % 4);
total += 1 + (4 - ((total + 1) % 4)); total += 4 - (total % 4);
idx[elem + 1] = idx[elem] + total; idx[elem + 1] = idx[elem] + total;
break; break;
@ -1153,7 +1153,7 @@ ctype_output (struct localedef_t *locale, const struct charmap_t *charmap,
iov[2 + elem + offset].iov_base = iov[2 + elem + offset].iov_base =
ctype->default_missing ?: (uint32_t *) L""; ctype->default_missing ?: (uint32_t *) L"";
iov[2 + elem + offset].iov_len = 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; idx[elem + 1] = idx[elem] + iov[2 + elem + offset].iov_len;
break; 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)); ctype->class_b[nr] = (uint32_t *) xcalloc (256 / 32, sizeof (uint32_t));
for (idx = 0; idx < 256; ++idx) /* We only set CLASS_B for the bits in the ISO C classes, not
if (ctype->class256_collection[idx] & _ISbit (nr)) the user defined classes. The number should not change but
ctype->class_b[nr][idx >> 5] |= (uint32_t)1 << (idx & 0x1f); 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++) for (nr = 0; nr < ctype->nr_charclass; nr++)

View File

@ -542,7 +542,7 @@ time_output (struct localedef_t *locale, const struct charmap_t *charmap,
* (2 + _NL_ITEM_INDEX (_NL_NUM_LC_TIME) * (2 + _NL_ITEM_INDEX (_NL_NUM_LC_TIME)
+ time->num_era - 1 + time->num_era - 1
+ 2 * 99 + 2 * 99
+ 2 + time->num_era * 10 - 1)); + 2 + time->num_era * 10));
struct locale_file data; struct locale_file data;
uint32_t idx[_NL_ITEM_INDEX (_NL_NUM_LC_TIME)]; uint32_t idx[_NL_ITEM_INDEX (_NL_NUM_LC_TIME)];
size_t cnt, last_idx, num, n; size_t cnt, last_idx, num, n;
@ -901,6 +901,12 @@ time_output (struct localedef_t *locale, const struct charmap_t *charmap,
++cnt; ++cnt;
++last_idx; ++last_idx;
/* We must align the following data. */
iov[2 + cnt].iov_base = (void *) "\0\0";
iov[2 + cnt].iov_len = -idx[last_idx] & 3;
idx[last_idx] += -idx[last_idx] & 3;
++cnt;
iov[2 + cnt].iov_base = (void *) time->wdate_fmt; iov[2 + cnt].iov_base = (void *) time->wdate_fmt;
iov[2 + cnt].iov_len = ((wcslen (iov[2 + cnt].iov_base) + 1) iov[2 + cnt].iov_len = ((wcslen (iov[2 + cnt].iov_base) + 1)
* sizeof (uint32_t)); * sizeof (uint32_t));
@ -916,7 +922,7 @@ time_output (struct localedef_t *locale, const struct charmap_t *charmap,
assert (cnt == (_NL_ITEM_INDEX (_NL_NUM_LC_TIME) assert (cnt == (_NL_ITEM_INDEX (_NL_NUM_LC_TIME)
+ time->num_era - 1 + time->num_era - 1
+ 2 * 99 + 2 * 99
+ 2 + time->num_era * 10 - 1)); + 2 + time->num_era * 10));
assert (last_idx == _NL_ITEM_INDEX (_NL_NUM_LC_TIME)); assert (last_idx == _NL_ITEM_INDEX (_NL_NUM_LC_TIME));
write_locale_data (output_path, LC_TIME, "LC_TIME", 2 + cnt, iov); write_locale_data (output_path, LC_TIME, "LC_TIME", 2 + cnt, iov);