mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-28 05:12:34 +00:00
located issue with test 2/14
This commit is contained in:
@@ -107,18 +107,23 @@ impl DetectionRXingResult {
|
|||||||
for barcodeColumn in 1..(self.barcodeColumnCount + 1) {
|
for barcodeColumn in 1..(self.barcodeColumnCount + 1) {
|
||||||
// for (int barcodeColumn = 1; barcodeColumn < barcodeColumnCount + 1; barcodeColumn++) {
|
// for (int barcodeColumn = 1; barcodeColumn < barcodeColumnCount + 1; barcodeColumn++) {
|
||||||
if self.detectionRXingResultColumns[barcodeColumn].is_some() {
|
if self.detectionRXingResultColumns[barcodeColumn].is_some() {
|
||||||
let codewords = self.detectionRXingResultColumns[barcodeColumn]
|
let codewords_len = self.detectionRXingResultColumns[barcodeColumn]
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.getCodewords();
|
.getCodewords()
|
||||||
for codewordsRow in 0..codewords.len() {
|
.len();
|
||||||
|
for codewordsRow in 0..codewords_len {
|
||||||
// for (int codewordsRow = 0; codewordsRow < codewords.length; codewordsRow++) {
|
// for (int codewordsRow = 0; codewordsRow < codewords.length; codewordsRow++) {
|
||||||
if let Some(cw_row) = codewords[codewordsRow] {
|
if let Some(cw_row) = self.detectionRXingResultColumns[barcodeColumn]
|
||||||
|
.as_ref()
|
||||||
|
.unwrap()
|
||||||
|
.getCodewords()[codewordsRow]
|
||||||
|
{
|
||||||
if !cw_row.hasValidRowNumber() {
|
if !cw_row.hasValidRowNumber() {
|
||||||
self.adjustRowNumbersWithCodewords(
|
self.adjustRowNumbersWithCodewords(
|
||||||
barcodeColumn,
|
barcodeColumn,
|
||||||
codewordsRow,
|
codewordsRow,
|
||||||
codewords,
|
barcodeColumn,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -481,17 +486,28 @@ impl DetectionRXingResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn adjustRowNumbersWithCodewords(
|
fn adjustRowNumbersWithCodewords(
|
||||||
&self,
|
&mut self,
|
||||||
barcodeColumn: usize,
|
barcodeColumn: usize,
|
||||||
codewordsRow: usize,
|
codewordsRow: usize,
|
||||||
codewords: &[Option<Codeword>],
|
codewordsColumn: usize,
|
||||||
|
// codewords: &mut [Option<Codeword>],
|
||||||
) {
|
) {
|
||||||
let mut codeword = codewords[codewordsRow];
|
let codewords = self.detectionRXingResultColumns[codewordsColumn]
|
||||||
|
.as_mut()
|
||||||
|
.unwrap()
|
||||||
|
.getCodewordsMut();
|
||||||
|
|
||||||
|
let codewords_len = codewords.len();
|
||||||
|
|
||||||
|
let codeword = &mut codewords[codewordsRow];
|
||||||
|
|
||||||
let previousColumnCodewords = self.detectionRXingResultColumns[barcodeColumn - 1]
|
let previousColumnCodewords = self.detectionRXingResultColumns[barcodeColumn - 1]
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.getCodewords();
|
.getCodewords();
|
||||||
|
|
||||||
let mut nextColumnCodewords = previousColumnCodewords;
|
let mut nextColumnCodewords = previousColumnCodewords;
|
||||||
|
|
||||||
if self.detectionRXingResultColumns[barcodeColumn + 1].is_some() {
|
if self.detectionRXingResultColumns[barcodeColumn + 1].is_some() {
|
||||||
nextColumnCodewords = self.detectionRXingResultColumns[barcodeColumn + 1]
|
nextColumnCodewords = self.detectionRXingResultColumns[barcodeColumn + 1]
|
||||||
.as_ref()
|
.as_ref()
|
||||||
@@ -517,12 +533,12 @@ impl DetectionRXingResult {
|
|||||||
otherCodewords[10] = previousColumnCodewords[codewordsRow - 2];
|
otherCodewords[10] = previousColumnCodewords[codewordsRow - 2];
|
||||||
otherCodewords[11] = nextColumnCodewords[codewordsRow - 2];
|
otherCodewords[11] = nextColumnCodewords[codewordsRow - 2];
|
||||||
}
|
}
|
||||||
if codewordsRow < codewords.len() - 1 {
|
if codewordsRow < codewords_len - 1 {
|
||||||
otherCodewords[1] = codewords[codewordsRow + 1];
|
otherCodewords[1] = codewords[codewordsRow + 1];
|
||||||
otherCodewords[6] = previousColumnCodewords[codewordsRow + 1];
|
otherCodewords[6] = previousColumnCodewords[codewordsRow + 1];
|
||||||
otherCodewords[7] = nextColumnCodewords[codewordsRow + 1];
|
otherCodewords[7] = nextColumnCodewords[codewordsRow + 1];
|
||||||
}
|
}
|
||||||
if codewordsRow < codewords.len() - 2 {
|
if codewordsRow < codewords_len - 2 {
|
||||||
otherCodewords[9] = codewords[codewordsRow + 2];
|
otherCodewords[9] = codewords[codewordsRow + 2];
|
||||||
otherCodewords[12] = previousColumnCodewords[codewordsRow + 2];
|
otherCodewords[12] = previousColumnCodewords[codewordsRow + 2];
|
||||||
otherCodewords[13] = nextColumnCodewords[codewordsRow + 2];
|
otherCodewords[13] = nextColumnCodewords[codewordsRow + 2];
|
||||||
|
|||||||
@@ -160,9 +160,9 @@ impl PDF417Reader {
|
|||||||
Ok(results)
|
Ok(results)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn getMaxWidth(p1: &Option<RXingResultPoint>, p2: &Option<RXingResultPoint>) -> u32 {
|
fn getMaxWidth(p1: &Option<RXingResultPoint>, p2: &Option<RXingResultPoint>) -> u64 {
|
||||||
if let (Some(p1), Some(p2)) = (p1, p2) {
|
if let (Some(p1), Some(p2)) = (p1, p2) {
|
||||||
(p1.getX() - p2.getX()).abs() as u32
|
(p1.getX() - p2.getX()).abs() as u64
|
||||||
} else {
|
} else {
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
@@ -172,11 +172,11 @@ impl PDF417Reader {
|
|||||||
// return (int) Math.abs(p1.getX() - p2.getX());
|
// return (int) Math.abs(p1.getX() - p2.getX());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn getMinWidth(p1: &Option<RXingResultPoint>, p2: &Option<RXingResultPoint>) -> u32 {
|
fn getMinWidth(p1: &Option<RXingResultPoint>, p2: &Option<RXingResultPoint>) -> u64 {
|
||||||
if let (Some(p1), Some(p2)) = (p1, p2) {
|
if let (Some(p1), Some(p2)) = (p1, p2) {
|
||||||
(p1.getX() - p2.getX()).abs() as u32
|
(p1.getX() - p2.getX()).abs() as u64
|
||||||
} else {
|
} else {
|
||||||
u32::MAX
|
u32::MAX as u64
|
||||||
}
|
}
|
||||||
// if (p1 == null || p2 == null) {
|
// if (p1 == null || p2 == null) {
|
||||||
// return Integer.MAX_VALUE;
|
// return Integer.MAX_VALUE;
|
||||||
@@ -187,24 +187,24 @@ impl PDF417Reader {
|
|||||||
fn getMaxCodewordWidth(p: &[Option<RXingResultPoint>]) -> u32 {
|
fn getMaxCodewordWidth(p: &[Option<RXingResultPoint>]) -> u32 {
|
||||||
Self::getMaxWidth(&p[0], &p[4])
|
Self::getMaxWidth(&p[0], &p[4])
|
||||||
.max(
|
.max(
|
||||||
Self::getMaxWidth(&p[6], &p[2]) * pdf_417_common::MODULES_IN_CODEWORD
|
Self::getMaxWidth(&p[6], &p[2]) * pdf_417_common::MODULES_IN_CODEWORD as u64
|
||||||
/ pdf_417_common::MODULES_IN_STOP_PATTERN,
|
/ pdf_417_common::MODULES_IN_STOP_PATTERN as u64,
|
||||||
)
|
)
|
||||||
.max(Self::getMaxWidth(&p[1], &p[5]).max(
|
.max(Self::getMaxWidth(&p[1], &p[5]).max(
|
||||||
Self::getMaxWidth(&p[7], &p[3]) * pdf_417_common::MODULES_IN_CODEWORD
|
Self::getMaxWidth(&p[7], &p[3]) * pdf_417_common::MODULES_IN_CODEWORD as u64
|
||||||
/ pdf_417_common::MODULES_IN_STOP_PATTERN,
|
/ pdf_417_common::MODULES_IN_STOP_PATTERN as u64,
|
||||||
))
|
)) as u32
|
||||||
}
|
}
|
||||||
|
|
||||||
fn getMinCodewordWidth(p: &[Option<RXingResultPoint>]) -> u32 {
|
fn getMinCodewordWidth(p: &[Option<RXingResultPoint>]) -> u32 {
|
||||||
Self::getMinWidth(&p[0], &p[4])
|
Self::getMinWidth(&p[0], &p[4])
|
||||||
.min(
|
.min(
|
||||||
Self::getMinWidth(&p[6], &p[2]) * pdf_417_common::MODULES_IN_CODEWORD
|
Self::getMinWidth(&p[6], &p[2]) * pdf_417_common::MODULES_IN_CODEWORD as u64
|
||||||
/ pdf_417_common::MODULES_IN_STOP_PATTERN,
|
/ pdf_417_common::MODULES_IN_STOP_PATTERN as u64,
|
||||||
)
|
)
|
||||||
.min(Self::getMinWidth(&p[1], &p[5]).min(
|
.min(Self::getMinWidth(&p[1], &p[5]).min(
|
||||||
Self::getMinWidth(&p[7], &p[3]) * pdf_417_common::MODULES_IN_CODEWORD
|
Self::getMinWidth(&p[7], &p[3]) * pdf_417_common::MODULES_IN_CODEWORD as u64
|
||||||
/ pdf_417_common::MODULES_IN_STOP_PATTERN,
|
/ pdf_417_common::MODULES_IN_STOP_PATTERN as u64,
|
||||||
))
|
)) as u32
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user