Added a few comments. Source in ztest also analyzed by Doxygen.
[yaz-moved-to-github.git] / src / icu_I18N.c
index 5e32d6b..764d8f7 100644 (file)
@@ -1,8 +1,11 @@
-/*
- * Copyright (C) 1995-2007, Index Data ApS
+/* This file is part of the YAZ toolkit.
+ * Copyright (C) 1995-2008 Index Data
  * See the file LICENSE for details.
- *
- * $Id: icu_I18N.c,v 1.19 2007-11-08 18:02:04 adam Exp $
+ */
+
+/**
+ * \file icu_I18N.c
+ * \brief ICU utilities
  */
 
 #if HAVE_CONFIG_H
@@ -166,8 +169,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 +183,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)
@@ -465,10 +450,10 @@ int icu_utf16_casemap(struct icu_buf_utf16 * dest16,
 
 
 
-UErrorCode icu_sortkey8_from_utf16(UCollator *coll,
-                                   struct icu_buf_utf8 * dest8, 
-                                   struct icu_buf_utf16 * src16,
-                                   UErrorCode * status)
+void icu_sortkey8_from_utf16(UCollator *coll,
+                             struct icu_buf_utf8 * dest8, 
+                             struct icu_buf_utf16 * src16,
+                             UErrorCode * status)
 { 
   
     int32_t sortkey_len = 0;
@@ -488,8 +473,6 @@ UErrorCode icu_sortkey8_from_utf16(UCollator *coll,
         dest8->utf8_len = sortkey_len;
     else 
         icu_buf_utf8_clear(dest8);
-    
-    return sortkey_len;
 }
 
 
@@ -922,7 +905,7 @@ struct icu_chain * icu_chain_xml_config(const xmlNode *xml_node,
         if (!strcmp((const char *) node->name, "casemap"))
             step = icu_chain_insert_step(chain, ICU_chain_step_type_casemap, 
                                          (const uint8_t *) xml_rule, status);
-        else if (!strcmp((const char *) node->name, "normalize"))
+        else if (!strcmp((const char *) node->name, "transform"))
             step = icu_chain_insert_step(chain, ICU_chain_step_type_normalize, 
                                          (const uint8_t *) xml_rule, status);
         else if (!strcmp((const char *) node->name, "tokenize"))