From: Adam Dickmeiss Date: Mon, 17 Dec 2007 11:23:16 +0000 (+0000) Subject: Fixed bug in icu_buf_utf8_to_cstr (wrong length). X-Git-Tag: YAZ.3.0.18~6 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=98fd6745c622d0f3585a9cc5a2b7624472c6a028;p=yaz-moved-to-github.git Fixed bug in icu_buf_utf8_to_cstr (wrong length). Fixed bug in icu_buf_utf8_to_cstr . A string could be truncated because its string length is set to 0 in icu_buf_utf8_resize. Function icu_buf_utf8_resize no longer resets the string. --- diff --git a/src/icu_I18N.c b/src/icu_I18N.c index de84874..bdfe5a6 100644 --- a/src/icu_I18N.c +++ b/src/icu_I18N.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: icu_I18N.c,v 1.21 2007-11-30 11:43:47 adam Exp $ + * $Id: icu_I18N.c,v 1.22 2007-12-17 11:23:16 adam Exp $ */ #if HAVE_CONFIG_H @@ -166,8 +166,7 @@ struct icu_buf_utf8 * icu_buf_utf8_resize(struct icu_buf_utf8 * buf8, else buf8->utf8 = (uint8_t *) xrealloc(buf8->utf8, sizeof(uint8_t) * capacity); - - icu_buf_utf8_clear(buf8); + buf8->utf8_cap = capacity; } else { @@ -181,23 +180,6 @@ struct icu_buf_utf8 * icu_buf_utf8_resize(struct icu_buf_utf8 * buf8, } -struct icu_buf_utf8 * icu_buf_utf8_copy(struct icu_buf_utf8 * dest8, - struct icu_buf_utf8 * src8) -{ - if(!dest8 || !src8 - || dest8 == src8) - return 0; - - - if (dest8->utf8_cap < src8->utf8_len) - icu_buf_utf8_resize(dest8, src8->utf8_len * 2); - - strncpy((char*) dest8->utf8, (char*) src8->utf8, src8->utf8_len); - - return dest8; -} - - const char *icu_buf_utf8_to_cstr(struct icu_buf_utf8 *src8) { if (!src8 || src8->utf8_len == 0)