]> granicus.if.org Git - icu/commitdiff
ICU-10379 fixes for IBM i - mostly clarifying ambiguous casts.
authorSteven R. Loomis <srl@icu-project.org>
Wed, 11 Sep 2013 19:38:07 +0000 (19:38 +0000)
committerSteven R. Loomis <srl@icu-project.org>
Wed, 11 Sep 2013 19:38:07 +0000 (19:38 +0000)
X-SVN-Rev: 34274

icu4c/source/i18n/Makefile.in
icu4c/source/i18n/decimfmt.cpp
icu4c/source/i18n/plurrule.cpp
icu4c/source/i18n/region.cpp
icu4c/source/i18n/scriptset.cpp

index 2b8bc89e70f500d926e7a3794c873a1f57b096d1..c644e8c6d8cc3779acaf93c9695d767133eed9c8 100644 (file)
@@ -87,8 +87,7 @@ uspoof.o uspoof_impl.o uspoof_build.o uspoof_conf.o uspoof_wsconf.o decfmtst.o s
 ztrans.o zrule.o vzone.o fphdlimp.o fpositer.o locdspnm.o \
 decNumber.o decContext.o alphaindex.o tznames.o tznames_impl.o tzgnames.o \
 tzfmt.o compactdecimalformat.o gender.o region.o scriptset.o identifier_info.o \
-tzfmt.o compactdecimalformat.o gender.o region.o uregion.o scriptset.o \
-identifier_info.o
+uregion.o
 
 ## Header files to install
 HEADERS = $(srcdir)/unicode/*.h
index e6e1558d10db8fdfac80b00852dfa048f2124008..a2e77e2ffa5a222861310e2194faf35546ab2cd7 100644 (file)
@@ -1064,7 +1064,7 @@ DecimalFormat::getFixedDecimal(double number, UErrorCode &status) const {
 
     int32_t numTrailingFractionZeros = minFractionDigits - result.visibleDecimalDigitCount;
     if (numTrailingFractionZeros > 0) {
-        double scaleFactor = pow(10.0, numTrailingFractionZeros);
+      double scaleFactor = pow(10.0, (double)numTrailingFractionZeros);
         result.decimalDigits *= scaleFactor;
         result.visibleDecimalDigitCount += numTrailingFractionZeros;
     }
@@ -1534,7 +1534,7 @@ DecimalFormat::_round(const DigitList &number, DigitList &adjustedNum, UBool& is
 
     if (fScale != 0) {
         DigitList ten;
-        ten.set(10);
+        ten.set((int32_t)10);
         if (fScale > 0) {
             for (int32_t i = fScale ; i > 0 ; i--) {
                 adjustedNum.mult(ten, status);
@@ -2179,7 +2179,7 @@ void DecimalFormat::parse(const UnicodeString& text,
 
         if (fScale != 0) {
             DigitList ten;
-            ten.set(10);
+            ten.set((int32_t)10);
             if (fScale > 0) {
                 for (int32_t i = fScale; i > 0; i--) {
                     UErrorCode ec = U_ZERO_ERROR;
index e8f381a2c822ca4ec7aa35bcb2fad0c6628143ab..e6d3b91794e4c6ded510e6d45233cf930d0c9a2f 100644 (file)
@@ -1475,7 +1475,7 @@ int64_t FixedDecimal::getFractionalDigits(double n, int32_t v) {
       case 2: return (int64_t)(fract*100.0 + 0.5);
       case 3: return (int64_t)(fract*1000.0 + 0.5);
       default:
-          double scaled = floor(fract * pow(10.0, v) + 0.5);
+          double scaled = floor(fract * pow(10.0, (double)v) + 0.5);
           if (scaled > U_INT64_MAX) {
               return U_INT64_MAX;
           } else {
index 1485c078e3eeeba8e4d88233457c8ff46cae1e40..23d33b5bfe46149c3160014a2125b72c61ca7886 100644 (file)
@@ -14,7 +14,7 @@
 */
 
 /**
- * \file 
+ * \file
  * \brief C++ API: Region classes (territory containment)
  */
 
@@ -73,7 +73,7 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(RegionNameEnumeration)
  * Initializes the region data from the ICU resource bundles.  The region data
  * contains the basic relationships such as which regions are known, what the numeric
  * codes are, any known aliases, and the territory containment data.
- * 
+ *
  * If the region data has already loaded, then this method simply returns without doing
  * anything meaningful.
  */
@@ -90,7 +90,7 @@ void Region::loadRegionData() {
         return;
     }
 
-   
+
     UErrorCode status = U_ZERO_ERROR;
 
     UResourceBundle* regionCodes = NULL;
@@ -118,7 +118,7 @@ void Region::loadRegionData() {
     UResourceBundle *rb = ures_openDirect(NULL,"metadata",&status);
     regionCodes = ures_getByKey(rb,"regionCodes",NULL,&status);
     territoryAlias = ures_getByKey(rb,"territoryAlias",NULL,&status);
-    
+
     UResourceBundle *rb2 = ures_openDirect(NULL,"supplementalData",&status);
     codeMappings = ures_getByKey(rb2,"codeMappings",NULL,&status);
 
@@ -232,7 +232,7 @@ void Region::loadRegionData() {
                 }
                 UnicodeString *code3 = new UnicodeString(codeMapping3Letter);
                 uhash_put(regionAliases,(void *)code3, (void *)r,&status);
-            }                    
+            }
         }
         ures_close(mapping);
     }
