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);
return 2;
}
if (c >= '!' && c <= '/') {
if (c <= '/') {
sb.append('\1'); //Shift 2 Set
sb.append((char) (c - 33));
return 2;
}
if (c >= ':' && c <= '@') {
if (c <= '@') {
sb.append('\1'); //Shift 2 Set
sb.append((char) (c - 58 + 15));
return 2;
}
if (c >= '[' && c <= '_') {
if (c <= '_') {
sb.append('\1'); //Shift 2 Set
sb.append((char) (c - 91 + 22));
return 2;
}
if (c >= '`' && c <= 127) {
if (c <= 127) {
sb.append('\2'); //Shift 3 Set
sb.append((char) (c - 96));
return 2;

View file

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

View file

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

View file

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

17
pom.xml
View file

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

View file

@ -49,7 +49,7 @@
<dependency>
<groupId>org.springframework</groupId>
<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>
</dependency>
<dependency>