ICU-12611 Fix some issues found through static analysis.

X-SVN-Rev: 38938
This commit is contained in:
George Rhoten 2016-07-03 17:20:51 +00:00
parent 5bb1e71bca
commit b592f5bfb7
9 changed files with 28 additions and 33 deletions

View File

@ -338,13 +338,11 @@ class CharsetISO2022 extends CharsetICU {
// private static final byte UCNV_OPTIONS_VERSION_MASK = 0xf;
private static final byte UCNV_2022_MAX_CONVERTERS = 10;
@SuppressWarnings("unused")
private static class UConverterDataISO2022 {
UConverterSharedData []myConverterArray;
CharsetEncoderMBCS currentEncoder;
CharsetDecoderMBCS currentDecoder;
CharsetMBCS currentConverter;
int currentType; // Cnv2022Type;
ISO2022State toU2022State;
ISO2022State fromU2022State;
int key;
@ -355,7 +353,6 @@ class CharsetISO2022 extends CharsetICU {
myConverterArray = new UConverterSharedData[UCNV_2022_MAX_CONVERTERS];
toU2022State = new ISO2022State();
fromU2022State = new ISO2022State();
currentType = 0;
key = 0;
version = 0;
isEmptySegment = false;

View File

@ -236,7 +236,7 @@ class CharsetMBCS extends CharsetICU {
throw new InvalidFormatException();
}
data = new UConverterSharedData(1, null, false, 0);
data = new UConverterSharedData(1, null, false);
data.staticData = staticData;
data.sharedDataCached = false;

View File

@ -51,7 +51,6 @@ final class UConverterSharedData {
// const UConverterImpl *impl; /* vtable-style struct of mostly function pointers */
// UConverterImpl impl; /* vtable-style struct of mostly function pointers */
/** initial values of some members of the mutable part of object */
long toUnicodeStatus;
/**
* Shared data structures currently come in two flavors:
@ -71,14 +70,12 @@ final class UConverterSharedData {
mbcs = new CharsetMBCS.UConverterMBCSTable();
}
UConverterSharedData(int referenceCounter_, UConverterStaticData staticData_, boolean sharedDataCached_, long toUnicodeStatus_)
UConverterSharedData(int referenceCounter_, UConverterStaticData staticData_, boolean sharedDataCached_)
{
this();
referenceCounter = referenceCounter_;
staticData = staticData_;
sharedDataCached = sharedDataCached_;
// impl = impl_;
toUnicodeStatus = toUnicodeStatus_;
}
/**

View File

@ -214,10 +214,17 @@ public class TZDBTimeZoneNames extends TimeZoneNames {
}
private static class TZDBNameInfo {
String mzID;
NameType type;
boolean ambiguousType;
String[] parseRegions;
final String mzID;
final NameType type;
final boolean ambiguousType;
final String[] parseRegions;
TZDBNameInfo(String mzID, NameType type, boolean ambiguousType, String[] parseRegions) {
this.mzID = mzID;
this.type = type;
this.ambiguousType = ambiguousType;
this.parseRegions = parseRegions;
}
}
private static class TZDBNameSearchHandler implements ResultHandler<TZDBNameInfo> {
@ -360,19 +367,17 @@ public class TZDBTimeZoneNames extends TimeZoneNames {
boolean ambiguousType = (std != null && dst != null && std.equals(dst));
if (std != null) {
TZDBNameInfo stdInf = new TZDBNameInfo();
stdInf.mzID = mzID;
stdInf.type = NameType.SHORT_STANDARD;
stdInf.ambiguousType = ambiguousType;
stdInf.parseRegions = parseRegions;
TZDBNameInfo stdInf = new TZDBNameInfo(mzID,
NameType.SHORT_STANDARD,
ambiguousType,
parseRegions);
trie.put(std, stdInf);
}
if (dst != null) {
TZDBNameInfo dstInf = new TZDBNameInfo();
dstInf.mzID = mzID;
dstInf.type = NameType.SHORT_DAYLIGHT;
dstInf.ambiguousType = ambiguousType;
dstInf.parseRegions = parseRegions;
TZDBNameInfo dstInf = new TZDBNameInfo(mzID,
NameType.SHORT_DAYLIGHT,
ambiguousType,
parseRegions);
trie.put(dst, dstInf);
}
}

View File

@ -843,7 +843,9 @@ public final class ZoneMeta {
if (tz instanceof OlsonTimeZone) {
canonicalID = ((OlsonTimeZone)tz).getCanonicalID();
}
canonicalID = getCanonicalCLDRID(tz.getID());
else {
canonicalID = getCanonicalCLDRID(tz.getID());
}
if (canonicalID == null) {
return null;
}

View File

@ -119,7 +119,7 @@ class RBBIRuleScanner {
fRuleSets[RBBIRuleParseTable.kRuleSet_name_start_char - 128] = new UnicodeSet(gRuleSet_name_start_char_pattern);
fRuleSets[RBBIRuleParseTable.kRuleSet_digit_char - 128] = new UnicodeSet(gRuleSet_digit_char_pattern);
fSymbolTable = new RBBISymbolTable(this, rb.fRules);
fSymbolTable = new RBBISymbolTable(this);
}
//----------------------------------------------------------------------------------------

View File

@ -15,7 +15,6 @@ import com.ibm.icu.lang.UCharacter;
class RBBISymbolTable implements SymbolTable{
String fRules;
HashMap<String, RBBISymbolTableEntry> fHashTable;
RBBIRuleScanner fRuleScanner;
@ -33,8 +32,7 @@ class RBBISymbolTable implements SymbolTable{
}
RBBISymbolTable(RBBIRuleScanner rs, String rules) {
fRules = rules;
RBBISymbolTable(RBBIRuleScanner rs) {
fRuleScanner = rs;
fHashTable = new HashMap<String, RBBISymbolTableEntry>();
ffffString = "\uffff";

View File

@ -1947,7 +1947,6 @@ public abstract class Transliterator implements StringTransform {
}
registry.put(ID,
resString, // resource
"UTF-16", // encoding
dir,
!type.equals("internal"));
} else if (type.equals("alias")) {

View File

@ -220,11 +220,9 @@ class TransliteratorRegistry {
static class ResourceEntry {
public String resource;
public String encoding;
public int direction;
public ResourceEntry(String n, String enc, int d) {
public ResourceEntry(String n, int d) {
resource = n;
encoding = enc;
direction = d;
}
}
@ -343,10 +341,9 @@ class TransliteratorRegistry {
*/
public void put(String ID,
String resourceName,
String encoding,
int dir,
boolean visible) {
registerEntry(ID, new ResourceEntry(resourceName, encoding, dir), visible);
registerEntry(ID, new ResourceEntry(resourceName, dir), visible);
}
/**