@@ -286,14 +286,14 @@ void Region::loadRegionData() {
         for ( int j = 0 ; j < ures_getSize(mapping); j++ ) {
             UnicodeString child = ures_getUnicodeStringByIndex(mapping,j,&status);
             Region *childRegion = (Region *) uhash_get(regionIDMap,(void *)&child);
-            if ( parentRegion != NULL && childRegion != NULL ) {                    
+            if ( parentRegion != NULL && childRegion != NULL ) {
 
                 // Add the child region to the set of regions contained by the parent
                 if (parentRegion->containedRegions == NULL) {
                     parentRegion->containedRegions = new UVector(uprv_deleteUObject, uhash_compareUnicodeString, status);
                 }
 
-                UnicodeString *childStr = new UnicodeString(status);
+                UnicodeString *childStr = new UnicodeString();
                 childStr->fastCopyFrom(childRegion->idStr);
                 parentRegion->containedRegions->addElement((void *)childStr,status);
 
@@ -306,7 +306,7 @@ void Region::loadRegionData() {
             }
         }
         ures_close(mapping);
-    }     
+    }
 
     // Create the availableRegions lists
     int32_t pos = -1;
@@ -392,7 +392,7 @@ UBool
 Region::operator!=(const Region &that) const {
         return (idStr != that.idStr);
 }
+
 /**
  * Returns a pointer to a Region using the given region code.  The region code can be either 2-letter ISO code,
  * 3-letter ISO code,  UNM.49 numeric code, or other valid Unicode Region Code as defined by the LDML specification.
@@ -442,7 +442,7 @@ Region::getInstance(const char *region_code, UErrorCode &status) {
  * Returns a pointer to a Region using the given numeric region code. If the numeric region code is not recognized,
  * the appropriate error code will be set ( U_ILLEGAL_ARGUMENT_ERROR ).
  */
-const Region* U_EXPORT2 
+const Region* U_EXPORT2
 Region::getInstance (int32_t code, UErrorCode &status) {
 
     loadRegionData();
@@ -458,7 +458,7 @@ Region::getInstance (int32_t code, UErrorCode &status) {
         UErrorCode fs = U_ZERO_ERROR;
         UnicodeString pat = UNICODE_STRING_SIMPLE("00#");
         DecimalFormat *df = new DecimalFormat(pat,fs);
-        
+
         UnicodeString id;
         id.remove();
         df->format(code,id);
@@ -488,14 +488,14 @@ Region::getInstance (int32_t code, UErrorCode &status) {
  */
 StringEnumeration* U_EXPORT2
 Region::getAvailable(URegionType type) {
-    
+
     loadRegionData();
     UErrorCode status = U_ZERO_ERROR;
     return new RegionNameEnumeration(availableRegions[type],status);
 
-    return NULL; 
+    return NULL;
 }
-   
+
 /**
  * Returns a pointer to the region that contains this region.  Returns NULL if this region is code "001" (World)
  * or "ZZ" (Unknown region). For example, calling this method with region "IT" (Italy) returns the
@@ -555,7 +555,7 @@ Region::getContainedRegions( URegionType type ) const {
 
     UErrorCode status = U_ZERO_ERROR;
     UVector *result = new UVector(NULL, uhash_compareChars, status);
+
     StringEnumeration *cr = getContainedRegions();
 
     for ( int32_t i = 0 ; i < cr->count(status) ; i++ ) {
@@ -578,7 +578,7 @@ Region::getContainedRegions( URegionType type ) const {
     delete result;
     return resultEnumeration;
 }
+
 /**
  * Returns true if this region contains the supplied other region anywhere in the region hierarchy.
  */
@@ -619,7 +619,7 @@ Region::getPreferredValues() const {
         return NULL;
     }
 }
+
 
 /**
  * Return this region's canonical region code.
@@ -649,16 +649,16 @@ RegionNameEnumeration::RegionNameEnumeration(UVector *fNameList, UErrorCode& sta
         for ( int32_t i = 0 ; i < fNameList->size() ; i++ ) {
             UnicodeString* this_region_name = (UnicodeString *)fNameList->elementAt(i);
             UnicodeString* new_region_name = new UnicodeString(*this_region_name);
-            fRegionNames->addElement((void *)new_region_name,status);          
+            fRegionNames->addElement((void *)new_region_name,status);
         }
     }
-    else { 
+    else {
         fRegionNames = NULL;
     }
 }
 
 const UnicodeString*
-RegionNameEnumeration::snext(UErrorCode& status) { 
+RegionNameEnumeration::snext(UErrorCode& status) {
   if (U_FAILURE(status) || (fRegionNames==NULL)) {
     return NULL;
   }
index 809e5f63a9f0c47a590de013c78302aa7106833b..5f635d030658a4c072cf59df1f516e2900a44bba 100644 (file)
@@ -196,7 +196,7 @@ UnicodeString &ScriptSet::displayScripts(UnicodeString &dest) const {
     UBool firstTime = TRUE;
     for (int32_t i = nextSetBit(0); i >= 0; i = nextSetBit(i + 1)) {
         if (!firstTime) {
-            dest.append(0x20);
+            dest.append((UChar)0x20);
         }
         firstTime = FALSE;
         const char *scriptName = uscript_getShortName((UScriptCode(i)));