ICU-12701 IBM i fixes (merge to trunk)

X-SVN-Rev: 39289
This commit is contained in:
Steven R. Loomis 2016-09-20 04:30:06 +00:00
parent 7960164327
commit 19d7d00bd8
12 changed files with 43 additions and 42 deletions

View file

@ -32,7 +32,7 @@ export QSH
#binary_suffixes='ico ICO bmp BMP jpg JPG gif GIF brk BRK'
#ICU specific binary files
#****************************************************************************
binary_suffixes='brk BRK bin BIN res RES cnv CNV dat DAT icu ICU spp SPP xml XML nrm NRM'
binary_suffixes='brk BRK bin BIN res RES cnv CNV dat DAT icu ICU spp SPP xml XML nrm NRM utf16be UTF16BE'
data_files='icu/source/data/brkitr/* icu/source/data/locales/* icu/source/data/coll/* icu/source/data/rbnf/* icu/source/data/mappings/* icu/source/data/misc/* icu/source/data/translit/* icu/source/data/unidata/* icu/source/test/testdata/*'
#****************************************************************************

View file

@ -1303,7 +1303,8 @@ Data set name type : PDS</samp>
<li>ILE C/C++ Compiler installed on the system</li>
<li>The latest IBM tools for Developers for IBM i &mdash;
<a href='http://www.ibm.com/servers/enable/site/porting/tools/'>http://www.ibm.com/servers/enable/site/porting/tools/</a>
<a href='https://www-356.ibm.com/partnerworld/wps/servlet/ContentHandler/pw_com_porting_tools_index'>https://www-356.ibm.com/partnerworld/wps/servlet/ContentHandler/pw_com_porting_tools_index</a>
<!-- formerly http://www.ibm.com/servers/enable/site/porting/tools/'>http://www.ibm.com/servers/enable/site/porting/tools/</a> -->
<!-- formerly: http://www.ibm.com/servers/enable/site/porting/iseries/overview/gnu_utilities.html -->
</li>
</ul>

View file

