diff options
author | Ulrich Drepper <drepper@redhat.com> | 1999-12-26 19:11:05 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1999-12-26 19:11:05 +0000 |
commit | c392db7c4be39bf2ad8668f6e75a1ec219da6b0e (patch) | |
tree | 3002f39e8c4095cfb1cd476bc242ae78fed0169f /string | |
parent | a35766db1672710adfc5c2dae5335526d20abab4 (diff) | |
download | glibc-c392db7c4be39bf2ad8668f6e75a1ec219da6b0e.zip glibc-c392db7c4be39bf2ad8668f6e75a1ec219da6b0e.tar.gz glibc-c392db7c4be39bf2ad8668f6e75a1ec219da6b0e.tar.bz2 |
Update.
1999-12-26 Ulrich Drepper <drepper@cygnus.com>
* ld-collate.c (struct element_t): Add field is_character and use it
to distinguish real character from collating elements and symbols.
(new_element): Take new parameter to initialize is_character. Change
all callers.
(handle_ellipsis): Use is_character field to make sure ellipsis is
only used with characters.
(collate_read): Fix reading of collating elements.
* string/strxfrm.c: Correct loop end detection and memory access
in the little optimization at the end.
* locale/programs/ld-monetary.c (monetary_finish): Correct code to
emit warnings. Provide default value for mon_decimal_point.
* locale/programs/ld-collate.c (collate_finish): Don't crash if this
category wasn't defined.
(collate_output): Likewise.
* locale/programs/ld-address.c: Don't emit message about not defined
category if be_quiet.
* locale/programs/ld-ctype.c: Likewise.
* locale/programs/ld-identification.c: Likewise.
* locale/programs/ld-measurement.c: Likewise.
* locale/programs/ld-messages.c: Likewise.
* locale/programs/ld-monetary.c: Likewise.
* locale/programs/ld-name.c: Likewise.
* locale/programs/ld-numeric.c: Likewise.
* locale/programs/ld-paper.c: Likewise.
* locale/programs/ld-telephone.c: Likewise.
* locale/programs/locfile.c (write_locale_data): Correct memory
allocation for fname.
Diffstat (limited to 'string')
-rw-r--r-- | string/strxfrm.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/string/strxfrm.c b/string/strxfrm.c index 67d15d5..6fc795f 100644 --- a/string/strxfrm.c +++ b/string/strxfrm.c @@ -267,9 +267,10 @@ STRXFRM (char *dest, const char *src, size_t n, __locale_t l) /* Handle the pushed elements now. */ size_t backw; - for (backw = idxcnt - 1; backw >= backw_stop; --backw) + backw = idxcnt; + while (backw > backw_stop) { - size_t len = weights[idxarr[backw]++]; + size_t len = weights[idxarr[--backw]++]; if (needed + len < n) while (len-- > 0) @@ -363,9 +364,10 @@ STRXFRM (char *dest, const char *src, size_t n, __locale_t l) /* Handle the pushed elements now. */ size_t backw; - for (backw = idxmax - 1; backw >= backw_stop; --backw) + backw = idxmax - 1; + while (backw > backw_stop) { - size_t len = weights[idxarr[backw]++]; + size_t len = weights[idxarr[--backw]++]; if (len != 0) { buflen = utf8_encode (buf, val); @@ -398,7 +400,7 @@ STRXFRM (char *dest, const char *src, size_t n, __locale_t l) a `position' rule at the end and if no non-ignored character is found the last \1 byte is immediately followed by a \0 byte signalling this. We can avoid the \1 byte(s). */ - if (needed > 2 && dest[needed - 2] == '\1') + if (needed <= n && needed > 2 && dest[needed - 2] == '\1') { /* Remove the \1 byte. */ --needed; |