ICU-13366 Changes per Shane codereview comments

X-SVN-Rev: 40572
This commit is contained in:
Peter Edberg 2017-10-05 20:36:07 +00:00
parent 38ae69d64a
commit 0b5b91a70b
6 changed files with 9 additions and 15 deletions

View File

@ -71,6 +71,7 @@
#include "uvector.h"
#include "cstr.h"
#include "dayperiodrules.h"
#include "tznames_impl.h" // ZONE_NAME_U16_MAX
#if defined( U_DEBUG_CALSVC ) || defined (U_DEBUG_CAL)
#include <stdio.h>
@ -80,9 +81,6 @@
// class SimpleDateFormat
// *****************************************************************************
// Some zone display names involving supplementary characters can be over 50 chars, 100 UTF-16 code units, 200 UTF-8 bytes
#define ZONE_NAME_U16_MAX 128
U_NAMESPACE_BEGIN
/**

View File

@ -33,9 +33,6 @@
#include "tznames_impl.h" // TextTrieMap
#include "patternprops.h"
// Some zone display names involving supplementary characters can be over 50 chars, 100 UTF-16 code units, 200 UTF-8 bytes
#define ZONE_NAME_U16_MAX 128
U_NAMESPACE_BEGIN
// Bit flags used by the parse method.

View File

@ -37,8 +37,6 @@
U_NAMESPACE_BEGIN
#define ZID_KEY_MAX 128
// Some zone display names involving supplementary characters can be over 50 chars, 100 UTF-16 code units, 200 UTF-8 bytes
#define ZONE_NAME_U16_MAX 128
static const char gZoneStrings[] = "zoneStrings";

View File

@ -18,6 +18,7 @@
#include "unicode/strenum.h"
#include "unicode/ustring.h"
#include "unicode/timezone.h"
#include "unicode/utf16.h"
#include "tznames_impl.h"
#include "cmemory.h"
@ -415,10 +416,8 @@ TextTrieMap::search(CharacterNode *node, const UnicodeString &text, int32_t star
// for folding we need to get a complete code point.
// size of character may grow after fold operation;
// then we need to get result as UTF16 code units.
UChar32 c32 = text.char32At(index++);
if (c32 >= 0x10000) {
index++;
}
UChar32 c32 = text.char32At(index);
index += U16_LENGTH(c32);
UnicodeString tmp(c32);
tmp.foldCase();
int32_t tmpidx = 0;

View File

@ -27,6 +27,9 @@
#include "uvector.h"
#include "umutex.h"
// Some zone display names involving supplementary characters can be over 50 chars, 100 UTF-16 code units, 200 UTF-8 bytes
#define ZONE_NAME_U16_MAX 128
U_NAMESPACE_BEGIN
/*

View File

@ -1156,7 +1156,7 @@ public class SimpleDateFormat extends DateFormat {
String digits = null;
if (numberFormat instanceof DecimalFormat) {
DecimalFormatSymbols decsym = ((DecimalFormat) numberFormat).getDecimalFormatSymbols();
String[] strDigits = decsym.getDigitStrings();
String[] strDigits = decsym.getDigitStringsLocal();
// Note: TimeZoneFormat#setGMTOffsetDigits() does not support string array,
// so we need to concatenate digits to make a single string.
StringBuilder digitsBuf = new StringBuilder();
@ -3247,8 +3247,7 @@ public class SimpleDateFormat extends DateFormat {
/* Skip this for Chinese calendar, moved from ChineseDateFormat */
if ( override != null && (override.compareTo("hebr") == 0 || override.indexOf("y=hebr") >= 0) && value < 1000 ) {
value += HEBREW_CAL_CUR_MILLENIUM_START_YEAR;
} else if (count == 2 && text.codePointCount(start, pos.getIndex()) == 2 && cal.haveDefaultCentury()
&& countDigits(text, start, pos.getIndex()) == 2) {
} else if (count == 2 && countDigits(text, start, pos.getIndex()) == 2 && cal.haveDefaultCentury()) {
// Assume for example that the defaultCenturyStart is 6/18/1903.
// This means that two-digit years will be forced into the range
// 6/18/1903 to 6/17/2003. As a result, years 00, 01, and 02