@ -30,7 +30,7 @@ enum CurrencySignCount {
class DecimalFormatSymbols;
struct DecimalFormatPattern : UMemory {
struct DecimalFormatPattern : public UMemory {
enum EPadPosition {
kPadBeforePrefix,
kPadAfterPrefix,
@ -73,7 +73,7 @@ struct DecimalFormatPattern : UMemory {
EPadPosition fPadPosition;
};
class DecimalFormatPatternParser : UMemory {
class DecimalFormatPatternParser : public UMemory {
public:
DecimalFormatPatternParser();
void useSymbols(const DecimalFormatSymbols& symbols);

View file

@ -1657,7 +1657,7 @@ UBool DecimalFormat::subparse(const UnicodeString& text,
// if we didn't see a decimal and it is required, check to see if the pattern had one
if(!sawDecimal && isDecimalPatternMatchRequired())
{
if(formatPattern.indexOf(DecimalFormatSymbols::kDecimalSeparatorSymbol) != 0)
if(formatPattern.indexOf(kPatternDecimalSeparator) != -1)
{
parsePosition.setIndex(oldStart);
parsePosition.setErrorIndex(position);
@ -1783,7 +1783,7 @@ printf("PP -> %d, SLOW = [%s]! pp=%d, os=%d, err=%s\n", position, parsedNum.d
// check if we missed a required decimal point
if(fastParseOk && isDecimalPatternMatchRequired())
{
if(formatPattern.indexOf(DecimalFormatSymbols::kDecimalSeparatorSymbol) != 0)
if(formatPattern.indexOf(kPatternDecimalSeparator) != -1)
{
parsePosition.setIndex(oldStart);
parsePosition.setErrorIndex(position);

View file

@ -708,7 +708,7 @@ DecimalFormatImpl::getMultiplier() const {
void
DecimalFormatImpl::setMultiplier(int32_t m) {
if (m == 0 || m == 1) {
fMultiplier.set(0);
fMultiplier.set((int32_t)0);
} else {
fMultiplier.set(m);
}
@ -1483,7 +1483,7 @@ DecimalFormatImpl::toNumberPattern(
}
} else {
if (i < roundingIncrementUpperExp && i >= roundingIncrementLowerExp) {
result.append(fEffPrecision.fMantissa.fRoundingIncrement.getDigitByExponent(i) + kPatternZeroDigit);
result.append((UChar)(fEffPrecision.fMantissa.fRoundingIncrement.getDigitByExponent(i) + kPatternZeroDigit));
} else if (minInterval.contains(i)) {
result.append(kPatternZeroDigit);
} else {

View file

@ -1556,9 +1556,9 @@ void CollationAPITest::TestVariableTopSetting() {
(int64_t)newVarTop2, (int64_t)newVarTop);
coll->setAttribute(UCOL_ALTERNATE_HANDLING, UCOL_SHIFTED, status);
assertEquals("empty==dollar", UCOL_EQUAL, coll->compare(UnicodeString(), dollar));
assertEquals("empty==euro", UCOL_EQUAL, coll->compare(UnicodeString(), euro));
assertEquals("dollar<zero", UCOL_LESS, coll->compare(dollar, UnicodeString((UChar)0x30)));
assertEquals("empty==dollar", (int32_t)UCOL_EQUAL, (int32_t)coll->compare(UnicodeString(), dollar));
assertEquals("empty==euro", (int32_t)UCOL_EQUAL, (int32_t)coll->compare(UnicodeString(), euro));
assertEquals("dollar<zero", (int32_t)UCOL_LESS, (int32_t)coll->compare(dollar, UnicodeString((UChar)0x30)));
coll->setVariableTop(oldVarTop, status);
@ -1593,9 +1593,9 @@ void CollationAPITest::TestMaxVariable() {
}
coll->setAttribute(UCOL_ALTERNATE_HANDLING, UCOL_SHIFTED, errorCode);
assertEquals("empty==dollar", UCOL_EQUAL, coll->compare(UnicodeString(), UnicodeString((UChar)0x24)));
assertEquals("empty==euro", UCOL_EQUAL, coll->compare(UnicodeString(), UnicodeString((UChar)0x20AC)));
assertEquals("dollar<zero", UCOL_LESS, coll->compare(UnicodeString((UChar)0x24), UnicodeString((UChar)0x30)));
assertEquals("empty==dollar", (int32_t)UCOL_EQUAL, (int32_t)coll->compare(UnicodeString(), UnicodeString((UChar)0x24)));
assertEquals("empty==euro", (int32_t)UCOL_EQUAL, (int32_t)coll->compare(UnicodeString(), UnicodeString((UChar)0x20AC)));
assertEquals("dollar<zero", (int32_t)UCOL_LESS, (int32_t)coll->compare(UnicodeString((UChar)0x24), UnicodeString((UChar)0x30)));
}
void CollationAPITest::TestGetLocale() {
@ -2354,7 +2354,7 @@ void CollationAPITest::TestCloneBinary() {
rbc->setAttribute(UCOL_STRENGTH, UCOL_PRIMARY, errorCode);
UnicodeString uUmlaut((UChar)0xfc);
UnicodeString ue = UNICODE_STRING_SIMPLE("ue");
assertEquals("rbc/primary: u-umlaut==ue", UCOL_EQUAL, rbc->compare(uUmlaut, ue, errorCode));
assertEquals("rbc/primary: u-umlaut==ue", (int32_t)UCOL_EQUAL, rbc->compare(uUmlaut, ue, errorCode));
uint8_t bin[25000];
int32_t binLength = rbc->cloneBinary(bin, UPRV_LENGTHOF(bin), errorCode);
if(errorCode.logDataIfFailureAndReset("rbc->cloneBinary()")) {
@ -2366,8 +2366,8 @@ void CollationAPITest::TestCloneBinary() {
if(errorCode.logDataIfFailureAndReset("RuleBasedCollator(rbc binary)")) {
return;
}
assertEquals("rbc2.strength==primary", UCOL_PRIMARY, rbc2.getAttribute(UCOL_STRENGTH, errorCode));
assertEquals("rbc2: u-umlaut==ue", UCOL_EQUAL, rbc2.compare(uUmlaut, ue, errorCode));
assertEquals("rbc2.strength==primary", (int32_t)UCOL_PRIMARY, rbc2.getAttribute(UCOL_STRENGTH, errorCode));
assertEquals("rbc2: u-umlaut==ue", (int32_t)UCOL_EQUAL, rbc2.compare(uUmlaut, ue, errorCode));
assertTrue("rbc==rbc2", *rbc == rbc2);
uint8_t bin2[25000];
int32_t bin2Length = rbc2.cloneBinary(bin2, UPRV_LENGTHOF(bin2), errorCode);
@ -2378,8 +2378,8 @@ void CollationAPITest::TestCloneBinary() {
if(errorCode.logDataIfFailureAndReset("RuleBasedCollator(rbc binary, length<0)")) {
return;
}
assertEquals("rbc3.strength==primary", UCOL_PRIMARY, rbc3.getAttribute(UCOL_STRENGTH, errorCode));
assertEquals("rbc3: u-umlaut==ue", UCOL_EQUAL, rbc3.compare(uUmlaut, ue, errorCode));
assertEquals("rbc3.strength==primary", (int32_t)UCOL_PRIMARY, rbc3.getAttribute(UCOL_STRENGTH, errorCode));
assertEquals("rbc3: u-umlaut==ue", (int32_t)UCOL_EQUAL, rbc3.compare(uUmlaut, ue, errorCode));
assertTrue("rbc==rbc3", *rbc == rbc3);
}

View file

@ -38,7 +38,7 @@ public:
virtual void TestCalendarExtremeLimit(void);
void TestLimits(void);
void TestLimitsThread(int threadNumber);
void TestLimitsThread(int32_t threadNumber);
private:
/*

View file

@ -1117,7 +1117,7 @@ void CollationTest::parseAndSetAttribute(IcuTestErrorCode &errorCode) {
// Parse attributes even if the Collator could not be created,
// in order to report syntax errors.
int32_t start = skipSpaces(1);
int32_t equalPos = fileLine.indexOf(0x3d);
int32_t equalPos = fileLine.indexOf((UChar)0x3d);
if(equalPos < 0) {
if(fileLine.compare(start, 7, UNICODE_STRING("reorder", 7)) == 0) {
parseAndSetReorderCodes(start + 7, errorCode);

View file

@ -931,14 +931,14 @@ void IntlTestDecimalFormatAPI::TestBadFastpath() {
UnicodeString fmt;
fmt.remove();
assertEquals("Format 1234", "1234", df->format(1234, fmt));
assertEquals("Format 1234", "1234", df->format((int32_t)1234, fmt));
df->setGroupingUsed(FALSE);
fmt.remove();
assertEquals("Format 1234", "1234", df->format(1234, fmt));
assertEquals("Format 1234", "1234", df->format((int32_t)1234, fmt));
df->setGroupingUsed(TRUE);
df->setGroupingSize(3);
fmt.remove();
assertEquals("Format 1234 w/ grouping", "1,234", df->format(1234, fmt));
assertEquals("Format 1234 w/ grouping", "1,234", df->format((int32_t)1234, fmt));
}
void IntlTestDecimalFormatAPI::TestRequiredDecimalPoint() {

View file

@ -8057,19 +8057,19 @@ void NumberFormatTest::TestAccountingCurrency() {
UNumberFormatStyle style = UNUM_CURRENCY_ACCOUNTING;
expect(NumberFormat::createInstance("en_US", style, status),
(Formattable)1234.5, "$1,234.50", TRUE, status);
(Formattable)(double)1234.5, "$1,234.50", TRUE, status);
expect(NumberFormat::createInstance("en_US", style, status),
(Formattable)-1234.5, "($1,234.50)", TRUE, status);
(Formattable)(double)-1234.5, "($1,234.50)", TRUE, status);
expect(NumberFormat::createInstance("en_US", style, status),
(Formattable)0, "$0.00", TRUE, status);
(Formattable)(double)0, "$0.00", TRUE, status);
expect(NumberFormat::createInstance("en_US", style, status),
(Formattable)-0.2, "($0.20)", TRUE, status);
(Formattable)(double)-0.2, "($0.20)", TRUE, status);
expect(NumberFormat::createInstance("ja_JP", style, status),
(Formattable)10000, UnicodeString("\\uFFE510,000").unescape(), TRUE, status);
(Formattable)(double)10000, UnicodeString("\\uFFE510,000").unescape(), TRUE, status);
expect(NumberFormat::createInstance("ja_JP", style, status),
(Formattable)-1000.5, UnicodeString("(\\uFFE51,000)").unescape(), FALSE, status);
(Formattable)(double)-1000.5, UnicodeString("(\\uFFE51,000)").unescape(), FALSE, status);
expect(NumberFormat::createInstance("de_DE", style, status),
(Formattable)-23456.7, UnicodeString("-23.456,70\\u00A0\\u20AC").unescape(), TRUE, status);
(Formattable)(double)-23456.7, UnicodeString("-23.456,70\\u00A0\\u20AC").unescape(), TRUE, status);
}
// for #5186
@ -8124,7 +8124,7 @@ void NumberFormatTest::TestCurrencyUsage() {
// test the getter here
UCurrencyUsage curUsage = fmt->getCurrencyUsage();
assertEquals("Test usage getter - standard", curUsage, UCURR_USAGE_STANDARD);
assertEquals("Test usage getter - standard", (int32_t)curUsage, (int32_t)UCURR_USAGE_STANDARD);
fmt->setCurrencyUsage(UCURR_USAGE_CASH, &status);
}else{
@ -8136,7 +8136,7 @@ void NumberFormatTest::TestCurrencyUsage() {
// must be usage = cash
UCurrencyUsage curUsage = fmt->getCurrencyUsage();
assertEquals("Test usage getter - cash", curUsage, UCURR_USAGE_CASH);
assertEquals("Test usage getter - cash", (int32_t)curUsage, (int32_t)UCURR_USAGE_CASH);
UnicodeString cash_currency;
fmt->format(agent,cash_currency);
@ -8314,9 +8314,9 @@ void NumberFormatTest::TestFastPathConsistent11524() {
}
fmt->setMaximumIntegerDigits(INT32_MIN);
UnicodeString appendTo;
assertEquals("", "0", fmt->format(123, appendTo));
assertEquals("", "0", fmt->format((int32_t)123, appendTo));
appendTo.remove();
assertEquals("", "0", fmt->format(12345, appendTo));
assertEquals("", "0", fmt->format((int32_t)12345, appendTo));
delete fmt;
}
@ -8489,13 +8489,13 @@ void NumberFormatTest::TestCtorApplyPatternDifference() {
assertEquals(
"ctor favors precision of currency",
"$5.00",
fmt.format(5, result));
fmt.format((double)5, result));
result.remove();
fmt.applyPattern(pattern.unescape(), status);
assertEquals(
"applyPattern favors precision of pattern",
"$5",
fmt.format(5, result));
fmt.format((double)5, result));
}
void NumberFormatTest::Test11868() {

View file

@ -895,7 +895,7 @@ void TestParams::setUTF8(UErrorCode &status) {
}
int32_t TestParams::getSrcLine(int bp) {
int32_t TestParams::getSrcLine(int32_t bp) {
if (bp >= textMap->size()) {
bp = textMap->size() - 1;
}
@ -911,7 +911,7 @@ int32_t TestParams::getSrcLine(int bp) {
}
int32_t TestParams::getExpectedBreak(int bp) {
int32_t TestParams::getExpectedBreak(int32_t bp) {
if (bp >= textMap->size()) {
return 0;
}
@ -924,7 +924,7 @@ int32_t TestParams::getExpectedBreak(int bp) {
}
int32_t TestParams::getSrcCol(int bp) {
int32_t TestParams::getSrcCol(int32_t bp) {
if (bp >= textMap->size()) {
bp = textMap->size() - 1;
}

View file

@ -1954,14 +1954,14 @@ void TimeZoneTest::TestCanonicalIDAPI() {
UnicodeString canonicalID;
UErrorCode ec = U_ZERO_ERROR;
UnicodeString *pResult = &TimeZone::getCanonicalID(bogus, canonicalID, ec);
assertEquals("TimeZone::getCanonicalID(bogus) should fail", U_ILLEGAL_ARGUMENT_ERROR, ec);
assertEquals("TimeZone::getCanonicalID(bogus) should fail", (int32_t)U_ILLEGAL_ARGUMENT_ERROR, ec);
assertTrue("TimeZone::getCanonicalID(bogus) should return the dest string", pResult == &canonicalID);
// U_FAILURE on input.
UnicodeString berlin("Europe/Berlin");
ec = U_MEMORY_ALLOCATION_ERROR;
pResult = &TimeZone::getCanonicalID(berlin, canonicalID, ec);
assertEquals("TimeZone::getCanonicalID(failure) should fail", U_MEMORY_ALLOCATION_ERROR, ec);
assertEquals("TimeZone::getCanonicalID(failure) should fail", (int32_t)U_MEMORY_ALLOCATION_ERROR, ec);
assertTrue("TimeZone::getCanonicalID(failure) should return the dest string", pResult == &canonicalID);
// Valid input should un-bogus the dest string.