rss_expanded integration partial pass

This commit is contained in:
Henry Schimke
2022-12-16 17:11:55 -06:00
parent afc3ee8fa1
commit 6842cda149
9 changed files with 133 additions and 230 deletions

View File

@@ -14,6 +14,7 @@
* limitations under the License.
*/
use super::rss::expanded::RSSExpandedReader;
use super::rss::RSS14Reader;
use super::CodaBarReader;
use super::Code128Reader;
@@ -90,9 +91,9 @@ impl MultiFormatOneDReader {
if possibleFormats.contains(&BarcodeFormat::RSS_14) {
readers.push(Box::new(RSS14Reader::new()));
}
// if (possibleFormats.contains(&BarcodeFormat::RSS_EXPANDED)) {
// readers.add(new RSSExpandedReader());
// }
if possibleFormats.contains(&BarcodeFormat::RSS_EXPANDED) {
readers.push(Box::new(RSSExpandedReader::new()));
}
}
if readers.is_empty() {
readers.push(Box::new(MultiFormatUPCEANReader::new(hints)));
@@ -102,7 +103,7 @@ impl MultiFormatOneDReader {
readers.push(Box::new(Code128Reader {}));
readers.push(Box::new(ITFReader::default()));
readers.push(Box::new(RSS14Reader::new()));
// readers.push(new RSSExpandedReader());
readers.push(Box::new(RSSExpandedReader::new()));
}
Self(readers)

View File

@@ -500,7 +500,7 @@ impl<'a> GeneralAppIdDecoder<'_> {
}
let mut i = 0;
while i < 4 && pos < self.information.getSize() {
while i < 4 && i + pos < self.information.getSize() {
// for (int i = 0; i < 4 && i + pos < this.information.getSize(); ++i) {
if self.information.get(pos + i) {
return false;

View File

@@ -477,11 +477,12 @@ impl RSSExpandedReader {
// Remove all the rows that contains only specified pairs
fn removePartialRows(pairs: &[ExpandedPair], rows: &mut Vec<ExpandedRow>) {
for i in 0..rows.len() {
let row_search = rows.clone();
for i in 0..row_search.len() {
// for r in rows {
// for (Iterator<ExpandedRow> iterator = rows.iterator(); iterator.hasNext();) {
// ExpandedRow r = iterator.next();
let r = rows.get(i).unwrap();
let r = row_search.get(i).unwrap();
if r.getPairs().len() != pairs.len() {
let mut allFound = true;
for p in r.getPairs() {
@@ -600,7 +601,7 @@ impl RSSExpandedReader {
checksum %= 211;
let checkCharacterValue = 211 * (s - 4) + checksum;
let checkCharacterValue = (211 * (s as i64 - 4) + checksum as i64) as u32;
checkCharacterValue == checkCharacter.unwrap().getValue()
}