"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "core/src/main/java/com/google/zxing/datamatrix/encoder/ErrorCorrection.java" between
zxing-zxing-3.4.0.tar.gz and zxing-zxing-3.4.1.tar.gz

About: ZXing ("zebra crossing") is a multi-format 1D/2D barcode image processing library implemented in Java, with ports to other languages.

ErrorCorrection.java  (zxing-zxing-3.4.0):ErrorCorrection.java  (zxing-zxing-3.4.1)
skipping to change at line 137 skipping to change at line 137
for (int e = block; e < errorSizes[block] * blockCount; e += blockCount) { for (int e = block; e < errorSizes[block] * blockCount; e += blockCount) {
sb.setCharAt(symbolInfo.getDataCapacity() + e, ecc.charAt(pos++)); sb.setCharAt(symbolInfo.getDataCapacity() + e, ecc.charAt(pos++));
} }
} }
} }
return sb.toString(); return sb.toString();
} }
private static String createECCBlock(CharSequence codewords, int numECWords) { private static String createECCBlock(CharSequence codewords, int numECWords) {
return createECCBlock(codewords, 0, codewords.length(), numECWords);
}
private static String createECCBlock(CharSequence codewords, int start, int le
n, int numECWords) {
int table = -1; int table = -1;
for (int i = 0; i < FACTOR_SETS.length; i++) { for (int i = 0; i < FACTOR_SETS.length; i++) {
if (FACTOR_SETS[i] == numECWords) { if (FACTOR_SETS[i] == numECWords) {
table = i; table = i;
break; break;
} }
} }
if (table < 0) { if (table < 0) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Illegal number of error correction codewords specified: " + numECWord s); "Illegal number of error correction codewords specified: " + numECWord s);
} }
int[] poly = FACTORS[table]; int[] poly = FACTORS[table];
char[] ecc = new char[numECWords]; char[] ecc = new char[numECWords];
for (int i = 0; i < numECWords; i++) { for (int i = 0; i < numECWords; i++) {
ecc[i] = 0; ecc[i] = 0;
} }
for (int i = start; i < start + len; i++) { for (int i = 0; i < codewords.length(); i++) {
int m = ecc[numECWords - 1] ^ codewords.charAt(i); int m = ecc[numECWords - 1] ^ codewords.charAt(i);
for (int k = numECWords - 1; k > 0; k--) { for (int k = numECWords - 1; k > 0; k--) {
if (m != 0 && poly[k] != 0) { if (m != 0 && poly[k] != 0) {
ecc[k] = (char) (ecc[k - 1] ^ ALOG[(LOG[m] + LOG[poly[k]]) % 255]); ecc[k] = (char) (ecc[k - 1] ^ ALOG[(LOG[m] + LOG[poly[k]]) % 255]);
} else { } else {
ecc[k] = ecc[k - 1]; ecc[k] = ecc[k - 1];
} }
} }
if (m != 0 && poly[0] != 0) { if (m != 0 && poly[0] != 0) {
ecc[0] = (char) ALOG[(LOG[m] + LOG[poly[0]]) % 255]; ecc[0] = (char) ALOG[(LOG[m] + LOG[poly[0]]) % 255];
 End of changes. 2 change blocks. 
6 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)