ICU-13001 warning cleanup

- 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
This commit is contained in:
Steven R. Loomis 2017-09-21 19:43:28 +00:00
parent f8beac7267
commit 89765009b4
5 changed files with 23 additions and 6 deletions

View 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

View file

@ -66,10 +66,8 @@
#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;

View file

@ -63,8 +63,10 @@
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;
/**

View 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);

View 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){