diff options
| author | Sam Varshavchik | 2020-11-24 19:40:15 -0500 |
|---|---|---|
| committer | Sam Varshavchik | 2020-11-24 19:40:15 -0500 |
| commit | 888d2f995d78427075d7e34393ef409b22687be6 (patch) | |
| tree | 1011c111b9c21b149a637c7654f706bb194f0389 | |
| parent | 181c424a834d13a27e6026d4d05ac49230372aba (diff) | |
| parent | b89f5f8dc09431bb345308b3a0ffd5f7d22cdfb2 (diff) | |
| download | courier-libs-888d2f995d78427075d7e34393ef409b22687be6.tar.bz2 | |
Merge remote-tracking branch 'origin/unicode-2.1' into master
| -rw-r--r-- | unicode/ChangeLog | 6 | ||||
| -rw-r--r-- | unicode/unicodebuf.c | 3 | ||||
| -rw-r--r-- | unicode/unicodetest.c | 19 |
3 files changed, 27 insertions, 1 deletions
diff --git a/unicode/ChangeLog b/unicode/ChangeLog index 8b4e8ce..01a1246 100644 --- a/unicode/ChangeLog +++ b/unicode/ChangeLog @@ -21,6 +21,12 @@ * Add bidi property lookups. +2.1.1 + +2020-11-24 Sam Varshavchik <mrsam@courier-mta.com> + + * unicodebuf.c (unicode_buf_remove): Bug fix. + 2.1 2020-04-21 Sam Varshavchik <mrsam@courier-mta.com> diff --git a/unicode/unicodebuf.c b/unicode/unicodebuf.c index eb64543..59b7522 100644 --- a/unicode/unicodebuf.c +++ b/unicode/unicodebuf.c @@ -89,7 +89,8 @@ void unicode_buf_remove(struct unicode_buf *p, cnt=p->len-pos; if (cnt) - memmove(p->ptr+pos+cnt, p->ptr+pos, p->len-pos-cnt); + memmove(p->ptr+pos, p->ptr+pos+cnt, + (p->len-pos-cnt) * sizeof(char32_t)); p->len -= cnt; } diff --git a/unicode/unicodetest.c b/unicode/unicodetest.c index e9e4228..12a874f 100644 --- a/unicode/unicodetest.c +++ b/unicode/unicodetest.c @@ -123,11 +123,30 @@ static void test2() exit(1); } +void testunicodebuf() +{ + struct unicode_buf buf; + + unicode_buf_init(&buf, -1); + unicode_buf_append_char(&buf, "01234567", 8); + unicode_buf_remove(&buf, 1, 6); + + if (unicode_buf_len(&buf) != 2 || + unicode_buf_ptr(&buf)[0] != '0' || + unicode_buf_ptr(&buf)[1] != '7') + { + fprintf(stderr, "unicode_buf_remove failed\n"); + exit(1); + } + unicode_buf_deinit(&buf); +} + int main(int argc, char **argv) { const char *chset=unicode_x_imap_modutf7; int argn=1; + testunicodebuf(); if (argn < argc && strcmp(argv[argn], "--smap") == 0) { chset=unicode_x_imap_modutf7 " ./~:"; |
