mirror of
https://github.com/zxing/zxing.git
synced 2025-01-12 03:37:34 -08:00
Various code tweaks, action updates, dep updates
This commit is contained in:
parent
fa19d4758f
commit
0ea0ecddc5
14
.github/CONTRIBUTING.md
vendored
14
.github/CONTRIBUTING.md
vendored
|
@ -19,8 +19,8 @@ Feature requests are not accepted.
|
||||||
|
|
||||||
### Bug Reports
|
### Bug Reports
|
||||||
|
|
||||||
Bug reports must have enough detail to understand and reproduce the problem.
|
Bug reports must have enough detail to understand and reproduce the problem.
|
||||||
Bug reports without an associated pull request will generally be closed.
|
Bug reports without an associated pull request will generally be closed.
|
||||||
However, bug reports with a pull request are likely to be merged promptly.
|
However, bug reports with a pull request are likely to be merged promptly.
|
||||||
|
|
||||||
## FAQ
|
## FAQ
|
||||||
|
@ -28,14 +28,14 @@ However, bug reports with a pull request are likely to be merged promptly.
|
||||||
Please search previous issues for an answer before opening a pull request. A few common ones
|
Please search previous issues for an answer before opening a pull request. A few common ones
|
||||||
are listed here.
|
are listed here.
|
||||||
|
|
||||||
### I get a compilation error.
|
### I get a compilation error
|
||||||
|
|
||||||
While you can check the build status on Github to confirm,
|
While you can check the build status on Github to confirm,
|
||||||
the project correctly builds and passes tests at all times.
|
the project correctly builds and passes tests at all times.
|
||||||
90% of the time it's due to using an old version of Java. Version 3.4+ require Java 8.
|
90% of the time it's due to using an old version of Java. Version 3.4+ require Java 8.
|
||||||
Use earlier versions with Java 7 and earlier.
|
Use earlier versions with Java 7 and earlier.
|
||||||
|
|
||||||
### This barcode doesn't decode.
|
### This barcode doesn't decode
|
||||||
|
|
||||||
Not all images will decode. All else equal, more is better, but this is not accepted as a bug
|
Not all images will decode. All else equal, more is better, but this is not accepted as a bug
|
||||||
report. A pull request that makes changes to make the barcode decode without decreasing the net
|
report. A pull request that makes changes to make the barcode decode without decreasing the net
|
||||||
|
|
8
.github/workflows/codeql-analysis.yml
vendored
8
.github/workflows/codeql-analysis.yml
vendored
|
@ -36,11 +36,11 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v1
|
uses: github/codeql-action/init@v2
|
||||||
with:
|
with:
|
||||||
languages: ${{ matrix.language }}
|
languages: ${{ matrix.language }}
|
||||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||||
|
@ -51,7 +51,7 @@ jobs:
|
||||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||||
# If this step fails, then you should remove it and run the build manually (see below)
|
# If this step fails, then you should remove it and run the build manually (see below)
|
||||||
- name: Autobuild
|
- name: Autobuild
|
||||||
uses: github/codeql-action/autobuild@v1
|
uses: github/codeql-action/autobuild@v2
|
||||||
|
|
||||||
# ℹ️ Command-line programs to run using the OS shell.
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
# 📚 https://git.io/JvXDl
|
# 📚 https://git.io/JvXDl
|
||||||
|
@ -65,4 +65,4 @@ jobs:
|
||||||
# make release
|
# make release
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v1
|
uses: github/codeql-action/analyze@v2
|
||||||
|
|
2
.github/workflows/test_java_17.yml
vendored
2
.github/workflows/test_java_17.yml
vendored
|
@ -12,7 +12,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- name: Set up JDK 17
|
- name: Set up JDK 17
|
||||||
uses: actions/setup-java@v2
|
uses: actions/setup-java@v2
|
||||||
with:
|
with:
|
||||||
|
|
2
.github/workflows/test_java_8_android.yml
vendored
2
.github/workflows/test_java_8_android.yml
vendored
|
@ -15,7 +15,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- name: Set up Android SDK
|
- name: Set up Android SDK
|
||||||
run: if [ ! -d /tmp/android-sdk-linux/platforms ]; then curl -s https://storage.googleapis.com/zxing-build/android-sdk-linux.tar.bz2 | bunzip2 | tar xf - -C /tmp; else ls -l /tmp/android-sdk-linux; fi
|
run: if [ ! -d /tmp/android-sdk-linux/platforms ]; then curl -s https://storage.googleapis.com/zxing-build/android-sdk-linux.tar.bz2 | bunzip2 | tar xf - -C /tmp; else ls -l /tmp/android-sdk-linux; fi
|
||||||
- name: Set up JDK 8
|
- name: Set up JDK 8
|
||||||
|
|
14
README.md
14
README.md
|
@ -70,7 +70,6 @@ library implemented in Java, with ports to other languages.
|
||||||
| [pyzxing](https://github.com/ChenjieXu/pyzxing) | Python wrapper to ZXing library
|
| [pyzxing](https://github.com/ChenjieXu/pyzxing) | Python wrapper to ZXing library
|
||||||
| [zxing-dart](https://github.com/shirne/zxing-dart) | Port to dart
|
| [zxing-dart](https://github.com/shirne/zxing-dart) | Port to dart
|
||||||
|
|
||||||
|
|
||||||
### Other related third-party open source projects
|
### Other related third-party open source projects
|
||||||
|
|
||||||
| Module | Description
|
| Module | Description
|
||||||
|
@ -82,10 +81,10 @@ library implemented in Java, with ports to other languages.
|
||||||
|
|
||||||
## Links
|
## Links
|
||||||
|
|
||||||
* [Online Decoder](https://zxing.org/w/decode.jspx)
|
* [Online Decoder](https://zxing.org/w/decode.jspx)
|
||||||
* [QR Code Generator](https://zxing.appspot.com/generator)
|
* [QR Code Generator](https://zxing.appspot.com/generator)
|
||||||
* [Javadoc](https://zxing.github.io/zxing/apidocs/)
|
* [Javadoc](https://zxing.github.io/zxing/apidocs/)
|
||||||
* [Documentation Site](https://zxing.github.io/zxing/)
|
* [Documentation Site](https://zxing.github.io/zxing/)
|
||||||
|
|
||||||
## Contacting
|
## Contacting
|
||||||
|
|
||||||
|
@ -94,9 +93,8 @@ on StackOverflow](https://stackoverflow.com/questions/tagged/zxing).
|
||||||
|
|
||||||
## Etcetera
|
## Etcetera
|
||||||
|
|
||||||
[![Coverity Status](https://scan.coverity.com/projects/1924/badge.svg)](https://scan.coverity.com/projects/1924)
|
[![codecov](https://codecov.io/gh/zxing/zxing/branch/master/graph/badge.svg?token=6RrJHvUMDl)](https://codecov.io/gh/zxing/zxing)
|
||||||
[![codecov.io](https://codecov.io/github/zxing/zxing/coverage.svg?branch=master)](https://codecov.io/github/zxing/zxing?branch=master)
|
[![Codacy](https://app.codacy.com/project/badge/Grade/5d1186edeb714f0187e3eb18cc6aeef1)](https://www.codacy.com/gh/zxing/zxing/dashboard?utm_source=github.com&utm_medium=referral&utm_content=zxing/zxing&utm_campaign=Badge_Grade)
|
||||||
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/7270e4b57c50483699448bf32721ab10)](https://www.codacy.com/app/srowen/zxing?utm_source=github.com&utm_medium=referral&utm_content=zxing/zxing&utm_campaign=Badge_Grade)
|
|
||||||
|
|
||||||
QR code is trademarked by Denso Wave, inc. Thanks to Haase & Martin OHG for contributing the logo.
|
QR code is trademarked by Denso Wave, inc. Thanks to Haase & Martin OHG for contributing the logo.
|
||||||
|
|
||||||
|
|
|
@ -188,7 +188,7 @@ public class MinimalECIInput implements ECIInput {
|
||||||
*
|
*
|
||||||
* @param index the index of the {@code int} value to be returned
|
* @param index the index of the {@code int} value to be returned
|
||||||
*
|
*
|
||||||
* @return the specified {@code int} ECI value.
|
* @return the specified {@code int} ECI value.
|
||||||
* The ECI specified the encoding of all bytes with a higher index until the
|
* The ECI specified the encoding of all bytes with a higher index until the
|
||||||
* next ECI or until the end of the input if no other ECI follows.
|
* next ECI or until the end of the input if no other ECI follows.
|
||||||
*
|
*
|
||||||
|
@ -236,11 +236,11 @@ public class MinimalECIInput implements ECIInput {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addEdges(String stringToEncode,
|
static void addEdges(String stringToEncode,
|
||||||
ECIEncoderSet encoderSet,
|
ECIEncoderSet encoderSet,
|
||||||
InputEdge[][] edges,
|
InputEdge[][] edges,
|
||||||
int from,
|
int from,
|
||||||
InputEdge previous,
|
InputEdge previous,
|
||||||
int fnc1) {
|
int fnc1) {
|
||||||
|
|
||||||
char ch = stringToEncode.charAt(from);
|
char ch = stringToEncode.charAt(from);
|
||||||
|
@ -290,7 +290,7 @@ public class MinimalECIInput implements ECIInput {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (minimalJ < 0) {
|
if (minimalJ < 0) {
|
||||||
throw new RuntimeException("Internal error: failed to encode \"" + stringToEncode + "\"");
|
throw new IllegalStateException("Failed to encode \"" + stringToEncode + "\"");
|
||||||
}
|
}
|
||||||
List<Integer> intsAL = new ArrayList<>();
|
List<Integer> intsAL = new ArrayList<>();
|
||||||
InputEdge current = edges[inputLength][minimalJ];
|
InputEdge current = edges[inputLength][minimalJ];
|
||||||
|
|
|
@ -64,11 +64,13 @@ public final class StringUtils {
|
||||||
*/
|
*/
|
||||||
public static String guessEncoding(byte[] bytes, Map<DecodeHintType,?> hints) {
|
public static String guessEncoding(byte[] bytes, Map<DecodeHintType,?> hints) {
|
||||||
Charset c = guessCharset(bytes, hints);
|
Charset c = guessCharset(bytes, hints);
|
||||||
if (c == SHIFT_JIS_CHARSET) {
|
if (c.equals(SHIFT_JIS_CHARSET)) {
|
||||||
return "SJIS";
|
return "SJIS";
|
||||||
} else if (c == StandardCharsets.UTF_8) {
|
}
|
||||||
|
if (c.equals(StandardCharsets.UTF_8)) {
|
||||||
return "UTF8";
|
return "UTF8";
|
||||||
} else if (c == StandardCharsets.ISO_8859_1) {
|
}
|
||||||
|
if (c.equals(StandardCharsets.ISO_8859_1)) {
|
||||||
return "ISO8859_1";
|
return "ISO8859_1";
|
||||||
}
|
}
|
||||||
return c.name();
|
return c.name();
|
||||||
|
|
|
@ -30,7 +30,7 @@ import com.google.zxing.common.MinimalECIInput;
|
||||||
*
|
*
|
||||||
* Uses Dijkstra to produce mathematically minimal encodings that are in some cases smaller than the results produced
|
* Uses Dijkstra to produce mathematically minimal encodings that are in some cases smaller than the results produced
|
||||||
* by the algorithm described in annex S in the specification ISO/IEC 16022:200(E). The biggest improvment of this
|
* by the algorithm described in annex S in the specification ISO/IEC 16022:200(E). The biggest improvment of this
|
||||||
* algorithm over that one is the case when the algorithm enters the most inefficient mode, the B256 mode. The
|
* algorithm over that one is the case when the algorithm enters the most inefficient mode, the B256 mode. The
|
||||||
* algorithm from the specification algorithm will exit this mode only if it encounters digits so that arbitrarily
|
* algorithm from the specification algorithm will exit this mode only if it encounters digits so that arbitrarily
|
||||||
* inefficient results can be produced if the postfix contains no digits.
|
* inefficient results can be produced if the postfix contains no digits.
|
||||||
*
|
*
|
||||||
|
@ -45,7 +45,7 @@ import com.google.zxing.common.MinimalECIInput;
|
||||||
* contains many * characters from ISO-8859-2 (Latin 2) and few from ISO-8859-3 (Latin 3)).
|
* contains many * characters from ISO-8859-2 (Latin 2) and few from ISO-8859-3 (Latin 3)).
|
||||||
* In a second stage this stream of ECIs and bytes is minimally encoded using the various Data Matrix encoding modes.
|
* In a second stage this stream of ECIs and bytes is minimally encoded using the various Data Matrix encoding modes.
|
||||||
* While both stages encode mathematically minimally it is not ensured that the result is mathematically minimal since
|
* While both stages encode mathematically minimally it is not ensured that the result is mathematically minimal since
|
||||||
* the size growth for inserting an ECI in the first stage can only be approximated as the first stage does not know
|
* the size growth for inserting an ECI in the first stage can only be approximated as the first stage does not know
|
||||||
* in which mode the ECI will occur in the second stage (may, or may not require an extra latch to ASCII depending on
|
* in which mode the ECI will occur in the second stage (may, or may not require an extra latch to ASCII depending on
|
||||||
* the current mode). The reason for this shortcoming are difficulties in implementing it in a straightforward and
|
* the current mode). The reason for this shortcoming are difficulties in implementing it in a straightforward and
|
||||||
* readable manner.
|
* readable manner.
|
||||||
|
@ -165,7 +165,7 @@ public final class MinimalEncoder {
|
||||||
* The number of characters encoded is returned in characterLength.
|
* The number of characters encoded is returned in characterLength.
|
||||||
* The number of characters encoded is also minimal in the sense that the algorithm stops as soon
|
* The number of characters encoded is also minimal in the sense that the algorithm stops as soon
|
||||||
* as a character encoding fills a C40 word competely (three C40 values). An exception is at the
|
* as a character encoding fills a C40 word competely (three C40 values). An exception is at the
|
||||||
* end of the string where two C40 values are allowed (according to the spec the third c40 value
|
* end of the string where two C40 values are allowed (according to the spec the third c40 value
|
||||||
* is filled with 0 (Shift 1) in this case).
|
* is filled with 0 (Shift 1) in this case).
|
||||||
*/
|
*/
|
||||||
static int getNumberOfC40Words(Input input, int from, boolean c40,int[] characterLength) {
|
static int getNumberOfC40Words(Input input, int from, boolean c40,int[] characterLength) {
|
||||||
|
@ -217,7 +217,7 @@ public final class MinimalEncoder {
|
||||||
// one ASCII encoded character or an extended character via Upper Shift
|
// one ASCII encoded character or an extended character via Upper Shift
|
||||||
addEdge(edges, new Edge(input, Mode.ASCII, from, 1, previous));
|
addEdge(edges, new Edge(input, Mode.ASCII, from, 1, previous));
|
||||||
}
|
}
|
||||||
|
|
||||||
Mode[] modes = {Mode.C40, Mode.TEXT};
|
Mode[] modes = {Mode.C40, Mode.TEXT};
|
||||||
for (Mode mode : modes) {
|
for (Mode mode : modes) {
|
||||||
int[] characterLength = new int[1];
|
int[] characterLength = new int[1];
|
||||||
|
@ -225,7 +225,7 @@ public final class MinimalEncoder {
|
||||||
addEdge(edges, new Edge(input, mode, from, characterLength[0], previous));
|
addEdge(edges, new Edge(input, mode, from, characterLength[0], previous));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (input.haveNCharacters(from,3) &&
|
if (input.haveNCharacters(from,3) &&
|
||||||
HighLevelEncoder.isNativeX12(input.charAt(from)) &&
|
HighLevelEncoder.isNativeX12(input.charAt(from)) &&
|
||||||
HighLevelEncoder.isNativeX12(input.charAt(from + 1)) &&
|
HighLevelEncoder.isNativeX12(input.charAt(from + 1)) &&
|
||||||
|
@ -260,16 +260,16 @@ public final class MinimalEncoder {
|
||||||
* Likewise the end vertices are located after the last character at position input.length().
|
* Likewise the end vertices are located after the last character at position input.length().
|
||||||
* For any position there might be up to six vertices, one for each of the encoding types ASCII, C40, TEXT, X12,
|
* For any position there might be up to six vertices, one for each of the encoding types ASCII, C40, TEXT, X12,
|
||||||
* EDF and B256.
|
* EDF and B256.
|
||||||
*
|
*
|
||||||
* As an example consider the input string "ABC123" then at position 0 there is only one vertex with the default
|
* As an example consider the input string "ABC123" then at position 0 there is only one vertex with the default
|
||||||
* ASCII encodation. At position 3 there might be vertices for the types ASCII, C40, X12, EDF and B256.
|
* ASCII encodation. At position 3 there might be vertices for the types ASCII, C40, X12, EDF and B256.
|
||||||
*
|
*
|
||||||
* An edge leading to such a vertex encodes one or more of the characters left of the position that the vertex
|
* An edge leading to such a vertex encodes one or more of the characters left of the position that the vertex
|
||||||
* represents. It encodes the characters in the encoding mode of the vertex that it ends on. In other words,
|
* represents. It encodes the characters in the encoding mode of the vertex that it ends on. In other words,
|
||||||
* all edges leading to a particular vertex encode the same characters (the length of the suffix can vary) using the same
|
* all edges leading to a particular vertex encode the same characters (the length of the suffix can vary) using the same
|
||||||
* encoding mode.
|
* encoding mode.
|
||||||
* As an example consider the input string "ABC123" and the vertex (4,EDF). Possible edges leading to this vertex
|
* As an example consider the input string "ABC123" and the vertex (4,EDF). Possible edges leading to this vertex
|
||||||
* are:
|
* are:
|
||||||
* (0,ASCII) --EDF(ABC1)--> (4,EDF)
|
* (0,ASCII) --EDF(ABC1)--> (4,EDF)
|
||||||
* (1,ASCII) --EDF(BC1)--> (4,EDF)
|
* (1,ASCII) --EDF(BC1)--> (4,EDF)
|
||||||
* (1,B256) --EDF(BC1)--> (4,EDF)
|
* (1,B256) --EDF(BC1)--> (4,EDF)
|
||||||
|
@ -389,11 +389,11 @@ public final class MinimalEncoder {
|
||||||
* (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256) EDF(CDE) (6) --> (5,EDF)
|
* (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256) EDF(CDE) (6) --> (5,EDF)
|
||||||
* (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256) EDF(CDEF) (6) --> (6,EDF)
|
* (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256) EDF(CDEF) (6) --> (6,EDF)
|
||||||
*
|
*
|
||||||
* Edge "(2,ASCII) ASCII(C) (3) --> (3,ASCII)" is minimal for the vertex (3,ASCII) so that edges "(2,EDF) ASCII(C) (5) --> (3,ASCII)"
|
* Edge "(2,ASCII) ASCII(C) (3) --> (3,ASCII)" is minimal for the vertex (3,ASCII) so that edges "(2,EDF) ASCII(C) (5) --> (3,ASCII)"
|
||||||
* and "(2,B256) ASCII(C) (4) --> (3,ASCII)" can be removed.
|
* and "(2,B256) ASCII(C) (4) --> (3,ASCII)" can be removed.
|
||||||
* Edge "(0,ASCII) EDF(ABC) (4) --> (3,EDF)" is minimal for the vertex (3,EDF) so that edges "(1,ASCII) EDF(BC) (5) --> (3,EDF)"
|
* Edge "(0,ASCII) EDF(ABC) (4) --> (3,EDF)" is minimal for the vertex (3,EDF) so that edges "(1,ASCII) EDF(BC) (5) --> (3,EDF)"
|
||||||
* and "(1,B256) EDF(BC) (6) --> (3,EDF)" can be removed.
|
* and "(1,B256) EDF(BC) (6) --> (3,EDF)" can be removed.
|
||||||
* Edge "(2,B256) B256(C) (4) --> (3,B256)" is minimal for the vertex (3,B256) so that edges "(2,ASCII) B256(C) (5) --> (3,B256)"
|
* Edge "(2,B256) B256(C) (4) --> (3,B256)" is minimal for the vertex (3,B256) so that edges "(2,ASCII) B256(C) (5) --> (3,B256)"
|
||||||
* and "(2,EDF) B256(C) (6) --> (3,B256)" can be removed.
|
* and "(2,EDF) B256(C) (6) --> (3,B256)" can be removed.
|
||||||
*
|
*
|
||||||
* This continues for vertices 3 thru 7
|
* This continues for vertices 3 thru 7
|
||||||
|
@ -472,7 +472,7 @@ public final class MinimalEncoder {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (minimalJ < 0) {
|
if (minimalJ < 0) {
|
||||||
throw new RuntimeException("Internal error: failed to encode \"" + input + "\"");
|
throw new IllegalStateException("Failed to encode \"" + input + "\"");
|
||||||
}
|
}
|
||||||
return new Result(edges[inputLength][minimalJ]);
|
return new Result(edges[inputLength][minimalJ]);
|
||||||
}
|
}
|
||||||
|
@ -512,7 +512,7 @@ public final class MinimalEncoder {
|
||||||
* C40 -> ASCII: word(c1,c2,c3), 254
|
* C40 -> ASCII: word(c1,c2,c3), 254
|
||||||
* TEXT -> ASCII: word(c1,c2,c3), 254
|
* TEXT -> ASCII: word(c1,c2,c3), 254
|
||||||
* X12 -> ASCII: word(c1,c2,c3), 254
|
* X12 -> ASCII: word(c1,c2,c3), 254
|
||||||
* EDIFACT -> ASCII: Unlatch character,0,0,0 or c1,Unlatch character,0,0 or c1,c2,Unlatch character,0 or
|
* EDIFACT -> ASCII: Unlatch character,0,0,0 or c1,Unlatch character,0,0 or c1,c2,Unlatch character,0 or
|
||||||
* c1,c2,c3,Unlatch character
|
* c1,c2,c3,Unlatch character
|
||||||
* B256 -> ASCII: without latch after n bytes
|
* B256 -> ASCII: without latch after n bytes
|
||||||
*/
|
*/
|
||||||
|
@ -616,7 +616,7 @@ public final class MinimalEncoder {
|
||||||
|
|
||||||
// see 5.2.5.2 C40 encodation rules and 5.2.7.2 ANSI X12 encodation rules
|
// see 5.2.5.2 C40 encodation rules and 5.2.7.2 ANSI X12 encodation rules
|
||||||
if (fromPosition + characterLength >= input.length() && getCodewordsRemaining(cachedTotalSize) == 0) {
|
if (fromPosition + characterLength >= input.length() && getCodewordsRemaining(cachedTotalSize) == 0) {
|
||||||
return Mode.ASCII;
|
return Mode.ASCII;
|
||||||
}
|
}
|
||||||
int lastASCII = getLastASCII();
|
int lastASCII = getLastASCII();
|
||||||
if (lastASCII == 1 && getCodewordsRemaining(cachedTotalSize + 1) == 0) {
|
if (lastASCII == 1 && getCodewordsRemaining(cachedTotalSize + 1) == 0) {
|
||||||
|
@ -631,7 +631,7 @@ public final class MinimalEncoder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Peeks ahead and returns 1 if the postfix consists of exactly two digits, 2 if the postfix consists of exactly
|
/** Peeks ahead and returns 1 if the postfix consists of exactly two digits, 2 if the postfix consists of exactly
|
||||||
* two consecutive digits and a non extended character or of 4 digits.
|
* two consecutive digits and a non extended character or of 4 digits.
|
||||||
* Returns 0 in any other case
|
* Returns 0 in any other case
|
||||||
**/
|
**/
|
||||||
int getLastASCII() {
|
int getLastASCII() {
|
||||||
|
@ -970,7 +970,7 @@ public final class MinimalEncoder {
|
||||||
} else if (input.getMacroId() == 6) {
|
} else if (input.getMacroId() == 6) {
|
||||||
size += prepend(MinimalEncoder.Edge.getBytes(237), bytesAL);
|
size += prepend(MinimalEncoder.Edge.getBytes(237), bytesAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (input.getFNC1Character() > 0) {
|
if (input.getFNC1Character() > 0) {
|
||||||
size += prepend(MinimalEncoder.Edge.getBytes(232), bytesAL);
|
size += prepend(MinimalEncoder.Edge.getBytes(232), bytesAL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -362,7 +362,7 @@ public final class Code128Writer extends OneDimensionalCodeWriter {
|
||||||
return CODE_CODE_B;
|
return CODE_CODE_B;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encodes minimally using Divide-And-Conquer with Memoization
|
* Encodes minimally using Divide-And-Conquer with Memoization
|
||||||
**/
|
**/
|
||||||
private static final class MinimalEncoder {
|
private static final class MinimalEncoder {
|
||||||
|
@ -435,8 +435,8 @@ public final class Code128Writer extends OneDimensionalCodeWriter {
|
||||||
patternIndex = CODE_FNC_3;
|
patternIndex = CODE_FNC_3;
|
||||||
break;
|
break;
|
||||||
case ESCAPE_FNC_4:
|
case ESCAPE_FNC_4:
|
||||||
if ((charset == Charset.A && latch != Latch.SHIFT) ||
|
if (charset == Charset.A && latch != Latch.SHIFT ||
|
||||||
(charset == Charset.B && latch == Latch.SHIFT)) {
|
charset == Charset.B && latch == Latch.SHIFT) {
|
||||||
patternIndex = CODE_FNC_4_A;
|
patternIndex = CODE_FNC_4_A;
|
||||||
} else {
|
} else {
|
||||||
patternIndex = CODE_FNC_4_B;
|
patternIndex = CODE_FNC_4_B;
|
||||||
|
@ -445,11 +445,10 @@ public final class Code128Writer extends OneDimensionalCodeWriter {
|
||||||
default:
|
default:
|
||||||
patternIndex = contents.charAt(i) - ' ';
|
patternIndex = contents.charAt(i) - ' ';
|
||||||
}
|
}
|
||||||
if ((charset == Charset.A && latch != Latch.SHIFT) ||
|
if ((charset == Charset.A && latch != Latch.SHIFT ||
|
||||||
(charset == Charset.B && latch == Latch.SHIFT)) {
|
charset == Charset.B && latch == Latch.SHIFT) &&
|
||||||
if (patternIndex < 0) {
|
patternIndex < 0) {
|
||||||
patternIndex += '`';
|
patternIndex += '`';
|
||||||
}
|
|
||||||
}
|
}
|
||||||
addPattern(patterns, patternIndex, checkSum, checkWeight, i);
|
addPattern(patterns, patternIndex, checkSum, checkWeight, i);
|
||||||
}
|
}
|
||||||
|
@ -505,11 +504,11 @@ public final class Code128Writer extends OneDimensionalCodeWriter {
|
||||||
if (mCost > 0) {
|
if (mCost > 0) {
|
||||||
return mCost;
|
return mCost;
|
||||||
}
|
}
|
||||||
|
|
||||||
int minCost = Integer.MAX_VALUE;
|
int minCost = Integer.MAX_VALUE;
|
||||||
Latch minLatch = Latch.NONE;
|
Latch minLatch = Latch.NONE;
|
||||||
boolean atEnd = position + 1 >= contents.length();
|
boolean atEnd = position + 1 >= contents.length();
|
||||||
|
|
||||||
Charset[] sets = new Charset[] { Charset.A, Charset.B };
|
Charset[] sets = new Charset[] { Charset.A, Charset.B };
|
||||||
for (int i = 0; i <= 1; i++) {
|
for (int i = 0; i <= 1; i++) {
|
||||||
if (canEncode(contents, sets[i], position)) {
|
if (canEncode(contents, sets[i], position)) {
|
||||||
|
|
|
@ -244,11 +244,11 @@ public final class PDF417ScanningDecoder {
|
||||||
throw NotFoundException.getNotFoundInstance();
|
throw NotFoundException.getNotFoundInstance();
|
||||||
}
|
}
|
||||||
barcodeMatrix01.setValue(calculatedNumberOfCodewords);
|
barcodeMatrix01.setValue(calculatedNumberOfCodewords);
|
||||||
} else if (numberOfCodewords[0] != calculatedNumberOfCodewords) {
|
} else if (numberOfCodewords[0] != calculatedNumberOfCodewords &&
|
||||||
if (calculatedNumberOfCodewords >= 1 && calculatedNumberOfCodewords <= PDF417Common.MAX_CODEWORDS_IN_BARCODE) {
|
calculatedNumberOfCodewords >= 1 &&
|
||||||
// The calculated one is more reliable as it is derived from the row indicator columns
|
calculatedNumberOfCodewords <= PDF417Common.MAX_CODEWORDS_IN_BARCODE) {
|
||||||
barcodeMatrix01.setValue(calculatedNumberOfCodewords);
|
// The calculated one is more reliable as it is derived from the row indicator columns
|
||||||
}
|
barcodeMatrix01.setValue(calculatedNumberOfCodewords);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -168,7 +168,7 @@ final class PDF417HighLevelEncoder {
|
||||||
* then charsets will be chosen so that the byte representation is minimal.
|
* then charsets will be chosen so that the byte representation is minimal.
|
||||||
* @return the encoded message (the char values range from 0 to 928)
|
* @return the encoded message (the char values range from 0 to 928)
|
||||||
*/
|
*/
|
||||||
static String encodeHighLevel(String msg, Compaction compaction, Charset encoding, boolean autoECI)
|
static String encodeHighLevel(String msg, Compaction compaction, Charset encoding, boolean autoECI)
|
||||||
throws WriterException {
|
throws WriterException {
|
||||||
|
|
||||||
if (msg.isEmpty()) {
|
if (msg.isEmpty()) {
|
||||||
|
@ -370,12 +370,12 @@ final class PDF417HighLevelEncoder {
|
||||||
tmp.append((char) 27); //ll
|
tmp.append((char) 27); //ll
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
if (startpos + idx + 1 < count) {
|
if (startpos + idx + 1 < count &&
|
||||||
if (!input.isECI(startpos + idx + 1) && isPunctuation(input.charAt(startpos + idx + 1))) {
|
!input.isECI(startpos + idx + 1) &&
|
||||||
submode = SUBMODE_PUNCTUATION;
|
isPunctuation(input.charAt(startpos + idx + 1))) {
|
||||||
tmp.append((char) 25); //pl
|
submode = SUBMODE_PUNCTUATION;
|
||||||
continue;
|
tmp.append((char) 25); //pl
|
||||||
}
|
continue;
|
||||||
}
|
}
|
||||||
tmp.append((char) 29); //ps
|
tmp.append((char) 29); //ps
|
||||||
tmp.append((char) PUNCTUATION[ch]);
|
tmp.append((char) PUNCTUATION[ch]);
|
||||||
|
@ -441,7 +441,7 @@ final class PDF417HighLevelEncoder {
|
||||||
while (localEnd < end && !input.isECI(localEnd)) {
|
while (localEnd < end && !input.isECI(localEnd)) {
|
||||||
localEnd++;
|
localEnd++;
|
||||||
}
|
}
|
||||||
|
|
||||||
final int localCount = localEnd - localStart;
|
final int localCount = localEnd - localStart;
|
||||||
if (localCount <= 0) {
|
if (localCount <= 0) {
|
||||||
//done
|
//done
|
||||||
|
|
|
@ -235,7 +235,6 @@ public final class BitMatrixTestCase extends Assert {
|
||||||
fullMatrix.setRegion(0, 0, 3, 3);
|
fullMatrix.setRegion(0, 0, 3, 3);
|
||||||
BitMatrix centerMatrix = new BitMatrix(3, 3);
|
BitMatrix centerMatrix = new BitMatrix(3, 3);
|
||||||
centerMatrix.setRegion(1, 1, 1, 1);
|
centerMatrix.setRegion(1, 1, 1, 1);
|
||||||
BitMatrix emptyMatrix24 = new BitMatrix(2, 4);
|
|
||||||
|
|
||||||
boolean[][] matrix = new boolean[3][3];
|
boolean[][] matrix = new boolean[3][3];
|
||||||
assertEquals(emptyMatrix, BitMatrix.parse(matrix));
|
assertEquals(emptyMatrix, BitMatrix.parse(matrix));
|
||||||
|
|
22
pom.xml
22
pom.xml
|
@ -165,7 +165,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
<version>3.4.0</version>
|
<version>3.4.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>${java.version}</source>
|
<source>${java.version}</source>
|
||||||
<quiet>true</quiet>
|
<quiet>true</quiet>
|
||||||
|
@ -204,22 +204,22 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-install-plugin</artifactId>
|
<artifactId>maven-install-plugin</artifactId>
|
||||||
<version>3.0.0-M1</version>
|
<version>3.0.1</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-resources-plugin</artifactId>
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
<version>3.2.0</version>
|
<version>3.3.0</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<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.2.2</version>
|
<version>3.3.0</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.4.0</version>
|
<version>3.4.2</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
@ -262,12 +262,12 @@
|
||||||
<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>2.0.0-M1</version>
|
<version>2.0.0-M2</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-deploy-plugin</artifactId>
|
<artifactId>maven-deploy-plugin</artifactId>
|
||||||
<version>3.0.0-M2</version>
|
<version>3.0.0</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
@ -277,7 +277,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||||
<version>3.3.0</version>
|
<version>3.4.1</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
@ -385,7 +385,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-site-plugin</artifactId>
|
<artifactId>maven-site-plugin</artifactId>
|
||||||
<version>4.0.0-M2</version>
|
<version>4.0.0-M3</version>
|
||||||
<inherited>false</inherited>
|
<inherited>false</inherited>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
@ -396,7 +396,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||||
<version>3.1.2</version>
|
<version>3.2.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<configLocation>src/checkstyle/checkstyle.xml</configLocation>
|
<configLocation>src/checkstyle/checkstyle.xml</configLocation>
|
||||||
<includeTestSourceDirectory>true</includeTestSourceDirectory>
|
<includeTestSourceDirectory>true</includeTestSourceDirectory>
|
||||||
|
@ -421,7 +421,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.rat</groupId>
|
<groupId>org.apache.rat</groupId>
|
||||||
<artifactId>apache-rat-plugin</artifactId>
|
<artifactId>apache-rat-plugin</artifactId>
|
||||||
<version>0.14</version>
|
<version>0.15</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<consoleOutput>true</consoleOutput>
|
<consoleOutput>true</consoleOutput>
|
||||||
<ignoreErrors>true</ignoreErrors>
|
<ignoreErrors>true</ignoreErrors>
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<spring.version>5.3.21</spring.version>
|
<spring.version>5.3.23</spring.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
Loading…
Reference in a new issue