]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/common/ucharstriebuilder.cpp
ICU-57132.0.1.tar.gz
[apple/icu.git] / icuSources / common / ucharstriebuilder.cpp
index b304a3b42c3015c1f4acb5038b9dd61b93300331..05255b48c9b3c88323defb5fa0ee45c9ad6ef25b 100644 (file)
@@ -1,6 +1,6 @@
 /*
 *******************************************************************************
-*   Copyright (C) 2010-2011, International Business Machines
+*   Copyright (C) 2010-2012, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 *******************************************************************************
 *   file name:  ucharstriebuilder.h
@@ -132,9 +132,9 @@ U_CDECL_BEGIN
 
 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);
 }
 
@@ -210,7 +210,7 @@ UCharsTrieBuilder::buildUChars(UStringTrieBuildOption buildOption, UErrorCode &e
     }
     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;
@@ -327,7 +327,7 @@ UCharsTrieBuilder::ensureCapacity(int32_t length) {
         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);
@@ -378,7 +378,7 @@ UCharsTrieBuilder::writeValueAndFinal(int32_t i, UBool isFinal) {
     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) {
@@ -402,7 +402,7 @@ UCharsTrieBuilder::writeValueAndType(UBool hasValue, int32_t value, int32_t node
     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) {