+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
-* Copyright (C) 2012-2014, International Business Machines
+* Copyright (C) 2012-2015, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
* collationdatabuilder.cpp
#include "uvectr64.h"
#include "uvector.h"
-#define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0]))
-
U_NAMESPACE_BEGIN
CollationDataBuilder::CEModifier::~CEModifier() {}
* Context strings must be unique and in ascending order.
*/
struct ConditionalCE32 : public UMemory {
+ ConditionalCE32()
+ : context(),
+ ce32(0), defaultCE32(Collation::NO_CE32), builtCE32(Collation::NO_CE32),
+ next(-1) {}
ConditionalCE32(const UnicodeString &ct, uint32_t ce)
: context(ct),
ce32(ce), defaultCE32(Collation::NO_CE32), builtCE32(Collation::NO_CE32),
int64_t
CollationDataBuilder::getSingleCE(UChar32 c, UErrorCode &errorCode) const {
if(U_FAILURE(errorCode)) { return 0; }
+ // Keep parallel with CollationData::getSingleCE().
UBool fromBase = FALSE;
uint32_t ce32 = utrie2_get32(trie, c);
if(ce32 == Collation::FALLBACK_CE32) {
if(!withContext) {
return copyFromBaseCE32(c, ce32, FALSE, errorCode);
}
- ConditionalCE32 head(UnicodeString(), 0);
+ ConditionalCE32 head;
UnicodeString context((UChar)0);
int32_t index;
if(Collation::isContractionCE32(ce32)) {
ce32 = CollationData::readCE32(p); // Default if no suffix match.
return copyFromBaseCE32(c, ce32, FALSE, errorCode);
}
- ConditionalCE32 head(UnicodeString(), 0);
+ ConditionalCE32 head;
UnicodeString context((UChar)0);
copyContractionsFromBaseCE32(context, c, ce32, &head, errorCode);
ce32 = makeBuilderContextCE32(head.next);
ce32 = encodeOneCE(Collation::unassignedCEFromCodePoint(c), errorCode);
break;
default:
- U_ASSERT(FALSE); // require ce32 == base->getFinalCE32(ce32)
- break;
+ UPRV_UNREACHABLE; // require ce32 == base->getFinalCE32(ce32)
}
return ce32;
}
if(base != NULL) {
data.numericPrimary = base->numericPrimary;
data.compressibleBytes = base->compressibleBytes;
- data.scripts = base->scripts;
- data.scriptsLength = base->scriptsLength;
+ data.numScripts = base->numScripts;
+ data.scriptsIndex = base->scriptsIndex;
+ data.scriptStarts = base->scriptStarts;
+ data.scriptStartsLength = base->scriptStartsLength;
}
buildFastLatinTable(data, errorCode);
}
// Build the contractions trie.
contractionBuilder.clear();
// Entry for an empty suffix, to be stored before the trie.
- uint32_t emptySuffixCE32;
+ uint32_t emptySuffixCE32 = 0;
uint32_t flags = 0;
if(firstCond->context.length() == suffixStart) {
// There is a mapping for the prefix and the single character c. (p|c)