mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
C++ changes to parallel r1837
git-svn-id: https://zxing.googlecode.com/svn/trunk@1840 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
395cdb0f24
commit
776e9b6a06
|
@ -144,6 +144,9 @@ namespace zxing {
|
|||
// Read three digits at a time
|
||||
while (count >= 3) {
|
||||
// Each 10 bits encodes three digits
|
||||
if (bits->available() < 10) {
|
||||
throw ReaderException("format exception");
|
||||
}
|
||||
int threeDigitsBits = bits->readBits(10);
|
||||
if (threeDigitsBits >= 1000) {
|
||||
ostringstream s;
|
||||
|
@ -157,6 +160,9 @@ namespace zxing {
|
|||
count -= 3;
|
||||
}
|
||||
if (count == 2) {
|
||||
if (bits->available() < 7) {
|
||||
throw ReaderException("format exception");
|
||||
}
|
||||
// Two digits left over to read, encoded in 7 bits
|
||||
int twoDigitsBits = bits->readBits(7);
|
||||
if (twoDigitsBits >= 100) {
|
||||
|
@ -168,6 +174,9 @@ namespace zxing {
|
|||
bytes[i++] = ALPHANUMERIC_CHARS[twoDigitsBits / 10];
|
||||
bytes[i++] = ALPHANUMERIC_CHARS[twoDigitsBits % 10];
|
||||
} else if (count == 1) {
|
||||
if (bits->available() < 4) {
|
||||
throw ReaderException("format exception");
|
||||
}
|
||||
// One digit left over to read
|
||||
int digitBits = bits->readBits(4);
|
||||
if (digitBits >= 10) {
|
||||
|
|
Loading…
Reference in a new issue