"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "core/src/main/java/com/google/zxing/datamatrix/encoder/HighLevelEncoder.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.

HighLevelEncoder.java  (zxing-zxing-3.4.0):HighLevelEncoder.java  (zxing-zxing-3.4.1)
skipping to change at line 128 skipping to change at line 128
* @param msg the message * @param msg the message
* @return the byte array of the message * @return the byte array of the message
*/ */
/* /*
public static byte[] getBytesForMessage(String msg) { public static byte[] getBytesForMessage(String msg) {
return msg.getBytes(Charset.forName("cp437")); //See 4.4.3 and annex B of IS O/IEC 15438:2001(E) return msg.getBytes(Charset.forName("cp437")); //See 4.4.3 and annex B of IS O/IEC 15438:2001(E)
} }
*/ */
private static char randomize253State(char ch, int codewordPosition) { private static char randomize253State(int codewordPosition) {
int pseudoRandom = ((149 * codewordPosition) % 253) + 1; int pseudoRandom = ((149 * codewordPosition) % 253) + 1;
int tempVariable = ch + pseudoRandom; int tempVariable = PAD + pseudoRandom;
return (char) (tempVariable <= 254 ? tempVariable : tempVariable - 254); return (char) (tempVariable <= 254 ? tempVariable : tempVariable - 254);
} }
/** /**
* Performs message encoding of a DataMatrix message using the algorithm descr ibed in annex P * Performs message encoding of a DataMatrix message using the algorithm descr ibed in annex P
* of ISO/IEC 16022:2000(E). * of ISO/IEC 16022:2000(E).
* *
* @param msg the message * @param msg the message
* @return the encoded message (the char values range from 0 to 255) * @return the encoded message (the char values range from 0 to 255)
*/ */
skipping to change at line 203 skipping to change at line 203
encodingMode != BASE256_ENCODATION && encodingMode != BASE256_ENCODATION &&
encodingMode != EDIFACT_ENCODATION) { encodingMode != EDIFACT_ENCODATION) {
context.writeCodeword('\u00fe'); //Unlatch (254) context.writeCodeword('\u00fe'); //Unlatch (254)
} }
//Padding //Padding
StringBuilder codewords = context.getCodewords(); StringBuilder codewords = context.getCodewords();
if (codewords.length() < capacity) { if (codewords.length() < capacity) {
codewords.append(PAD); codewords.append(PAD);
} }
while (codewords.length() < capacity) { while (codewords.length() < capacity) {
codewords.append(randomize253State(PAD, codewords.length() + 1)); codewords.append(randomize253State(codewords.length() + 1));
} }
return context.getCodewords().toString(); return context.getCodewords().toString();
} }
static int lookAheadTest(CharSequence msg, int startpos, int currentMode) { static int lookAheadTest(CharSequence msg, int startpos, int currentMode) {
if (startpos >= msg.length()) { if (startpos >= msg.length()) {
return currentMode; return currentMode;
} }
float[] charCounts; float[] charCounts;
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 lines changed or added

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