Minor updates to plugins and from code inspection

This commit is contained in:
Sean Owen 2019-01-25 21:20:56 -06:00
parent a81dda90ba
commit 9617a90616
7 changed files with 22 additions and 32 deletions

View file

@ -142,22 +142,22 @@ class C40Encoder implements Encoder {
sb.append(c); sb.append(c);
return 2; return 2;
} }
if (c >= '!' && c <= '/') { if (c <= '/') {
sb.append('\1'); //Shift 2 Set sb.append('\1'); //Shift 2 Set
sb.append((char) (c - 33)); sb.append((char) (c - 33));
return 2; return 2;
} }
if (c >= ':' && c <= '@') { if (c <= '@') {
sb.append('\1'); //Shift 2 Set sb.append('\1'); //Shift 2 Set
sb.append((char) (c - 58 + 15)); sb.append((char) (c - 58 + 15));
return 2; return 2;
} }
if (c >= '[' && c <= '_') { if (c <= '_') {
sb.append('\1'); //Shift 2 Set sb.append('\1'); //Shift 2 Set
sb.append((char) (c - 91 + 22)); sb.append((char) (c - 91 + 22));
return 2; return 2;
} }
if (c >= '`' && c <= 127) { if (c <= 127) {
sb.append('\2'); //Shift 3 Set sb.append('\2'); //Shift 3 Set
sb.append((char) (c - 96)); sb.append((char) (c - 96));
return 2; return 2;

View file

@ -113,14 +113,9 @@ public final class ErrorCorrection {
sb.setLength(sb.capacity()); sb.setLength(sb.capacity());
int[] dataSizes = new int[blockCount]; int[] dataSizes = new int[blockCount];
int[] errorSizes = new int[blockCount]; int[] errorSizes = new int[blockCount];
int[] startPos = new int[blockCount];
for (int i = 0; i < blockCount; i++) { for (int i = 0; i < blockCount; i++) {
dataSizes[i] = symbolInfo.getDataLengthForInterleavedBlock(i + 1); dataSizes[i] = symbolInfo.getDataLengthForInterleavedBlock(i + 1);
errorSizes[i] = symbolInfo.getErrorLengthForInterleavedBlock(i + 1); errorSizes[i] = symbolInfo.getErrorLengthForInterleavedBlock(i + 1);
startPos[i] = 0;
if (i > 0) {
startPos[i] = startPos[i - 1] + dataSizes[i];
}
} }
for (int block = 0; block < blockCount; block++) { for (int block = 0; block < blockCount; block++) {
StringBuilder temp = new StringBuilder(dataSizes[block]); StringBuilder temp = new StringBuilder(dataSizes[block]);

View file

@ -42,12 +42,12 @@ final class TextEncoder extends C40Encoder {
sb.append(c); sb.append(c);
return 2; return 2;
} }
if (c >= '!' && c <= '/') { if (c <= '/') {
sb.append('\1'); //Shift 2 Set sb.append('\1'); //Shift 2 Set
sb.append((char) (c - 33)); sb.append((char) (c - 33));
return 2; return 2;
} }
if (c >= ':' && c <= '@') { if (c <= '@') {
sb.append('\1'); //Shift 2 Set sb.append('\1'); //Shift 2 Set
sb.append((char) (c - 58 + 15)); sb.append((char) (c - 58 + 15));
return 2; return 2;
@ -62,12 +62,12 @@ final class TextEncoder extends C40Encoder {
sb.append((char) (c - 96)); sb.append((char) (c - 96));
return 2; return 2;
} }
if (c >= 'A' && c <= 'Z') { if (c <= 'Z') {
sb.append('\2'); //Shift 3 Set sb.append('\2'); //Shift 3 Set
sb.append((char) (c - 65 + 1)); sb.append((char) (c - 65 + 1));
return 2; return 2;
} }
if (c >= '{' && c <= 127) { if (c <= 127) {
sb.append('\2'); //Shift 3 Set sb.append('\2'); //Shift 3 Set
sb.append((char) (c - 123 + 27)); sb.append((char) (c - 123 + 27));
return 2; return 2;

View file

@ -61,7 +61,7 @@ public final class PDF417Reader implements Reader, MultipleBarcodeReader {
public Result decode(BinaryBitmap image, Map<DecodeHintType,?> hints) throws NotFoundException, FormatException, public Result decode(BinaryBitmap image, Map<DecodeHintType,?> hints) throws NotFoundException, FormatException,
ChecksumException { ChecksumException {
Result[] result = decode(image, hints, false); Result[] result = decode(image, hints, false);
if (result == null || result.length == 0 || result[0] == null) { if (result.length == 0 || result[0] == null) {
throw NotFoundException.getNotFoundInstance(); throw NotFoundException.getNotFoundInstance();
} }
return result[0]; return result[0];

View file

@ -422,6 +422,7 @@ final class DecodedBitStreamParser {
subMode = Mode.LOWER; subMode = Mode.LOWER;
break; break;
case AL: case AL:
case TEXT_COMPACTION_MODE_LATCH:
subMode = Mode.ALPHA; subMode = Mode.ALPHA;
break; break;
case PS: case PS:
@ -432,9 +433,6 @@ final class DecodedBitStreamParser {
case MODE_SHIFT_TO_BYTE_COMPACTION_MODE: case MODE_SHIFT_TO_BYTE_COMPACTION_MODE:
result.append((char) byteCompactionData[i]); result.append((char) byteCompactionData[i]);
break; break;
case TEXT_COMPACTION_MODE_LATCH:
subMode = Mode.ALPHA;
break;
} }
} }
break; break;
@ -446,14 +444,12 @@ final class DecodedBitStreamParser {
} else { } else {
switch (subModeCh) { switch (subModeCh) {
case PAL: case PAL:
case TEXT_COMPACTION_MODE_LATCH:
subMode = Mode.ALPHA; subMode = Mode.ALPHA;
break; break;
case MODE_SHIFT_TO_BYTE_COMPACTION_MODE: case MODE_SHIFT_TO_BYTE_COMPACTION_MODE:
result.append((char) byteCompactionData[i]); result.append((char) byteCompactionData[i]);
break; break;
case TEXT_COMPACTION_MODE_LATCH:
subMode = Mode.ALPHA;
break;
} }
} }
break; break;
@ -483,6 +479,7 @@ final class DecodedBitStreamParser {
} else { } else {
switch (subModeCh) { switch (subModeCh) {
case PAL: case PAL:
case TEXT_COMPACTION_MODE_LATCH:
subMode = Mode.ALPHA; subMode = Mode.ALPHA;
break; break;
case MODE_SHIFT_TO_BYTE_COMPACTION_MODE: case MODE_SHIFT_TO_BYTE_COMPACTION_MODE:
@ -490,9 +487,6 @@ final class DecodedBitStreamParser {
// see 5.4.2.4 of the specification // see 5.4.2.4 of the specification
result.append((char) byteCompactionData[i]); result.append((char) byteCompactionData[i]);
break; break;
case TEXT_COMPACTION_MODE_LATCH:
subMode = Mode.ALPHA;
break;
} }
} }
break; break;

17
pom.xml
View file

@ -88,6 +88,7 @@
<!-- This can't reference project.version as some subprojects version differently --> <!-- This can't reference project.version as some subprojects version differently -->
<zxing.version>3.3.4-SNAPSHOT</zxing.version> <zxing.version>3.3.4-SNAPSHOT</zxing.version>
<android.platform>22</android.platform> <android.platform>22</android.platform>
<maven.scm.version>1.9.5</maven.scm.version>
</properties> </properties>
<build> <build>
@ -230,17 +231,17 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version> <version>3.1.1</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId> <artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version> <version>3.1.1</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId> <artifactId>maven-jarsigner-plugin</artifactId>
<version>1.4</version> <version>3.0.0</version>
<executions> <executions>
<execution> <execution>
<id>signing</id> <id>signing</id>
@ -272,7 +273,7 @@
<dependency> <dependency>
<groupId>org.apache.maven.scm</groupId> <groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId> <artifactId>maven-scm-provider-gitexe</artifactId>
<version>1.9.5</version> <!-- can't go to 1.10 until release plugin does --> <version>${maven.scm.version}</version> <!-- can't go to 1.10 until release plugin does -->
</dependency> </dependency>
</dependencies> </dependencies>
<configuration> <configuration>
@ -285,7 +286,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId> <artifactId>maven-scm-plugin</artifactId>
<version>1.9.5</version> <version>${maven.scm.version}</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
@ -460,14 +461,14 @@
<dependency> <dependency>
<groupId>com.puppycrawl.tools</groupId> <groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId> <artifactId>checkstyle</artifactId>
<version>8.14</version> <version>8.16</version>
</dependency> </dependency>
</dependencies> </dependencies>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.rat</groupId> <groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId> <artifactId>apache-rat-plugin</artifactId>
<version>0.12</version> <version>0.13</version>
<configuration> <configuration>
<excludes> <excludes>
<exclude>**/.*</exclude> <exclude>**/.*</exclude>
@ -520,7 +521,7 @@
<plugin> <plugin>
<groupId>org.jacoco</groupId> <groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId> <artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.2</version> <version>0.8.3</version>
<executions> <executions>
<execution> <execution>
<goals> <goals>

View file

@ -49,7 +49,7 @@
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId> <artifactId>spring-test</artifactId>
<version>4.3.18.RELEASE</version> <!-- 5.x requires Java 8 --> <version>4.3.22.RELEASE</version> <!-- 5.x requires Java 8 -->
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>