/*
*****************************************************************************
- * Copyright (C) 1996-2011, International Business Machines Corporation and *
- * others. All Rights Reserved. *
+ * Copyright (C) 1996-2015, International Business Machines Corporation and
+ * others. All Rights Reserved.
*****************************************************************************
*/
pieces_lengths(NULL),
current(NULL),
current_length(0),
- nfd(*Normalizer2Factory::getNFDInstance(status)),
+ nfd(*Normalizer2::getNFDInstance(status)),
nfcImpl(*Normalizer2Factory::getNFCImpl(status))
{
if(U_SUCCESS(status) && nfcImpl.ensureCanonIterData(status)) {
for (i = 0; i < source.length(); i += U16_LENGTH(cp)) {
cp = source.char32At(i);
const UHashElement *ne = NULL;
- int32_t el = -1;
+ int32_t el = UHASH_FIRST;
UnicodeString subPermuteString = source;
// optimization:
// TODO: optimize by not permuting any class zero.
const UHashElement *ne = NULL;
- int32_t el = -1;
+ int32_t el = UHASH_FIRST;
//Iterator it = basic.iterator();
ne = basic.nextElement(el);
//while (it.hasNext())
permutations.removeAll();
permute(item, CANITER_SKIP_ZEROES, &permutations, status);
const UHashElement *ne2 = NULL;
- int32_t el2 = -1;
+ int32_t el2 = UHASH_FIRST;
//Iterator it2 = permutations.iterator();
ne2 = permutations.nextElement(el2);
//while (it2.hasNext())
}
//result.toArray(finalResult);
result_len = 0;
- el = -1;
+ el = UHASH_FIRST;
ne = result.nextElement(el);
while(ne != NULL) {
finalResult[result_len++] = *((UnicodeString *)(ne->value.pointer));
UnicodeString prefix(segment, i);
prefix += cp2;
- int32_t el = -1;
+ int32_t el = UHASH_FIRST;
const UHashElement *ne = remainder.nextElement(el);
while (ne != NULL) {
UnicodeString item = *((UnicodeString *)(ne->value.pointer));
int32_t inputLen=temp.length();
UnicodeString decompString;
nfd.normalize(temp, decompString, status);
+ if (U_FAILURE(status)) {
+ return NULL;
+ }
+ if (decompString.isBogus()) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return NULL;
+ }
const UChar *decomp=decompString.getBuffer();
int32_t decompLen=decompString.length();