projects
/
zxing.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add Code 93 support. Update tests to reflect new (better) number of successes.
[zxing.git]
/
core
/
src
/
com
/
google
/
zxing
/
oned
/
Code39Reader.java
diff --git
a/core/src/com/google/zxing/oned/Code39Reader.java
b/core/src/com/google/zxing/oned/Code39Reader.java
index
50c0ede
..
0bc66bf
100644
(file)
--- a/
core/src/com/google/zxing/oned/Code39Reader.java
+++ b/
core/src/com/google/zxing/oned/Code39Reader.java
@@
-30,6
+30,7
@@
import java.util.Hashtable;
* <p>Decodes Code 39 barcodes. This does not support "Full ASCII Code 39" yet.</p>
*
* @author Sean Owen
* <p>Decodes Code 39 barcodes. This does not support "Full ASCII Code 39" yet.</p>
*
* @author Sean Owen
+ * @see Code93Reader
*/
public final class Code39Reader extends OneDReader {
*/
public final class Code39Reader extends OneDReader {
@@
-143,22
+144,24
@@
public final class Code39Reader extends OneDReader {
for (int i = 0; i < max; i++) {
total += ALPHABET_STRING.indexOf(result.charAt(i));
}
for (int i = 0; i < max; i++) {
total += ALPHABET_STRING.indexOf(result.charAt(i));
}
- if (
total % 43 != ALPHABET_STRING.indexOf(result.charAt(max))
) {
+ if (
result.charAt(max) != ALPHABET[total % 43]
) {
throw ChecksumException.getChecksumInstance();
}
result.deleteCharAt(max);
}
throw ChecksumException.getChecksumInstance();
}
result.deleteCharAt(max);
}
- String resultString = result.toString();
- if (extendedMode) {
- resultString = decodeExtended(resultString);
- }
-
- if (resultString.length() == 0) {
+ if (result.length() == 0) {
// Almost surely a false positive
throw NotFoundException.getNotFoundInstance();
}
// Almost surely a false positive
throw NotFoundException.getNotFoundInstance();
}
+ String resultString;
+ if (extendedMode) {
+ resultString = decodeExtended(result);
+ } else {
+ resultString = result.toString();
+ }
+
float left = (float) (start[1] + start[0]) / 2.0f;
float right = (float) (nextStart + lastStart) / 2.0f;
return new Result(
float left = (float) (start[1] + start[0]) / 2.0f;
float right = (float) (nextStart + lastStart) / 2.0f;
return new Result(
@@
-271,7
+274,7
@@
public final class Code39Reader extends OneDReader {
throw NotFoundException.getNotFoundInstance();
}
throw NotFoundException.getNotFoundInstance();
}
- private static String decodeExtended(String encoded) throws FormatException {
+ private static String decodeExtended(String
Buffer
encoded) throws FormatException {
int length = encoded.length();
StringBuffer decoded = new StringBuffer(length);
for (int i = 0; i < length; i++) {
int length = encoded.length();
StringBuffer decoded = new StringBuffer(length);
for (int i = 0; i < length; i++) {