ICU-10624 Swat clang compile warnings. More fixes to come.

X-SVN-Rev: 34854
This commit is contained in:
Andy Heninger 2014-01-10 02:24:54 +00:00
parent cebd0a29d5
commit 1996008111
21 changed files with 63 additions and 57 deletions

View file

@ -1,7 +1,7 @@
/*
******************************************************************************
*
* Copyright (C) 1997-2013, International Business Machines
* Copyright (C) 1997-2014, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
@ -2136,6 +2136,7 @@ u_versionToString(const UVersionInfo versionArray, char *versionString) {
U_CAPI void U_EXPORT2
u_getVersion(UVersionInfo versionArray) {
(void)copyright; // Suppress unused variable warning from clang.
u_versionFromString(versionArray, U_ICU_VERSION);
}

View file

@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (C) 2000-2012, International Business Machines
* Copyright (C) 2000-2014, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* file name: ucnv2022.cpp
@ -748,7 +748,7 @@ getKey_2022(char c,int32_t* key,int32_t* offset){
while (hi != low) /*binary search*/{
register int32_t mid = (hi+low) >> 1; /*Finds median*/
int32_t mid = (hi+low) >> 1; /*Finds median*/
if (mid == oldmid)
break;

View file

@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 1999-2013, International Business Machines
* Copyright (C) 1999-2014, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -78,9 +78,9 @@ utf8_countTrailBytes[256];
* @internal
*/
#define U8_COUNT_TRAIL_BYTES(leadByte) \
((leadByte)<0xf0 ? \
((leadByte)>=0xc0)+((leadByte)>=0xe0) : \
(leadByte)<0xfe ? 3+((leadByte)>=0xf8)+((leadByte)>=0xfc) : 0)
((unsigned char)(leadByte)<0xf0 ? \
((unsigned char)(leadByte)>=0xc0)+((unsigned char)(leadByte)>=0xe0) : \
(unsigned char)(leadByte)<0xfe ? 3+((unsigned char)(leadByte)>=0xf8)+((unsigned char)(leadByte)>=0xfc) : 0)
/**
* Counts the trail bytes for a UTF-8 lead byte of a valid UTF-8 sequence.

View file

@ -1,7 +1,7 @@
/* ------------------------------------------------------------------ */
/* Decimal Number arithmetic module */
/* ------------------------------------------------------------------ */
/* Copyright (c) IBM Corporation, 2000-2012. All rights reserved. */
/* Copyright (c) IBM Corporation, 2000-2014. All rights reserved. */
/* */
/* This software is made available under the terms of the */
/* ICU License -- ICU 1.8.1 and later. */
@ -215,7 +215,9 @@ static const Unit uarrone[1]={1}; /* Unit array of 1, used for incrementing *
/* ------------------------------------------------------------------ */
/* round-for-reround digits */
/* ------------------------------------------------------------------ */
#if 0
static const uByte DECSTICKYTAB[10]={1,1,2,3,4,6,6,7,8,9}; /* used if sticky */
#endif
/* ------------------------------------------------------------------ */
/* Powers of ten (powers[n]==10**n, 0<=n<=9) */

View file

@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (C) 1997-2012, International Business Machines
* Copyright (C) 1997-2014, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*
@ -58,10 +58,6 @@
//static const char I64_MIN_REP[] = "9223372036854775808";
static const uint8_t DIGIT_HAVE_NONE=0;
static const uint8_t DIGIT_HAVE_DOUBLE=1;
static const uint8_t DIGIT_HAVE_INT64=2;
U_NAMESPACE_BEGIN
// -------------------------------------

View file

@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 2007-2013, International Business Machines Corporation and
* Copyright (C) 2007-2014, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*
@ -49,7 +49,6 @@ static const UChar PK_VAR_I[]={LOW_I,0};
static const UChar PK_VAR_F[]={LOW_F,0};
static const UChar PK_VAR_T[]={LOW_T,0};
static const UChar PK_VAR_V[]={LOW_V,0};
static const UChar PK_VAR_J[]={LOW_J,0};
static const UChar PK_WITHIN[]={LOW_W,LOW_I,LOW_T,LOW_H,LOW_I,LOW_N,0};
static const UChar PK_DECIMAL[]={LOW_D,LOW_E,LOW_C,LOW_I,LOW_M,LOW_A,LOW_L,0};
static const UChar PK_INTEGER[]={LOW_I,LOW_N,LOW_T,LOW_E,LOW_G,LOW_E,LOW_R,0};

View file

@ -1,7 +1,7 @@
//
// file: regexcmp.cpp
//
// Copyright (C) 2002-2013 International Business Machines Corporation and others.
// Copyright (C) 2002-2014 International Business Machines Corporation and others.
// All Rights Reserved.
//
// This file contains the ICU regular expression compiler, which is responsible
@ -3937,6 +3937,7 @@ UnicodeSet *RegexCompile::scanProp() {
if (U_FAILURE(*fStatus)) {
return NULL;
}
(void)chLowerP; // Suppress compiler unused variable warning.
U_ASSERT(fC.fChar == chLowerP || fC.fChar == chP);
UBool negated = (fC.fChar == chP);

View file

@ -1,7 +1,7 @@
/*
******************************************************************************
* *
* Copyright (C) 2001-2009, International Business Machines *
* Copyright (C) 2001-2014, International Business Machines *
* Corporation and others. All Rights Reserved. *
* *
******************************************************************************
@ -30,6 +30,7 @@ static cleanupFunc *gCleanupFunctions[UCLN_I18N_COUNT];
static UBool i18n_cleanup(void)
{
ECleanupI18NType libType = UCLN_I18N_START;
(void)copyright; /* Suppress unused variable warning with clang. */
while (++libType<UCLN_I18N_COUNT) {
if (gCleanupFunctions[libType])

View file

@ -1,7 +1,7 @@
/*
******************************************************************************
* *
* Copyright (C) 2001-2013, International Business Machines *
* Copyright (C) 2001-2014, International Business Machines *
* Corporation and others. All Rights Reserved. *
* *
******************************************************************************
@ -36,6 +36,7 @@ static UBool io_cleanup(void)
{
ECleanupIOType libType = UCLN_IO_START;
(void)copyright; // Suppress unused variable warning.
while (++libType<UCLN_IO_COUNT) {
if (gCleanupFunctions[libType])
{

View file

@ -1,6 +1,6 @@
/*
*
* (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved
* (C) Copyright IBM Corp. and others 1998-2014 - All Rights Reserved
*
*/
@ -20,8 +20,8 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(IndicRearrangementProcessor2)
IndicRearrangementProcessor2::IndicRearrangementProcessor2(
const LEReferenceTo<MorphSubtableHeader2> &morphSubtableHeader, LEErrorCode &success)
: StateTableProcessor2(morphSubtableHeader, success), indicRearrangementSubtableHeader(morphSubtableHeader, success),
entryTable(stHeader, success, entryTableOffset, LE_UNBOUNDED_ARRAY)
: StateTableProcessor2(morphSubtableHeader, success), entryTable(stHeader, success, entryTableOffset, LE_UNBOUNDED_ARRAY),
indicRearrangementSubtableHeader(morphSubtableHeader, success)
{
}

View file

@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved
* (C) Copyright IBM Corp. and others 1998-2014 - All Rights Reserved
*/
#include "LETypes.h"
@ -53,6 +53,7 @@ const le_int32 DefaultCharMapper::controlCharsCount = LE_ARRAY_SIZE(controlChars
LEUnicode32 DefaultCharMapper::mapChar(LEUnicode32 ch) const
{
(void)copyright; // Suppress unused variable warning.
if (fFilterControls) {
le_int32 index = OpenTypeUtilities::search((le_uint32)ch, (le_uint32 *)controlChars, controlCharsCount);

View file

@ -1,6 +1,6 @@
/*
*
* (C) Copyright IBM Corp and Others. 1998-2013 - All Rights Reserved
* (C) Copyright IBM Corp and Others. 1998-2014 - All Rights Reserved
*
*/
@ -25,7 +25,7 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LigatureSubstitutionProcessor2)
LigatureSubstitutionProcessor2::LigatureSubstitutionProcessor2(const LEReferenceTo<MorphSubtableHeader2> &morphSubtableHeader, LEErrorCode &success)
: StateTableProcessor2(morphSubtableHeader, success),
ligActionOffset(0),
ligatureSubstitutionHeader(morphSubtableHeader, success), componentOffset(0), ligatureOffset(0), entryTable()
componentOffset(0), ligatureOffset(0), entryTable(), ligatureSubstitutionHeader(morphSubtableHeader, success)
{
if (LE_FAILURE(success)) return;
@ -84,7 +84,7 @@ le_uint16 LigatureSubstitutionProcessor2::processStateEntry(LEGlyphStorage &glyp
}
do {
le_uint32 componentGlyph = componentStack[m--]; // pop off
le_int32 componentGlyph = componentStack[m--]; // pop off
ap.addObject(success);
action = SWAPL(*ap.getAlias());
@ -95,7 +95,7 @@ le_uint16 LigatureSubstitutionProcessor2::processStateEntry(LEGlyphStorage &glyp
offset = action & lafComponentOffsetMask;
if (offset != 0) {
if(componentGlyph > glyphStorage.getGlyphCount()) {
if(componentGlyph > glyphStorage.getGlyphCount() || componentGlyph < 0) {
LE_DEBUG_BAD_FONT("preposterous componentGlyph");
currGlyph+= dir;
return nextStateIndex; // get out! bad font

View file

@ -1,6 +1,6 @@
/*
*
* (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved
* (C) Copyright IBM Corp. and others 1998-2014 - All Rights Reserved
*
*/
@ -21,10 +21,17 @@ StateTableProcessor2::StateTableProcessor2()
}
StateTableProcessor2::StateTableProcessor2(const LEReferenceTo<MorphSubtableHeader2> &morphSubtableHeader, LEErrorCode &success)
: SubtableProcessor2(morphSubtableHeader, success), stateTableHeader(morphSubtableHeader, success),
stHeader(stateTableHeader, success, (const StateTableHeader2*)&stateTableHeader->stHeader),
nClasses(0), classTableOffset(0), stateArrayOffset(0), entryTableOffset(0), classTable(), format(0),
stateArray()
: SubtableProcessor2(morphSubtableHeader, success),
dir(1),
format(0),
nClasses(0),
classTableOffset(0),
stateArrayOffset(0),
entryTableOffset(0),
classTable(),
stateArray(),
stateTableHeader(morphSubtableHeader, success),
stHeader(stateTableHeader, success, (const StateTableHeader2*)&stateTableHeader->stHeader)
{
if (LE_FAILURE(success)) {
return;

View file

@ -1,6 +1,6 @@
/*
*
* (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved
* (C) Copyright IBM Corp. and others 1998-2014 - All Rights Reserved
*
*/
@ -16,7 +16,7 @@ SubtableProcessor2::SubtableProcessor2()
}
SubtableProcessor2::SubtableProcessor2(const LEReferenceTo<MorphSubtableHeader2> &morphSubtableHeader, LEErrorCode &success)
: subtableHeader(morphSubtableHeader, success), length(0), coverage(0), subtableFeatures(0L)
: length(0), coverage(0), subtableFeatures(0L), subtableHeader(morphSubtableHeader, success)
{
if(LE_FAILURE(success)) return;

View file

@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (C) 2002-2013, International Business Machines
* Copyright (C) 2002-2014, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*/
@ -332,6 +332,7 @@ ParagraphLayout::ParagraphLayout(const LEUnicode chars[], le_int32 count,
return;
}
(void)copyright; // Suppress unused variable warning.
(void)fVertical; // Suppress warning for unused field fVertical.
// FIXME: should check the limit arrays for consistency...
@ -359,7 +360,7 @@ ParagraphLayout::ParagraphLayout(const LEUnicode chars[], le_int32 count,
le_int32 styleCount = sizeof styleRunArrays / sizeof styleRunArrays[0];
StyleRuns styleRuns(styleRunArrays, styleCount);
LEErrorCode layoutStatus = LE_NO_ERROR;
fStyleRunCount = styleRuns.getRuns(NULL, NULL);
fStyleRunLimits = LE_NEW_ARRAY(le_int32, fStyleRunCount);
@ -427,7 +428,7 @@ ParagraphLayout::ParagraphLayout(const LEUnicode chars[], le_int32 count,
}
// Make big arrays for the glyph widths, glyph-to-char and char-to-glyph maps,
// in logical order. (Both maps need an extra entry for the end of the text.)
// in logical order. (Both maps need an extra entry for the end of the text.)
//
// For each layout get the positions and convert them into glyph widths, in
// logical order. Get the glyph-to-char mapping, offset by starting index in the
@ -437,7 +438,7 @@ ParagraphLayout::ParagraphLayout(const LEUnicode chars[], le_int32 count,
fGlyphToCharMap = LE_NEW_ARRAY(le_int32, fGlyphCount + 1);
fCharToMinGlyphMap = LE_NEW_ARRAY(le_int32, fCharCount + 1);
fCharToMaxGlyphMap = LE_NEW_ARRAY(le_int32, fCharCount + 1);
if ((fGlyphWidths == NULL) || (fGlyphToCharMap == NULL) ||
if ((fGlyphWidths == NULL) || (fGlyphToCharMap == NULL) ||
(fCharToMinGlyphMap == NULL) || (fCharToMaxGlyphMap == NULL)) {
status = LE_MEMORY_ALLOCATION_ERROR;
return;
@ -452,7 +453,7 @@ ParagraphLayout::ParagraphLayout(const LEUnicode chars[], le_int32 count,
fStyleRunInfo[run].glyphs = LE_NEW_ARRAY(LEGlyphID, glyphCount);
fStyleRunInfo[run].positions = LE_NEW_ARRAY(float, glyphCount * 2 + 2);
if ((fStyleRunInfo[run].glyphs == NULL) ||
if ((fStyleRunInfo[run].glyphs == NULL) ||
(fStyleRunInfo[run].positions == NULL)) {
status = LE_MEMORY_ALLOCATION_ERROR;
return;
@ -610,7 +611,7 @@ ParagraphLayout::~ParagraphLayout()
}
}
le_bool ParagraphLayout::isComplex(const LEUnicode chars[], le_int32 count)
{
UErrorCode scriptStatus = U_ZERO_ERROR;
@ -1090,7 +1091,7 @@ void ParagraphLayout::appendRun(ParagraphLayout::Line *line, le_int32 run, le_in
// previous run, even though this glyph may be in the middle of the
// run.
fVisualRunLastX -= fStyleRunInfo[run].positions[leftGlyph * 2];
// Make rightGlyph be the glyph just to the right of
// the run's glyphs
rightGlyph += 1;
@ -1204,7 +1205,7 @@ le_int32 ParagraphLayout::Line::getWidth() const
le_int32 glyphCount = lastRun->getGlyphCount();
const float *positions = lastRun->getPositions();
return (le_int32) positions[glyphCount * 2];
}

View file

@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
* Copyright (c) 1997-2013, International Business Machines Corporation and
* Copyright (c) 1997-2014, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/*****************************************************************************
@ -3176,8 +3176,6 @@ TestEBCDICSwapLFNL() {
}
#endif
static const UVersionInfo ICU_34 = {3,4,0,0};
static void TestFromUCountPending(){
#if !UCONFIG_NO_LEGACY_CONVERSION
UErrorCode status = U_ZERO_ERROR;

View file

@ -1,7 +1,7 @@
/********************************************************************
* COPYRIGHT:
* Copyright (c) 2001-2013, International Business Machines Corporation and
* Copyright (c) 2001-2014, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/*******************************************************************************
@ -1573,6 +1573,7 @@ static void TestChMove(void) {
/*
const static char impTest[][20] = {
"\\u4e00",
"a",
@ -1581,6 +1582,7 @@ const static char impTest[][20] = {
"B",
"\\u4e01"
};
*/
static void TestImplicitTailoring(void) {

View file

@ -1,5 +1,5 @@
/********************************************************************
* Copyright (c) 1997-2013, International Business Machines
* Copyright (c) 1997-2014, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************/
@ -39,7 +39,7 @@ void TestUScriptCodeAPI(){
"asfdasd", "5464", "12235",
/* test the last index */
"zyyy", "YI",
'\0'
NULL
};
UScriptCode expected[] ={
/* locales should return */
@ -68,7 +68,7 @@ void TestUScriptCodeAPI(){
const int32_t capacity = 10;
for( ; testNames[i]!='\0'; i++){
for( ; testNames[i]!=NULL; i++){
UScriptCode script[10]={USCRIPT_INVALID_CODE};
uscript_getCode(testNames[i],script,capacity, &err);
if( script[0] != expected[i]){
@ -126,7 +126,7 @@ void TestUScriptCodeAPI(){
/* test names */
"Cyrillic","Deseret","Devanagari","Ethiopic","Georgian",
"Gothic", "Greek", "Gujarati",
'\0'
NULL
};
i=0;
while(i<sizeof(testAbbr)/sizeof(UScriptCode)){
@ -165,7 +165,7 @@ void TestUScriptCodeAPI(){
"Knda","Kana","Khmr","Laoo",
"Latn",
"Mlym", "Mong",
'\0'
NULL
};
i=0;
while(i<sizeof(testAbbr)/sizeof(UScriptCode)){

View file

@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
* Copyright (c) 1997-2013, International Business Machines Corporation and
* Copyright (c) 1997-2014, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/*******************************************************************************
@ -104,7 +104,6 @@ parseUCDFile(const char *filename,
/* test data ---------------------------------------------------------------- */
static const UChar LAST_CHAR_CODE_IN_FILE = 0xFFFD;
static const char tagStrings[] = "MnMcMeNdNlNoZsZlZpCcCfCsCoCnLuLlLtLmLoPcPdPsPePoSmScSkSoPiPf";
static const int32_t tagValues[] =
{

View file

@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 2007-2013, International Business Machines
* Copyright (C) 2007-2014, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -383,7 +383,6 @@ enum { kTestOptionsPatLenMax = 32 };
static const UChar skel_Hmm[] = { 0x0048, 0x006D, 0x006D, 0 };
static const UChar skel_HHmm[] = { 0x0048, 0x0048, 0x006D, 0x006D, 0 };
static const UChar skel_hhmm[] = { 0x0068, 0x0068, 0x006D, 0x006D, 0 };
static const UChar patn_Hcmm[] = { 0x0048, 0x003A, 0x006D, 0x006D, 0 }; /* H:mm */
static const UChar patn_hcmm_a[] = { 0x0068, 0x003A, 0x006D, 0x006D, 0x0020, 0x0061, 0 }; /* h:mm a */
static const UChar patn_HHcmm[] = { 0x0048, 0x0048, 0x003A, 0x006D, 0x006D, 0 }; /* HH:mm */
static const UChar patn_hhcmm_a[] = { 0x0068, 0x0068, 0x003A, 0x006D, 0x006D, 0x0020, 0x0061, 0 }; /* hh:mm a */

View file

@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
* Copyright (c) 1996-2010, International Business Machines Corporation and
* Copyright (c) 1996-2014, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
@ -18,8 +18,6 @@
#include "unicode/simpletz.h"
static const double DAY_MS = 24.*60.*60.*1000.;
#define CASE(id,test) case id: name = #test; if (exec) { logln(#test "---"); logln((UnicodeString)""); test(); } break
AstroTest::AstroTest(): astro(NULL), gc(NULL) {