ICU-535 fix MSVC level 4 warnings

X-SVN-Rev: 2259
This commit is contained in:
Alan Liu 2000-08-15 18:25:20 +00:00
parent c12fea0792
commit 8e99af2483
21 changed files with 54 additions and 43 deletions

View File

@ -138,11 +138,11 @@ Normalizer::normalize(const UnicodeString& source,
break;
case COMPOSE:
case COMPOSE_COMPAT:
compose(source, mode & COMPAT_BIT, options, result, status);
compose(source, (mode & COMPAT_BIT) != 0, options, result, status);
break;
case DECOMP:
case DECOMP_COMPAT:
decompose(source, mode & COMPAT_BIT, options, result, status);
decompose(source, (mode & COMPAT_BIT) != 0, options, result, status);
break;
}
}
@ -547,7 +547,7 @@ UChar Normalizer::prevCompose()
// TODO: The performance of this is awful; add a way to compose
// a UnicodeString& in place.
UnicodeString composed;
compose(buffer, (fMode & COMPAT_BIT), fOptions, composed, status);
compose(buffer, (fMode & COMPAT_BIT) != 0, fOptions, composed, status);
buffer.truncate(0);
buffer += composed;

View File

@ -463,7 +463,7 @@ ChoiceFormat::format(int32_t number,
UnicodeString&
ChoiceFormat::format(double number,
UnicodeString& toAppendTo,
FieldPosition& status) const
FieldPosition& /*pos*/) const
{
// find the number
int32_t i;

View File

@ -37,7 +37,7 @@ Formattable::Formattable()
// -------------------------------------
// Creates a formattable object with a Date instance.
Formattable::Formattable(UDate date, ISDATE isDate)
Formattable::Formattable(UDate date, ISDATE /*isDate*/)
: fType(kDate)
{
fValue.fDate = date;

View File

@ -41,7 +41,7 @@ Format::~Format()
// -------------------------------------
// copy constructor
Format::Format(const Format& that)
Format::Format(const Format& /*that*/)
{
}
@ -49,7 +49,7 @@ Format::Format(const Format& that)
// assignment operator
Format&
Format::operator=(const Format& that)
Format::operator=(const Format& /*that*/)
{
return *this;
}
@ -93,7 +93,7 @@ Format::parseObject(const UnicodeString& source,
// -------------------------------------
UBool
Format::operator==(const Format& that) const
Format::operator==(const Format& /*that*/) const
{
// Add this implementation to make linker happy.
return TRUE;

View File

@ -1521,9 +1521,9 @@ GregorianCalendar::roll(EDateFields field, int32_t amount, UErrorCode& status)
* containing the Gregorian cutover point. Do shared computations
* for these fields here. [j81 - aliu] */
UBool inCutoverMonth = FALSE;
int32_t cMonthLen; // 'c' for cutover; in days
int32_t cDayOfMonth; // no discontinuity: [0, cMonthLen)
double cMonthStart; // in ms
int32_t cMonthLen=0; // 'c' for cutover; in days
int32_t cDayOfMonth=0; // no discontinuity: [0, cMonthLen)
double cMonthStart=0.0; // in ms
switch (field) {
case DAY_OF_MONTH:
case WEEK_OF_MONTH:

View File

@ -130,8 +130,8 @@ void HexToUnicodeTransliterator::applyPattern(const UnicodeString& thePattern,
* the index pattern.length() (that is, one past the end), we
* create a virtual ';' if necessary.
*/
UChar c; // These are outside the loop so we can see the
UBool isLiteral; // previous character...
UChar c = 0; // These are outside the loop so we can see the
UBool isLiteral = FALSE; // previous character...
for (int32_t i=0; i<=pattern.length(); ++i) {
// Create the virtual trailing ';' if necessary
if (i == pattern.length()) {

View File

@ -256,7 +256,7 @@ MessageFormat::applyPattern(const UnicodeString& newPattern,
case 0x007D /*'}'*/:
if (braceStack == 0) {
part = 0;
makeFormat(i, formatNumber, segments, success);
makeFormat(/*i,*/ formatNumber, segments, success);
if(U_FAILURE(success))
return;
formatNumber++;
@ -930,7 +930,7 @@ MessageFormat::itos(int32_t i,
// Checks which format instance we are really using based on the segments.
void
MessageFormat::makeFormat(int32_t position,
MessageFormat::makeFormat(/*int32_t position, */
int32_t offsetNumber,
UnicodeString* segments,
UErrorCode& success)

View File

@ -15,7 +15,7 @@ Transliterator* NullTransliterator::clone(void) const {
return new NullTransliterator();
}
void NullTransliterator::handleTransliterate(Replaceable& text, UTransPosition& offsets,
UBool isIncremental) const {
void NullTransliterator::handleTransliterate(Replaceable& /*text*/, UTransPosition& offsets,
UBool /*isIncremental*/) const {
offsets.start = offsets.limit;
}

View File

@ -196,6 +196,11 @@ public:
int32_t start) {
return parser.syntaxError(code, rule, start);
}
private:
// Disallowed methods; no impl.
RuleHalf(const RuleHalf&);
RuleHalf& operator=(const RuleHalf&);
};
const UnicodeString RuleHalf::gOperators = OPERATORS;

View File

@ -187,6 +187,10 @@ private:
UChar c);
friend class RuleHalf;
// Disallowed methods; no impl.
TransliterationRuleParser(const TransliterationRuleParser&);
TransliterationRuleParser& operator=(const TransliterationRuleParser&);
};
#endif

View File

@ -217,7 +217,7 @@ TransliterationRuleSet::findMatch(const Replaceable& text,
/* We only need to check our indexed bin of the rule table,
* based on the low byte of the first key character.
*/
int16_t x = text.charAt(pos.start) & 0xFF;
int16_t x = (int16_t) (text.charAt(pos.start) & 0xFF);
for (int32_t i=index[x]; i<index[x+1]; ++i) {
if (rules[i]->matches(text, pos, data, filter)) {
return rules[i];
@ -264,7 +264,7 @@ TransliterationRuleSet::findIncrementalMatch(const Replaceable& text,
* based on the low byte of the first key character.
*/
isPartial = FALSE;
int16_t x = text.charAt(pos.start) & 0xFF;
int16_t x = (int16_t) (text.charAt(pos.start) & 0xFF);
for (int32_t i=index[x]; i<index[x+1]; ++i) {
int32_t match = rules[i]->getMatchDegree(text, pos, data, filter);
switch (match) {

View File

@ -137,8 +137,8 @@ void TimeZone::loadZoneData() {
* udata callback to verify the zone data.
*/
UBool U_CALLCONV
TimeZone::isDataAcceptable(void *context,
const char *type, const char *name,
TimeZone::isDataAcceptable(void * /*context*/,
const char * /*type*/, const char * /*name*/,
const UDataInfo *pInfo) {
return
pInfo->size >= sizeof(UDataInfo) &&

View File

@ -68,7 +68,7 @@ U_CAPI UCalendar*
ucal_open( const UChar* zoneID,
int32_t len,
const char* locale,
UCalendarType type,
UCalendarType /*type*/,
UErrorCode* status)
{
if(U_FAILURE(*status)) return 0;
@ -80,7 +80,7 @@ ucal_open( const UChar* zoneID,
else {
int32_t length = (len == -1 ? u_strlen(zoneID) : len);
zone = TimeZone::createTimeZone(UnicodeString((UChar*)zoneID));
zone = TimeZone::createTimeZone(UnicodeString(len == -1, zoneID, length));
}
if(zone == 0) {
*status = U_MEMORY_ALLOCATION_ERROR;

View File

@ -286,7 +286,7 @@ udat_getSymbols(const UDateFormat *fmt,
{
if(U_FAILURE(*status)) return -1;
int32_t actLen;
int32_t actLen = 0;
const DateFormatSymbols *syms =
((SimpleDateFormat*)fmt)->getDateFormatSymbols();
@ -359,7 +359,7 @@ udat_countSymbols( const UDateFormat *fmt,
{
const DateFormatSymbols *syms =
((SimpleDateFormat*)fmt)->getDateFormatSymbols();
int32_t count;
int32_t count = 0;
switch(type) {
case UDAT_ERAS:

View File

@ -21,7 +21,7 @@ public:
NullFilter(UBool r) { result = r; }
NullFilter(const NullFilter& f) { result = f.result; }
virtual ~NullFilter() {}
virtual UBool contains(UChar c) const { return result; }
virtual UBool contains(UChar /*c*/) const { return result; }
virtual UnicodeFilter* clone() const { return new NullFilter(*this); }
};

View File

@ -220,7 +220,7 @@ void UnicodeToHexTransliterator::setUppercase(UBool outputUppercase) {
* Implements {@link Transliterator#handleTransliterate}.
*/
void UnicodeToHexTransliterator::handleTransliterate(Replaceable& text, UTransPosition& offsets,
UBool isIncremental) const {
UBool /*isIncremental*/) const {
/**
* Performs transliteration changing all characters to
* Unicode hexadecimal escapes. For example, '@' -> "U+0040",

View File

@ -12,7 +12,7 @@
#include <float.h>
#include <math.h>
void CalendarLimitTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* par )
void CalendarLimitTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ )
{
if (exec) logln("TestSuite TestCalendarLimit");
switch (index) {

View File

@ -25,7 +25,7 @@ const UDate CalendarRegressionTest::LATEST_SUPPORTED_MILLIS = 4503599627370
#define CASE(id,test) case id: name = #test; if (exec) { logln(#test "---"); logln((UnicodeString)""); test(); } break
void
CalendarRegressionTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* par )
CalendarRegressionTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ )
{
// if (exec) logln((UnicodeString)"TestSuite NumberFormatRegressionTest");
switch (index) {
@ -742,7 +742,7 @@ CalendarRegressionTest::test4031502()
GregorianCalendar *cal = (GregorianCalendar*)Calendar::createInstance(status);
cal->set(Calendar::YEAR, 1997);
cal->set(Calendar::DAY_OF_YEAR, 1);
UDate d = cal->getTime(status); // Should be Jan 1
//UDate d = cal->getTime(status); // Should be Jan 1
//logln(d.toString());
if (cal->get(Calendar::DAY_OF_YEAR, status) != 1)
errln("Fail: DAY_OF_YEAR not set");

View File

@ -15,7 +15,7 @@
// class CalendarTest
// *****************************************************************************
void CalendarTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* par )
void CalendarTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ )
{
if (exec) logln("TestSuite TestCalendar");
switch (index) {
@ -437,13 +437,15 @@ CalendarTest::TestGregorianChange768()
GregorianCalendar* c = new GregorianCalendar(status);
if (U_FAILURE(status)) { errln("Couldn't create GregorianCalendar"); return; }
logln(UnicodeString("With cutoff ") + dateToString(c->getGregorianChange(), str));
logln(UnicodeString(" isLeapYear(1800) = ") + ((b = c->isLeapYear(1800)) ? "true" : "false"));
b = c->isLeapYear(1800);
logln(UnicodeString(" isLeapYear(1800) = ") + (b ? "true" : "false"));
logln(UnicodeString(" (should be FALSE)"));
if (b) errln("FAIL");
c->setGregorianChange(date(0, 0, 1), status);
if (U_FAILURE(status)) { errln("GregorianCalendar::setGregorianChange failed"); return; }
logln(UnicodeString("With cutoff ") + dateToString(c->getGregorianChange(), str));
logln(UnicodeString(" isLeapYear(1800) = ") + ((b = c->isLeapYear(1800)) ? "true" : "false"));
b = c->isLeapYear(1800);
logln(UnicodeString(" isLeapYear(1800) = ") + (b ? "true" : "false"));
logln(UnicodeString(" (should be TRUE)"));
if (!b) errln("FAIL");
delete c;
@ -1173,23 +1175,23 @@ CalendarTest::TestDOW_LOCALandYEAR_WOY()
cal->clear();
cal->set(1997, Calendar::DECEMBER, 25);
doYEAR_WOYLoop(cal, sdf, times, status);
//loop_addroll(cal, sdf, times, Calendar::YEAR_WOY, Calendar::YEAR, status);
//loop_addroll(cal, /*sdf,*/ times, Calendar::YEAR_WOY, Calendar::YEAR, status);
yearAddTest(*cal, status); // aliu
loop_addroll(cal, sdf, times, Calendar::DOW_LOCAL, Calendar::DAY_OF_WEEK, status);
loop_addroll(cal, /*sdf,*/ times, Calendar::DOW_LOCAL, Calendar::DAY_OF_WEEK, status);
if (U_FAILURE(status)) { errln("Error in parse/calculate test for 1997"); return; }
cal->clear();
cal->set(1998, Calendar::DECEMBER, 25);
doYEAR_WOYLoop(cal, sdf, times, status);
//loop_addroll(cal, sdf, times, Calendar::YEAR_WOY, Calendar::YEAR, status);
//loop_addroll(cal, /*sdf,*/ times, Calendar::YEAR_WOY, Calendar::YEAR, status);
yearAddTest(*cal, status); // aliu
loop_addroll(cal, sdf, times, Calendar::DOW_LOCAL, Calendar::DAY_OF_WEEK, status);
loop_addroll(cal, /*sdf,*/ times, Calendar::DOW_LOCAL, Calendar::DAY_OF_WEEK, status);
if (U_FAILURE(status)) { errln("Error in parse/calculate test for 1998"); return; }
cal->clear();
cal->set(1582, Calendar::OCTOBER, 1);
doYEAR_WOYLoop(cal, sdf, times, status);
//loop_addroll(cal, sdf, times, Calendar::YEAR_WOY, Calendar::YEAR, status);
//loop_addroll(cal, /*sdf,*/ times, Calendar::YEAR_WOY, Calendar::YEAR, status);
yearAddTest(*cal, status); // aliu
loop_addroll(cal, sdf, times, Calendar::DOW_LOCAL, Calendar::DAY_OF_WEEK, status);
loop_addroll(cal, /*sdf,*/ times, Calendar::DOW_LOCAL, Calendar::DAY_OF_WEEK, status);
if (U_FAILURE(status)) { errln("Error in parse/calculate test for 1582"); return; }
delete sdf;
@ -1271,7 +1273,7 @@ static UnicodeString fieldName(Calendar::EDateFields f) {
}
}
void CalendarTest::loop_addroll(Calendar *cal, SimpleDateFormat *sdf, int times, Calendar::EDateFields field, Calendar::EDateFields field2, UErrorCode& errorCode) {
void CalendarTest::loop_addroll(Calendar *cal, /*SimpleDateFormat *sdf,*/ int times, Calendar::EDateFields field, Calendar::EDateFields field2, UErrorCode& errorCode) {
Calendar *calclone;
SimpleDateFormat fmt(UnicodeString("EEE MMM dd yyyy / YYYY'-W'ww-ee"), errorCode);
fmt.setCalendar(*cal);
@ -1454,7 +1456,7 @@ void CalendarTest::TestWOY(void) {
SimpleDateFormat fmt(UnicodeString("EEE MMM dd yyyy', WOY' w"), status);
CHECK(status, "Fail: Cannot construct calendar/format");
Calendar::EDaysOfWeek fdw;
Calendar::EDaysOfWeek fdw = (Calendar::EDaysOfWeek) 0;
for (int8_t pass=1; pass<=2; ++pass) {
switch (pass) {

View File

@ -161,7 +161,7 @@ public:
virtual void doYEAR_WOYLoop(Calendar *cal,
SimpleDateFormat *sdf, int32_t times, UErrorCode& status);
// test subroutine used by TestDOW_LOCALandYEAR_WOY
virtual void loop_addroll(Calendar *cal, SimpleDateFormat *sdf,
virtual void loop_addroll(Calendar *cal, /*SimpleDateFormat *sdf, */
int times, Calendar::EDateFields field, Calendar::EDateFields field2,
UErrorCode& errorCode);

View File

@ -381,7 +381,7 @@ OffsetIndex* gentz::parseOffsetIndexTable(FileStream* in) {
}
int8_t* nextIndex = (int8_t*)&(zoneNumberArray[alignedCount]);
index->nextEntryDelta = (i==(n-1)) ? 0 : (nextIndex - (int8_t*)index);
index->nextEntryDelta = (uint16_t) ((i==(n-1)) ? 0 : (nextIndex - (int8_t*)index));
index = (OffsetIndex*)nextIndex;
}
offsetIndexSize = (int8_t*)index - (int8_t*)result;