diff options
| -rw-r--r-- | unicode/ChangeLog | 8 | ||||
| -rw-r--r-- | unicode/configure.ac | 2 | ||||
| -rw-r--r-- | unicode/unicodebuf.c | 3 | ||||
| -rw-r--r-- | unicode/unicodetest.c | 19 |
4 files changed, 30 insertions, 2 deletions
diff --git a/unicode/ChangeLog b/unicode/ChangeLog index a9203d3..8cb0196 100644 --- a/unicode/ChangeLog +++ b/unicode/ChangeLog @@ -1,3 +1,11 @@ +2.1.1 + +2020-11-24 Sam Varshavchik <mrsam@courier-mta.com> + + * unicodebuf.c (unicode_buf_remove): Bug fix. + +2.1 + 2018-07-13 Sam Varshavchik <mrsam@courier-mta.com> * unicode.c: Fix error and validation of valid modified-utf7 diff --git a/unicode/configure.ac b/unicode/configure.ac index bce0500..a57d405 100644 --- a/unicode/configure.ac +++ b/unicode/configure.ac @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT([courier-unicode], [2.1], [courier-users@lists.sourceforge.net]) +AC_INIT([courier-unicode], [2.1.1], [courier-users@lists.sourceforge.net]) >confdefs.h # Kill PACKAGE_ macros 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 " ./~:"; |
