]> granicus.if.org Git - icu/commitdiff
ICU-10376 fixup clang warnings
authorSteven R. Loomis <srl@icu-project.org>
Wed, 18 Sep 2013 20:08:25 +0000 (20:08 +0000)
committerSteven R. Loomis <srl@icu-project.org>
Wed, 18 Sep 2013 20:08:25 +0000 (20:08 +0000)
X-SVN-Rev: 34385

17 files changed:
icu4c/source/common/ubidi.c
icu4c/source/configure
icu4c/source/configure.ac
icu4c/source/i18n/csrsbcs.cpp
icu4c/source/i18n/datefmt.cpp
icu4c/source/i18n/islamcal.cpp
icu4c/source/i18n/islamcal.h
icu4c/source/i18n/numfmt.cpp
icu4c/source/i18n/timezone.cpp
icu4c/source/i18n/tzfmt.cpp
icu4c/source/layout/LETypes.h
icu4c/source/layout/LigatureSubstProc.cpp
icu4c/source/test/cintltst/creststn.c
icu4c/source/test/intltest/caltest.cpp
icu4c/source/test/intltest/csdetest.cpp
icu4c/source/test/intltest/dtfmttst.cpp
icu4c/source/test/intltest/tsmthred.cpp

index 33d9c51f98758edd06e4ed6950660e547d70b1f7..2ba416c08d566e6cf932415960343f05dd4f82b6 100644 (file)
@@ -634,10 +634,10 @@ getDirProps(UBiDi *pBiDi) {
 
 /* determine the paragraph level at position index */
 U_CFUNC UBiDiLevel
-ubidi_getParaLevelAtIndex(const UBiDi *pBiDi, int32_t index) {
+ubidi_getParaLevelAtIndex(const UBiDi *pBiDi, int32_t pindex) {
     int32_t i;
     for(i=0; i<pBiDi->paraCount; i++)
-        if(index<pBiDi->paras[i].limit)
+        if(pindex<pBiDi->paras[i].limit)
             break;
     if(i>=pBiDi->paraCount)
         i=pBiDi->paraCount-1;
index 654de7d042c08c7b9d3e25c9af505ca9882f836a..340ad6fa39e1f900676224e7003be72fe1fe3bdc 100755 (executable)
@@ -7443,13 +7443,13 @@ fi
 # for build.
 
 if test "${CC}" == "clang"; then
-   CLANGCFLAGS="-Qunused-arguments"
+   CLANGCFLAGS="-Qunused-arguments -Wno-parentheses-equality"
 else
    CLANGCFLAGS=""
 fi
 
 if test "${CXX}" == "clang++"; then
-   CLANGCXXFLAGS="-Qunused-arguments"
+   CLANGCXXFLAGS="-Qunused-arguments -Wno-parentheses-equality"
 else
    CLANGCXXFLAGS=""
 fi
index f3c1e19fbfd33b93aea8b46f1ea95d0da346136d..f56b533b4534e13b75d97984caa66b569fe7e2ab 100644 (file)
@@ -1250,13 +1250,13 @@ fi
 # for build.
 
 if test "${CC}" == "clang"; then
-   CLANGCFLAGS="-Qunused-arguments"
+   CLANGCFLAGS="-Qunused-arguments -Wno-parentheses-equality"
 else
    CLANGCFLAGS=""
 fi
 
 if test "${CXX}" == "clang++"; then
-   CLANGCXXFLAGS="-Qunused-arguments"
+   CLANGCXXFLAGS="-Qunused-arguments -Wno-parentheses-equality"
 else
    CLANGCXXFLAGS=""
 fi
index 80d21149280a2bcf0e832bd563b445b2a5f8f4c9..d03367cc4eedca7440a64bbf3d49e4ad94cbc186 100644 (file)
@@ -20,7 +20,7 @@
 U_NAMESPACE_BEGIN
 
 NGramParser::NGramParser(const int32_t *theNgramList, const uint8_t *theCharMap)
 :byteIndex(0), ngram(0)
: ngram(0), byteIndex(0)
 {
     ngramList = theNgramList;
     charMap   = theCharMap;
index bc34dae813df99966b086eb153fda04b5a4b921d..1caeac907b9c83b6894ce3eb13d5faaac11c3888 100644 (file)
@@ -530,7 +530,7 @@ DateFormat::setBooleanAttribute(UDateFormatBooleanAttribute attr,
 //----------------------------------------------------------------------
 
 UBool 
-DateFormat::getBooleanAttribute(UDateFormatBooleanAttribute attr, UErrorCode &status) const {
+DateFormat::getBooleanAttribute(UDateFormatBooleanAttribute attr, UErrorCode &/*status*/) const {
 
     return fBoolFlags.get(attr);
 }
index 59de71335fa6538e1272dec8629994f548ffe520..c5a4838f86913c62ebb85383011bc9a06e65864c 100644 (file)
@@ -23,6 +23,7 @@
 #include "astro.h" // CalendarAstronomer
 #include "uhash.h"
 #include "ucln_in.h"
+#include "uassert.h"
 
 static const UDate HIJRA_MILLIS = -42521587200000.0;    // 7/16/622 AD 00:00
 
@@ -84,9 +85,12 @@ const char *IslamicCalendar::getType() const {
         return "islamic";
     } else if(civil==TBLA){
         return "islamic-tbla";
+    } else if(civil==UMALQURA){
+      return "islamic-umalqura";
     } else {
-               return "islamic-umalqura";
-       }
+      U_ASSERT(false); // out of range
+      return "islamic-unknown";
+    }
 }
 
 Calendar* IslamicCalendar::clone() const {
@@ -459,7 +463,7 @@ void IslamicCalendar::handleComputeFields(int32_t julianDay, UErrorCode &status)
 
         year = months / 12 + 1;
         month = months % 12;
-    } else if(civil == UMALQURA){
+    } else if(civil == UMALQURA) {
                int32_t umalquraStartdays = yearStart(UMALQURA_YEAR_START) ;
                if( days < umalquraStartdays){
                        //Use Civil calculation
@@ -490,7 +494,10 @@ void IslamicCalendar::handleComputeFields(int32_t julianDay, UErrorCode &status)
                        year = y;
                                month = m;
                }
-       }
+    } else { // invalid 'civil'
+      U_ASSERT(false); // should not get here, out of range
+      year=month=0;
+    }
 
        dayOfMonth = (days - monthStart(year, month)) + 1;
 
index b37e8169cb26f34b3986bf4e4b19c91e6b3c0fa6..35785606833defc685e1b57600b7d7fe0d6174f5 100644 (file)
@@ -94,7 +94,7 @@ class U_I18N_API IslamicCalendar : public Calendar {
   enum ECivil {
     ASTRONOMICAL,
     CIVIL,
-       UMALQURA,
+    UMALQURA,
     TBLA
   };
   
@@ -452,7 +452,7 @@ class U_I18N_API IslamicCalendar : public Calendar {
     static const int32_t ASTRONOMICAL_EPOC = 1948439;
 
 
-  static const int getUmalqura_MonthLength(int i, int j){
+  static int getUmalqura_MonthLength(int i, int j){
 
     static const int UMALQURA_MONTHLENGTH[] = {                
         //* 1318 -1322 */ "0101 0111 0100", "1001 0111 0110", "0100 1011 0111", "0010 0101 0111", "0101 0010 1011",
index f1dcdb93d59b800eb85224c10dfa7c413f2def88..da09207e87dea258e4c54038790cd80989c2e220 100644 (file)
@@ -457,7 +457,7 @@ class ArgExtractor {
 
   const Formattable* number(void) const;
   const UChar *iso(void) const;
-  const UBool wasCurrency(void) const;
+  UBool wasCurrency(void) const;
 };
 
 inline const Formattable*
@@ -465,7 +465,7 @@ ArgExtractor::number(void) const {
   return num;
 }
 
-inline const UBool
+inline UBool
 ArgExtractor::wasCurrency(void) const {
   return fWasCurrency;
 }
@@ -475,7 +475,7 @@ ArgExtractor::iso(void) const {
   return save;
 }
 
-ArgExtractor::ArgExtractor(const NumberFormat& nf, const Formattable& obj, UErrorCode& /*status*/)
+ArgExtractor::ArgExtractor(const NumberFormat& /*nf*/, const Formattable& obj, UErrorCode& /*status*/)
   : num(&obj), fWasCurrency(FALSE) {
 
     const UObject* o = obj.getObject(); // most commonly o==NULL
index 0e37d19b38bdf803ffcd3b39646ae1dd4db96c4c..e656a7a8b90c924d0d582be63bebca04bca4d69f 100644 (file)
@@ -1617,7 +1617,7 @@ TimeZone::getIDForWindowsID(const UnicodeString& winid, const char* region, Unic
     char winidKey[MAX_WINDOWS_ID_SIZE];
     int32_t winKeyLen = winid.extract(0, winid.length(), winidKey, sizeof(winidKey) - 1, US_INV);
 
-    if (winKeyLen == 0 || winKeyLen >= sizeof(winidKey)) {
+    if (winKeyLen == 0 || winKeyLen >= (int32_t)sizeof(winidKey)) {
         ures_close(zones);
         return id;
     }
@@ -1634,7 +1634,6 @@ TimeZone::getIDForWindowsID(const UnicodeString& winid, const char* region, Unic
     int32_t len = 0;
     UBool gotID = FALSE;
     if (region) {
-        int32_t tzidsLen = 0;
         const UChar *tzids = ures_getStringByKey(zones, region, &len, &tmperr); // use tmperr, because
                                                                                 // regional mapping is optional
         if (U_SUCCESS(tmperr)) {
index 3b787627e33837ad9f0c4cdddaf38026a77edeee..a2e8a5936a64ee83b8f20f8e60960222d737064a 100644 (file)
@@ -743,6 +743,10 @@ TimeZoneFormat::format(UTimeZoneFormatStyle style, const TimeZone& tz, UDate dat
             case UTZFMT_STYLE_ISO_EXTENDED_LOCAL_FULL:
                 formatOffsetISO8601Extended(offset, FALSE, FALSE, FALSE, name, status);
                 break;
+
+            default:
+              // UTZFMT_STYLE_ZONE_ID, UTZFMT_STYLE_ZONE_ID_SHORT, UTZFMT_STYLE_EXEMPLAR_LOCATION
+              break;
             }
 
             if (timeType) {
index 7b4b162e497188f489b834fd2b43adc121dd4e8f..21e41ddbe21db1d2ab324400d2bc75957a6818ed 100644 (file)
@@ -302,7 +302,7 @@ typedef struct LEPoint LEPoint;
 /**
  * Range check for overflow
  */
-#define LE_RANGE_CHECK(type, count, ptrfn) (( (LE_UINTPTR_MAX / sizeof(type)) < count ) ? NULL : (ptrfn))
+#define LE_RANGE_CHECK(type, count, ptrfn) (( (LE_UINTPTR_MAX / sizeof(type)) < (size_t)count ) ? NULL : (ptrfn))
 /**
  * A convenience macro to get the length of an array.
  *
index 3c7958ea831ba4198013daf1e613bc1ad4558ce9..53f6f5a34f6948d1dffb03e6af28bcd21a1b7b67 100644 (file)
@@ -90,7 +90,7 @@ ByteOffset LigatureSubstitutionProcessor::processStateEntry(LEGlyphStorage &glyp
                   LE_DEBUG_BAD_FONT("off end of ligature substitution header");
                   return newState; // get out! bad font
               }
-              if(componentGlyph > glyphStorage.getGlyphCount()) {
+              if(componentGlyph > (le_uint32)glyphStorage.getGlyphCount()) {
                 LE_DEBUG_BAD_FONT("preposterous componentGlyph");
                 currGlyph++;
                 return newState; // get out! bad font
index 8444da45a04ad5be459550d71cdc3f245e2e4700..26cb756783796e2a6323a4bd06c67a5ee07ab6c4 100644 (file)
@@ -2005,7 +2005,6 @@ static void TestPreventFallback() {
     UResourceBundle* theBundle = NULL;
     const char* testdatapath;
     UErrorCode status = U_ZERO_ERROR;
-    UResourceBundle* res = NULL;
     int32_t unused_len = 0;
 
     testdatapath=loadTestData(&status);
index 30f98e8c73daff94a9a0cd1f8582f4e8e77b9799..1becfc4868c7ff62c2c5316aa7531fb71b3ed662 100644 (file)
@@ -2802,11 +2802,10 @@ void CalendarTest::Test8449() {
         tstCal->roll(UCAL_DAY_OF_MONTH, (UBool)TRUE, status);
         TEST_CHECK_STATUS;
     }
-    
+
     if(day != (initDay + loopCnt - 1) || month != IslamicCalendar::RABI_2 || year != 1434)
-        errln("invalid values for RABI_2 date after roll of " + loopCnt);
-        
-    
+      errln("invalid values for RABI_2 date after roll of %d", loopCnt);
+
     status = U_ZERO_ERROR;
     tstCal->clear();
     initMonth = 2;
index 62b4eacb2b85be3d6329532260616c891270cec6..9776e9b10ae22733e9430b9d0fca0e0dc3b174c4 100644 (file)
@@ -285,13 +285,13 @@ void CharsetDetectionTest::ConstructionTest()
     LocalUEnumerationPointer eActive(ucsdet_getDetectableCharsets(csd.getAlias(), status));
     const char *activeName = NULL;
 
-    while (activeName = uenum_next(eActive.getAlias(), NULL, status)) {
+    while ((activeName = uenum_next(eActive.getAlias(), NULL, status))) {
         // the charset must be included in all list
         UBool found = FALSE;
 
         const char *name = NULL;
         uenum_reset(e.getAlias(), status);
-        while (name = uenum_next(e.getAlias(), NULL, status)) {
+        while ((name = uenum_next(e.getAlias(), NULL, status))) {
             if (strcmp(activeName, name) == 0) {
                 found = TRUE;
                 break;
index 6e44fa726ef3d7cc78ac28cb093b1c16950b1c42..cb63ee085188c90370ece9eaf45e3b51fb52601e 100644 (file)
@@ -4232,15 +4232,16 @@ void DateFormatTest::TestDateFormatLeniency() {
            SimpleDateFormat * sdmft = new SimpleDateFormat(itemPtr->pattern, locale, status);
            sdmft->setLenient(itemPtr->leniency);
            sdmft->setBooleanAttribute(UDAT_PARSE_ALLOW_WHITESPACE, itemPtr->leniency, status).setBooleanAttribute(UDAT_PARSE_ALLOW_NUMERIC, itemPtr->leniency, status);
-           UDate d = sdmft->parse(itemPtr->parseString, pos);
-           
+           /*UDate d = */sdmft->parse(itemPtr->parseString, pos);
+
            delete sdmft;
            if(pos.getErrorIndex() > -1)
                if(itemPtr->expectedResult.length() != 0) {
-                   errln("error: unexpected error - " + itemPtr->parseString + " - error index " + pos.getErrorIndex() + " - leniency " + itemPtr->leniency);
-                    continue;
-               } else
-                   continue;
+                 errln("error: unexpected error - " + itemPtr->parseString + " - error index " + pos.getErrorIndex() + " - leniency " + itemPtr->leniency);
+                 continue;
+               } else {
+                 continue;
+               }
         }
     }
     delete cal;
index efd899ee047c29f3c20f371ea94ab2853b587205..a65e9b914374497fe28f8fae7ed36b513e76b086 100644 (file)
@@ -727,7 +727,7 @@ void ThreadSafeFormat::init(UErrorCode &status) {
   gFormat->format(gBBDThing, gBBDStr, NULL, status);
 }
 
-void ThreadSafeFormat::fini(UErrorCode &status) {
+void ThreadSafeFormat::fini(UErrorCode &/*status*/) {
   gFormat.adoptInstead(NULL);
 }