UErrorCode *status,
const char *locale)
{
- if(!casemap)
+ if (!casemap)
return 0;
return icu_utf16_casemap(dest16, src16, locale,
0, status);
break;
case ICU_chain_step_type_tokenize:
- step->u.tokenizer = icu_tokenizer_create((char *) chain->locale,
+ step->u.tokenizer = icu_tokenizer_create(chain->locale,
(char) rule[0], status);
break;
case ICU_chain_step_type_transliterate:
(const char *) rule, status);
break;
case YAZ_chain_step_type_stemming:
- step->u.stemmer = yaz_stemmer_create((char *) chain->locale, (const char *) rule, status);
+ step->u.stemmer = yaz_stemmer_create(chain->locale,
+ (const char *) rule, status);
break;
default:
break;
chain->sort = sort;
- chain->coll = ucol_open((const char *) chain->locale, status);
+ chain->coll = ucol_open(chain->locale, status);
if (U_FAILURE(*status))
return 0;
}
}
-static struct icu_chain_step *icu_chain_insert_step(
- struct icu_chain *chain, enum icu_chain_step_type type,
- const uint8_t *rule, UErrorCode *status);
-
struct icu_chain *icu_chain_xml_config(const xmlNode *xml_node,
int sort,
UErrorCode *status)
*status = U_ZERO_ERROR;
- if (!xml_node ||xml_node->type != XML_ELEMENT_NODE)
- return 0;
-
+ if (xml_node && xml_node->type == XML_ELEMENT_NODE)
{
xmlChar *xml_locale = xmlGetProp((xmlNode *) xml_node,
(xmlChar *) "locale");
-
if (xml_locale)
{
chain = icu_chain_create((const char *) xml_locale, sort, status);
xmlFree(xml_locale);
}
-
}
+
if (!chain)
return 0;
{
tokenizer->token_count++;
tokenizer->token_id++;
- } else {
- tokenizer->token_id = 0;
}
+ else
+ tokenizer->token_id = 0;
+
tokenizer->token_start = tkn_start;
tokenizer->token_end = tkn_end;
/* copying into token buffer if it exists */
- if (tkn16){
+ if (tkn16)
+ {
if (tkn16->utf16_cap < tkn_len)
icu_buf_utf16_resize(tkn16, (size_t) tkn_len * 2);
if (!icu_buf_utf16_copy(dest16, src16))
return 0;
- utrans_transUChars (transform->trans,
- dest16->utf16, &(dest16->utf16_len),
- dest16->utf16_cap,
- 0, &(dest16->utf16_len), status);
+ utrans_transUChars(transform->trans,
+ dest16->utf16, &(dest16->utf16_len),
+ dest16->utf16_cap,
+ 0, &(dest16->utf16_len), status);
if (U_FAILURE(*status))
icu_buf_utf16_clear(dest16);
if (!buf16)
return 0;
- if (capacity > 0)
+ if (capacity > 0)
{
if (0 == buf16->utf16)
buf16->utf16 = (UChar *) xmalloc(sizeof(UChar) * capacity);
buf16->utf16_len = 0;
buf16->utf16_cap = 0;
}
-
return buf16;
}
if (!buf8)
return 0;
- if (capacity > 0)
+ if (capacity > 0)
{
if (0 == buf8->utf8)
buf8->utf8 = (uint8_t *) xmalloc(sizeof(uint8_t) * capacity);
buf8->utf8_cap = capacity;
}
- else {
+ else
+ {
xfree(buf8->utf8);
buf8->utf8 = 0;
buf8->utf8_len = 0;
src8cstr, src8cstr_len, status);
}
- if (U_SUCCESS(*status)
- && utf16_len <= dest16->utf16_cap)
+ if (U_SUCCESS(*status) && utf16_len <= dest16->utf16_cap)
dest16->utf16_len = utf16_len;
else
icu_buf_utf16_clear(dest16);
src16->utf16, src16->utf16_len, status);
}
- if (U_SUCCESS(*status)
- && utf8_len <= dest8->utf8_cap)
+ if (U_SUCCESS(*status) && utf8_len <= dest8->utf8_cap)
dest8->utf8_len = utf8_len;
else
icu_buf_utf8_clear(dest8);