X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Ficu_sortkey.c;h=9af6e52ad93ffc81b89c402031cea30f3398a0d4;hb=00537b483d646bd04a204708ecbde708861f044e;hp=c9fc3805d5fca603462f056626f6b8d9e4a7164b;hpb=4493d0acd68f0d3f1b0f1b6c79e3934bfa3207ed;p=yaz-moved-to-github.git diff --git a/src/icu_sortkey.c b/src/icu_sortkey.c index c9fc380..9af6e52 100644 --- a/src/icu_sortkey.c +++ b/src/icu_sortkey.c @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2011 Index Data + * Copyright (C) 1995-2012 Index Data * See the file LICENSE for details. */ @@ -27,15 +27,15 @@ #include /* char names */ void icu_sortkey8_from_utf16(UCollator *coll, - struct icu_buf_utf8 * dest8, + struct icu_buf_utf8 * dest8, struct icu_buf_utf16 * src16, UErrorCode * status) -{ +{ int32_t sortkey_len = 0; /* we'll fake a capacity of one less, because it turns out that ucol_getSortKey writes ONE character too much */ int32_t cap = dest8->utf8_cap ? dest8->utf8_cap - 1 : 0; - + sortkey_len = ucol_getSortKey(coll, src16->utf16, src16->utf16_len, dest8->utf8, cap); @@ -50,7 +50,7 @@ void icu_sortkey8_from_utf16(UCollator *coll, if (U_SUCCESS(*status) && sortkey_len > 0) dest8->utf8_len = sortkey_len; - else + else icu_buf_utf8_clear(dest8); }