diff --git a/android/src/com/google/zxing/client/android/PreferencesActivity.java b/android/src/com/google/zxing/client/android/PreferencesActivity.java index e15233769..b6ee0c7e7 100755 --- a/android/src/com/google/zxing/client/android/PreferencesActivity.java +++ b/android/src/com/google/zxing/client/android/PreferencesActivity.java @@ -41,8 +41,8 @@ public final class PreferencesActivity extends PreferenceActivity static final String KEY_HELP_VERSION_SHOWN = "preferences_help_version_shown"; - CheckBoxPreference decode1D; - CheckBoxPreference decodeQR; + private CheckBoxPreference decode1D; + private CheckBoxPreference decodeQR; @Override protected void onCreate(Bundle icicle) { diff --git a/core/src/com/google/zxing/LuminanceSource.java b/core/src/com/google/zxing/LuminanceSource.java index f4156b242..4b6d4539f 100644 --- a/core/src/com/google/zxing/LuminanceSource.java +++ b/core/src/com/google/zxing/LuminanceSource.java @@ -38,7 +38,7 @@ public abstract class LuminanceSource { /** * Fetches one row of luminance data from the underlying platform's bitmap. Values range from * 0 (black) to 255 (white). Because Java does not have an unsigned byte type, callers will have - * to bitwise and with 0xff for each value. It is preferrable for implementations of this method + * to bitwise and with 0xff for each value. It is preferable for implementations of this method * to only fetch this row rather than the whole image, since no 2D Readers may be installed and * getMatrix() may never be called. * diff --git a/core/src/com/google/zxing/Reader.java b/core/src/com/google/zxing/Reader.java index eb7c5f7ed..ca6892c9a 100644 --- a/core/src/com/google/zxing/Reader.java +++ b/core/src/com/google/zxing/Reader.java @@ -46,7 +46,8 @@ public interface Reader { * hints, each possibly associated to some data, which may help the implementation decode. * * @param image image of barcode to decode - * @param hints passed as a {@link java.util.Hashtable} from {@link com.google.zxing.DecodeHintType} to aribtrary data. The + * @param hints passed as a {@link java.util.Hashtable} from {@link com.google.zxing.DecodeHintType} + * to arbitrary data. The * meaning of the data depends upon the hint type. The implementation may or may not do * anything with these hints. * @return String which the barcode encodes diff --git a/core/src/com/google/zxing/ResultPoint.java b/core/src/com/google/zxing/ResultPoint.java index 31cefe463..0c8e883d7 100644 --- a/core/src/com/google/zxing/ResultPoint.java +++ b/core/src/com/google/zxing/ResultPoint.java @@ -117,7 +117,7 @@ public class ResultPoint { /** * Returns the z component of the cross product between vectors BC and BA. */ - public static float crossProductZ(ResultPoint pointA, ResultPoint pointB, ResultPoint pointC) { + private static float crossProductZ(ResultPoint pointA, ResultPoint pointB, ResultPoint pointC) { float bX = pointB.x; float bY = pointB.y; return ((pointC.x - bX) * (pointA.y - bY)) - ((pointC.y - bY) * (pointA.x - bX)); diff --git a/core/src/com/google/zxing/client/result/GeoResultParser.java b/core/src/com/google/zxing/client/result/GeoResultParser.java index 1c1bc1f82..f08605964 100644 --- a/core/src/com/google/zxing/client/result/GeoResultParser.java +++ b/core/src/com/google/zxing/client/result/GeoResultParser.java @@ -19,7 +19,7 @@ package com.google.zxing.client.result; import com.google.zxing.Result; /** - * Parses a "geo:" URI result, which specifices a location on the surface of + * Parses a "geo:" URI result, which specifies a location on the surface of * the Earth as well as an optional altitude above the surface. See * * http://tools.ietf.org/html/draft-mayrhofer-geo-uri-00. diff --git a/core/src/com/google/zxing/client/result/ProductResultParser.java b/core/src/com/google/zxing/client/result/ProductResultParser.java index c7d5c5309..0ca23b2fc 100644 --- a/core/src/com/google/zxing/client/result/ProductResultParser.java +++ b/core/src/com/google/zxing/client/result/ProductResultParser.java @@ -21,7 +21,7 @@ import com.google.zxing.Result; import com.google.zxing.oned.UPCEReader; /** - * Parses strings of digits that repesent a UPC code. + * Parses strings of digits that represent a UPC code. * * @author dswitkin@google.com (Daniel Switkin) */ diff --git a/core/src/com/google/zxing/client/result/ResultParser.java b/core/src/com/google/zxing/client/result/ResultParser.java index d8172b4ba..c5fd9e034 100644 --- a/core/src/com/google/zxing/client/result/ResultParser.java +++ b/core/src/com/google/zxing/client/result/ResultParser.java @@ -117,7 +117,7 @@ public abstract class ResultParser { return escaped; } - static String urlDecode(String escaped) { + private static String urlDecode(String escaped) { // No we can't use java.net.URLDecoder here. JavaME doesn't have it. if (escaped == null) { diff --git a/core/src/com/google/zxing/common/GridSampler.java b/core/src/com/google/zxing/common/GridSampler.java index 0e293e85a..e7af414ab 100644 --- a/core/src/com/google/zxing/common/GridSampler.java +++ b/core/src/com/google/zxing/common/GridSampler.java @@ -75,7 +75,7 @@ public abstract class GridSampler { *

These 16 parameters define the transformation needed to sample the image.

* * @param image image to sample - * @param dimension width/height of {@link BitMatrix} to sample from iamge + * @param dimension width/height of {@link BitMatrix} to sample from image * @return {@link BitMatrix} representing a grid of points sampled from the image within a region * defined by the "from" parameters * @throws ReaderException if image can't be sampled, for example, if the transformation defined diff --git a/core/src/com/google/zxing/common/LocalBlockBinarizer.java b/core/src/com/google/zxing/common/LocalBlockBinarizer.java index 93fc0311a..8f3709827 100644 --- a/core/src/com/google/zxing/common/LocalBlockBinarizer.java +++ b/core/src/com/google/zxing/common/LocalBlockBinarizer.java @@ -77,7 +77,7 @@ public final class LocalBlockBinarizer extends Binarizer { // For each 8x8 block in the image, calculate the average black point using a 5x5 grid // of the blocks around it. Also handles the corner cases, but will ignore up to 7 pixels - // on the right edge and 7 pixels at the bottom of the image if the overall dimsions are not + // on the right edge and 7 pixels at the bottom of the image if the overall dimensions are not // multiples of eight. In practice, leaving those pixels white does not seem to be a problem. private static void calculateThresholdForBlock(byte[] luminances, int subWidth, int subHeight, int stride, int[][] blackPoints, BitMatrix matrix) { diff --git a/core/src/com/google/zxing/common/detector/MonochromeRectangleDetector.java b/core/src/com/google/zxing/common/detector/MonochromeRectangleDetector.java index 1a4528229..75eab7ac1 100644 --- a/core/src/com/google/zxing/common/detector/MonochromeRectangleDetector.java +++ b/core/src/com/google/zxing/common/detector/MonochromeRectangleDetector.java @@ -149,7 +149,7 @@ public final class MonochromeRectangleDetector { * be part of a Data Matrix barcode. * * @param fixedDimension if scanning horizontally, this is the row (the fixed vertical location) - * where we are scanning. If scanning vertically it's the colummn, the fixed horizontal location + * where we are scanning. If scanning vertically it's the column, the fixed horizontal location * @param maxWhiteRun largest run of white pixels that can still be considered part of the * barcode region * @param minDim minimum pixel location, horizontally or vertically, to consider diff --git a/core/src/com/google/zxing/datamatrix/decoder/BitMatrixParser.java b/core/src/com/google/zxing/datamatrix/decoder/BitMatrixParser.java index 8305977ff..6536ebf01 100644 --- a/core/src/com/google/zxing/datamatrix/decoder/BitMatrixParser.java +++ b/core/src/com/google/zxing/datamatrix/decoder/BitMatrixParser.java @@ -170,7 +170,7 @@ final class BitMatrixParser { } /** - *

Reads the 8 bits of the standard utah shaped pattern.

+ *

Reads the 8 bits of the standard Utah-shaped pattern.

* *

See ISO 16022:2006, 5.8.1 Figure 6

* diff --git a/core/src/com/google/zxing/oned/AbstractUPCEANReader.java b/core/src/com/google/zxing/oned/AbstractUPCEANReader.java index a8e2955d6..0d1b26fd1 100644 --- a/core/src/com/google/zxing/oned/AbstractUPCEANReader.java +++ b/core/src/com/google/zxing/oned/AbstractUPCEANReader.java @@ -160,7 +160,7 @@ public abstract class AbstractUPCEANReader extends AbstractOneDReader implements * @return true iff string of digits passes the UPC/EAN checksum algorithm * @throws ReaderException if the string does not contain only digits */ - public static boolean checkStandardUPCEANChecksum(String s) throws ReaderException { + private static boolean checkStandardUPCEANChecksum(String s) throws ReaderException { int length = s.length(); if (length == 0) { return false; diff --git a/core/src/com/google/zxing/oned/AbstractUPCEANWriter.java b/core/src/com/google/zxing/oned/AbstractUPCEANWriter.java index b2d2e4c75..eb33ec2ef 100644 --- a/core/src/com/google/zxing/oned/AbstractUPCEANWriter.java +++ b/core/src/com/google/zxing/oned/AbstractUPCEANWriter.java @@ -51,7 +51,7 @@ public abstract class AbstractUPCEANWriter implements UPCEANWriter { } /** @return a byte array of horizontal pixels (0 = white, 1 = black) */ - protected static ByteMatrix renderResult(byte[] code, int width, int height) { + private static ByteMatrix renderResult(byte[] code, int width, int height) { int inputWidth = code.length; // Add quiet zone on both sides int fullWidth = inputWidth + (AbstractUPCEANReader.START_END_PATTERN.length << 1); diff --git a/core/src/com/google/zxing/oned/ITFReader.java b/core/src/com/google/zxing/oned/ITFReader.java index b3613abfa..4b4de2e0a 100644 --- a/core/src/com/google/zxing/oned/ITFReader.java +++ b/core/src/com/google/zxing/oned/ITFReader.java @@ -123,7 +123,7 @@ public final class ITFReader extends AbstractOneDReader { * @param resultString {@link StringBuffer} to append decoded chars to * @throws ReaderException if decoding could not complete successfully */ - static void decodeMiddle(BitArray row, int payloadStart, int payloadEnd, + private static void decodeMiddle(BitArray row, int payloadStart, int payloadEnd, StringBuffer resultString) throws ReaderException { // Digits are interleaved in pairs - 5 black lines for one digit, and the @@ -256,8 +256,8 @@ public final class ITFReader extends AbstractOneDReader { // ref: http://www.barcode-1.net/i25code.html validateQuietZone(row, endPattern[0]); - // Now recalc the indicies of where the 'endblock' starts & stops to - // accomodate + // Now recalculate the indices of where the 'endblock' starts & stops to + // accommodate // the reversed nature of the search int temp = endPattern[0]; endPattern[0] = row.getSize() - endPattern[1]; @@ -265,7 +265,7 @@ public final class ITFReader extends AbstractOneDReader { return endPattern; } finally { - // Put the row back the righ way. + // Put the row back the right way. row.reverse(); } } @@ -279,7 +279,7 @@ public final class ITFReader extends AbstractOneDReader { * ints * @throws ReaderException if pattern is not found */ - static int[] findGuardPattern(BitArray row, int rowOffset, int[] pattern) throws ReaderException { + private static int[] findGuardPattern(BitArray row, int rowOffset, int[] pattern) throws ReaderException { // TODO: This is very similar to implementation in AbstractUPCEANReader. Consider if they can be // merged to a single method. diff --git a/core/src/com/google/zxing/pdf417/decoder/DecodedBitStreamParser.java b/core/src/com/google/zxing/pdf417/decoder/DecodedBitStreamParser.java index 3c7743549..a8cf59210 100644 --- a/core/src/com/google/zxing/pdf417/decoder/DecodedBitStreamParser.java +++ b/core/src/com/google/zxing/pdf417/decoder/DecodedBitStreamParser.java @@ -109,7 +109,7 @@ final class DecodedBitStreamParser { break; } default: { - // Default to text compaction. During testing numberous barcodes + // Default to text compaction. During testing numerous barcodes // appeared to be missing the starting mode. In these cases defaulting // to text compaction seems to work. codeIndex--; @@ -143,10 +143,9 @@ final class DecodedBitStreamParser { int[] byteCompactionData = new int[codewords[0] << 1]; int index = 0; - int code = 0; boolean end = false; while ((codeIndex < codewords[0]) && !end) { - code = codewords[codeIndex++]; + int code = codewords[codeIndex++]; if (code < TEXT_COMPACTION_MODE_LATCH) { textCompactionData[index] = code / 30; textCompactionData[index + 1] = code % 30; @@ -341,10 +340,9 @@ final class DecodedBitStreamParser { long value = 0; char[] decodedData = new char[6]; int[] byteCompactedCodewords = new int[6]; - int code = 0; boolean end = false; while ((codeIndex < codewords[0]) && !end) { - code = codewords[codeIndex++]; + int code = codewords[codeIndex++]; if (code < TEXT_COMPACTION_MODE_LATCH) { byteCompactedCodewords[count] = code; count++; @@ -386,10 +384,9 @@ final class DecodedBitStreamParser { // is an integer multiple of 6 int count = 0; long value = 0; - int code = 0; boolean end = false; while ((codeIndex < codewords[0]) && !end) { - code = codewords[codeIndex++]; + int code = codewords[codeIndex++]; if (code < TEXT_COMPACTION_MODE_LATCH) { count += 1; // Base 900 @@ -515,9 +512,8 @@ final class DecodedBitStreamParser { */ private static String decodeBase900toBase10(int[] codewords, int count) { StringBuffer accum = null; - StringBuffer value = null; for (int i = 0; i < count; i++) { - value = multiply(EXP900[count - i - 1], codewords[i]); + StringBuffer value = multiply(EXP900[count - i - 1], codewords[i]); if (accum == null) { // First time in accum=0 accum = value; @@ -526,7 +522,7 @@ final class DecodedBitStreamParser { } } String result = null; - // Remove leading '1' which was inserted to preserce + // Remove leading '1' which was inserted to preserve // leading zeros for (int i = 0; i < accum.length(); i++) { if (accum.charAt(i) == '1') { diff --git a/core/src/com/google/zxing/pdf417/decoder/Decoder.java b/core/src/com/google/zxing/pdf417/decoder/Decoder.java index d50fa5339..fb722b688 100644 --- a/core/src/com/google/zxing/pdf417/decoder/Decoder.java +++ b/core/src/com/google/zxing/pdf417/decoder/Decoder.java @@ -93,7 +93,7 @@ public final class Decoder { * @return an index to the first data codeword. * @throws ReaderException */ - private static int verifyCodewordCount(int[] codewords, int numECCodewords) throws ReaderException { + private static void verifyCodewordCount(int[] codewords, int numECCodewords) throws ReaderException { if (codewords.length < 4) { // Codeword array size should be at least 4 allowing for // Count CW, At least one Data CW, Error Correction CW, Error Correction CW @@ -114,7 +114,6 @@ public final class Decoder { throw ReaderException.getInstance(); } } - return 1; // Index to first data codeword } /** diff --git a/core/src/com/google/zxing/pdf417/detector/Detector.java b/core/src/com/google/zxing/pdf417/detector/Detector.java index 5f20f3abf..dabdce8bd 100644 --- a/core/src/com/google/zxing/pdf417/detector/Detector.java +++ b/core/src/com/google/zxing/pdf417/detector/Detector.java @@ -128,7 +128,7 @@ public final class Detector { * vertices[6] x, y top right codeword area * vertices[7] x, y bottom right codeword area */ - private static ResultPoint[] findVertices(BitMatrix matrix) throws ReaderException { + private static ResultPoint[] findVertices(BitMatrix matrix) { int height = matrix.getHeight(); int width = matrix.getWidth(); int halfWidth = width >> 1; @@ -136,10 +136,9 @@ public final class Detector { ResultPoint[] result = new ResultPoint[8]; boolean found = false; - int[] loc = null; // Top Left for (int i = 0; i < height; i++) { - loc = findGuardPattern(matrix, 0, i, halfWidth, false, START_PATTERN); + int[] loc = findGuardPattern(matrix, 0, i, halfWidth, false, START_PATTERN); if (loc != null) { result[0] = new ResultPoint(loc[0], i); result[4] = new ResultPoint(loc[1], i); @@ -151,7 +150,7 @@ public final class Detector { if (found) { // Found the Top Left vertex found = false; for (int i = height - 1; i > 0; i--) { - loc = findGuardPattern(matrix, 0, i, halfWidth, false, START_PATTERN); + int[] loc = findGuardPattern(matrix, 0, i, halfWidth, false, START_PATTERN); if (loc != null) { result[1] = new ResultPoint(loc[0], i); result[5] = new ResultPoint(loc[1], i); @@ -164,7 +163,7 @@ public final class Detector { if (found) { // Found the Bottom Left vertex found = false; for (int i = 0; i < height; i++) { - loc = findGuardPattern(matrix, halfWidth, i, halfWidth, false, STOP_PATTERN); + int[] loc = findGuardPattern(matrix, halfWidth, i, halfWidth, false, STOP_PATTERN); if (loc != null) { result[2] = new ResultPoint(loc[1], i); result[6] = new ResultPoint(loc[0], i); @@ -177,7 +176,7 @@ public final class Detector { if (found) { // Found the Top right vertex found = false; for (int i = height - 1; i > 0; i--) { - loc = findGuardPattern(matrix, halfWidth, i, halfWidth, false, STOP_PATTERN); + int[] loc = findGuardPattern(matrix, halfWidth, i, halfWidth, false, STOP_PATTERN); if (loc != null) { result[3] = new ResultPoint(loc[1], i); result[7] = new ResultPoint(loc[0], i); @@ -208,7 +207,7 @@ public final class Detector { * vertices[6] x, y top right codeword area * vertices[7] x, y bottom right codeword area */ - private static ResultPoint[] findVertices180(BitMatrix matrix) throws ReaderException { + private static ResultPoint[] findVertices180(BitMatrix matrix) { int height = matrix.getHeight(); int width = matrix.getWidth(); int halfWidth = width >> 1; @@ -216,10 +215,9 @@ public final class Detector { ResultPoint[] result = new ResultPoint[8]; boolean found = false; - int[] loc = null; // Top Left for (int i = height - 1; i > 0; i--) { - loc = findGuardPattern(matrix, halfWidth, i, halfWidth, true, START_PATTERN_REVERSE); + int[] loc = findGuardPattern(matrix, halfWidth, i, halfWidth, true, START_PATTERN_REVERSE); if (loc != null) { result[0] = new ResultPoint(loc[1], i); result[4] = new ResultPoint(loc[0], i); @@ -231,7 +229,7 @@ public final class Detector { if (found) { // Found the Top Left vertex found = false; for (int i = 0; i < height; i++) { - loc = findGuardPattern(matrix, halfWidth, i, halfWidth, true, START_PATTERN_REVERSE); + int[] loc = findGuardPattern(matrix, halfWidth, i, halfWidth, true, START_PATTERN_REVERSE); if (loc != null) { result[1] = new ResultPoint(loc[1], i); result[5] = new ResultPoint(loc[0], i); @@ -244,7 +242,7 @@ public final class Detector { if (found) { // Found the Bottom Left vertex found = false; for (int i = height - 1; i > 0; i--) { - loc = findGuardPattern(matrix, 0, i, halfWidth, false, STOP_PATTERN_REVERSE); + int[] loc = findGuardPattern(matrix, 0, i, halfWidth, false, STOP_PATTERN_REVERSE); if (loc != null) { result[2] = new ResultPoint(loc[0], i); result[6] = new ResultPoint(loc[1], i); @@ -257,7 +255,7 @@ public final class Detector { if (found) { // Found the Top Right vertex found = false; for (int i = 0; i < height; i++) { - loc = findGuardPattern(matrix, 0, i, halfWidth, false, STOP_PATTERN_REVERSE); + int[] loc = findGuardPattern(matrix, 0, i, halfWidth, false, STOP_PATTERN_REVERSE); if (loc != null) { result[3] = new ResultPoint(loc[0], i); result[7] = new ResultPoint(loc[1], i); @@ -414,7 +412,7 @@ public final class Detector { * being searched for as a pattern * @return start/end horizontal offset of guard pattern, as an array of two ints. */ - static int[] findGuardPattern(BitMatrix matrix, int column, int row, int width, + private static int[] findGuardPattern(BitMatrix matrix, int column, int row, int width, boolean whiteFirst, int[] pattern) { int patternLength = pattern.length; // TODO: Find a way to cache this array, as this method is called hundreds of times @@ -465,7 +463,7 @@ public final class Detector { * variance between counters and patterns equals the pattern length, * higher values mean even more variance */ - public static int patternMatchVariance(int[] counters, int[] pattern, int maxIndividualVariance) { + private static int patternMatchVariance(int[] counters, int[] pattern, int maxIndividualVariance) { int numCounters = counters.length; int total = 0; int patternLength = 0; diff --git a/core/src/com/google/zxing/qrcode/QRCodeWriter.java b/core/src/com/google/zxing/qrcode/QRCodeWriter.java index 0c59ed7cf..028aa8edc 100644 --- a/core/src/com/google/zxing/qrcode/QRCodeWriter.java +++ b/core/src/com/google/zxing/qrcode/QRCodeWriter.java @@ -83,7 +83,7 @@ public final class QRCodeWriter implements Writer { int outputHeight = Math.max(height, qrHeight); int multiple = Math.min(outputWidth / qrWidth, outputHeight / qrHeight); - // Padding includes both the quiet zone and the extra white pixels to accomodate the requested + // Padding includes both the quiet zone and the extra white pixels to accommodate the requested // dimensions. For example, if input is 25x25 the QR will be 33x33 including the quiet zone. // If the requested size is 200x160, the multiple will be 4, for a QR of 132x132. These will // handle all the padding from 100x100 (the actual QR) up to 200x160. diff --git a/core/src/com/google/zxing/qrcode/detector/Detector.java b/core/src/com/google/zxing/qrcode/detector/Detector.java index 8b0067488..17c1dd193 100644 --- a/core/src/com/google/zxing/qrcode/detector/Detector.java +++ b/core/src/com/google/zxing/qrcode/detector/Detector.java @@ -319,7 +319,7 @@ public class Detector { * @param overallEstModuleSize estimated module size so far * @param estAlignmentX x coordinate of center of area probably containing alignment pattern * @param estAlignmentY y coordinate of above - * @param allowanceFactor number of pixels in all directons to search from the center + * @param allowanceFactor number of pixels in all directions to search from the center * @return {@link AlignmentPattern} if found, or null otherwise * @throws ReaderException if an unexpected error occurs during detection */ diff --git a/core/src/com/google/zxing/qrcode/encoder/Encoder.java b/core/src/com/google/zxing/qrcode/encoder/Encoder.java index 49011ee7c..1bfd1b055 100644 --- a/core/src/com/google/zxing/qrcode/encoder/Encoder.java +++ b/core/src/com/google/zxing/qrcode/encoder/Encoder.java @@ -558,7 +558,7 @@ public final class Encoder { } } - static void appendECI(CharacterSetECI eci, BitVector bits) { + private static void appendECI(CharacterSetECI eci, BitVector bits) { bits.appendBits(Mode.ECI.getBits(), 4); // This is correct for values up to 127, which is all we need now. bits.appendBits(eci.getValue(), 8);