]> granicus.if.org Git - icu/commitdiff
ICU-13001 warning cleanup
authorSteven R. Loomis <srl@icu-project.org>
Thu, 21 Sep 2017 19:43:28 +0000 (19:43 +0000)
committerSteven R. Loomis <srl@icu-project.org>
Thu, 21 Sep 2017 19:43:28 +0000 (19:43 +0000)
- remove some dead code
- fix some warnings that show up when services, regex are turned off
- change some macros into inline functions to quell parenthesis complaints (ucnv_u16.cpp)

X-SVN-Rev: 40442

icu4c/source/common/ucnv_u16.cpp
icu4c/source/i18n/calendar.cpp
icu4c/source/i18n/coll.cpp
icu4c/source/i18n/rbnf.cpp
icu4c/source/tools/genrb/wrtxml.cpp

index 91291c003b8e644c78c5a6fb846b7a8a3963b658..28f2727ecdf122df9f967d0bc2b2d683f382374a 100644 (file)
@@ -1323,9 +1323,17 @@ _UTF16GetName(const UConverter *cnv) {
 U_CDECL_END
 extern const UConverterSharedData _UTF16Data;
 
-#define IS_UTF16BE(cnv) ((cnv)->sharedData==&_UTF16BEData)
-#define IS_UTF16LE(cnv) ((cnv)->sharedData==&_UTF16LEData)
-#define IS_UTF16(cnv) ((cnv)->sharedData==&_UTF16Data || (cnv)->sharedData==&_UTF16v2Data)
+static inline bool IS_UTF16BE(const UConverter *cnv) {
+    return ((cnv)->sharedData == &_UTF16BEData);
+}
+
+static inline bool IS_UTF16LE(const UConverter *cnv) {
+    return ((cnv)->sharedData == &_UTF16LEData);
+}
+
+static inline bool IS_UTF16(const UConverter *cnv) {
+    return ((cnv)->sharedData==&_UTF16Data) || ((cnv)->sharedData == &_UTF16v2Data);
+}
 
 U_CDECL_BEGIN
 static void U_CALLCONV
index 10fc1ed2774eaf03aef4b4c3ef35c3931dc73f4a..12966a739a3ad9c6a6a5c81d45b4a6d5b1fde39f 100644 (file)
 #if !UCONFIG_NO_SERVICE
 static icu::ICULocaleService* gService = NULL;
 static icu::UInitOnce gServiceInitOnce = U_INITONCE_INITIALIZER;
-#endif
 
 // INTERNAL - for cleanup
-
 U_CDECL_BEGIN
 static UBool calendar_cleanup(void) {
 #if !UCONFIG_NO_SERVICE
@@ -82,6 +80,7 @@ static UBool calendar_cleanup(void) {
     return TRUE;
 }
 U_CDECL_END
+#endif
 
 // ------------------------------------------
 //
@@ -234,6 +233,8 @@ static ECalType getCalendarType(const char *s) {
     return CALTYPE_UNKNOWN;
 }
 
+#if !UCONFIG_NO_SERVICE
+// Only used with service registration.
 static UBool isStandardSupportedKeyword(const char *keyword, UErrorCode& status) {
     if(U_FAILURE(status)) {
         return FALSE;
@@ -242,6 +243,7 @@ static UBool isStandardSupportedKeyword(const char *keyword, UErrorCode& status)
     return (calType != CALTYPE_UNKNOWN);
 }
 
+// only used with service registration.
 static void getCalendarKeyword(const UnicodeString &id, char *targetBuffer, int32_t targetBufferSize) {
     UnicodeString calendarKeyword = UNICODE_STRING_SIMPLE("calendar=");
     int32_t calKeyLen = calendarKeyword.length();
@@ -255,6 +257,7 @@ static void getCalendarKeyword(const UnicodeString &id, char *targetBuffer, int3
     }
     targetBuffer[keyLen] = 0;
 }
+#endif
 
 static ECalType getCalendarTypeForLocale(const char *locid) {
     UErrorCode status = U_ZERO_ERROR;
index be4b6b886407ab4a161b486024f89b72a3b2b22d..25c8745cbf203b3c590ffea65a67a65394bd653d 100644 (file)
 
 static icu::Locale* availableLocaleList = NULL;
 static int32_t  availableLocaleListCount;
+#if !UCONFIG_NO_SERVICE
 static icu::ICULocaleService* gService = NULL;
 static icu::UInitOnce gServiceInitOnce = U_INITONCE_INITIALIZER;
+#endif
 static icu::UInitOnce gAvailableLocaleListInitOnce;
 
 /**
index 6539217ac2be08c58baaad5f3338fe20a89ffbf2..66f532e79aaab3ed101b2f7bed763d244b7314b6 100644 (file)
@@ -1200,7 +1200,6 @@ RuleBasedNumberFormat::format(double number,
                               UnicodeString& toAppendTo,
                               FieldPosition& /* pos */) const
 {
-    int32_t startPos = toAppendTo.length();
     UErrorCode status = U_ZERO_ERROR;
     if (defaultRuleSet) {
         format(number, *defaultRuleSet, toAppendTo, status);
index 2bfcfebf9efd70884880a0ab7272aa1e34c4a9d5..b4d21b87db3807331571ba1aa4305a155507f21e 100644 (file)
@@ -395,6 +395,7 @@ trim(char **src, int32_t *len){
     *len = i+1;
 }
 
+#if UCONFIG_NO_REGULAR_EXPRESSIONS==0 /* donot compile when no RegularExpressions are available */
 static void
 print(UChar* src, int32_t srcLen,const char *tagStart,const char *tagEnd,  UErrorCode *status){
     int32_t bufCapacity   = srcLen*4;
@@ -420,6 +421,8 @@ print(UChar* src, int32_t srcLen,const char *tagStart,const char *tagEnd,  UErro
 
     }
 }
+#endif
+
 static void
 printNoteElements(const UString *src, UErrorCode *status){
 
@@ -471,6 +474,7 @@ static void printAttribute(const char *name, const char *value, int32_t /*len*/)
     write_utf8_file(out, UnicodeString("\""));
 }
 
+#if UCONFIG_NO_REGULAR_EXPRESSIONS==0 /* donot compile when no RegularExpressions are available */
 static void printAttribute(const char *name, const UnicodeString value, int32_t /*len*/)
 {
     write_utf8_file(out, UnicodeString(" "));
@@ -479,6 +483,7 @@ static void printAttribute(const char *name, const UnicodeString value, int32_t
     write_utf8_file(out, value);
     write_utf8_file(out, UnicodeString("\""));
 }
+#endif
 
 static void
 printComments(struct UString *src, const char *resName, UBool printTranslate, UErrorCode *status){