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:
srowen 2009-08-25 21:29:39 +00:00
parent 46640620e9
commit c02bd97b6a
6 changed files with 29 additions and 40 deletions

View file

@ -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;
} }
} }

View file

@ -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;
} }

View file

@ -51,41 +51,33 @@ 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;
int quarterHeight = halfHeight / 2; int quarterHeight = halfHeight / 2;

View file

@ -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);

View file

@ -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;