From 19d7d00bd8685d8d395c9c900b94ac696d2814a6 Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Tue, 20 Sep 2016 04:30:06 +0000 Subject: [PATCH] ICU-12701 IBM i fixes (merge to trunk) X-SVN-Rev: 39289 --- icu4c/as_is/os400/unpax-icu.sh | 2 +- icu4c/readme.html | 3 ++- icu4c/source/i18n/decimalformatpattern.h | 4 +-- icu4c/source/i18n/decimfmt.cpp | 4 +-- icu4c/source/i18n/decimfmtimpl.cpp | 4 +-- icu4c/source/test/intltest/apicoll.cpp | 22 ++++++++--------- icu4c/source/test/intltest/callimts.h | 2 +- icu4c/source/test/intltest/collationtest.cpp | 2 +- icu4c/source/test/intltest/dcfmapts.cpp | 6 ++--- icu4c/source/test/intltest/numfmtst.cpp | 26 ++++++++++---------- icu4c/source/test/intltest/rbbitst.cpp | 6 ++--- icu4c/source/test/intltest/tztest.cpp | 4 +-- 12 files changed, 43 insertions(+), 42 deletions(-) diff --git a/icu4c/as_is/os400/unpax-icu.sh b/icu4c/as_is/os400/unpax-icu.sh index 19deb762d29..a6fc31174eb 100755 --- a/icu4c/as_is/os400/unpax-icu.sh +++ b/icu4c/as_is/os400/unpax-icu.sh @@ -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/*' #**************************************************************************** diff --git a/icu4c/readme.html b/icu4c/readme.html index e0bef728ab7..050c2cd1c99 100644 --- a/icu4c/readme.html +++ b/icu4c/readme.html @@ -1303,7 +1303,8 @@ Data set name type : PDS
  • ILE C/C++ Compiler installed on the system
  • The latest IBM tools for Developers for IBM i — - http://www.ibm.com/servers/enable/site/porting/tools/ + https://www-356.ibm.com/partnerworld/wps/servlet/ContentHandler/pw_com_porting_tools_index +
  • diff --git a/icu4c/source/i18n/decimalformatpattern.h b/icu4c/source/i18n/decimalformatpattern.h index c456021958a..c8998f95f8f 100644 --- a/icu4c/source/i18n/decimalformatpattern.h +++ b/icu4c/source/i18n/decimalformatpattern.h @@ -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); diff --git a/icu4c/source/i18n/decimfmt.cpp b/icu4c/source/i18n/decimfmt.cpp index 9945dcd81f6..f03143ade42 100644 --- a/icu4c/source/i18n/decimfmt.cpp +++ b/icu4c/source/i18n/decimfmt.cpp @@ -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); diff --git a/icu4c/source/i18n/decimfmtimpl.cpp b/icu4c/source/i18n/decimfmtimpl.cpp index 621ac93cd79..1bf742d148c 100644 --- a/icu4c/source/i18n/decimfmtimpl.cpp +++ b/icu4c/source/i18n/decimfmtimpl.cpp @@ -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 { diff --git a/icu4c/source/test/intltest/apicoll.cpp b/icu4c/source/test/intltest/apicoll.cpp index ca96e18d784..d64d349b0c8 100644 --- a/icu4c/source/test/intltest/apicoll.cpp +++ b/icu4c/source/test/intltest/apicoll.cpp @@ -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("dollarcompare(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("dollarcompare(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("dollarcompare(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("dollarcompare(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); } diff --git a/icu4c/source/test/intltest/callimts.h b/icu4c/source/test/intltest/callimts.h index b76c3b12ca0..9eb5a31b799 100644 --- a/icu4c/source/test/intltest/callimts.h +++ b/icu4c/source/test/intltest/callimts.h @@ -38,7 +38,7 @@ public: virtual void TestCalendarExtremeLimit(void); void TestLimits(void); - void TestLimitsThread(int threadNumber); + void TestLimitsThread(int32_t threadNumber); private: /* diff --git a/icu4c/source/test/intltest/collationtest.cpp b/icu4c/source/test/intltest/collationtest.cpp index ba69d6ed396..e628c826d9f 100644 --- a/icu4c/source/test/intltest/collationtest.cpp +++ b/icu4c/source/test/intltest/collationtest.cpp @@ -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); diff --git a/icu4c/source/test/intltest/dcfmapts.cpp b/icu4c/source/test/intltest/dcfmapts.cpp index cc274bed1df..7101c66ff63 100644 --- a/icu4c/source/test/intltest/dcfmapts.cpp +++ b/icu4c/source/test/intltest/dcfmapts.cpp @@ -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() { diff --git a/icu4c/source/test/intltest/numfmtst.cpp b/icu4c/source/test/intltest/numfmtst.cpp index 4eb31dc0cc7..c3230991017 100644 --- a/icu4c/source/test/intltest/numfmtst.cpp +++ b/icu4c/source/test/intltest/numfmtst.cpp @@ -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() { diff --git a/icu4c/source/test/intltest/rbbitst.cpp b/icu4c/source/test/intltest/rbbitst.cpp index ea826244031..a7939c543c3 100644 --- a/icu4c/source/test/intltest/rbbitst.cpp +++ b/icu4c/source/test/intltest/rbbitst.cpp @@ -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; } diff --git a/icu4c/source/test/intltest/tztest.cpp b/icu4c/source/test/intltest/tztest.cpp index 73fff330055..00a6707e51b 100644 --- a/icu4c/source/test/intltest/tztest.cpp +++ b/icu4c/source/test/intltest/tztest.cpp @@ -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.