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; return ((firstByte & 0x3F) << 8) | secondByte;
} else if ((firstByte & 0xE0) == 0xC0) { } else if ((firstByte & 0xE0) == 0xC0) {
// three bytes // three bytes
int secondByte = bits.readBits(8); int secondThirdBytes = bits.readBits(16);
int thirdByte = bits.readBits(8); return ((firstByte & 0x1F) << 16) | secondThirdBytes;
return ((firstByte & 0x1F) << 16) | (secondByte << 8) | thirdByte;
} }
// FIXME: What should we return here? throw new IllegalArgumentException("Bad ECI bits starting with byte " + firstByte);
return 0;
} }
private static void decodeKanjiSegment(BitSource bits, 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} * count of characters that will follow encoded in this {@link Mode}
*/ */
int getCharacterCountBits(Version version) { int getCharacterCountBits(Version version) {
if (this == ECI) { if (this.equals(ECI)) {
throw new UnsupportedOperationException("Character count doesn't apply to ECI mode"); throw new IllegalArgumentException("Character count doesn't apply to ECI mode");
} }
int number = version.getVersionNumber(); int number = version.getVersionNumber();
int offset; int offset;