mirror of
https://github.com/zxing/zxing.git
synced 2025-01-12 19:57:27 -08:00
Tiny code adjustments from inspection
git-svn-id: https://zxing.googlecode.com/svn/trunk@1041 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
46640620e9
commit
c02bd97b6a
|
@ -96,7 +96,7 @@ public final class Result {
|
|||
return "[" + rawBytes.length + " bytes]";
|
||||
} else {
|
||||
return text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -52,10 +52,7 @@ final class URIResultParser extends ResultParser {
|
|||
}
|
||||
int period = uri.indexOf('.');
|
||||
// Look for period in a domain but followed by at least a two-char TLD
|
||||
if (period >= uri.length() - 2) {
|
||||
return false;
|
||||
}
|
||||
return period >= 0 || uri.indexOf(':') >= 0;
|
||||
return period < uri.length() - 2 && (period >= 0 || uri.indexOf(':') >= 0);
|
||||
}
|
||||
|
||||
}
|
|
@ -51,11 +51,11 @@ public final class Version {
|
|||
|
||||
// Calculate the total number of codewords
|
||||
int total = 0;
|
||||
int ecCodewords = ecBlocks.ecCodewords;
|
||||
ECB[] ecbArray = ecBlocks.ecBlocks;
|
||||
int ecCodewords = ecBlocks.getECCodewords();
|
||||
ECB[] ecbArray = ecBlocks.getECBlocks();
|
||||
for (int i = 0; i < ecbArray.length; i++) {
|
||||
ECB ecBlock = ecbArray[i];
|
||||
total += ecBlock.count * (ecBlock.dataCodewords + ecCodewords);
|
||||
total += ecBlock.getCount() * (ecBlock.getDataCodewords() + ecCodewords);
|
||||
}
|
||||
this.totalCodewords = total;
|
||||
}
|
||||
|
|
|
@ -51,40 +51,32 @@ public final class ByQuadrantReader implements Reader {
|
|||
int halfWidth = width / 2;
|
||||
int halfHeight = height / 2;
|
||||
|
||||
{
|
||||
BinaryBitmap topLeft = image.crop(0, 0, halfWidth, halfHeight);
|
||||
try {
|
||||
return delegate.decode(topLeft, hints);
|
||||
} catch (ReaderException re) {
|
||||
// continue
|
||||
}
|
||||
BinaryBitmap topLeft = image.crop(0, 0, halfWidth, halfHeight);
|
||||
try {
|
||||
return delegate.decode(topLeft, hints);
|
||||
} catch (ReaderException re) {
|
||||
// continue
|
||||
}
|
||||
|
||||
{
|
||||
BinaryBitmap topRight = image.crop(halfWidth, 0, width, halfHeight);
|
||||
try {
|
||||
return delegate.decode(topRight, hints);
|
||||
} catch (ReaderException re) {
|
||||
// continue
|
||||
}
|
||||
BinaryBitmap topRight = image.crop(halfWidth, 0, width, halfHeight);
|
||||
try {
|
||||
return delegate.decode(topRight, hints);
|
||||
} catch (ReaderException re) {
|
||||
// continue
|
||||
}
|
||||
|
||||
{
|
||||
BinaryBitmap bottomLeft = image.crop(0, halfHeight, halfWidth, height);
|
||||
try {
|
||||
return delegate.decode(bottomLeft, hints);
|
||||
} catch (ReaderException re) {
|
||||
// continue
|
||||
}
|
||||
BinaryBitmap bottomLeft = image.crop(0, halfHeight, halfWidth, height);
|
||||
try {
|
||||
return delegate.decode(bottomLeft, hints);
|
||||
} catch (ReaderException re) {
|
||||
// continue
|
||||
}
|
||||
|
||||
{
|
||||
BinaryBitmap bottomRight = image.crop(halfWidth, halfHeight, width, height);
|
||||
try {
|
||||
return delegate.decode(bottomRight, hints);
|
||||
} catch (ReaderException re) {
|
||||
// continue
|
||||
}
|
||||
BinaryBitmap bottomRight = image.crop(halfWidth, halfHeight, width, height);
|
||||
try {
|
||||
return delegate.decode(bottomRight, hints);
|
||||
} catch (ReaderException re) {
|
||||
// continue
|
||||
}
|
||||
|
||||
int quarterWidth = halfWidth / 2;
|
||||
|
|
|
@ -190,7 +190,7 @@ final class BitMatrixParser {
|
|||
for (int i = 0; i < width; i += MODULES_IN_SYMBOL) {
|
||||
for (int mask = MODULES_IN_SYMBOL - 1; mask >= 0; mask--) {
|
||||
if (rowCounters[i + (MODULES_IN_SYMBOL - 1 - mask)] >= rowHeight >>> 1) {
|
||||
symbol |= 1 << mask;
|
||||
symbol |= 1L << mask;
|
||||
}
|
||||
}
|
||||
if (columnNumber > 0) {
|
||||
|
@ -305,7 +305,7 @@ final class BitMatrixParser {
|
|||
* @param symbol
|
||||
* @return the codeword corresponding to the symbol.
|
||||
*/
|
||||
private int getCodeword(long symbol) {
|
||||
private static int getCodeword(long symbol) {
|
||||
long sym = symbol;
|
||||
sym &= 0x3ffff;
|
||||
int i = findCodewordIndex(sym);
|
||||
|
|
|
@ -138,9 +138,9 @@ final class DecodedBitStreamParser {
|
|||
*/
|
||||
private static int textCompaction(int[] codewords, int codeIndex, StringBuffer result) {
|
||||
// 2 character per codeword
|
||||
int[] textCompactionData = new int[codewords[0] * 2];
|
||||
int[] textCompactionData = new int[codewords[0] << 1];
|
||||
// Used to hold the byte compaction value if there is a mode shift
|
||||
int[] byteCompactionData = new int[codewords[0] * 2];
|
||||
int[] byteCompactionData = new int[codewords[0] << 1];
|
||||
|
||||
int index = 0;
|
||||
int code = 0;
|
||||
|
|
Loading…
Reference in a new issue