ICU-12611 Fix some issues found through static analysis.
X-SVN-Rev: 38935
This commit is contained in:
parent
edbdac6318
commit
3fe7709485
@ -688,7 +688,6 @@ class CharsetBOCU1 extends CharsetICU {
|
|||||||
int sourceIndex, nextSourceIndex;
|
int sourceIndex, nextSourceIndex;
|
||||||
int prev, c , diff, count;
|
int prev, c , diff, count;
|
||||||
byte[] bytes;
|
byte[] bytes;
|
||||||
int targetCapacity;
|
|
||||||
CoderResult cr;
|
CoderResult cr;
|
||||||
|
|
||||||
/* label values for supporting behavior similar to goto in C */
|
/* label values for supporting behavior similar to goto in C */
|
||||||
|
@ -110,7 +110,6 @@ class CharsetISCII extends CharsetICU {
|
|||||||
|
|
||||||
private final static String ISCII_CNV_PREFIX = "ISCII,version=";
|
private final static String ISCII_CNV_PREFIX = "ISCII,version=";
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
private static final class UConverterDataISCII {
|
private static final class UConverterDataISCII {
|
||||||
int option;
|
int option;
|
||||||
int contextCharToUnicode; /* previous Unicode codepoint for contextual analysis */
|
int contextCharToUnicode; /* previous Unicode codepoint for contextual analysis */
|
||||||
@ -123,12 +122,10 @@ class CharsetISCII extends CharsetICU {
|
|||||||
short defMaskToUnicode; /* mask for default state in toUnicode */
|
short defMaskToUnicode; /* mask for default state in toUnicode */
|
||||||
boolean isFirstBuffer; /* boolean for fromUnicode to see if we need to announce the first script */
|
boolean isFirstBuffer; /* boolean for fromUnicode to see if we need to announce the first script */
|
||||||
boolean resetToDefaultToUnicode; /* boolean for reseting to default delta and mask when a newline is encountered */
|
boolean resetToDefaultToUnicode; /* boolean for reseting to default delta and mask when a newline is encountered */
|
||||||
String name;
|
|
||||||
int prevToUnicodeStatus; /* Hold the previous toUnicodeStatus. This is necessary because we may need to know the last two code points. */
|
int prevToUnicodeStatus; /* Hold the previous toUnicodeStatus. This is necessary because we may need to know the last two code points. */
|
||||||
|
|
||||||
UConverterDataISCII(int option, String name) {
|
UConverterDataISCII(int option) {
|
||||||
this.option = option;
|
this.option = option;
|
||||||
this.name = name;
|
|
||||||
|
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
@ -766,10 +763,7 @@ class CharsetISCII extends CharsetICU {
|
|||||||
//get the version number of the ISCII converter
|
//get the version number of the ISCII converter
|
||||||
int option = Integer.parseInt(icuCanonicalName.substring(14));
|
int option = Integer.parseInt(icuCanonicalName.substring(14));
|
||||||
|
|
||||||
extraInfo = new UConverterDataISCII(
|
extraInfo = new UConverterDataISCII(option);
|
||||||
option,
|
|
||||||
ISCII_CNV_PREFIX + (option & UCNV_OPTIONS_VERSION_MASK) /* name */
|
|
||||||
);
|
|
||||||
|
|
||||||
initializePNJSets();
|
initializePNJSets();
|
||||||
}
|
}
|
||||||
|
@ -237,7 +237,6 @@ class CharsetMBCS extends CharsetICU {
|
|||||||
}
|
}
|
||||||
|
|
||||||
data = new UConverterSharedData(1, null, false, 0);
|
data = new UConverterSharedData(1, null, false, 0);
|
||||||
data.dataReader = reader;
|
|
||||||
data.staticData = staticData;
|
data.staticData = staticData;
|
||||||
data.sharedDataCached = false;
|
data.sharedDataCached = false;
|
||||||
|
|
||||||
|
@ -110,8 +110,7 @@ class CharsetSCSU extends CharsetICU{
|
|||||||
private static final int defineOne=6;
|
private static final int defineOne=6;
|
||||||
// };
|
// };
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
private final static class SCSUData {
|
||||||
private final static class SCSUData{
|
|
||||||
/* dynamic window offsets, intitialize to default values from initialDynamicOffsets */
|
/* dynamic window offsets, intitialize to default values from initialDynamicOffsets */
|
||||||
int toUDynamicOffsets[] = new int[8] ;
|
int toUDynamicOffsets[] = new int[8] ;
|
||||||
int fromUDynamicOffsets[] = new int[8] ;
|
int fromUDynamicOffsets[] = new int[8] ;
|
||||||
@ -121,7 +120,6 @@ class CharsetSCSU extends CharsetICU{
|
|||||||
short toUState;
|
short toUState;
|
||||||
byte toUQuoteWindow, toUDynamicWindow;
|
byte toUQuoteWindow, toUDynamicWindow;
|
||||||
short toUByteOne;
|
short toUByteOne;
|
||||||
short toUPadding[];
|
|
||||||
|
|
||||||
/* state machine state - fromUnicode */
|
/* state machine state - fromUnicode */
|
||||||
boolean fromUIsSingleByteMode;
|
boolean fromUIsSingleByteMode;
|
||||||
|
@ -49,7 +49,7 @@ final class UConverterAlias {
|
|||||||
|
|
||||||
static byte[] gNormalizedStringTable = null;
|
static byte[] gNormalizedStringTable = null;
|
||||||
|
|
||||||
static final String GET_STRING(int idx) {
|
private static final String GET_STRING(int idx) {
|
||||||
return extractString(gStringTable, 2 * idx);
|
return extractString(gStringTable, 2 * idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -701,9 +701,6 @@ final class UConverterAlias {
|
|||||||
|
|
||||||
static int gAvailableConverterCount = 0;
|
static int gAvailableConverterCount = 0;
|
||||||
|
|
||||||
static byte[] gDefaultConverterNameBuffer; // [MAX_CONVERTER_NAME_LENGTH +
|
|
||||||
// 1]; /* +1 for NULL */
|
|
||||||
|
|
||||||
static String gDefaultConverterName = null;
|
static String gDefaultConverterName = null;
|
||||||
|
|
||||||
// static UBool haveAvailableConverterList(UErrorCode *pErrorCode)
|
// static UBool haveAvailableConverterList(UErrorCode *pErrorCode)
|
||||||
@ -762,53 +759,4 @@ final class UConverterAlias {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* default converter name --------------------------------------------------- */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* In order to be really thread-safe, the get function would have to take
|
|
||||||
* a buffer parameter and copy the current string inside a mutex block.
|
|
||||||
* This implementation only tries to be really thread-safe while
|
|
||||||
* setting the name.
|
|
||||||
* It assumes that setting a pointer is atomic.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// U_CFUNC const char * getDefaultName()
|
|
||||||
// static final synchronized String getDefaultName() {
|
|
||||||
// /* local variable to be thread-safe */
|
|
||||||
// String name;
|
|
||||||
//
|
|
||||||
// //agljport:todo umtx_lock(null);
|
|
||||||
// name = gDefaultConverterName;
|
|
||||||
// //agljport:todo umtx_unlock(null);
|
|
||||||
//
|
|
||||||
// if (name == null) {
|
|
||||||
// //UConverter cnv = null;
|
|
||||||
// int length = 0;
|
|
||||||
//
|
|
||||||
// name = CharsetICU.getDefaultCharsetName();
|
|
||||||
//
|
|
||||||
// /* if the name is there, test it out and get the canonical name with options */
|
|
||||||
// if (name != null) {
|
|
||||||
// // cnv = UConverter.open(name);
|
|
||||||
// // name = cnv.getName(cnv);
|
|
||||||
// // TODO: fix me
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (name == null || name.length() == 0 ||/* cnv == null ||*/
|
|
||||||
// length >= gDefaultConverterNameBuffer.length) {
|
|
||||||
// /* Panic time, let's use a fallback. */
|
|
||||||
// name = new String("US-ASCII");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// //length=(int32_t)(strlen(name));
|
|
||||||
//
|
|
||||||
// /* Copy the name before we close the converter. */
|
|
||||||
// name = gDefaultConverterName;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return name;
|
|
||||||
// }
|
|
||||||
|
|
||||||
//end bld.c
|
|
||||||
}
|
}
|
||||||
|
@ -339,7 +339,6 @@ final class UConverterSharedData {
|
|||||||
return sharedData;
|
return sharedData;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
UConverterDataReader dataReader = null;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* returns a converter type from a string
|
* returns a converter type from a string
|
||||||
|
@ -1175,7 +1175,7 @@ public final class StringSearch extends SearchIterator {
|
|||||||
// * the match limit is a normalization boundary
|
// * the match limit is a normalization boundary
|
||||||
boolean allowMidclusterMatch =
|
boolean allowMidclusterMatch =
|
||||||
breakIterator == null &&
|
breakIterator == null &&
|
||||||
nextCEI != null && (((nextCEI.ce_) >>> 32) & 0xFFFF0000L) != 0 &&
|
(((nextCEI.ce_) >>> 32) & 0xFFFF0000L) != 0 &&
|
||||||
maxLimit >= lastCEI.highIndex_ && nextCEI.highIndex_ > maxLimit &&
|
maxLimit >= lastCEI.highIndex_ && nextCEI.highIndex_ > maxLimit &&
|
||||||
(nfd_.hasBoundaryBefore(codePointAt(targetText, maxLimit)) ||
|
(nfd_.hasBoundaryBefore(codePointAt(targetText, maxLimit)) ||
|
||||||
nfd_.hasBoundaryAfter(codePointBefore(targetText, maxLimit)));
|
nfd_.hasBoundaryAfter(codePointBefore(targetText, maxLimit)));
|
||||||
@ -1435,7 +1435,7 @@ public final class StringSearch extends SearchIterator {
|
|||||||
// * the match limit is a normalization boundary
|
// * the match limit is a normalization boundary
|
||||||
boolean allowMidclusterMatch =
|
boolean allowMidclusterMatch =
|
||||||
breakIterator == null &&
|
breakIterator == null &&
|
||||||
nextCEI != null && (((nextCEI.ce_) >>> 32) & 0xFFFF0000L) != 0 &&
|
(((nextCEI.ce_) >>> 32) & 0xFFFF0000L) != 0 &&
|
||||||
maxLimit >= lastCEI.highIndex_ && nextCEI.highIndex_ > maxLimit &&
|
maxLimit >= lastCEI.highIndex_ && nextCEI.highIndex_ > maxLimit &&
|
||||||
(nfd_.hasBoundaryBefore(codePointAt(targetText, maxLimit)) ||
|
(nfd_.hasBoundaryBefore(codePointAt(targetText, maxLimit)) ||
|
||||||
nfd_.hasBoundaryAfter(codePointBefore(targetText, maxLimit)));
|
nfd_.hasBoundaryAfter(codePointBefore(targetText, maxLimit)));
|
||||||
|
@ -895,8 +895,7 @@ public class GlobalizationPreferences implements Freezable<GlobalizationPreferen
|
|||||||
int index = 0;
|
int index = 0;
|
||||||
while (index < result.size()) {
|
while (index < result.size()) {
|
||||||
ULocale uloc = result.get(index);
|
ULocale uloc = result.get(index);
|
||||||
while (true) {
|
while ((uloc = uloc.getFallback()) != null) {
|
||||||
uloc = uloc.getFallback();
|
|
||||||
if (uloc.getLanguage().length() == 0) {
|
if (uloc.getLanguage().length() == 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1417,7 +1417,8 @@ public class ICUResourceBundle extends UResourceBundle {
|
|||||||
UResourceBundle requested) {
|
UResourceBundle requested) {
|
||||||
WholeBundle wholeBundle = base.wholeBundle;
|
WholeBundle wholeBundle = base.wholeBundle;
|
||||||
ClassLoader loaderToUse = wholeBundle.loader;
|
ClassLoader loaderToUse = wholeBundle.loader;
|
||||||
String locale = null, keyPath = null;
|
String locale;
|
||||||
|
String keyPath = null;
|
||||||
String bundleName;
|
String bundleName;
|
||||||
String rpath = wholeBundle.reader.getAlias(_resource);
|
String rpath = wholeBundle.reader.getAlias(_resource);
|
||||||
if (aliasesVisited == null) {
|
if (aliasesVisited == null) {
|
||||||
@ -1473,12 +1474,7 @@ public class ICUResourceBundle extends UResourceBundle {
|
|||||||
}
|
}
|
||||||
sub = ICUResourceBundle.findResourceWithFallback(keyPath, bundle, null);
|
sub = ICUResourceBundle.findResourceWithFallback(keyPath, bundle, null);
|
||||||
}else{
|
}else{
|
||||||
if (locale == null) {
|
bundle = getBundleInstance(bundleName, locale, loaderToUse, false);
|
||||||
// {dlf} must use requestor's class loader to get resources from same jar
|
|
||||||
bundle = getBundleInstance(bundleName, "", loaderToUse, false);
|
|
||||||
} else {
|
|
||||||
bundle = getBundleInstance(bundleName, locale, loaderToUse, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
int numKeys;
|
int numKeys;
|
||||||
if (keyPath != null) {
|
if (keyPath != null) {
|
||||||
|
@ -218,7 +218,7 @@ public final class ICUResourceBundleReader {
|
|||||||
// set pool bundle if necessary
|
// set pool bundle if necessary
|
||||||
if (usesPoolBundle) {
|
if (usesPoolBundle) {
|
||||||
poolBundleReader = getReader(baseName, "pool", loader);
|
poolBundleReader = getReader(baseName, "pool", loader);
|
||||||
if (!poolBundleReader.isPoolBundle) {
|
if (poolBundleReader == null || !poolBundleReader.isPoolBundle) {
|
||||||
throw new IllegalStateException("pool.res is not a pool bundle");
|
throw new IllegalStateException("pool.res is not a pool bundle");
|
||||||
}
|
}
|
||||||
if (poolBundleReader.poolCheckSum != poolCheckSum) {
|
if (poolBundleReader.poolCheckSum != poolCheckSum) {
|
||||||
|
@ -578,7 +578,6 @@ public class ICUService extends ICUNotifier {
|
|||||||
* Return a map from visible ids to factories.
|
* Return a map from visible ids to factories.
|
||||||
*/
|
*/
|
||||||
private Map<String, Factory> getVisibleIDMap() {
|
private Map<String, Factory> getVisibleIDMap() {
|
||||||
Map<String, Factory> idcache = this.idcache;
|
|
||||||
synchronized (this) { // or idcache-only lock?
|
synchronized (this) { // or idcache-only lock?
|
||||||
if (idcache == null) {
|
if (idcache == null) {
|
||||||
try {
|
try {
|
||||||
@ -589,7 +588,7 @@ public class ICUService extends ICUNotifier {
|
|||||||
Factory f = lIter.previous();
|
Factory f = lIter.previous();
|
||||||
f.updateVisibleIDs(mutableMap);
|
f.updateVisibleIDs(mutableMap);
|
||||||
}
|
}
|
||||||
this.idcache = idcache = Collections.unmodifiableMap(mutableMap);
|
this.idcache = Collections.unmodifiableMap(mutableMap);
|
||||||
} finally {
|
} finally {
|
||||||
factoryLock.releaseRead();
|
factoryLock.releaseRead();
|
||||||
}
|
}
|
||||||
|
@ -260,7 +260,9 @@ public class JavaTimeZone extends TimeZone {
|
|||||||
public TimeZone cloneAsThawed() {
|
public TimeZone cloneAsThawed() {
|
||||||
JavaTimeZone tz = (JavaTimeZone)super.cloneAsThawed();
|
JavaTimeZone tz = (JavaTimeZone)super.cloneAsThawed();
|
||||||
tz.javatz = (java.util.TimeZone)javatz.clone();
|
tz.javatz = (java.util.TimeZone)javatz.clone();
|
||||||
tz.javacal = (java.util.GregorianCalendar)javacal.clone();
|
synchronized(javacal) {
|
||||||
|
tz.javacal = (java.util.GregorianCalendar)javacal.clone();
|
||||||
|
}
|
||||||
tz.isFrozen = false;
|
tz.isFrozen = false;
|
||||||
return tz;
|
return tz;
|
||||||
}
|
}
|
||||||
|
@ -570,7 +570,7 @@ public class OlsonTimeZone extends BasicTimeZone {
|
|||||||
if (transitionCount > 0) {
|
if (transitionCount > 0) {
|
||||||
r = res.get("typeMap");
|
r = res.get("typeMap");
|
||||||
typeMapData = r.getBinary(null);
|
typeMapData = r.getBinary(null);
|
||||||
if (typeMapData.length != transitionCount) {
|
if (typeMapData == null || typeMapData.length != transitionCount) {
|
||||||
throw new IllegalArgumentException("Invalid Format");
|
throw new IllegalArgumentException("Invalid Format");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -170,8 +170,8 @@ public class Relation<K, V> implements Freezable<Relation<K,V>> { // TODO: add ,
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void putAll(Map<? extends K, ? extends V> t) {
|
public void putAll(Map<? extends K, ? extends V> t) {
|
||||||
for (K key : t.keySet()) {
|
for (Map.Entry<? extends K, ? extends V> entry : t.entrySet()) {
|
||||||
put(key, t.get(key));
|
put(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,8 +266,8 @@ public class Relation<K, V> implements Freezable<Relation<K,V>> { // TODO: add ,
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Relation<K,V> addAllInverted(Map<V,K> source) {
|
public Relation<K,V> addAllInverted(Map<V,K> source) {
|
||||||
for (V value : source.keySet()) {
|
for (Map.Entry<V,K> entry : source.entrySet()) {
|
||||||
put(source.get(value), value);
|
put(entry.getValue(), entry.getKey());
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,7 @@ public class StringRange {
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
return compareTo((Range)obj) == 0;
|
return this == obj || (obj != null && obj instanceof Range && compareTo((Range)obj) == 0);
|
||||||
}
|
}
|
||||||
public int compareTo(Range that) {
|
public int compareTo(Range that) {
|
||||||
int diff = min - that.min;
|
int diff = min - that.min;
|
||||||
|
@ -106,7 +106,7 @@ public class TimeZoneGenericNames implements Serializable, Freezable<TimeZoneGen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ULocale _locale;
|
private final ULocale _locale;
|
||||||
private TimeZoneNames _tznames;
|
private TimeZoneNames _tznames;
|
||||||
|
|
||||||
private transient volatile boolean _frozen;
|
private transient volatile boolean _frozen;
|
||||||
|
@ -261,7 +261,7 @@ public final class UCharacterName
|
|||||||
}
|
}
|
||||||
|
|
||||||
synchronized (m_utilStringBuffer_) {
|
synchronized (m_utilStringBuffer_) {
|
||||||
m_utilStringBuffer_.delete(0, m_utilStringBuffer_.length());
|
m_utilStringBuffer_.setLength(0);
|
||||||
byte b;
|
byte b;
|
||||||
char token;
|
char token;
|
||||||
for (int i = 0; i < length;) {
|
for (int i = 0; i < length;) {
|
||||||
@ -369,7 +369,7 @@ public final class UCharacterName
|
|||||||
result = TYPE_NAMES_[type];
|
result = TYPE_NAMES_[type];
|
||||||
}
|
}
|
||||||
synchronized (m_utilStringBuffer_) {
|
synchronized (m_utilStringBuffer_) {
|
||||||
m_utilStringBuffer_.delete(0, m_utilStringBuffer_.length());
|
m_utilStringBuffer_.setLength(0);
|
||||||
m_utilStringBuffer_.append('<');
|
m_utilStringBuffer_.append('<');
|
||||||
m_utilStringBuffer_.append(result);
|
m_utilStringBuffer_.append(result);
|
||||||
m_utilStringBuffer_.append('-');
|
m_utilStringBuffer_.append('-');
|
||||||
@ -491,7 +491,7 @@ public final class UCharacterName
|
|||||||
{
|
{
|
||||||
String result = null;
|
String result = null;
|
||||||
synchronized (m_utilStringBuffer_) {
|
synchronized (m_utilStringBuffer_) {
|
||||||
m_utilStringBuffer_.delete(0, m_utilStringBuffer_.length());
|
m_utilStringBuffer_.setLength(0);
|
||||||
m_algorithm_[index].appendName(codepoint, m_utilStringBuffer_);
|
m_algorithm_[index].appendName(codepoint, m_utilStringBuffer_);
|
||||||
result = m_utilStringBuffer_.toString();
|
result = m_utilStringBuffer_.toString();
|
||||||
}
|
}
|
||||||
@ -820,8 +820,7 @@ public final class UCharacterName
|
|||||||
int count = 0;
|
int count = 0;
|
||||||
for (int factor = m_factor_[i]; factor > 0; -- factor) {
|
for (int factor = m_factor_[i]; factor > 0; -- factor) {
|
||||||
synchronized (m_utilStringBuffer_) {
|
synchronized (m_utilStringBuffer_) {
|
||||||
m_utilStringBuffer_.delete(0,
|
m_utilStringBuffer_.setLength(0);
|
||||||
m_utilStringBuffer_.length());
|
|
||||||
count
|
count
|
||||||
= UCharacterUtility.getNullTermByteSubString(
|
= UCharacterUtility.getNullTermByteSubString(
|
||||||
m_utilStringBuffer_,
|
m_utilStringBuffer_,
|
||||||
@ -883,7 +882,7 @@ public final class UCharacterName
|
|||||||
}
|
}
|
||||||
|
|
||||||
synchronized (m_utilStringBuffer_) {
|
synchronized (m_utilStringBuffer_) {
|
||||||
m_utilStringBuffer_.delete(0, m_utilStringBuffer_.length());
|
m_utilStringBuffer_.setLength(0);
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int factor;
|
int factor;
|
||||||
size --;
|
size --;
|
||||||
@ -1190,7 +1189,7 @@ public final class UCharacterName
|
|||||||
) {
|
) {
|
||||||
// index in terms integer index
|
// index in terms integer index
|
||||||
synchronized (m_utilStringBuffer_) {
|
synchronized (m_utilStringBuffer_) {
|
||||||
m_utilStringBuffer_.delete(0, m_utilStringBuffer_.length());
|
m_utilStringBuffer_.setLength(0);
|
||||||
|
|
||||||
for (int index = m_algorithm_.length - 1; index >= 0; index --)
|
for (int index = m_algorithm_.length - 1; index >= 0; index --)
|
||||||
{
|
{
|
||||||
@ -1523,8 +1522,7 @@ public final class UCharacterName
|
|||||||
byte tlength = tokenlength[b];
|
byte tlength = tokenlength[b];
|
||||||
if (tlength == 0) {
|
if (tlength == 0) {
|
||||||
synchronized (m_utilStringBuffer_) {
|
synchronized (m_utilStringBuffer_) {
|
||||||
m_utilStringBuffer_.delete(0,
|
m_utilStringBuffer_.setLength(0);
|
||||||
m_utilStringBuffer_.length());
|
|
||||||
UCharacterUtility.getNullTermByteSubString(
|
UCharacterUtility.getNullTermByteSubString(
|
||||||
m_utilStringBuffer_, m_tokenstring_,
|
m_utilStringBuffer_, m_tokenstring_,
|
||||||
token);
|
token);
|
||||||
|
@ -34,8 +34,7 @@ public final class USerializedSet {
|
|||||||
|
|
||||||
length=src[srcStart++];
|
length=src[srcStart++];
|
||||||
|
|
||||||
|
if ((length&0x8000) != 0) {
|
||||||
if((length&0x8000) >0) {
|
|
||||||
/* there are supplementary values */
|
/* there are supplementary values */
|
||||||
length&=0x7fff;
|
length&=0x7fff;
|
||||||
if(src.length<(srcStart+1+length)) {
|
if(src.length<(srcStart+1+length)) {
|
||||||
|
@ -174,7 +174,8 @@ public class CharSequences {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static int compare(int codepoint, CharSequence a) {
|
public static int compare(int codepoint, CharSequence a) {
|
||||||
return -compare(a, codepoint);
|
int result = compare(a, codepoint);
|
||||||
|
return result > 0 ? -1 : result < 0 ? 1 : 0; // Reverse the order.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -105,28 +105,28 @@ public final class ArabicShaping {
|
|||||||
") for buffer of length " + dest.length);
|
") for buffer of length " + dest.length);
|
||||||
}
|
}
|
||||||
/* Validate input options */
|
/* Validate input options */
|
||||||
if ( ((options&TASHKEEL_MASK) > 0) &&
|
if ( ((options&TASHKEEL_MASK) != 0) &&
|
||||||
!(((options & TASHKEEL_MASK)==TASHKEEL_BEGIN) ||
|
!(((options & TASHKEEL_MASK)==TASHKEEL_BEGIN) ||
|
||||||
((options & TASHKEEL_MASK)==TASHKEEL_END ) ||
|
((options & TASHKEEL_MASK)==TASHKEEL_END) ||
|
||||||
((options & TASHKEEL_MASK)==TASHKEEL_RESIZE )||
|
((options & TASHKEEL_MASK)==TASHKEEL_RESIZE) ||
|
||||||
((options & TASHKEEL_MASK)==TASHKEEL_REPLACE_BY_TATWEEL)) ){
|
((options & TASHKEEL_MASK)==TASHKEEL_REPLACE_BY_TATWEEL))) {
|
||||||
throw new IllegalArgumentException("Wrong Tashkeel argument");
|
throw new IllegalArgumentException("Wrong Tashkeel argument");
|
||||||
}
|
}
|
||||||
|
|
||||||
///CLOVER:OFF
|
///CLOVER:OFF
|
||||||
//According to Steven Loomis, the code is unreachable when you OR all the constants within the if statements
|
//According to Steven Loomis, the code is unreachable when you OR all the constants within the if statements
|
||||||
if(((options&LAMALEF_MASK) > 0)&&
|
if(((options&LAMALEF_MASK) != 0) &&
|
||||||
!(((options & LAMALEF_MASK)==LAMALEF_BEGIN) ||
|
!(((options & LAMALEF_MASK)==LAMALEF_BEGIN) ||
|
||||||
((options & LAMALEF_MASK)==LAMALEF_END ) ||
|
((options & LAMALEF_MASK)==LAMALEF_END) ||
|
||||||
((options & LAMALEF_MASK)==LAMALEF_RESIZE )||
|
((options & LAMALEF_MASK)==LAMALEF_RESIZE) ||
|
||||||
((options & LAMALEF_MASK)==LAMALEF_AUTO) ||
|
((options & LAMALEF_MASK)==LAMALEF_AUTO) ||
|
||||||
((options & LAMALEF_MASK)==LAMALEF_NEAR))){
|
((options & LAMALEF_MASK)==LAMALEF_NEAR))) {
|
||||||
throw new IllegalArgumentException("Wrong Lam Alef argument");
|
throw new IllegalArgumentException("Wrong Lam Alef argument");
|
||||||
}
|
}
|
||||||
///CLOVER:ON
|
///CLOVER:ON
|
||||||
|
|
||||||
/* Validate Tashkeel (Tashkeel replacement options should be enabled in shaping mode only)*/
|
/* Validate Tashkeel (Tashkeel replacement options should be enabled in shaping mode only)*/
|
||||||
if(((options&TASHKEEL_MASK) > 0) && (options&LETTERS_MASK) == LETTERS_UNSHAPE) {
|
if(((options&TASHKEEL_MASK) != 0) && (options&LETTERS_MASK) == LETTERS_UNSHAPE) {
|
||||||
throw new IllegalArgumentException("Tashkeel replacement should not be enabled in deshaping mode ");
|
throw new IllegalArgumentException("Tashkeel replacement should not be enabled in deshaping mode ");
|
||||||
}
|
}
|
||||||
return internalShape(source, sourceStart, sourceLength, dest, destStart, destSize);
|
return internalShape(source, sourceStart, sourceLength, dest, destStart, destSize);
|
||||||
@ -1689,8 +1689,8 @@ public final class ArabicShaping {
|
|||||||
int nw = 0;
|
int nw = 0;
|
||||||
|
|
||||||
while (i >= 0) {
|
while (i >= 0) {
|
||||||
// If high byte of currLink > 0 then there might be more than one shape
|
// If high byte of currLink != 0 then there might be more than one shape
|
||||||
if ((currLink & '\uFF00') > 0 || isTashkeelChar(dest[i])) {
|
if ((currLink & '\uFF00') != 0 || isTashkeelChar(dest[i])) {
|
||||||
nw = i - 1;
|
nw = i - 1;
|
||||||
nx = -2;
|
nx = -2;
|
||||||
while (nx < 0) { // we need to know about next char
|
while (nx < 0) { // we need to know about next char
|
||||||
@ -1871,7 +1871,7 @@ public final class ArabicShaping {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LETTERS_SHAPE:
|
case LETTERS_SHAPE:
|
||||||
if( ((options&TASHKEEL_MASK)> 0) &&
|
if( ((options&TASHKEEL_MASK) != 0) &&
|
||||||
((options&TASHKEEL_MASK) !=TASHKEEL_REPLACE_BY_TATWEEL)) {
|
((options&TASHKEEL_MASK) !=TASHKEEL_REPLACE_BY_TATWEEL)) {
|
||||||
/* Call the shaping function with tashkeel flag == 2 for removal of tashkeel */
|
/* Call the shaping function with tashkeel flag == 2 for removal of tashkeel */
|
||||||
outputSize = shapeUnicode(temp, 0, sourceLength, destSize, 2);
|
outputSize = shapeUnicode(temp, 0, sourceLength, destSize, 2);
|
||||||
|
@ -529,7 +529,6 @@ public class Bidi {
|
|||||||
int contextPos; /* position of last strong char found before opening */
|
int contextPos; /* position of last strong char found before opening */
|
||||||
short flags; /* bits for L or R/AL found within the pair */
|
short flags; /* bits for L or R/AL found within the pair */
|
||||||
byte contextDir; /* L or R according to last strong char before opening */
|
byte contextDir; /* L or R according to last strong char before opening */
|
||||||
byte filler; /* to complete a nice multiple of 4 bytes */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static class IsoRun {
|
static class IsoRun {
|
||||||
|
@ -44,7 +44,6 @@ class CjkBreakEngine extends DictionaryBreakEngine {
|
|||||||
setCharacters(fHangulWordSet);
|
setCharacters(fHangulWordSet);
|
||||||
} else { //Chinese and Japanese
|
} else { //Chinese and Japanese
|
||||||
UnicodeSet cjSet = new UnicodeSet();
|
UnicodeSet cjSet = new UnicodeSet();
|
||||||
cjSet = new UnicodeSet();
|
|
||||||
cjSet.addAll(fHanWordSet);
|
cjSet.addAll(fHanWordSet);
|
||||||
cjSet.addAll(fKatakanaWordSet);
|
cjSet.addAll(fKatakanaWordSet);
|
||||||
cjSet.addAll(fHiraganaWordSet);
|
cjSet.addAll(fHiraganaWordSet);
|
||||||
|
@ -245,10 +245,10 @@ public class DateIntervalInfo implements Cloneable, Freezable<DateIntervalInfo>,
|
|||||||
* @stable ICU 4.0
|
* @stable ICU 4.0
|
||||||
*/
|
*/
|
||||||
public boolean equals(Object a) {
|
public boolean equals(Object a) {
|
||||||
if ( a instanceof PatternInfo ) {
|
if (a instanceof PatternInfo) {
|
||||||
PatternInfo patternInfo = (PatternInfo)a;
|
PatternInfo patternInfo = (PatternInfo)a;
|
||||||
return Utility.objectEquals(fIntervalPatternFirstPart, patternInfo.fIntervalPatternFirstPart) &&
|
return Utility.objectEquals(fIntervalPatternFirstPart, patternInfo.fIntervalPatternFirstPart) &&
|
||||||
Utility.objectEquals(fIntervalPatternSecondPart, fIntervalPatternSecondPart) &&
|
Utility.objectEquals(fIntervalPatternSecondPart, patternInfo.fIntervalPatternSecondPart) &&
|
||||||
fFirstDateInPtnIsLaterDate == patternInfo.fFirstDateInPtnIsLaterDate;
|
fFirstDateInPtnIsLaterDate == patternInfo.fFirstDateInPtnIsLaterDate;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -2068,14 +2068,15 @@ public class DateTimePatternGenerator implements Freezable<DateTimePatternGenera
|
|||||||
MISSING_FIELD = 0x1000;
|
MISSING_FIELD = 0x1000;
|
||||||
|
|
||||||
|
|
||||||
static private String getName(String s) {
|
private static String getName(String s) {
|
||||||
int i = getCanonicalIndex(s, true);
|
int i = getCanonicalIndex(s, true);
|
||||||
String name = FIELD_NAME[types[i][1]];
|
String name = FIELD_NAME[types[i][1]];
|
||||||
int subtype = types[i][2];
|
if (types[i][2] < 0) {
|
||||||
boolean string = subtype < 0;
|
name += ":S"; // string
|
||||||
if (string) subtype = -subtype;
|
}
|
||||||
if (subtype < 0) name += ":S";
|
else {
|
||||||
else name += ":N";
|
name += ":N";
|
||||||
|
}
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2321,10 +2322,8 @@ public class DateTimePatternGenerator implements Freezable<DateTimePatternGenera
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean equals(Object other) {
|
public boolean equals(Object other) {
|
||||||
if (this == other) { return true; }
|
return this == other || (other != null && other instanceof SkeletonFields
|
||||||
if (other == null) { return false; }
|
&& compareTo((SkeletonFields) other) == 0);
|
||||||
SkeletonFields _other = (SkeletonFields) other;
|
|
||||||
return Arrays.equals(chars, _other.chars) && Arrays.equals(lengths, _other.lengths);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
@ -2448,14 +2447,13 @@ public class DateTimePatternGenerator implements Freezable<DateTimePatternGenera
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int compareTo(DateTimeMatcher that) {
|
public int compareTo(DateTimeMatcher that) {
|
||||||
return -original.compareTo(that.original);
|
int result = original.compareTo(that.original);
|
||||||
|
return result > 0 ? -1 : result < 0 ? 1 : 0; // Reverse the order.
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean equals(Object other) {
|
public boolean equals(Object other) {
|
||||||
if (this == other) { return true; }
|
return this == other || (other != null && other instanceof DateTimeMatcher
|
||||||
if (other == null) { return false; }
|
&& original.equals(((DateTimeMatcher) other).original));
|
||||||
DateTimeMatcher _other = (DateTimeMatcher) other;
|
|
||||||
return original.equals(_other.original);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
|
@ -345,6 +345,12 @@ public abstract class LocaleDisplayNames {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null || !(obj instanceof UiListItem)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
UiListItem other = (UiListItem)obj;
|
UiListItem other = (UiListItem)obj;
|
||||||
return nameInDisplayLocale.equals(other.nameInDisplayLocale)
|
return nameInDisplayLocale.equals(other.nameInDisplayLocale)
|
||||||
&& nameInSelf.equals(other.nameInSelf)
|
&& nameInSelf.equals(other.nameInSelf)
|
||||||
|
@ -1111,7 +1111,7 @@ public class MeasureFormat extends UFormat {
|
|||||||
return positive ? ((DecimalFormat)nf).getPositivePrefix() : ((DecimalFormat)nf).getNegativePrefix();
|
return positive ? ((DecimalFormat)nf).getPositivePrefix() : ((DecimalFormat)nf).getNegativePrefix();
|
||||||
}
|
}
|
||||||
public String getSuffix(boolean positive) {
|
public String getSuffix(boolean positive) {
|
||||||
return positive ? ((DecimalFormat)nf).getPositiveSuffix() : ((DecimalFormat)nf).getPositiveSuffix();
|
return positive ? ((DecimalFormat)nf).getPositiveSuffix() : ((DecimalFormat)nf).getNegativeSuffix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1277,7 +1277,7 @@ final class NFRule {
|
|||||||
*/
|
*/
|
||||||
private boolean allIgnorable(String str) {
|
private boolean allIgnorable(String str) {
|
||||||
// if the string is empty, we can just return true
|
// if the string is empty, we can just return true
|
||||||
if (str.length() == 0) {
|
if (str == null || str.length() == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
RbnfLenientScanner scanner = formatter.getLenientScanner();
|
RbnfLenientScanner scanner = formatter.getLenientScanner();
|
||||||
|
@ -506,7 +506,7 @@ final class NFRuleSet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if there's a master rule, use it to format the number
|
// if there's a master rule, use it to format the number
|
||||||
if (nonNumericalRules != null && nonNumericalRules[MASTER_RULE_INDEX] != null) {
|
if (nonNumericalRules[MASTER_RULE_INDEX] != null) {
|
||||||
return nonNumericalRules[MASTER_RULE_INDEX];
|
return nonNumericalRules[MASTER_RULE_INDEX];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -48,8 +48,6 @@ class RBBIRuleScanner {
|
|||||||
|
|
||||||
RBBIRuleChar fC = new RBBIRuleChar(); // Current char for parse state machine
|
RBBIRuleChar fC = new RBBIRuleChar(); // Current char for parse state machine
|
||||||
// processing.
|
// processing.
|
||||||
String fVarName; // $variableName, valid when we've just
|
|
||||||
// scanned one.
|
|
||||||
|
|
||||||
|
|
||||||
short fStack[] = new short[kStackSize]; // State stack, holds state pushes
|
short fStack[] = new short[kStackSize]; // State stack, holds state pushes
|
||||||
|
@ -124,7 +124,7 @@ class RBBISetBuilder {
|
|||||||
RangeDescriptor fRangeList; // Head of the linked list of RangeDescriptors
|
RangeDescriptor fRangeList; // Head of the linked list of RangeDescriptors
|
||||||
|
|
||||||
IntTrieBuilder fTrie; // The mapping TRIE that is the end result of processing
|
IntTrieBuilder fTrie; // The mapping TRIE that is the end result of processing
|
||||||
int fTrieSize; // the Unicode Sets.
|
// the Unicode Sets.
|
||||||
|
|
||||||
// Groups correspond to character categories -
|
// Groups correspond to character categories -
|
||||||
// groups of ranges that are in the same original UnicodeSets.
|
// groups of ranges that are in the same original UnicodeSets.
|
||||||
|
@ -601,12 +601,16 @@ public class SpoofChecker {
|
|||||||
// setAllowedLocales.
|
// setAllowedLocales.
|
||||||
private void addScriptChars(ULocale locale, UnicodeSet allowedChars) {
|
private void addScriptChars(ULocale locale, UnicodeSet allowedChars) {
|
||||||
int scripts[] = UScript.getCode(locale);
|
int scripts[] = UScript.getCode(locale);
|
||||||
UnicodeSet tmpSet = new UnicodeSet();
|
if (scripts != null) {
|
||||||
int i;
|
UnicodeSet tmpSet = new UnicodeSet();
|
||||||
for (i = 0; i < scripts.length; i++) {
|
for (int i = 0; i < scripts.length; i++) {
|
||||||
tmpSet.applyIntPropertyValue(UProperty.SCRIPT, scripts[i]);
|
tmpSet.applyIntPropertyValue(UProperty.SCRIPT, scripts[i]);
|
||||||
allowedChars.addAll(tmpSet);
|
allowedChars.addAll(tmpSet);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// else it's an unknown script.
|
||||||
|
// Maybe they asked for the script of "zxx", which refers to no linguistic content.
|
||||||
|
// Maybe they asked for the script of a newer locale that we don't know in the older version of ICU.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -227,8 +227,6 @@ public final class StringPrep {
|
|||||||
private int[] indexes;
|
private int[] indexes;
|
||||||
// mapping data read from the data file
|
// mapping data read from the data file
|
||||||
private char[] mappingData;
|
private char[] mappingData;
|
||||||
// format version of the data file
|
|
||||||
//private byte[] formatVersion;
|
|
||||||
// the version of Unicode supported by the data file
|
// the version of Unicode supported by the data file
|
||||||
private VersionInfo sprepUniVer;
|
private VersionInfo sprepUniVer;
|
||||||
// the Unicode version of last entry in the
|
// the Unicode version of last entry in the
|
||||||
@ -287,9 +285,6 @@ public final class StringPrep {
|
|||||||
// load the rest of the data data and initialize the data members
|
// load the rest of the data data and initialize the data members
|
||||||
mappingData = reader.read(indexes[INDEX_MAPPING_DATA_SIZE]/2);
|
mappingData = reader.read(indexes[INDEX_MAPPING_DATA_SIZE]/2);
|
||||||
|
|
||||||
// get the data format version
|
|
||||||
/*formatVersion = */reader.getDataFormatVersion();
|
|
||||||
|
|
||||||
// get the options
|
// get the options
|
||||||
doNFKC = ((indexes[OPTIONS] & NORMALIZATION_ON) > 0);
|
doNFKC = ((indexes[OPTIONS] & NORMALIZATION_ON) > 0);
|
||||||
checkBiDi = ((indexes[OPTIONS] & CHECK_BIDI_ON) > 0);
|
checkBiDi = ((indexes[OPTIONS] & CHECK_BIDI_ON) > 0);
|
||||||
|
@ -529,7 +529,7 @@ public class TimeUnitFormat extends MeasureFormat {
|
|||||||
// then search the units resource fallback from the current level to root
|
// then search the units resource fallback from the current level to root
|
||||||
if (parentLocale == null && resourceKey.equals("unitsShort")) {
|
if (parentLocale == null && resourceKey.equals("unitsShort")) {
|
||||||
searchInTree("units", styl, timeUnit, srcPluralCount, searchPluralCount, countToPatterns);
|
searchInTree("units", styl, timeUnit, srcPluralCount, searchPluralCount, countToPatterns);
|
||||||
if (countToPatterns != null && countToPatterns.get(srcPluralCount) != null
|
if (countToPatterns.get(srcPluralCount) != null
|
||||||
&& countToPatterns.get(srcPluralCount)[styl] != null) {
|
&& countToPatterns.get(srcPluralCount)[styl] != null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -4512,7 +4512,8 @@ public class UnicodeSet extends UnicodeFilter implements Iterable<String>, Compa
|
|||||||
if (o.list[i] == HIGH) {
|
if (o.list[i] == HIGH) {
|
||||||
if (o.strings.isEmpty()) return -1;
|
if (o.strings.isEmpty()) return -1;
|
||||||
String item = o.strings.first();
|
String item = o.strings.first();
|
||||||
return -compare(item, list[i]);
|
int compareResult = compare(item, list[i]);
|
||||||
|
return compareResult > 0 ? -1 : compareResult < 0 ? 1 : 0; // Reverse the order.
|
||||||
}
|
}
|
||||||
// otherwise return the result if even index, or the reversal if not
|
// otherwise return the result if even index, or the reversal if not
|
||||||
return (i & 1) == 0 ? result : -result;
|
return (i & 1) == 0 ? result : -result;
|
||||||
|
@ -55,7 +55,7 @@ public class AnnualTimeZoneRule extends TimeZoneRule {
|
|||||||
super(name, rawOffset, dstSavings);
|
super(name, rawOffset, dstSavings);
|
||||||
this.dateTimeRule = dateTimeRule;
|
this.dateTimeRule = dateTimeRule;
|
||||||
this.startYear = startYear;
|
this.startYear = startYear;
|
||||||
this.endYear = endYear > MAX_YEAR ? MAX_YEAR : endYear;
|
this.endYear = endYear;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -60,7 +60,7 @@ public class ByteArrayWrapper implements Comparable<ByteArrayWrapper>
|
|||||||
* @stable ICU 3.2
|
* @stable ICU 3.2
|
||||||
*/
|
*/
|
||||||
public ByteArrayWrapper(byte[] bytesToAdopt, int size) {
|
public ByteArrayWrapper(byte[] bytesToAdopt, int size) {
|
||||||
if ((bytesToAdopt == null && size != 0) || size < 0 || size > bytesToAdopt.length) {
|
if ((bytesToAdopt == null && size != 0) || size < 0 || (bytesToAdopt != null && size > bytesToAdopt.length)) {
|
||||||
throw new IndexOutOfBoundsException("illegal size: " + size);
|
throw new IndexOutOfBoundsException("illegal size: " + size);
|
||||||
}
|
}
|
||||||
this.bytes = bytesToAdopt;
|
this.bytes = bytesToAdopt;
|
||||||
@ -115,7 +115,9 @@ public class ByteArrayWrapper implements Comparable<ByteArrayWrapper>
|
|||||||
{
|
{
|
||||||
if (bytes == null || bytes.length < capacity) {
|
if (bytes == null || bytes.length < capacity) {
|
||||||
byte[] newbytes = new byte[capacity];
|
byte[] newbytes = new byte[capacity];
|
||||||
copyBytes(bytes, 0, newbytes, 0, size);
|
if (bytes != null) {
|
||||||
|
copyBytes(bytes, 0, newbytes, 0, size);
|
||||||
|
}
|
||||||
bytes = newbytes;
|
bytes = newbytes;
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
|
@ -770,7 +770,7 @@ public class GregorianCalendar extends Calendar {
|
|||||||
eyear = (int) floorDivide(4*julianEpochDay + 1464, 1461);
|
eyear = (int) floorDivide(4*julianEpochDay + 1464, 1461);
|
||||||
|
|
||||||
// Compute the Julian calendar day number for January 1, eyear
|
// Compute the Julian calendar day number for January 1, eyear
|
||||||
long january1 = 365*(eyear-1) + floorDivide(eyear-1, 4);
|
long january1 = 365L*(eyear-1L) + floorDivide(eyear-1L, 4L);
|
||||||
dayOfYear = (int)(julianEpochDay - january1); // 0-based
|
dayOfYear = (int)(julianEpochDay - january1); // 0-based
|
||||||
|
|
||||||
// Julian leap years occurred historically every 4 years starting
|
// Julian leap years occurred historically every 4 years starting
|
||||||
|
@ -450,11 +450,7 @@ public class IndianCalendar extends Calendar {
|
|||||||
month %= 12;
|
month %= 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(month == 12) {
|
imonth = month + 1;
|
||||||
imonth = 1;
|
|
||||||
} else {
|
|
||||||
imonth = month +1;
|
|
||||||
}
|
|
||||||
|
|
||||||
double jd = IndianToJD(year ,imonth, 1);
|
double jd = IndianToJD(year ,imonth, 1);
|
||||||
|
|
||||||
|
@ -738,7 +738,7 @@ public class IslamicCalendar extends Calendar {
|
|||||||
*/
|
*/
|
||||||
protected int handleGetMonthLength(int extendedYear, int month) {
|
protected int handleGetMonthLength(int extendedYear, int month) {
|
||||||
|
|
||||||
int length = 0;
|
int length;
|
||||||
|
|
||||||
if (cType == CalculationType.ISLAMIC_CIVIL
|
if (cType == CalculationType.ISLAMIC_CIVIL
|
||||||
|| cType == CalculationType.ISLAMIC_TBLA
|
|| cType == CalculationType.ISLAMIC_TBLA
|
||||||
@ -747,16 +747,20 @@ public class IslamicCalendar extends Calendar {
|
|||||||
if (month == DHU_AL_HIJJAH && civilLeapYear(extendedYear)) {
|
if (month == DHU_AL_HIJJAH && civilLeapYear(extendedYear)) {
|
||||||
length++;
|
length++;
|
||||||
}
|
}
|
||||||
} else if (cType == CalculationType.ISLAMIC) {
|
}
|
||||||
|
else if (cType == CalculationType.ISLAMIC) {
|
||||||
month = 12*(extendedYear-1) + month;
|
month = 12*(extendedYear-1) + month;
|
||||||
length = (int)( trueMonthStart(month+1) - trueMonthStart(month) );
|
length = (int)( trueMonthStart(month+1) - trueMonthStart(month) );
|
||||||
}else if (cType == CalculationType.ISLAMIC_UMALQURA){
|
}
|
||||||
|
else { // cType == CalculationType.ISLAMIC_UMALQURA should be true at this point and not null.
|
||||||
int idx = (extendedYear - UMALQURA_YEAR_START); // calculate year offset into bit map array
|
int idx = (extendedYear - UMALQURA_YEAR_START); // calculate year offset into bit map array
|
||||||
int mask = (0x01 << (11 - month)); // set mask for bit corresponding to month
|
int mask = (0x01 << (11 - month)); // set mask for bit corresponding to month
|
||||||
if((UMALQURA_MONTHLENGTH[idx] & mask) == 0 )
|
if((UMALQURA_MONTHLENGTH[idx] & mask) == 0 ) {
|
||||||
length = 29;
|
length = 29;
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
length = 30;
|
length = 30;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
@ -460,6 +460,12 @@ public class LocaleMatcher {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
|
if (obj == this) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null || !(obj instanceof LocalePatternMatcher)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
LocalePatternMatcher other = (LocalePatternMatcher) obj;
|
LocalePatternMatcher other = (LocalePatternMatcher) obj;
|
||||||
return Utility.objectEquals(level, other.level)
|
return Utility.objectEquals(level, other.level)
|
||||||
&& Utility.objectEquals(lang, other.lang)
|
&& Utility.objectEquals(lang, other.lang)
|
||||||
@ -665,21 +671,6 @@ public class LocaleMatcher {
|
|||||||
return 1.0 - diff;
|
return 1.0 - diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add an exceptional distance between languages, typically because regional
|
|
||||||
* dialects were given their own language codes. At this point the code is
|
|
||||||
* symmetric. We don't bother producing an equivalence class because there are
|
|
||||||
* so few cases; this function depends on the other permutations being
|
|
||||||
* added specifically.
|
|
||||||
* @internal
|
|
||||||
* @deprecated This API is ICU internal only.
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
@Deprecated
|
|
||||||
private LanguageMatcherData addDistance(String desired, String supported, int percent) {
|
|
||||||
return addDistance(desired, supported, percent, false, null);
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
* @deprecated This API is ICU internal only.
|
* @deprecated This API is ICU internal only.
|
||||||
|
@ -352,7 +352,8 @@ public class LocalePriorityList implements Iterable<ULocale> {
|
|||||||
|
|
||||||
private static Comparator<Double> myDescendingDouble = new Comparator<Double>() {
|
private static Comparator<Double> myDescendingDouble = new Comparator<Double>() {
|
||||||
public int compare(Double o1, Double o2) {
|
public int compare(Double o1, Double o2) {
|
||||||
return -o1.compareTo(o2);
|
int result = o1.compareTo(o2);
|
||||||
|
return result > 0 ? -1 : result < 0 ? 1 : 0; // Reverse the order.
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -422,7 +422,7 @@ public class PersianCalendar extends Calendar {
|
|||||||
long daysSinceEpoch = julianDay - PERSIAN_EPOCH;
|
long daysSinceEpoch = julianDay - PERSIAN_EPOCH;
|
||||||
year = 1 + (int) floorDivide(33 * daysSinceEpoch + 3, 12053);
|
year = 1 + (int) floorDivide(33 * daysSinceEpoch + 3, 12053);
|
||||||
|
|
||||||
long farvardin1 = 365 * (year - 1) + floorDivide(8 * year + 21, 33);
|
long farvardin1 = 365L * (year - 1L) + floorDivide(8L * year + 21, 33L);
|
||||||
dayOfYear = (int)(daysSinceEpoch - farvardin1); // 0-based
|
dayOfYear = (int)(daysSinceEpoch - farvardin1); // 0-based
|
||||||
if (dayOfYear < 216) { // Compute 0-based month
|
if (dayOfYear < 216) { // Compute 0-based month
|
||||||
month = dayOfYear / 31;
|
month = dayOfYear / 31;
|
||||||
|
@ -349,7 +349,7 @@ public class RuleBasedTimeZone extends BasicTimeZone {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
boolean isFinal = false;
|
boolean isFinal = false;
|
||||||
TimeZoneTransition result = null;
|
TimeZoneTransition result;
|
||||||
TimeZoneTransition tzt = historicTransitions.get(0);
|
TimeZoneTransition tzt = historicTransitions.get(0);
|
||||||
long tt = tzt.getTime();
|
long tt = tzt.getTime();
|
||||||
if (tt > base || (inclusive && tt == base)) {
|
if (tt > base || (inclusive && tt == base)) {
|
||||||
@ -394,18 +394,16 @@ public class RuleBasedTimeZone extends BasicTimeZone {
|
|||||||
result = prev;
|
result = prev;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (result != null) {
|
// For now, this implementation ignore transitions with only zone name changes.
|
||||||
// For now, this implementation ignore transitions with only zone name changes.
|
TimeZoneRule from = result.getFrom();
|
||||||
TimeZoneRule from = result.getFrom();
|
TimeZoneRule to = result.getTo();
|
||||||
TimeZoneRule to = result.getTo();
|
if (from.getRawOffset() == to.getRawOffset()
|
||||||
if (from.getRawOffset() == to.getRawOffset()
|
&& from.getDSTSavings() == to.getDSTSavings()) {
|
||||||
&& from.getDSTSavings() == to.getDSTSavings()) {
|
// No offset changes. Try next one if not final
|
||||||
// No offset changes. Try next one if not final
|
if (isFinal) {
|
||||||
if (isFinal) {
|
return null;
|
||||||
return null;
|
} else {
|
||||||
} else {
|
result = getNextTransition(result.getTime(), false /* always exclusive */);
|
||||||
result = getNextTransition(result.getTime(), false /* always exclusive */);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -422,7 +420,7 @@ public class RuleBasedTimeZone extends BasicTimeZone {
|
|||||||
if (historicTransitions == null) {
|
if (historicTransitions == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
TimeZoneTransition result = null;
|
TimeZoneTransition result;
|
||||||
TimeZoneTransition tzt = historicTransitions.get(0);
|
TimeZoneTransition tzt = historicTransitions.get(0);
|
||||||
long tt = tzt.getTime();
|
long tt = tzt.getTime();
|
||||||
if (inclusive && tt == base) {
|
if (inclusive && tt == base) {
|
||||||
@ -464,15 +462,13 @@ public class RuleBasedTimeZone extends BasicTimeZone {
|
|||||||
result = tzt;
|
result = tzt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (result != null) {
|
// For now, this implementation ignore transitions with only zone name changes.
|
||||||
// For now, this implementation ignore transitions with only zone name changes.
|
TimeZoneRule from = result.getFrom();
|
||||||
TimeZoneRule from = result.getFrom();
|
TimeZoneRule to = result.getTo();
|
||||||
TimeZoneRule to = result.getTo();
|
if (from.getRawOffset() == to.getRawOffset()
|
||||||
if (from.getRawOffset() == to.getRawOffset()
|
&& from.getDSTSavings() == to.getDSTSavings()) {
|
||||||
&& from.getDSTSavings() == to.getDSTSavings()) {
|
// No offset changes. Try previous one
|
||||||
// No offset changes. Try previous one
|
result = getPreviousTransition(result.getTime(), false /* always exclusive */);
|
||||||
result = getPreviousTransition(result.getTime(), false /* always exclusive */);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,8 @@ class NullTransliterator extends Transliterator {
|
|||||||
/**
|
/**
|
||||||
* Package accessible IDs for this transliterator.
|
* Package accessible IDs for this transliterator.
|
||||||
*/
|
*/
|
||||||
static String SHORT_ID = "Null";
|
static final String SHORT_ID = "Null";
|
||||||
static String _ID = "Any-Null";
|
static final String _ID = "Any-Null";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a transliterator.
|
* Constructs a transliterator.
|
||||||
|
Loading…
Reference in New Issue
Block a user