C++: fix dormat BitArray quiet zone checking bug that was causing rampant false positives

also make zxing test app decode call a little cleaner.


git-svn-id: https://zxing.googlecode.com/svn/trunk@1566 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
flyashi 2010-08-26 14:46:31 +00:00
parent d26cfc7fd1
commit 84b6b3d57b
2 changed files with 3 additions and 3 deletions

View file

@ -90,9 +90,9 @@ bool BitArray::isRange(size_t start, size_t end, bool value) {
size_t lastWord = end >> logBits_;
for (size_t i = firstWord; i <= lastWord; i++) {
size_t firstBit = i > firstWord ? 0 : start & bitsMask_;
size_t lastBit = i < lastWord ? logBits_ : end & bitsMask_;
size_t lastBit = i < lastWord ? bitsPerWord_ - 1: end & bitsMask_;
unsigned int mask;
if (firstBit == 0 && lastBit == logBits_) {
if (firstBit == 0 && lastBit == bitsPerWord_ - 1) {
mask = numeric_limits<unsigned int>::max();
} else {
mask = 0;

View file

@ -54,7 +54,7 @@ static const int MAX_EXPECTED = 1024;
Ref<Result> decode(Ref<BinaryBitmap> image, DecodeHints hints) {
Ref<Reader> reader(new MultiFormatReader);
return Ref<Result> (new Result(*reader->decode(image, hints)));
return reader->decode(image, hints);
}