mirror of
https://github.com/zxing/zxing.git
synced 2025-02-20 18:47:38 -08:00
Fix some warnings from new inspection tool
This commit is contained in:
parent
33fd85e0c2
commit
7b1e1ccadb
|
@ -39,10 +39,8 @@ public abstract class ReaderException extends Exception {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent stack traces from being taken
|
// Prevent stack traces from being taken
|
||||||
// srowen says: huh, my IDE is saying this is not an override. native methods can't be overridden?
|
|
||||||
// This, at least, does not hurt. Because we use a singleton pattern here, it doesn't matter anyhow.
|
|
||||||
@Override
|
@Override
|
||||||
public final Throwable fillInStackTrace() {
|
public final synchronized Throwable fillInStackTrace() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -470,7 +470,8 @@ public final class Detector {
|
||||||
|
|
||||||
boolean colorModel = image.get(p1.getX(), p1.getY());
|
boolean colorModel = image.get(p1.getX(), p1.getY());
|
||||||
|
|
||||||
for (int i = 0; i < d; i++) {
|
int iMax = (int) Math.ceil(d);
|
||||||
|
for (int i = 0; i < iMax; i++) {
|
||||||
px += dx;
|
px += dx;
|
||||||
py += dy;
|
py += dy;
|
||||||
if (image.get(MathUtils.round(px), MathUtils.round(py)) != colorModel) {
|
if (image.get(MathUtils.round(px), MathUtils.round(py)) != colorModel) {
|
||||||
|
|
|
@ -307,14 +307,11 @@ public final class BitMatrix implements Cloneable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int width = right - left;
|
if (right < left || bottom < top) {
|
||||||
int height = bottom - top;
|
|
||||||
|
|
||||||
if (width < 0 || height < 0) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new int[] {left, top, width, height};
|
return new int[] {left, top, right - left, bottom - top};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -47,7 +47,7 @@ final class Base256Encoder implements Encoder {
|
||||||
if (context.hasMoreCharacters() || mustPad) {
|
if (context.hasMoreCharacters() || mustPad) {
|
||||||
if (dataCount <= 249) {
|
if (dataCount <= 249) {
|
||||||
buffer.setCharAt(0, (char) dataCount);
|
buffer.setCharAt(0, (char) dataCount);
|
||||||
} else if (dataCount > 249 && dataCount <= 1555) {
|
} else if (dataCount <= 1555) {
|
||||||
buffer.setCharAt(0, (char) ((dataCount / 250) + 249));
|
buffer.setCharAt(0, (char) ((dataCount / 250) + 249));
|
||||||
buffer.insert(1, (char) (dataCount % 250));
|
buffer.insert(1, (char) (dataCount % 250));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -251,12 +251,12 @@ public final class HighLevelEncoder {
|
||||||
|
|
||||||
//step L
|
//step L
|
||||||
if (isDigit(c)) {
|
if (isDigit(c)) {
|
||||||
charCounts[ASCII_ENCODATION] += 0.5;
|
charCounts[ASCII_ENCODATION] += 0.5f;
|
||||||
} else if (isExtendedASCII(c)) {
|
} else if (isExtendedASCII(c)) {
|
||||||
charCounts[ASCII_ENCODATION] = (int) Math.ceil(charCounts[ASCII_ENCODATION]);
|
charCounts[ASCII_ENCODATION] = (float) Math.ceil(charCounts[ASCII_ENCODATION]);
|
||||||
charCounts[ASCII_ENCODATION] += 2;
|
charCounts[ASCII_ENCODATION] += 2.0f;
|
||||||
} else {
|
} else {
|
||||||
charCounts[ASCII_ENCODATION] = (int) Math.ceil(charCounts[ASCII_ENCODATION]);
|
charCounts[ASCII_ENCODATION] = (float) Math.ceil(charCounts[ASCII_ENCODATION]);
|
||||||
charCounts[ASCII_ENCODATION]++;
|
charCounts[ASCII_ENCODATION]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ public final class HighLevelEncoder {
|
||||||
|
|
||||||
// step Q
|
// step Q
|
||||||
if (isSpecialB256(c)) {
|
if (isSpecialB256(c)) {
|
||||||
charCounts[BASE256_ENCODATION] += 4;
|
charCounts[BASE256_ENCODATION] += 4.0f;
|
||||||
} else {
|
} else {
|
||||||
charCounts[BASE256_ENCODATION]++;
|
charCounts[BASE256_ENCODATION]++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,16 +127,14 @@ public final class RSSExpandedReader extends AbstractRSSReader {
|
||||||
this.pairs.clear();
|
this.pairs.clear();
|
||||||
this.startFromEven = false;
|
this.startFromEven = false;
|
||||||
try {
|
try {
|
||||||
List<ExpandedPair> pairs = decodeRow2pairs(rowNumber, row);
|
return constructResult(decodeRow2pairs(rowNumber, row));
|
||||||
return constructResult(pairs);
|
|
||||||
} catch (NotFoundException e) {
|
} catch (NotFoundException e) {
|
||||||
// OK
|
// OK
|
||||||
}
|
}
|
||||||
|
|
||||||
this.pairs.clear();
|
this.pairs.clear();
|
||||||
this.startFromEven = true;
|
this.startFromEven = true;
|
||||||
List<ExpandedPair> pairs = decodeRow2pairs(rowNumber, row);
|
return constructResult(decodeRow2pairs(rowNumber, row));
|
||||||
return constructResult(pairs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -134,17 +134,17 @@ final class PDF417HighLevelEncoder {
|
||||||
static {
|
static {
|
||||||
//Construct inverse lookups
|
//Construct inverse lookups
|
||||||
Arrays.fill(MIXED, (byte) -1);
|
Arrays.fill(MIXED, (byte) -1);
|
||||||
for (byte i = 0; i < TEXT_MIXED_RAW.length; i++) {
|
for (int i = 0; i < TEXT_MIXED_RAW.length; i++) {
|
||||||
byte b = TEXT_MIXED_RAW[i];
|
byte b = TEXT_MIXED_RAW[i];
|
||||||
if (b > 0) {
|
if (b > 0) {
|
||||||
MIXED[b] = i;
|
MIXED[b] = (byte) i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Arrays.fill(PUNCTUATION, (byte) -1);
|
Arrays.fill(PUNCTUATION, (byte) -1);
|
||||||
for (byte i = 0; i < TEXT_PUNCTUATION_RAW.length; i++) {
|
for (int i = 0; i < TEXT_PUNCTUATION_RAW.length; i++) {
|
||||||
byte b = TEXT_PUNCTUATION_RAW[i];
|
byte b = TEXT_PUNCTUATION_RAW[i];
|
||||||
if (b > 0) {
|
if (b > 0) {
|
||||||
PUNCTUATION[b] = i;
|
PUNCTUATION[b] = (byte) i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue