"Fossies" - the Fresh Open Source Software Archive  

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

C40Encoder.java  (zxing-zxing-3.4.0):C40Encoder.java  (zxing-zxing-3.4.1)
skipping to change at line 79 skipping to change at line 79
int count = buffer.length(); int count = buffer.length();
buffer.delete(count - lastCharSize, count); buffer.delete(count - lastCharSize, count);
context.pos--; context.pos--;
char c = context.getCurrentChar(); char c = context.getCurrentChar();
lastCharSize = encodeChar(c, removed); lastCharSize = encodeChar(c, removed);
context.resetSymbolInfo(); //Deal with possible reduction in symbol size context.resetSymbolInfo(); //Deal with possible reduction in symbol size
return lastCharSize; return lastCharSize;
} }
static void writeNextTriplet(EncoderContext context, StringBuilder buffer) { static void writeNextTriplet(EncoderContext context, StringBuilder buffer) {
context.writeCodewords(encodeToCodewords(buffer, 0)); context.writeCodewords(encodeToCodewords(buffer));
buffer.delete(0, 3); buffer.delete(0, 3);
} }
/** /**
* Handle "end of data" situations * Handle "end of data" situations
* *
* @param context the encoder context * @param context the encoder context
* @param buffer the buffer with the remaining encoded characters * @param buffer the buffer with the remaining encoded characters
*/ */
void handleEOD(EncoderContext context, StringBuilder buffer) { void handleEOD(EncoderContext context, StringBuilder buffer) {
skipping to change at line 171 skipping to change at line 171
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;
} }
sb.append("\1\u001e"); //Shift 2, Upper Shift sb.append("\1\u001e"); //Shift 2, Upper Shift
int len = 2; int len = 2;
len += encodeChar((char) (c - 128), sb); len += encodeChar((char) (c - 128), sb);
return len; return len;
} }
private static String encodeToCodewords(CharSequence sb, int startPos) { private static String encodeToCodewords(CharSequence sb) {
char c1 = sb.charAt(startPos); int v = (1600 * sb.charAt(0)) + (40 * sb.charAt(1)) + sb.charAt(2) + 1;
char c2 = sb.charAt(startPos + 1);
char c3 = sb.charAt(startPos + 2);
int v = (1600 * c1) + (40 * c2) + c3 + 1;
char cw1 = (char) (v / 256); char cw1 = (char) (v / 256);
char cw2 = (char) (v % 256); char cw2 = (char) (v % 256);
return new String(new char[] {cw1, cw2}); return new String(new char[] {cw1, cw2});
} }
} }
 End of changes. 2 change blocks. 
6 lines changed or deleted 3 lines changed or added

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