mirror of
https://github.com/zxing/zxing.git
synced 2024-11-10 13:04:05 -08:00
Issue 509
git-svn-id: https://zxing.googlecode.com/svn/trunk@1525 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
00322f3873
commit
b868c6e3ae
|
@ -84,7 +84,7 @@ Version *BitMatrixParser::readVersion() {
|
|||
return parsedVersion_;
|
||||
}
|
||||
|
||||
size_t dimension = bitMatrix_->getDimension();
|
||||
int dimension = bitMatrix_->getDimension();
|
||||
|
||||
int provisionalVersion = (dimension - 17) >> 2;
|
||||
if (provisionalVersion <= 6) {
|
||||
|
@ -101,7 +101,7 @@ Version *BitMatrixParser::readVersion() {
|
|||
}
|
||||
|
||||
parsedVersion_ = Version::decodeVersionInformation(versionBits);
|
||||
if (parsedVersion_ != 0) {
|
||||
if (parsedVersion_ != 0 && parsedVersion_->getDimensionForVersion() == dimension) {
|
||||
return parsedVersion_;
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ Version *BitMatrixParser::readVersion() {
|
|||
}
|
||||
|
||||
parsedVersion_ = Version::decodeVersionInformation(versionBits);
|
||||
if (parsedVersion_ != 0) {
|
||||
if (parsedVersion_ != 0 && parsedVersion_->getDimensionForVersion() == dimension) {
|
||||
return parsedVersion_;
|
||||
}
|
||||
throw ReaderException("Could not decode version");
|
||||
|
|
|
@ -53,6 +53,9 @@ Ref<DetectorResult> Detector::detect(DecodeHints const& hints) {
|
|||
Ref<FinderPattern> bottomLeft(info->getBottomLeft());
|
||||
|
||||
float moduleSize = calculateModuleSize(topLeft, topRight, bottomLeft);
|
||||
if (moduleSize < 1.0f) {
|
||||
throw zxing::ReaderException("bad module size");
|
||||
}
|
||||
int dimension = computeDimension(topLeft, topRight, bottomLeft, moduleSize);
|
||||
Version *provisionalVersion = Version::getProvisionalVersionForDimension(dimension);
|
||||
int modulesBetweenFPCenters = provisionalVersion->getDimensionForVersion() - 7;
|
||||
|
|
Loading…
Reference in a new issue