mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-21 12:40:02 +00:00
ICU-13412 Merging the fix for #13466 ICU4C SimpleDateFormat fractional seconds parsing issue with Chakma locale (r40647) to maint-60.
X-SVN-Rev: 40651
This commit is contained in:
parent
741f37529e
commit
1623af4b25
3 changed files with 24 additions and 6 deletions
|
@ -3202,7 +3202,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
|
|||
|
||||
case UDAT_FRACTIONAL_SECOND_FIELD:
|
||||
// Fractional seconds left-justify
|
||||
i = pos.getIndex() - start;
|
||||
i = countDigits(text, start, pos.getIndex());
|
||||
if (i < 3) {
|
||||
while (i < 3) {
|
||||
value *= 10;
|
||||
|
@ -3728,6 +3728,19 @@ void SimpleDateFormat::parseInt(const UnicodeString& text,
|
|||
}
|
||||
}
|
||||
|
||||
int32_t SimpleDateFormat::countDigits(const UnicodeString& text, int32_t start, int32_t end) const {
|
||||
int32_t numDigits = 0;
|
||||
int32_t idx = start;
|
||||
while (idx < end) {
|
||||
UChar32 cp = text.char32At(idx);
|
||||
if (u_isdigit(cp)) {
|
||||
numDigits++;
|
||||
}
|
||||
idx += U16_LENGTH(cp);
|
||||
}
|
||||
return numDigits;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
void SimpleDateFormat::translatePattern(const UnicodeString& originalPattern,
|
||||
|
|
|
@ -1433,6 +1433,16 @@ private:
|
|||
int32_t checkIntSuffix(const UnicodeString& text, int32_t start,
|
||||
int32_t patLoc, UBool isNegative) const;
|
||||
|
||||
/**
|
||||
* Counts number of digit code points in the specified text.
|
||||
*
|
||||
* @param text input text
|
||||
* @param start start index, inclusive
|
||||
* @param end end index, exclusive
|
||||
* @return number of digits found in the text in the specified range.
|
||||
*/
|
||||
int32_t countDigits(const UnicodeString& text, int32_t start, int32_t end) const;
|
||||
|
||||
/**
|
||||
* Translate a pattern, mapping each character in the from string to the
|
||||
* corresponding character in the to string. Return an error if the original
|
||||
|
|
|
@ -567,11 +567,6 @@ void TimeZoneFormatTest::RunTimeRoundTripTests(int32_t threadNumber) {
|
|||
logln(" Thread %d, Locale %s, Pattern %s",
|
||||
threadNumber, gLocaleData->locales[locidx].getName(), CStr(pattern)());
|
||||
|
||||
if (uprv_strcmp(gLocaleData->locales[locidx].getLanguage(), "ccp") == 0
|
||||
&& logKnownIssue("13446", "Chakma time zone parsing")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
SimpleDateFormat *sdf = new SimpleDateFormat(pattern, gLocaleData->locales[locidx], status);
|
||||
if (U_FAILURE(status)) {
|
||||
errcheckln(status, (UnicodeString) "new SimpleDateFormat failed for pattern " +
|
||||
|
|
Loading…
Add table
Reference in a new issue