ICU-12611 Fix some issues found through static analysis.
X-SVN-Rev: 39151
This commit is contained in:
parent
ecdc261090
commit
cfcd20f0f4
@ -587,7 +587,7 @@ public final class CollationBuilder extends CollationRuleParser.Sink {
|
||||
int start = 0;
|
||||
int limit = length;
|
||||
for (;;) {
|
||||
int i = (start + limit) / 2;
|
||||
int i = (int)(((long)start + (long)limit) / 2);
|
||||
long node = nodes[rootPrimaryIndexes[i]];
|
||||
long nodePrimary = node >>> 32; // weight32FromNode(node)
|
||||
if (p == nodePrimary) {
|
||||
|
@ -45,7 +45,7 @@ final class CollationFastLatinBuilder {
|
||||
if (limit == 0) { return ~0; }
|
||||
int start = 0;
|
||||
for (;;) {
|
||||
int i = (start + limit) / 2;
|
||||
int i = (int)(((long)start + (long)limit) / 2);
|
||||
int cmp = compareInt64AsUnsigned(ce, list[i]);
|
||||
if (cmp == 0) {
|
||||
return i;
|
||||
|
@ -453,7 +453,7 @@ public final class CollationRootElements {
|
||||
while((start + 1) < limit) {
|
||||
// Invariant: elements[start] and elements[limit] are primaries,
|
||||
// and elements[start]<=p<=elements[limit].
|
||||
int i = (start + limit) / 2;
|
||||
int i = (int)(((long)start + (long)limit) / 2);
|
||||
long q = elements[i];
|
||||
if((q & SEC_TER_DELTA_FLAG) != 0) {
|
||||
// Find the next primary.
|
||||
|
@ -180,12 +180,14 @@ public class RbnfScannerProviderImpl implements RbnfLenientScannerProvider {
|
||||
int oKey = keyIter.next();
|
||||
while (oKey != CollationElementIterator.NULLORDER) {
|
||||
while (oStr != CollationElementIterator.NULLORDER &&
|
||||
CollationElementIterator.primaryOrder(oStr) == 0)
|
||||
CollationElementIterator.primaryOrder(oStr) == 0) {
|
||||
oStr = strIter.next();
|
||||
}
|
||||
|
||||
while (oKey != CollationElementIterator.NULLORDER &&
|
||||
CollationElementIterator.primaryOrder(oKey) == 0)
|
||||
CollationElementIterator.primaryOrder(oKey) == 0) {
|
||||
oKey = keyIter.next();
|
||||
}
|
||||
|
||||
if (oStr == CollationElementIterator.NULLORDER) {
|
||||
return new int[] { -1, 0 };
|
||||
@ -210,11 +212,7 @@ public class RbnfScannerProviderImpl implements RbnfLenientScannerProvider {
|
||||
}
|
||||
}
|
||||
|
||||
if (oKey == CollationElementIterator.NULLORDER) {
|
||||
return new int[] { keyStart, strIter.getOffset() - keyStart };
|
||||
}
|
||||
|
||||
return new int[] { -1, 0 };
|
||||
return new int[] { keyStart, strIter.getOffset() - keyStart };
|
||||
}
|
||||
///CLOVER:ON
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user