/*
*******************************************************************************
-* Copyright (C) 2010-2011, International Business Machines
+* Copyright (C) 2010-2012, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: ucharstriebuilder.h
static int32_t U_CALLCONV
compareElementStrings(const void *context, const void *left, const void *right) {
- const UnicodeString *strings=reinterpret_cast<const UnicodeString *>(context);
- const UCharsTrieElement *leftElement=reinterpret_cast<const UCharsTrieElement *>(left);
- const UCharsTrieElement *rightElement=reinterpret_cast<const UCharsTrieElement *>(right);
+ const UnicodeString *strings=static_cast<const UnicodeString *>(context);
+ const UCharsTrieElement *leftElement=static_cast<const UCharsTrieElement *>(left);
+ const UCharsTrieElement *rightElement=static_cast<const UCharsTrieElement *>(right);
return leftElement->compareStringTo(*rightElement, *strings);
}
}
if(ucharsCapacity<capacity) {
uprv_free(uchars);
- uchars=reinterpret_cast<UChar *>(uprv_malloc(capacity*2));
+ uchars=static_cast<UChar *>(uprv_malloc(capacity*2));
if(uchars==NULL) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
ucharsCapacity=0;
do {
newCapacity*=2;
} while(newCapacity<=length);
- UChar *newUChars=reinterpret_cast<UChar *>(uprv_malloc(newCapacity*2));
+ UChar *newUChars=static_cast<UChar *>(uprv_malloc(newCapacity*2));
if(newUChars==NULL) {
// unable to allocate memory
uprv_free(uchars);
int32_t length;
if(i<0 || i>UCharsTrie::kMaxTwoUnitValue) {
intUnits[0]=(UChar)(UCharsTrie::kThreeUnitValueLead);
- intUnits[1]=(UChar)(i>>16);
+ intUnits[1]=(UChar)((uint32_t)i>>16);
intUnits[2]=(UChar)i;
length=3;
// } else if(i<=UCharsTrie::kMaxOneUnitValue) {
int32_t length;
if(value<0 || value>UCharsTrie::kMaxTwoUnitNodeValue) {
intUnits[0]=(UChar)(UCharsTrie::kThreeUnitNodeValueLead);
- intUnits[1]=(UChar)(value>>16);
+ intUnits[1]=(UChar)((uint32_t)value>>16);
intUnits[2]=(UChar)value;
length=3;
} else if(value<=UCharsTrie::kMaxOneUnitNodeValue) {