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]";
|
return "[" + rawBytes.length + " bytes]";
|
||||||
} else {
|
} else {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,10 +52,7 @@ final class URIResultParser extends ResultParser {
|
||||||
}
|
}
|
||||||
int period = uri.indexOf('.');
|
int period = uri.indexOf('.');
|
||||||
// Look for period in a domain but followed by at least a two-char TLD
|
// Look for period in a domain but followed by at least a two-char TLD
|
||||||
if (period >= uri.length() - 2) {
|
return period < uri.length() - 2 && (period >= 0 || uri.indexOf(':') >= 0);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return period >= 0 || uri.indexOf(':') >= 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -51,11 +51,11 @@ public final class Version {
|
||||||
|
|
||||||
// Calculate the total number of codewords
|
// Calculate the total number of codewords
|
||||||
int total = 0;
|
int total = 0;
|
||||||
int ecCodewords = ecBlocks.ecCodewords;
|
int ecCodewords = ecBlocks.getECCodewords();
|
||||||
ECB[] ecbArray = ecBlocks.ecBlocks;
|
ECB[] ecbArray = ecBlocks.getECBlocks();
|
||||||
for (int i = 0; i < ecbArray.length; i++) {
|
for (int i = 0; i < ecbArray.length; i++) {
|
||||||
ECB ecBlock = ecbArray[i];
|
ECB ecBlock = ecbArray[i];
|
||||||
total += ecBlock.count * (ecBlock.dataCodewords + ecCodewords);
|
total += ecBlock.getCount() * (ecBlock.getDataCodewords() + ecCodewords);
|
||||||
}
|
}
|
||||||
this.totalCodewords = total;
|
this.totalCodewords = total;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,40 +51,32 @@ public final class ByQuadrantReader implements Reader {
|
||||||
int halfWidth = width / 2;
|
int halfWidth = width / 2;
|
||||||
int halfHeight = height / 2;
|
int halfHeight = height / 2;
|
||||||
|
|
||||||
{
|
BinaryBitmap topLeft = image.crop(0, 0, halfWidth, halfHeight);
|
||||||
BinaryBitmap topLeft = image.crop(0, 0, halfWidth, halfHeight);
|
try {
|
||||||
try {
|
return delegate.decode(topLeft, hints);
|
||||||
return delegate.decode(topLeft, hints);
|
} catch (ReaderException re) {
|
||||||
} catch (ReaderException re) {
|
// continue
|
||||||
// continue
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
BinaryBitmap topRight = image.crop(halfWidth, 0, width, halfHeight);
|
||||||
BinaryBitmap topRight = image.crop(halfWidth, 0, width, halfHeight);
|
try {
|
||||||
try {
|
return delegate.decode(topRight, hints);
|
||||||
return delegate.decode(topRight, hints);
|
} catch (ReaderException re) {
|
||||||
} catch (ReaderException re) {
|
// continue
|
||||||
// continue
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
BinaryBitmap bottomLeft = image.crop(0, halfHeight, halfWidth, height);
|
||||||
BinaryBitmap bottomLeft = image.crop(0, halfHeight, halfWidth, height);
|
try {
|
||||||
try {
|
return delegate.decode(bottomLeft, hints);
|
||||||
return delegate.decode(bottomLeft, hints);
|
} catch (ReaderException re) {
|
||||||
} catch (ReaderException re) {
|
// continue
|
||||||
// continue
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
BinaryBitmap bottomRight = image.crop(halfWidth, halfHeight, width, height);
|
||||||
BinaryBitmap bottomRight = image.crop(halfWidth, halfHeight, width, height);
|
try {
|
||||||
try {
|
return delegate.decode(bottomRight, hints);
|
||||||
return delegate.decode(bottomRight, hints);
|
} catch (ReaderException re) {
|
||||||
} catch (ReaderException re) {
|
// continue
|
||||||
// continue
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int quarterWidth = halfWidth / 2;
|
int quarterWidth = halfWidth / 2;
|
||||||
|
|
|
@ -190,7 +190,7 @@ final class BitMatrixParser {
|
||||||
for (int i = 0; i < width; i += MODULES_IN_SYMBOL) {
|
for (int i = 0; i < width; i += MODULES_IN_SYMBOL) {
|
||||||
for (int mask = MODULES_IN_SYMBOL - 1; mask >= 0; mask--) {
|
for (int mask = MODULES_IN_SYMBOL - 1; mask >= 0; mask--) {
|
||||||
if (rowCounters[i + (MODULES_IN_SYMBOL - 1 - mask)] >= rowHeight >>> 1) {
|
if (rowCounters[i + (MODULES_IN_SYMBOL - 1 - mask)] >= rowHeight >>> 1) {
|
||||||
symbol |= 1 << mask;
|
symbol |= 1L << mask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (columnNumber > 0) {
|
if (columnNumber > 0) {
|
||||||
|
@ -305,7 +305,7 @@ final class BitMatrixParser {
|
||||||
* @param symbol
|
* @param symbol
|
||||||
* @return the codeword corresponding to the symbol.
|
* @return the codeword corresponding to the symbol.
|
||||||
*/
|
*/
|
||||||
private int getCodeword(long symbol) {
|
private static int getCodeword(long symbol) {
|
||||||
long sym = symbol;
|
long sym = symbol;
|
||||||
sym &= 0x3ffff;
|
sym &= 0x3ffff;
|
||||||
int i = findCodewordIndex(sym);
|
int i = findCodewordIndex(sym);
|
||||||
|
|
|
@ -138,9 +138,9 @@ final class DecodedBitStreamParser {
|
||||||
*/
|
*/
|
||||||
private static int textCompaction(int[] codewords, int codeIndex, StringBuffer result) {
|
private static int textCompaction(int[] codewords, int codeIndex, StringBuffer result) {
|
||||||
// 2 character per codeword
|
// 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
|
// 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 index = 0;
|
||||||
int code = 0;
|
int code = 0;
|
||||||
|
|
Loading…
Reference in a new issue