Correct a few more things about ECI parsing

git-svn-id: https://zxing.googlecode.com/svn/trunk@451 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2008-06-19 16:49:04 +00:00
parent 466130bcf0
commit 24e31c6a9a
2 changed files with 5 additions and 7 deletions

View file

@ -115,12 +115,10 @@ final class DecodedBitStreamParser {
return ((firstByte & 0x3F) << 8) | secondByte;
} else if ((firstByte & 0xE0) == 0xC0) {
// three bytes
int secondByte = bits.readBits(8);
int thirdByte = bits.readBits(8);
return ((firstByte & 0x1F) << 16) | (secondByte << 8) | thirdByte;
int secondThirdBytes = bits.readBits(16);
return ((firstByte & 0x1F) << 16) | secondThirdBytes;
}
// FIXME: What should we return here?
return 0;
throw new IllegalArgumentException("Bad ECI bits starting with byte " + firstByte);
}
private static void decodeKanjiSegment(BitSource bits,

View file

@ -71,8 +71,8 @@ final class Mode {
* count of characters that will follow encoded in this {@link Mode}
*/
int getCharacterCountBits(Version version) {
if (this == ECI) {
throw new UnsupportedOperationException("Character count doesn't apply to ECI mode");
if (this.equals(ECI)) {
throw new IllegalArgumentException("Character count doesn't apply to ECI mode");
}
int number = version.getVersionNumber();
int offset;