"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "core/src/main/java/com/google/zxing/aztec/encoder/BinaryShiftToken.java" between
zxing-zxing-3.4.1.tar.gz and zxing-zxing-3.5.0.tar.gz

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

BinaryShiftToken.java  (zxing-zxing-3.4.1):BinaryShiftToken.java  (zxing-zxing-3.5.0)
skipping to change at line 23 skipping to change at line 23
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.google.zxing.aztec.encoder; package com.google.zxing.aztec.encoder;
import com.google.zxing.common.BitArray; import com.google.zxing.common.BitArray;
final class BinaryShiftToken extends Token { final class BinaryShiftToken extends Token {
private final short binaryShiftStart; private final int binaryShiftStart;
private final short binaryShiftByteCount; private final int binaryShiftByteCount;
BinaryShiftToken(Token previous, BinaryShiftToken(Token previous,
int binaryShiftStart, int binaryShiftStart,
int binaryShiftByteCount) { int binaryShiftByteCount) {
super(previous); super(previous);
this.binaryShiftStart = (short) binaryShiftStart; this.binaryShiftStart = binaryShiftStart;
this.binaryShiftByteCount = (short) binaryShiftByteCount; this.binaryShiftByteCount = binaryShiftByteCount;
} }
@Override @Override
public void appendTo(BitArray bitArray, byte[] text) { public void appendTo(BitArray bitArray, byte[] text) {
for (int i = 0; i < binaryShiftByteCount; i++) { int bsbc = binaryShiftByteCount;
if (i == 0 || (i == 31 && binaryShiftByteCount <= 62)) { for (int i = 0; i < bsbc; i++) {
if (i == 0 || (i == 31 && bsbc <= 62)) {
// We need a header before the first character, and before // We need a header before the first character, and before
// character 31 when the total byte code is <= 62 // character 31 when the total byte code is <= 62
bitArray.appendBits(31, 5); // BINARY_SHIFT bitArray.appendBits(31, 5); // BINARY_SHIFT
if (binaryShiftByteCount > 62) { if (bsbc > 62) {
bitArray.appendBits(binaryShiftByteCount - 31, 16); bitArray.appendBits(bsbc - 31, 16);
} else if (i == 0) { } else if (i == 0) {
// 1 <= binaryShiftByteCode <= 62 // 1 <= binaryShiftByteCode <= 62
bitArray.appendBits(Math.min(binaryShiftByteCount, 31), 5); bitArray.appendBits(Math.min(bsbc, 31), 5);
} else { } else {
// 32 <= binaryShiftCount <= 62 and i == 31 // 32 <= binaryShiftCount <= 62 and i == 31
bitArray.appendBits(binaryShiftByteCount - 31, 5); bitArray.appendBits(bsbc - 31, 5);
} }
} }
bitArray.appendBits(text[binaryShiftStart + i], 8); bitArray.appendBits(text[binaryShiftStart + i], 8);
} }
} }
@Override @Override
public String toString() { public String toString() {
return "<" + binaryShiftStart + "::" + (binaryShiftStart + binaryShiftByteCo unt - 1) + '>'; return "<" + binaryShiftStart + "::" + (binaryShiftStart + binaryShiftByteCo unt - 1) + '>';
} }
 End of changes. 6 change blocks. 
10 lines changed or deleted 11 lines changed or added

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