ICU-535 fixed some compiler warnings

X-SVN-Rev: 2157
This commit is contained in:
George Rhoten 2000-08-10 00:28:31 +00:00
parent 91d5a8163e
commit c0f0217993
11 changed files with 535 additions and 560 deletions

View file

@ -32,20 +32,19 @@ void CalendarLimitTest::runIndexedTest( int32_t index, UBool exec, char* &name,
// *****************************************************************************
// class CalendarLimitTest
// *****************************************************************************
// this is 2^52 - 1, the largest allowable mantissa with a 0 exponent in a 64-bit double
const UDate CalendarLimitTest::EARLIEST_SUPPORTED_MILLIS = - 4503599627370495.0;
const UDate CalendarLimitTest::LATEST_SUPPORTED_MILLIS = 4503599627370495.0;
// -------------------------------------
void
CalendarLimitTest::test(UDate millis, Calendar* cal, DateFormat* fmt)
{
UErrorCode exception = U_ZERO_ERROR;
UnicodeString theDate;
UErrorCode status = U_ZERO_ERROR;
UDate d = millis;
cal->setTime(millis, exception);
if (U_SUCCESS(exception)) {
fmt->format(millis, theDate);
@ -152,7 +151,7 @@ CalendarLimitTest::explore3(UDate expectedLateLimit)
int32_t* fields = new int32_t[3];
int32_t oldYear = -1;
int32_t newYear = -1;
while (TRUE) {
for (;;) {
if(! timeToFields(millis, fields))
break;
newYear = fields[0];
@ -166,7 +165,7 @@ CalendarLimitTest::explore3(UDate expectedLateLimit)
oldYear = -1;
newYear = -1;
millis /= 2;
while (TRUE) {
for (;;) {
if(! timeToFields(millis, fields))
break;
newYear = fields[0];

View file

@ -41,25 +41,17 @@ void ConvertTest::runIndexedTest( int32_t index, UBool exec, char* &name, char*
void ConvertTest::TestConvert()
{
char subchar [4] = {(char)0xBE, (char)0xEF};
char myptr[4];
char save[4];
int32_t testLong1;
int16_t rest = 0;
FILE* f = NULL;
FILE* f2 = NULL;
int32_t uniLen = 0;
int32_t len = 0;
int32_t x = 0;
FILE* ucs_file_in = NULL;
UChar BOM = 0x0000;
UChar myUChar = 0x0000;
char myChar = 0x00;
char mytarget[MAX_FILE_LEN];
char* mytarget_1 = mytarget;
char* mytarget_use = mytarget;
UChar* consumedUni = NULL;
char* consumedChar = NULL;
char* consumed = NULL;
char output_cp_buffer [MAX_FILE_LEN];
UChar ucs_file_buffer [MAX_FILE_LEN];
@ -68,9 +60,7 @@ void ConvertTest::TestConvert()
UChar* my_ucs_file_buffer_1 = my_ucs_file_buffer;
int32_t i = 0;
int8_t ii = 0;
uint16_t ij = 0;
int32_t j = 0;
int32_t k = 0;
uint16_t codepage_index = 0;
int32_t cp = 0;
UErrorCode err = U_ZERO_ERROR;
@ -79,8 +69,6 @@ void ConvertTest::TestConvert()
UConverterFromUCallback MIA1, MIA1_2;
UConverterToUCallback MIA2, MIA2_2;
void *MIA1Context, *MIA1Context2, *MIA2Context, *MIA2Context2;
UChar myUnitarget[MAX_FILE_LEN];
UChar *myUnitarget_1 = myUnitarget;
UnicodeConverter* someConverters[5];
/******************************************************************
Checking Unicode -> ksc
@ -98,7 +86,7 @@ void ConvertTest::TestConvert()
};
const int32_t CodePagesAsciiControls[NUM_CODEPAGE] =
/* const int32_t CodePagesAsciiControls[NUM_CODEPAGE] =
{
0xFFFFFFFF
@ -108,7 +96,7 @@ void ConvertTest::TestConvert()
const int32_t CodePagesOtherControls[NUM_CODEPAGE] =
{
0x00000005
};
};*/
const int8_t CodePagesMinChars[NUM_CODEPAGE] =
@ -141,7 +129,7 @@ void ConvertTest::TestConvert()
};
const UConverterToUCallback CodePagesMissingCharAction[NUM_CODEPAGE] =
/* const UConverterToUCallback CodePagesMissingCharAction[NUM_CODEPAGE] =
{
UCNV_TO_U_CALLBACK_SUBSTITUTE
};
@ -149,16 +137,26 @@ void ConvertTest::TestConvert()
const UConverterFromUCallback CodePagesMissingUnicodeAction[NUM_CODEPAGE] =
{
UCNV_FROM_U_CALLBACK_SUBSTITUTE
};
};*/
const Locale CodePagesLocale[NUM_CODEPAGE] =
{
Locale::KOREAN
};
UChar CodePagesFlakySequence[NUM_CODEPAGE][20] =
/* UChar CodePagesFlakySequence[NUM_CODEPAGE][20] =
{
{(UChar)0xAC10,(UChar)0xAC11, (UChar)0xAC12, (UChar)0xAC13 , (UChar)0xAC14, (UChar)0xAC15, (UChar)0xAC16, (UChar)0xAC17, (UChar)0xd7a4 /*Offensive Codepoint*/, (UChar)0xAC14, (UChar)0xAC15}
{(UChar)0xAC10,
(UChar)0xAC11,
(UChar)0xAC12,
(UChar)0xAC13,
(UChar)0xAC14,
(UChar)0xAC15,
(UChar)0xAC16,
(UChar)0xAC17,
(UChar)0xd7a4, /*Offensive Codepoint*/
/* (UChar)0xAC14,
(UChar)0xAC15}
};
char CodePagesFlakyCharSequence[NUM_CODEPAGE][20] =
@ -168,10 +166,10 @@ void ConvertTest::TestConvert()
(char)0xB0, (char)0xAA,
(char)0xB0, (char)0xAB,
(char)0xb0, (char)0xff,/*Offensive Codepoint*/
(char)0xB0, (char)0xAC,
/* (char)0xB0, (char)0xAC,
(char)0xB0, (char)0xAD
}
};
};*/
UConverterFromUCallback fromUAction = NULL;
void* fromUContext = NULL;
UConverterToUCallback toUAction = NULL;
@ -314,7 +312,7 @@ void ConvertTest::TestConvert()
ii=4;
myConverter->getSubstitutionChars(myptr,ii,err);
for(x=0;x<ii;x++) rest = ((unsigned char)rest << 8) + (unsigned char)myptr[x];
for(x=0;x<ii;x++) rest = (int16_t)(((unsigned char)rest << 8) + (unsigned char)myptr[x]);
if (rest==CodePagesSubstitutionChars[codepage_index]) logln("Substitution character ok");
else errln("Substitution character failed.");
@ -462,11 +460,11 @@ void ConvertTest::TestConvert()
{
myUChar = ucs_file_buffer[i-1];
ucs_file_buffer[i-1] = (BOM==0xFEFF)?myUChar:((myUChar >> 8) | (myUChar << 8)); /*adjust if BIG_ENDIAN*/
ucs_file_buffer[i-1] = (UChar)((BOM==0xFEFF)?myUChar:((myUChar >> 8) | (myUChar << 8))); /*adjust if BIG_ENDIAN*/
}
myUChar = ucs_file_buffer[i-1];
ucs_file_buffer[i-1] = (BOM==0xFEFF)?myUChar:((myUChar >> 8) | (myUChar << 8)); /*adjust if BIG_ENDIAN Corner Case*/
ucs_file_buffer[i-1] = (UChar)((BOM==0xFEFF)?myUChar:((myUChar >> 8) | (myUChar << 8))); /*adjust if BIG_ENDIAN Corner Case*/
UnicodeString* uniString = new UnicodeString(ucs_file_buffer,i);
UnicodeString* uniString3 = new UnicodeString(ucs_file_buffer,i);
@ -510,7 +508,7 @@ void ConvertTest::TestConvert()
/*AIX Compiler hacks*/
const UChar* tmp_ucs_buf = ucs_file_buffer_use;
const UChar* tmp_consumedUni = NULL;
//const UChar* tmp_consumedUni = NULL;
myConverter->fromUnicode(mytarget_1,
mytarget + MAX_FILE_LEN,

View file

@ -63,24 +63,24 @@ public:
void addElement(UnicodeString text) { fEnd->fLink = new TextLink(&fBase, text); fEnd = fEnd->fLink; ++fSize; }
void insertElementAt(UnicodeString text, int pos) {
if(pos >= fSize || pos < 0)
;
else if(pos == 0){
if(pos >= fSize || pos < 0)
;
else if(pos == 0){
TextLink* insert = new TextLink(&fBase, text);
insert->fLink=fBase.fLink;
++fSize;
fBase.fLink=insert;
}
else{
insert->fLink=fBase.fLink;
++fSize;
fBase.fLink=insert;
}
else{
TextLink* link = fBase.fLink;
while(--pos > 0)
while(--pos > 0)
link=link->fLink;
TextLink* insert = new TextLink(&fBase, text);
insert->fLink =link->fLink;
insert->fLink =link->fLink;
link->fLink=insert;
++fSize;
++fSize;
}
}
}
UnicodeString elementAt(int32_t pos) {
@ -534,12 +534,12 @@ void IntlTestTextBoundary::addTestCharacterData()
UnicodeString IntlTestTextBoundary::createTestData(Enumeration* e)
{
UnicodeString result = "";
UnicodeString result = "";
while (e->hasMoreElements()) {
result += e->nextElement();
}
return result;
while (e->hasMoreElements()) {
result += e->nextElement();
}
return result;
}
//---------------------------------------------
@ -614,8 +614,8 @@ void IntlTestTextBoundary::TestCharacterIteration()
errln("Failed to create the BreakIterator for default locale in TestCharacterIteration.\n");
return;
}
// generalIteratorTest(*e, testCharacterText, characterSelectionData);
generalIteratorTest(*e, characterSelectionData);
// generalIteratorTest(*e, testCharacterText, characterSelectionData);
generalIteratorTest(*e, characterSelectionData);
delete e;
}
void IntlTestTextBoundary::TestCharacterInvariants()
@ -763,17 +763,17 @@ thaiLineSelection->addElement(CharsToUnicodeString("\\u0e2b\\u0e19\\u0e49\\u0e32
thaiLineSelection->addElement(CharsToUnicodeString("\\u0e17\\u0e35\\u0e48"));
thaiLineSelection->addElement(CharsToUnicodeString("\\u0e19\\u0e31\\u0e49\\u0e19"));
BreakIterator* e = BreakIterator::createLineInstance(
BreakIterator* e = BreakIterator::createLineInstance(
Locale("th"), status);
if (U_FAILURE(status))
{
errln("Failed to create the BreakIterator for default locale in TestThaiLineBreak.\n");
return;
}
generalIteratorTest(*e, thaiLineSelection);
delete e;
delete thaiLineSelection;
delete e;
delete thaiLineSelection;
}
void IntlTestTextBoundary::TestMixedThaiLineBreak()
@ -830,18 +830,18 @@ thaiLineSelection->addElement(CharsToUnicodeString("(\\u0e1b\\u0e23\\u0e30\\u0e4
thaiLineSelection->addElement(CharsToUnicodeString("\\u0e19\\u0e31\\u0e49\\u0e19 "));
thaiLineSelection->addElement(CharsToUnicodeString("(\"\\u0e2e\\u0e32\\u0e23\\u0e4c\\u0e14\\u0e14\\u0e34\\u0e2a\\u0e01\\u0e4c\")."));
BreakIterator* e = BreakIterator::createLineInstance(
BreakIterator* e = BreakIterator::createLineInstance(
Locale("th"), status);
if (U_FAILURE(status))
{
errln("Failed to create the BreakIterator for default locale in TestMixedThaiLineBreak.\n");
return;
}
generalIteratorTest(*e, thaiLineSelection);
delete e;
delete thaiLineSelection;
delete e;
delete thaiLineSelection;
}
@ -860,17 +860,17 @@ void IntlTestTextBoundary::TestMaiyamok()
thaiLineSelection->addElement(CharsToUnicodeString("\\u0e40\\u0e03\\u0e35\\u0e22\\u0e07"));
thaiLineSelection->addElement(CharsToUnicodeString("\\u0e43\\u0e2b\\u0e21\\u0e48"));
BreakIterator* e = BreakIterator::createLineInstance(
BreakIterator* e = BreakIterator::createLineInstance(
Locale("th"), status);
if (U_FAILURE(status))
{
errln("Failed to create the BreakIterator for default locale in TestMaiyamok.\n");
return;
}
generalIteratorTest(*e, thaiLineSelection);
delete e;
delete thaiLineSelection;
delete e;
delete thaiLineSelection;
}
/**
@ -954,7 +954,7 @@ void IntlTestTextBoundary::TestGetAvailableLocales()
if (locCount == 0)
errln("getAvailableLocales() returned an empty list!");
// I have no idea how to test this function...
// Todo: I have no idea how to test this function...
}
//Testing the BreakIterator::getDisplayName() function
@ -1010,7 +1010,6 @@ void IntlTestTextBoundary::TestBug4153072() {
UnicodeString str("...Hello, World!...");
int32_t begin = 3;
int32_t end = str.length() - 3;
UBool gotException = FALSE;
UBool dummy;
StringCharacterIterator* textIterator = new StringCharacterIterator(str, begin, end, begin);
@ -1062,31 +1061,30 @@ void IntlTestTextBoundary::runIndexedTest( int32_t index, UBool exec, char* &nam
{
if (exec) logln("TestSuite TextBoundary: ");
switch (index) {
case 0: name = "TestSentenceIteration"; if(exec) TestSentenceIteration(); break;
case 1: name = "TestWordIteration"; if(exec) TestWordIteration(); break;
case 0: name = "TestSentenceIteration"; if(exec) TestSentenceIteration(); break;
case 1: name = "TestWordIteration"; if(exec) TestWordIteration(); break;
case 2: name = "TestLineIteration"; if(exec) TestLineIteration(); break;
case 3: name = "TestCharacterIteration"; if(exec) TestCharacterIteration(); break;
case 4: name = "TestSentenceInvariants"; if(exec) TestSentenceInvariants();break;
case 5: name = "TestWordInvariants"; if(exec) TestWordInvariants();break;
case 6: name = "TestLineInvariants"; if(exec) TestLineInvariants();break;
case 7: name = "TestCharacterInvariants"; if(exec) TestCharacterInvariants();break;
case 8: name = "TestEmptyString"; if (exec) TestEmptyString(); break;
case 3: name = "TestCharacterIteration"; if(exec) TestCharacterIteration(); break;
case 4: name = "TestSentenceInvariants"; if(exec) TestSentenceInvariants();break;
case 5: name = "TestWordInvariants"; if(exec) TestWordInvariants();break;
case 6: name = "TestLineInvariants"; if(exec) TestLineInvariants();break;
case 7: name = "TestCharacterInvariants"; if(exec) TestCharacterInvariants();break;
case 8: name = "TestEmptyString"; if (exec) TestEmptyString(); break;
case 9: name = "TestGetAvailableLocales"; if (exec) TestGetAvailableLocales(); break;
case 10: name = "TestGetDisplayName"; if (exec) TestGetDisplayName(); break;
case 11: name = "TestPreceding"; if (exec) TestPreceding(); break;
case 12: name = "TestBug4153072"; if (exec) TestBug4153072(); break;
case 13: name = "TestEndBehaviour"; if (exec) TestEndBehaviour(); break;
case 14: name = "TestJapaneseLineBreak"; if (exec) TestJapaneseLineBreak(); break;
case 15: name = "TestThaiLineBreak"; if(exec) TestThaiLineBreak(); break;
case 16: name = "TestMixedThaiLineBreak"; if(exec) TestMixedThaiLineBreak(); break;
case 17: name = "TestMaiyamok"; if(exec) TestMaiyamok(); break;
default: name = ""; break; //needed to end loop
}
}
@ -1099,8 +1097,8 @@ void IntlTestTextBoundary::runIndexedTest( int32_t index, UBool exec, char* &nam
void IntlTestTextBoundary::generalIteratorTest(BreakIterator& bi, Vector* expectedResult)
{
Enumeration *elems = expectedResult->elements();
UnicodeString text = createTestData(elems);
delete elems;
UnicodeString text = createTestData(elems);
delete elems;
bi.setText(&text);
@ -1109,14 +1107,14 @@ void IntlTestTextBoundary::generalIteratorTest(BreakIterator& bi, Vector* expect
logln("comparing forward and backward...");
int errs = getErrors();
UnicodeString str1="forward iteration";
UnicodeString str2="backward iteration";
UnicodeString str1="forward iteration";
UnicodeString str2="backward iteration";
compareFragmentLists(str1, str2, nextResults,
previousResults);
if (getErrors() == errs) {
logln("comparing expected and actual...");
str1="expected result";
str2="actual result";
str1="expected result";
str2="actual result";
compareFragmentLists(str1, str2, expectedResult,
nextResults);
}
@ -1127,10 +1125,10 @@ void IntlTestTextBoundary::generalIteratorTest(BreakIterator& bi, Vector* expect
for (int i = 0; i < expectedResult->size(); i++)
boundaries[i + 2] = boundaries[i + 1] + ((UnicodeString)expectedResult->elementAt(i)).
length();
int len = expectedResult->size() + 3 -1;
boundaries[len] = BreakIterator::DONE;
boundaries[len] = BreakIterator::DONE;
testFollowing(bi, text, boundaries);
testPreceding(bi, text, boundaries);
testIsBoundary(bi, text, boundaries);
@ -1172,7 +1170,7 @@ Vector* IntlTestTextBoundary::testLastAndPrevious(BreakIterator& bi, UnicodeStri
int32_t p = bi.last();
int32_t lastP = p;
Vector *result = new Vector();
UnicodeString selection;
UnicodeString selection;
if (p != text.length())
errln((UnicodeString)"last() returned " + p + (UnicodeString)" instead of " + text.length());
@ -1192,7 +1190,7 @@ Vector* IntlTestTextBoundary::testLastAndPrevious(BreakIterator& bi, UnicodeStri
}
lastP = p;
}
return result;
return result;
}
void IntlTestTextBoundary::compareFragmentLists(UnicodeString& f1Name, UnicodeString& f2Name, Vector* f1, Vector* f2)
@ -1203,7 +1201,7 @@ void IntlTestTextBoundary::compareFragmentLists(UnicodeString& f1Name, UnicodeSt
UnicodeString s2;
int32_t t1 = 0;
int32_t t2 = 0;
UnicodeString target;
UnicodeString target;
while (p1 < f1->size() && p2 < f2->size()) {
s1 = (UnicodeString)f1->elementAt(p1);

View file

@ -737,7 +737,6 @@ LocaleTest::TestGetLangsAndCountries()
const char spotCheck1[ ][4] = { "en", "es", "fr", "de", "it",
"ja", "ko", "zh", "th", "he",
"id", "iu", "ug", "yi", "za" };
int32_t spotLen = 15;
int32_t i;

View file

@ -677,7 +677,6 @@ void NumberFormatRegressionTest::Test4087244 (void) {
const DecimalFormatSymbols *sym = df->getDecimalFormatSymbols();
UChar decSep = sym->getDecimalSeparator();
UChar monSep = sym->getMonetaryDecimalSeparator();
UChar zero = sym->getZeroDigit();
if (decSep == monSep) {
errln("ERROR in test: want decimal sep != monetary sep");
return;
@ -2257,7 +2256,7 @@ void NumberFormatRegressionTest::Test4243108(void) {
failure(status, "DecimalFormatSymbols ct");
DecimalFormat fmt(UnicodeString("#.#"), sym, status);
failure(status, "DecimalFormat ct");
UnicodeString str;
FieldPosition pos;
@ -2289,5 +2288,5 @@ void NumberFormatRegressionTest::Test4243108(void) {
} else {
errln(UnicodeString("FAIL 0.0 x #.# = ") + str +
", want " + exp);
}
}
}

View file

@ -36,7 +36,7 @@ void test_ParsePosition( void )
}
delete pp1;
{
UTextOffset to = 5;
ParsePosition pp2( to );
@ -157,8 +157,6 @@ void test_FieldPosition( void )
void test_Formattable( void )
{
UErrorCode status = U_ZERO_ERROR;
Formattable* ftp = new Formattable();
if (!ftp || !(ftp->getType() == Formattable::kLong) || !(ftp->getLong() == 0)) {
it_errln("*** Formattable constructor or getType or getLong");

File diff suppressed because it is too large Load diff

View file

@ -511,11 +511,11 @@ void TransliteratorTest::TestJ277(void) {
UChar sigma = 0x3C3;
UChar upsilon = 0x3C5;
UChar nu = 0x3BD;
UChar PHI = 0x3A6;
// UChar PHI = 0x3A6;
UChar alpha = 0x3B1;
UChar omega = 0x3C9;
UChar omicron = 0x3BF;
UChar epsilon = 0x3B5;
// UChar omega = 0x3C9;
// UChar omicron = 0x3BF;
// UChar epsilon = 0x3B5;
// sigma upsilon nu -> syn
UnicodeString syn;
@ -940,4 +940,4 @@ void TransliteratorTest::expectAux(const UnicodeString& tag,
}
}
static UChar toHexString(int32_t i) { return i + (i < 10 ? ZERO : (UPPER_A - 10)); }
static UChar toHexString(int32_t i) { return (UChar)(i + (i < 10 ? ZERO : (UPPER_A - 10))); }

View file

@ -477,7 +477,6 @@ void BasicNormalizerTest::assertEqual(const UnicodeString& input,
Normalizer* iter,
const UnicodeString& errPrefix)
{
int index = 0;
UnicodeString result;
for (UChar32 ch = iter->first(); ch != iter->DONE; ch = iter->next()) {

View file

@ -147,7 +147,6 @@ TimeZoneTest::TestGenericAPI()
logln(UnicodeString("Value returned from t_timezone = ") + tzoffset);
// Invert sign because UNIX semantics are backwards
if (tzoffset < 0) tzoffset = -tzoffset;
UErrorCode status = U_ZERO_ERROR;
// --- The following test would fail outside PST now that
// --- PST is generally set to be default timezone in format tests
//if ((*saveDefault == *pstZone) && (tzoffset != 28800)) {

View file

@ -39,7 +39,7 @@ UnicodeSetTest::runIndexedTest(int32_t index, UBool exec,
CASE(4,TestMinimalRep);
CASE(5,TestAPI);
CASE(6,TestExhaustive);
default: name = ""; break;
default: name = ""; break;
}
}
@ -75,7 +75,6 @@ UnicodeSetTest::TestCategories(void) {
int32_t failures = 0;
// Make sure generation of L doesn't pollute cached Lu set
// First generate L, then Lu
UChar32 TOP = 0x200; // Don't need to go over the whole range:
set.applyPattern("[:L:]", status);
if (U_FAILURE(status)) { errln("FAIL"); return; }
for (i=0; i<0x200; ++i) {
@ -158,7 +157,6 @@ UnicodeSetTest::TestCloneEqualHash(void) {
}
void
UnicodeSetTest::TestAddRemove(void) {
UErrorCode status = U_ZERO_ERROR;
UnicodeSet set; // Construct empty set
doAssert(set.isEmpty() == TRUE, "set should be empty");
doAssert(set.size() == 0, "size should be 0");
@ -640,7 +638,7 @@ UnicodeSetTest::expectPairs(const UnicodeSet& set, const UnicodeString& expected
}
}
static UChar toHexString(int32_t i) { return i + (i < 10 ? 0x30 : (0x41 - 10)); }
static UChar toHexString(int32_t i) { return (UChar)(i + (i < 10 ? 0x30 : (0x41 - 10))); }
void
UnicodeSetTest::doAssert(UBool condition, const char *message)