2. encodeSegments in QrCode
3. variable name was wrong
pull/90/head
gerzees 5 years ago
parent ef3a6f7021
commit 6ca8ea40bc

@ -151,8 +151,8 @@ public final class QrCode {
Objects.requireNonNull(segments);
Objects.requireNonNull(errorCorrectionLevel);
final boolean isVersionInRange = MIN_VERSION <= minVersion && minVersion <= maxVersion && maxVersion <= MAX_VERSION;
final boolean isMaskValid = mask < -1 || mask > 7;
if (!isVersionInRange || isMaskValid)
final boolean isMaskOutOfRange = mask < -1 || mask > 7;
if (!isVersionInRange || isMaskOutOfRange)
throw new IllegalArgumentException("Invalid value");
@ -181,6 +181,7 @@ public final class QrCode {
return new QrCode(version, errorCorrectionLevel, dataCodewords, mask);
}
/*---- Private helper methods for encodeSegments ----*/
// Pack bits into bytes in big endian
private static byte[] bitBufferToCodewords(BitBuffer bitBuffer) {
@ -197,9 +198,6 @@ public final class QrCode {
bitBuffer.appendBits(padByte, 8);
}
/*---- Private helper methods for encodeSegments ----*/
// Add terminator and pad up to a byte if applicable
private static void addTerminator(BitBuffer bitBuffer, int dataCapacityBits) {
bitBuffer.appendBits(0, Math.min(4, dataCapacityBits - bitBuffer.bitLength()));

Loading…
Cancel
Save