cleanup more warnings and deprecated function use

This commit is contained in:
Henry Schimke
2022-12-30 17:00:35 -06:00
parent b383d7b0d4
commit 29a4040f2d
38 changed files with 158 additions and 133 deletions

View File

@@ -256,9 +256,11 @@ impl CalendarParsedRXingResult {
// ? DateFormat.getDateInstance(DateFormat.MEDIUM) // ? DateFormat.getDateInstance(DateFormat.MEDIUM)
// : DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM); // : DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
// return format.format(date); // return format.format(date);
NaiveDateTime::from_timestamp(date, 0) if let Some(dtm) = NaiveDateTime::from_timestamp_opt(date, 0) {
.format(format_string) dtm.format(format_string).to_string()
.to_string() } else {
String::from("")
}
} }
fn parseDurationMS(durationString: &str) -> i64 { fn parseDurationMS(durationString: &str) -> i64 {

View File

@@ -250,8 +250,10 @@ fn assertEqualOrNaN(expected: f64, actual: f64) {
} }
fn format_date_string(timestamp: i64, format_string: &str) -> String { fn format_date_string(timestamp: i64, format_string: &str) -> String {
NaiveDateTime::from_timestamp(timestamp, 0) if let Some(dtm) = NaiveDateTime::from_timestamp_opt(timestamp, 0) {
.format(format_string) dtm.format(format_string).to_string()
.to_string() } else {
String::from("")
}
// DateTime::from(timestamp,0).with_timezone(Utc).format(format_string).to_string() // DateTime::from(timestamp,0).with_timezone(Utc).format(format_string).to_string()
} }

View File

@@ -36,9 +36,7 @@ use std::collections::HashMap;
use crate::BarcodeFormat; use crate::BarcodeFormat;
use super::{ use super::{ExpandedProductParsedRXingResult, ParsedClientResult, ResultParser};
ExpandedProductParsedRXingResult, ParsedClientResult, ResultParser,
};
/** /**
* Parses strings of digits that represent a RSS Extended code. * Parses strings of digits that represent a RSS Extended code.

View File

@@ -27,7 +27,7 @@
// import java.util.Locale; // import java.util.Locale;
// import java.util.TimeZone; // import java.util.TimeZone;
use chrono::{TimeZone, Utc}; use chrono::{LocalResult, TimeZone, Utc};
use crate::{client::result::ParsedRXingResult, BarcodeFormat, RXingResult}; use crate::{client::result::ParsedRXingResult, BarcodeFormat, RXingResult};
@@ -500,8 +500,11 @@ fn test_vevent() {
} }
fn format_date(year: i32, month: u32, day: u32) -> String { fn format_date(year: i32, month: u32, day: u32) -> String {
let dtm = Utc.ymd(year, month, day); if let LocalResult::Single(dtm) = Utc.with_ymd_and_hms(year, month, day, 0, 0, 0) {
dtm.format("%F").to_string() dtm.format("%F").to_string()
} else {
String::from("")
}
// Calendar cal = Calendar.getInstance(); // Calendar cal = Calendar.getInstance();
// cal.clear(); // cal.clear();
// cal.set(year, month - 1, day); // cal.set(year, month - 1, day);
@@ -509,8 +512,13 @@ fn format_date(year: i32, month: u32, day: u32) -> String {
} }
fn format_time(year: i32, month: u32, day: u32, hour: u32, min: u32, sec: u32) -> String { fn format_time(year: i32, month: u32, day: u32, hour: u32, min: u32, sec: u32) -> String {
let dtm = Utc.ymd(year, month, day).and_hms(hour, min, sec); if let LocalResult::Single(dtm) = Utc.with_ymd_and_hms(year, month, day, hour, min, sec) {
dtm.format("%c").to_string() //Utc.ymd(year, month, day).and_hms(hour, min, sec);
dtm.format("%c").to_string()
} else {
String::from("")
}
// Calendar cal = Calendar.getInstance(); // Calendar cal = Calendar.getInstance();
// cal.clear(); // cal.clear();
// cal.set(year, month - 1, day, hour, min, sec); // cal.set(year, month - 1, day, hour, min, sec);

View File

@@ -81,6 +81,7 @@ impl BitMatrix {
// bits = new int[rowSize * height]; // bits = new int[rowSize * height];
} }
#[allow(dead_code)]
fn with_all_data(&self, width: u32, height: u32, rowSize: usize, bits: Vec<u32>) -> Self { fn with_all_data(&self, width: u32, height: u32, rowSize: usize, bits: Vec<u32>) -> Self {
Self { Self {
width, width,
@@ -168,7 +169,7 @@ impl BitMatrix {
if bitsPos > rowStartPos { if bitsPos > rowStartPos {
//if rowLength == -1 { //if rowLength == -1 {
if first_run { if first_run {
first_run = false; // first_run = false;
rowLength = bitsPos - rowStartPos; rowLength = bitsPos - rowStartPos;
} else if bitsPos - rowStartPos != rowLength { } else if bitsPos - rowStartPos != rowLength {
return Err(Exceptions::IllegalArgumentException( return Err(Exceptions::IllegalArgumentException(

View File

@@ -224,6 +224,7 @@ impl DefaultPlacement {
self.module(1, self.numcols as isize - 1, pos, 8); self.module(1, self.numcols as isize - 1, pos, 8);
} }
#[allow(dead_code)]
fn toBitFieldStringArray(&self) -> Vec<String> { fn toBitFieldStringArray(&self) -> Vec<String> {
let bits = self.getBits(); let bits = self.getBits();
let numrows = self.getNumrows(); let numrows = self.getNumrows();

View File

@@ -20,7 +20,6 @@ use crate::{Dimension, Exceptions};
use super::{SymbolInfo, SymbolInfoLookup, SymbolShapeHint}; use super::{SymbolInfo, SymbolInfoLookup, SymbolShapeHint};
use encoding::{self, EncodingRef}; use encoding::{self, EncodingRef};
use unicode_segmentation::UnicodeSegmentation;
const ISO_8859_1_ENCODER: EncodingRef = encoding::all::ISO_8859_1; const ISO_8859_1_ENCODER: EncodingRef = encoding::all::ISO_8859_1;

View File

@@ -24,6 +24,7 @@ use super::{
ASCIIEncoder, Base256Encoder, C40Encoder, EdifactEncoder, Encoder, EncoderContext, ASCIIEncoder, Base256Encoder, C40Encoder, EdifactEncoder, Encoder, EncoderContext,
SymbolInfoLookup, SymbolShapeHint, TextEncoder, X12Encoder, SymbolInfoLookup, SymbolShapeHint, TextEncoder, X12Encoder,
}; };
#[allow(dead_code)]
const DEFAULT_ENCODING: EncodingRef = encoding::all::ISO_8859_1; const DEFAULT_ENCODING: EncodingRef = encoding::all::ISO_8859_1;
/** /**

View File

@@ -354,13 +354,12 @@ impl<'a> SymbolInfoLookup<'a> {
} }
mod tests { mod tests {
use crate::{
datamatrix::encoder::{SymbolInfo, SymbolShapeHint}, use crate::{datamatrix::encoder::SymbolShapeHint, Dimension};
Dimension,
};
use super::SymbolInfoLookup; use super::SymbolInfoLookup;
#[allow(dead_code)]
const LOOKUP: SymbolInfoLookup = SymbolInfoLookup::new(); const LOOKUP: SymbolInfoLookup = SymbolInfoLookup::new();
/** /**

View File

@@ -17,8 +17,8 @@
use std::{collections::HashSet, path::PathBuf, rc::Rc}; use std::{collections::HashSet, path::PathBuf, rc::Rc};
use crate::{ use crate::{
common::HybridBinarizer, BarcodeFormat, BinaryBitmap, common::HybridBinarizer, BarcodeFormat, BinaryBitmap, BufferedImageLuminanceSource,
BufferedImageLuminanceSource, MultiFormatReader, MultiFormatReader,
}; };
use super::{GenericMultipleBarcodeReader, MultipleBarcodeReader}; use super::{GenericMultipleBarcodeReader, MultipleBarcodeReader};

View File

@@ -15,7 +15,7 @@
*/ */
use crate::{ use crate::{
common::{BitMatrix}, common::BitMatrix,
qrcode::detector::{Detector, QRCodeDetectorResult}, qrcode::detector::{Detector, QRCodeDetectorResult},
DecodeHintType, DecodeHintValue, DecodingHintDictionary, Exceptions, DecodeHintType, DecodeHintValue, DecodingHintDictionary, Exceptions,
}; };

View File

@@ -218,11 +218,7 @@ impl Code93Writer {
*/ */
#[cfg(test)] #[cfg(test)]
mod Code93WriterTestCase { mod Code93WriterTestCase {
use crate::{ use crate::{common::BitMatrixTestCase, oned::Code93Writer, BarcodeFormat, Writer};
common::BitMatrixTestCase,
oned::{Code93Writer},
BarcodeFormat, Writer,
};
#[test] #[test]
fn testEncode() { fn testEncode() {

View File

@@ -22,9 +22,9 @@ use crate::Reader;
use super::EAN13Reader; use super::EAN13Reader;
use super::EAN8Reader; use super::EAN8Reader;
use super::STAND_IN;
use super::UPCAReader; use super::UPCAReader;
use super::UPCEReader; use super::UPCEReader;
use super::STAND_IN;
use super::{OneDReader, UPCEANReader}; use super::{OneDReader, UPCEANReader};
/** /**

View File

@@ -24,44 +24,62 @@
* http://www.piramidepse.com/ * http://www.piramidepse.com/
*/ */
use crate::oned::rss::expanded::{ use crate::oned::rss::expanded::{binary_util, decoders::abstract_expanded_decoder::createDecoder};
binary_util,
decoders::{abstract_expanded_decoder::createDecoder, AbstractExpandedDecoder},
};
/** /**
* @author Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) * @author Pablo Orduña, University of Deusto (pablo.orduna@deusto.es)
*/ */
pub const numeric10: &str = "..X..XX"; #[allow(dead_code)]
pub const numeric12: &str = "..X.X.X"; pub const NUMERIC10: &str = "..X..XX";
pub const numeric1FNC1: &str = "..XXX.X"; #[allow(dead_code)]
pub const NUMERIC12: &str = "..X.X.X";
#[allow(dead_code)]
pub const NUMERIC1_FNC1: &str = "..XXX.X";
// static final String numericFNC11 = "XXX.XXX"; // static final String numericFNC11 = "XXX.XXX";
pub const numeric2alpha: &str = "...."; #[allow(dead_code)]
pub const NUMERIC2ALPHA: &str = "....";
pub const alphaA: &str = "X....."; #[allow(dead_code)]
pub const alphaFNC1: &str = ".XXXX"; pub const ALPHA_A: &str = "X.....";
pub const alpha2numeric: &str = "..."; #[allow(dead_code)]
pub const alpha2isoiec646: &str = "..X.."; pub const ALPHA_FNC1: &str = ".XXXX";
#[allow(dead_code)]
pub const ALPHA2NUMERIC: &str = "...";
#[allow(dead_code)]
pub const ALPHA2ISOIEC646: &str = "..X..";
pub const i646B: &str = "X.....X"; #[allow(dead_code)]
pub const i646C: &str = "X....X."; pub const I646_B: &str = "X.....X";
pub const i646FNC1: &str = ".XXXX"; #[allow(dead_code)]
pub const isoiec6462alpha: &str = "..X.."; pub const I646_C: &str = "X....X.";
#[allow(dead_code)]
pub const I646_FNC1: &str = ".XXXX";
#[allow(dead_code)]
pub const ISOIEC6462ALPHA: &str = "..X..";
pub const compressedGtin900123456798908: &str = ".........X..XXX.X.X.X...XX.XXXXX.XXXX.X."; #[allow(dead_code)]
pub const compressedGtin900000000000008: &str = "........................................"; pub const COMPRESSED_GTIN900123456798908: &str = ".........X..XXX.X.X.X...XX.XXXXX.XXXX.X.";
#[allow(dead_code)]
pub const COMPRESSED_GTIN900000000000008: &str = "........................................";
pub const compressed15bitWeight1750: &str = "....XX.XX.X.XX."; #[allow(dead_code)]
pub const compressed15bitWeight11750: &str = ".X.XX.XXXX..XX."; pub const COMPRESSED15BIT_WEIGHT1750: &str = "....XX.XX.X.XX.";
pub const compressed15bitWeight0: &str = "..............."; #[allow(dead_code)]
pub const COMPRESSED15BIT_WEIGHT11750: &str = ".X.XX.XXXX..XX.";
#[allow(dead_code)]
pub const COMPRESSED15BIT_WEIGHT0: &str = "...............";
pub const compressed20bitWeight1750: &str = ".........XX.XX.X.XX."; #[allow(dead_code)]
pub const COMPRESSED20BIT_WEIGHT1750: &str = ".........XX.XX.X.XX.";
pub const compressedDateMarch12th2010: &str = "....XXXX.X..XX.."; #[allow(dead_code)]
pub const compressedDateEnd: &str = "X..X.XX........."; pub const COMPRESSED_DATE_MARCH12TH2010: &str = "....XXXX.X..XX..";
#[allow(dead_code)]
pub const COMPRESSED_DATE_END: &str = "X..X.XX.........";
#[allow(dead_code)]
pub fn assertCorrectBinaryString(binaryString: &str, expectedNumber: &str) { pub fn assertCorrectBinaryString(binaryString: &str, expectedNumber: &str) {
let binary = binary_util::buildBitArrayFromStringWithoutSpaces(binaryString).expect("built"); let binary = binary_util::buildBitArrayFromStringWithoutSpaces(binaryString).expect("built");

View File

@@ -84,7 +84,7 @@ mod AI013103DecoderTest {
fn test0131031() { fn test0131031() {
let data = format!( let data = format!(
"{}{}{}", "{}{}{}",
HEADER, compressedGtin900123456798908, compressed15bitWeight1750 HEADER, COMPRESSED_GTIN900123456798908, COMPRESSED15BIT_WEIGHT1750
); );
let expected = "(01)90012345678908(3103)001750"; let expected = "(01)90012345678908(3103)001750";
assertCorrectBinaryString(&data, expected); assertCorrectBinaryString(&data, expected);
@@ -94,7 +94,7 @@ mod AI013103DecoderTest {
fn test0131032() { fn test0131032() {
let data = format!( let data = format!(
"{}{}{}", "{}{}{}",
HEADER, compressedGtin900000000000008, compressed15bitWeight0 HEADER, COMPRESSED_GTIN900000000000008, COMPRESSED15BIT_WEIGHT0
); );
let expected = "(01)90000000000003(3103)000000"; let expected = "(01)90000000000003(3103)000000";
assertCorrectBinaryString(&data, expected); assertCorrectBinaryString(&data, expected);
@@ -105,7 +105,7 @@ mod AI013103DecoderTest {
fn test013103invalid() { fn test013103invalid() {
let data = format!( let data = format!(
"{}{}{}..", "{}{}{}..",
HEADER, compressedGtin900123456798908, compressed15bitWeight1750 HEADER, COMPRESSED_GTIN900123456798908, COMPRESSED15BIT_WEIGHT1750
); );
assertCorrectBinaryString(&data, ""); assertCorrectBinaryString(&data, "");
} }

View File

@@ -36,7 +36,7 @@ const HEADER: &str = "..X.X";
fn test0132021() { fn test0132021() {
let data = format!( let data = format!(
"{}{}{}", "{}{}{}",
HEADER, compressedGtin900123456798908, compressed15bitWeight1750 HEADER, COMPRESSED_GTIN900123456798908, COMPRESSED15BIT_WEIGHT1750
); );
let expected = "(01)90012345678908(3202)001750"; let expected = "(01)90012345678908(3202)001750";
@@ -47,7 +47,7 @@ fn test0132021() {
fn test0132031() { fn test0132031() {
let data = format!( let data = format!(
"{}{}{}", "{}{}{}",
HEADER, compressedGtin900123456798908, compressed15bitWeight11750 HEADER, COMPRESSED_GTIN900123456798908, COMPRESSED15BIT_WEIGHT11750
); );
let expected = "(01)90012345678908(3203)001750"; let expected = "(01)90012345678908(3203)001750";

View File

@@ -153,9 +153,9 @@ mod AI013X0X1XDecoderTest {
let data = format!( let data = format!(
"{}{}{}{}", "{}{}{}{}",
HEADER310X11, HEADER310X11,
compressedGtin900123456798908, COMPRESSED_GTIN900123456798908,
compressed20bitWeight1750, COMPRESSED20BIT_WEIGHT1750,
compressedDateEnd COMPRESSED_DATE_END
); );
let expected = "(01)90012345678908(3100)001750"; let expected = "(01)90012345678908(3100)001750";
@@ -167,9 +167,9 @@ mod AI013X0X1XDecoderTest {
let data = format!( let data = format!(
"{}{}{}{}", "{}{}{}{}",
HEADER310X11, HEADER310X11,
compressedGtin900123456798908, COMPRESSED_GTIN900123456798908,
compressed20bitWeight1750, COMPRESSED20BIT_WEIGHT1750,
compressedDateMarch12th2010 COMPRESSED_DATE_MARCH12TH2010
); );
let expected = "(01)90012345678908(3100)001750(11)100312"; let expected = "(01)90012345678908(3100)001750(11)100312";
@@ -181,9 +181,9 @@ mod AI013X0X1XDecoderTest {
let data = format!( let data = format!(
"{}{}{}{}", "{}{}{}{}",
HEADER320X11, HEADER320X11,
compressedGtin900123456798908, COMPRESSED_GTIN900123456798908,
compressed20bitWeight1750, COMPRESSED20BIT_WEIGHT1750,
compressedDateMarch12th2010 COMPRESSED_DATE_MARCH12TH2010
); );
let expected = "(01)90012345678908(3200)001750(11)100312"; let expected = "(01)90012345678908(3200)001750(11)100312";
@@ -195,9 +195,9 @@ mod AI013X0X1XDecoderTest {
let data = format!( let data = format!(
"{}{}{}{}", "{}{}{}{}",
HEADER310X13, HEADER310X13,
compressedGtin900123456798908, COMPRESSED_GTIN900123456798908,
compressed20bitWeight1750, COMPRESSED20BIT_WEIGHT1750,
compressedDateMarch12th2010 COMPRESSED_DATE_MARCH12TH2010
); );
let expected = "(01)90012345678908(3100)001750(13)100312"; let expected = "(01)90012345678908(3100)001750(13)100312";
@@ -209,9 +209,9 @@ mod AI013X0X1XDecoderTest {
let data = format!( let data = format!(
"{}{}{}{}", "{}{}{}{}",
HEADER320X13, HEADER320X13,
compressedGtin900123456798908, COMPRESSED_GTIN900123456798908,
compressed20bitWeight1750, COMPRESSED20BIT_WEIGHT1750,
compressedDateMarch12th2010 COMPRESSED_DATE_MARCH12TH2010
); );
let expected = "(01)90012345678908(3200)001750(13)100312"; let expected = "(01)90012345678908(3200)001750(13)100312";
@@ -223,9 +223,9 @@ mod AI013X0X1XDecoderTest {
let data = format!( let data = format!(
"{}{}{}{}", "{}{}{}{}",
HEADER310X15, HEADER310X15,
compressedGtin900123456798908, COMPRESSED_GTIN900123456798908,
compressed20bitWeight1750, COMPRESSED20BIT_WEIGHT1750,
compressedDateMarch12th2010 COMPRESSED_DATE_MARCH12TH2010
); );
let expected = "(01)90012345678908(3100)001750(15)100312"; let expected = "(01)90012345678908(3100)001750(15)100312";
@@ -237,9 +237,9 @@ mod AI013X0X1XDecoderTest {
let data = format!( let data = format!(
"{}{}{}{}", "{}{}{}{}",
HEADER320X15, HEADER320X15,
compressedGtin900123456798908, COMPRESSED_GTIN900123456798908,
compressed20bitWeight1750, COMPRESSED20BIT_WEIGHT1750,
compressedDateMarch12th2010 COMPRESSED_DATE_MARCH12TH2010
); );
let expected = "(01)90012345678908(3200)001750(15)100312"; let expected = "(01)90012345678908(3200)001750(15)100312";
@@ -251,9 +251,9 @@ mod AI013X0X1XDecoderTest {
let data = format!( let data = format!(
"{}{}{}{}", "{}{}{}{}",
HEADER310X17, HEADER310X17,
compressedGtin900123456798908, COMPRESSED_GTIN900123456798908,
compressed20bitWeight1750, COMPRESSED20BIT_WEIGHT1750,
compressedDateMarch12th2010 COMPRESSED_DATE_MARCH12TH2010
); );
let expected = "(01)90012345678908(3100)001750(17)100312"; let expected = "(01)90012345678908(3100)001750(17)100312";
@@ -265,9 +265,9 @@ mod AI013X0X1XDecoderTest {
let data = format!( let data = format!(
"{}{}{}{}", "{}{}{}{}",
HEADER320X17, HEADER320X17,
compressedGtin900123456798908, COMPRESSED_GTIN900123456798908,
compressed20bitWeight1750, COMPRESSED20BIT_WEIGHT1750,
compressedDateMarch12th2010 COMPRESSED_DATE_MARCH12TH2010
); );
let expected = "(01)90012345678908(3200)001750(17)100312"; let expected = "(01)90012345678908(3200)001750(17)100312";

View File

@@ -71,7 +71,7 @@ mod AnyAIDecoderTest {
fn testAnyAIDecoder1() { fn testAnyAIDecoder1() {
let data = format!( let data = format!(
"{}{}{}{}{}{}{}", "{}{}{}{}{}{}{}",
HEADER, numeric10, numeric12, numeric2alpha, alphaA, alpha2numeric, numeric12 HEADER, NUMERIC10, NUMERIC12, NUMERIC2ALPHA, ALPHA_A, ALPHA2NUMERIC, NUMERIC12
); );
let expected = "(10)12A12"; let expected = "(10)12A12";
@@ -82,7 +82,7 @@ mod AnyAIDecoderTest {
fn testAnyAIDecoder2() { fn testAnyAIDecoder2() {
let data = format!( let data = format!(
"{}{}{}{}{}{}{}", "{}{}{}{}{}{}{}",
HEADER, numeric10, numeric12, numeric2alpha, alphaA, alpha2isoiec646, i646B HEADER, NUMERIC10, NUMERIC12, NUMERIC2ALPHA, ALPHA_A, ALPHA2ISOIEC646, I646_B
); );
let expected = "(10)12AB"; let expected = "(10)12AB";
@@ -94,15 +94,15 @@ mod AnyAIDecoderTest {
let data = format!( let data = format!(
"{}{}{}{}{}{}{}{}{}{}", "{}{}{}{}{}{}{}{}{}{}",
HEADER, HEADER,
numeric10, NUMERIC10,
numeric2alpha, NUMERIC2ALPHA,
alpha2isoiec646, ALPHA2ISOIEC646,
i646B, I646_B,
i646C, I646_C,
isoiec6462alpha, ISOIEC6462ALPHA,
alphaA, ALPHA_A,
alpha2numeric, ALPHA2NUMERIC,
numeric10 NUMERIC10
); );
let expected = "(10)BCA10"; let expected = "(10)BCA10";
@@ -111,7 +111,7 @@ mod AnyAIDecoderTest {
#[test] #[test]
fn testAnyAIDecodernumericFNC1secondDigit() { fn testAnyAIDecodernumericFNC1secondDigit() {
let data = format!("{}{}{}", HEADER, numeric10, numeric1FNC1); let data = format!("{}{}{}", HEADER, NUMERIC10, NUMERIC1_FNC1);
let expected = "(10)1"; let expected = "(10)1";
assertCorrectBinaryString(&data, expected); assertCorrectBinaryString(&data, expected);
@@ -121,7 +121,7 @@ mod AnyAIDecoderTest {
fn testAnyAIDecoderalphaFNC1() { fn testAnyAIDecoderalphaFNC1() {
let data = format!( let data = format!(
"{}{}{}{}{}", "{}{}{}{}{}",
HEADER, numeric10, numeric2alpha, alphaA, alphaFNC1 HEADER, NUMERIC10, NUMERIC2ALPHA, ALPHA_A, ALPHA_FNC1
); );
let expected = "(10)A"; let expected = "(10)A";
@@ -132,7 +132,7 @@ mod AnyAIDecoderTest {
fn testAnyAIDecoder646FNC1() { fn testAnyAIDecoder646FNC1() {
let data = format!( let data = format!(
"{}{}{}{}{}{}{}", "{}{}{}{}{}{}{}",
HEADER, numeric10, numeric2alpha, alphaA, isoiec6462alpha, i646B, i646FNC1 HEADER, NUMERIC10, NUMERIC2ALPHA, ALPHA_A, ISOIEC6462ALPHA, I646_B, I646_FNC1
); );
let expected = "(10)AB"; let expected = "(10)AB";

View File

@@ -48,7 +48,9 @@ impl DecodedNumeric {
pub fn new(newPosition: usize, firstDigit: u32, secondDigit: u32) -> Result<Self, Exceptions> { pub fn new(newPosition: usize, firstDigit: u32, secondDigit: u32) -> Result<Self, Exceptions> {
// super(newPosition); // super(newPosition);
if /*firstDigit < 0 ||*/ firstDigit > 10 || /*secondDigit < 0 ||*/ secondDigit > 10 { if
/*firstDigit < 0 ||*/
firstDigit > 10 || /*secondDigit < 0 ||*/ secondDigit > 10 {
return Err(Exceptions::FormatException( return Err(Exceptions::FormatException(
".getFormatInstance();".to_owned(), ".getFormatInstance();".to_owned(),
)); ));

View File

@@ -23,18 +23,16 @@
* *
* http://www.piramidepse.com/ * http://www.piramidepse.com/
*/ */
/**
* @author Pablo Orduña, University of Deusto (pablo.orduna@deusto.es)
* @author Eduardo Castillejo, University of Deusto (eduardo.castillejo@deusto.es)
*/
use std::collections::HashMap; use std::collections::HashMap;
use crate::Exceptions; use crate::Exceptions;
use lazy_static::lazy_static; use lazy_static::lazy_static;
/**
* @author Pablo Orduña, University of Deusto (pablo.orduna@deusto.es)
* @author Eduardo Castillejo, University of Deusto (eduardo.castillejo@deusto.es)
*/
lazy_static! { lazy_static! {
static ref TWO_DIGIT_DATA_LENGTH : HashMap<String,DataLength> = { static ref TWO_DIGIT_DATA_LENGTH : HashMap<String,DataLength> = {

View File

@@ -27,7 +27,7 @@
use std::collections::HashMap; use std::collections::HashMap;
use crate::{ use crate::{
common::{detector::MathUtils, BitArray}, common::BitArray,
oned::{ oned::{
recordPattern, recordPatternInReverse, recordPattern, recordPatternInReverse,
rss::{ rss::{
@@ -287,6 +287,7 @@ impl RSSExpandedReader {
[45, 135, 194, 160, 58, 174, 100, 89], [45, 135, 194, 160, 58, 174, 100, 89],
]; ];
#[allow(dead_code)]
const MAX_PAIRS: usize = 11; const MAX_PAIRS: usize = 11;
// Not private for testing // Not private for testing
@@ -536,6 +537,7 @@ impl RSSExpandedReader {
// Only used for unit testing // Only used for unit testing
#[cfg(test)] #[cfg(test)]
#[allow(dead_code)]
pub(crate) fn getRowsMut(&mut self) -> &mut [ExpandedRow] { pub(crate) fn getRowsMut(&mut self) -> &mut [ExpandedRow] {
&mut self.rows &mut self.rows
} }

View File

@@ -17,7 +17,7 @@
use std::collections::HashMap; use std::collections::HashMap;
use crate::{ use crate::{
common::{detector::MathUtils, BitArray}, common::BitArray,
oned::{one_d_reader, OneDReader}, oned::{one_d_reader, OneDReader},
BarcodeFormat, DecodeHintType, DecodingHintDictionary, Exceptions, RXingResult, BarcodeFormat, DecodeHintType, DecodingHintDictionary, Exceptions, RXingResult,
RXingResultMetadataType, RXingResultMetadataValue, RXingResultPoint, Reader, ResultPoint, RXingResultMetadataType, RXingResultMetadataValue, RXingResultPoint, Reader, ResultPoint,
@@ -250,7 +250,7 @@ impl RSS14Reader {
row: &BitArray, row: &BitArray,
right: bool, right: bool,
rowNumber: u32, rowNumber: u32,
hints: &DecodingHintDictionary, _hints: &DecodingHintDictionary,
) -> Option<Pair> { ) -> Option<Pair> {
let pos_pair = || -> Result<Pair, Exceptions> { let pos_pair = || -> Result<Pair, Exceptions> {
let startEnd = self.findFinderPattern(row, right)?; let startEnd = self.findFinderPattern(row, right)?;
@@ -464,7 +464,7 @@ impl RSS14Reader {
} }
firstElementStart += 1; firstElementStart += 1;
let firstCounter = startEnd[0] - firstElementStart as usize; let firstCounter = startEnd[0] - firstElementStart as usize;
let counters = &mut self.decodeFinderCounters; let counters = &mut self.decodeFinderCounters;
let counter_len = counters.len(); let counter_len = counters.len();
counters.copy_within(..counter_len - 1, 1); counters.copy_within(..counter_len - 1, 1);

View File

@@ -21,7 +21,7 @@ use crate::{
RXingResultMetadataValue, RXingResultPoint, RXingResultMetadataValue, RXingResultPoint,
}; };
use super::{upc_ean_reader, STAND_IN, UPCEANReader}; use super::{upc_ean_reader, UPCEANReader, STAND_IN};
/** /**
* @see UPCEANExtension5Support * @see UPCEANExtension5Support

View File

@@ -21,7 +21,7 @@ use crate::{
RXingResultMetadataValue, RXingResultPoint, RXingResultMetadataValue, RXingResultPoint,
}; };
use super::{upc_ean_reader, STAND_IN, UPCEANReader}; use super::{upc_ean_reader, UPCEANReader, STAND_IN};
/** /**
* @see UPCEANExtension2Support * @see UPCEANExtension2Support

View File

@@ -16,7 +16,7 @@
use crate::{common::BitArray, Exceptions, RXingResult}; use crate::{common::BitArray, Exceptions, RXingResult};
use super::{STAND_IN, UPCEANExtension2Support, UPCEANExtension5Support, UPCEANReader}; use super::{UPCEANExtension2Support, UPCEANExtension5Support, UPCEANReader, STAND_IN};
pub struct UPCEANExtensionSupport { pub struct UPCEANExtensionSupport {
twoSupport: UPCEANExtension2Support, twoSupport: UPCEANExtension2Support,

View File

@@ -19,8 +19,8 @@ use std::{fmt::Display, rc::Rc};
use crate::pdf417::pdf_417_common; use crate::pdf417::pdf_417_common;
use super::{ use super::{
BarcodeMetadata, BoundingBox, Codeword, BarcodeMetadata, BoundingBox, Codeword, DetectionRXingResultColumnTrait,
DetectionRXingResultColumnTrait, DetectionRXingResultRowIndicatorColumn, DetectionRXingResultRowIndicatorColumn,
}; };
const ADJUST_ROW_NUMBER_SKIP: u32 = 2; const ADJUST_ROW_NUMBER_SKIP: u32 = 2;

View File

@@ -16,7 +16,7 @@
use rand::Rng; use rand::Rng;
use crate::{ Exceptions}; use crate::Exceptions;
use super::{ use super::{
abstract_error_correction_test_case::{corrupt, getRandom}, abstract_error_correction_test_case::{corrupt, getRandom},
@@ -56,7 +56,6 @@ fn testNoError() {
#[test] #[test]
fn testExplicitError() { fn testExplicitError() {
for i in 0..PDF417_TEST_WITH_EC.len() { for i in 0..PDF417_TEST_WITH_EC.len() {
// for (int i = 0; i < PDF417_TEST_WITH_EC.length; i++) { // for (int i = 0; i < PDF417_TEST_WITH_EC.length; i++) {
let mut received = PDF417_TEST_WITH_EC.clone(); let mut received = PDF417_TEST_WITH_EC.clone();

View File

@@ -9,8 +9,6 @@ mod mode;
mod qr_code_decoder_meta_data; mod qr_code_decoder_meta_data;
mod version; mod version;
#[cfg(test)]
mod data_mask_testcase;
#[cfg(test)] #[cfg(test)]
mod DecodedBitStreamParserTestCase; mod DecodedBitStreamParserTestCase;
#[cfg(test)] #[cfg(test)]
@@ -21,6 +19,8 @@ mod FormatInformationTestCase;
mod ModeTestCase; mod ModeTestCase;
#[cfg(test)] #[cfg(test)]
mod VersionTestCase; mod VersionTestCase;
#[cfg(test)]
mod data_mask_testcase;
pub use bit_matrix_parser::*; pub use bit_matrix_parser::*;
pub use data_block::*; pub use data_block::*;

View File

@@ -17,7 +17,6 @@
* @author satorux@google.com (Satoru Takabayashi) - creator * @author satorux@google.com (Satoru Takabayashi) - creator
* @author dswitkin@google.com (Daniel Switkin) - ported from C++ * @author dswitkin@google.com (Daniel Switkin) - ported from C++
*/ */
use std::collections::HashMap; use std::collections::HashMap;
use encoding::EncodingRef; use encoding::EncodingRef;

View File

@@ -713,7 +713,7 @@ impl Edge {
// } // }
size size
}, },
_encoders : encoders, _encoders: encoders,
} }
// this.mode = mode; // this.mode = mode;
// this.fromPosition = fromPosition; // this.fromPosition = fromPosition;

View File

@@ -11,13 +11,13 @@ pub use byte_matrix::*;
pub use minimal_encoder::*; pub use minimal_encoder::*;
pub use qr_code::*; pub use qr_code::*;
#[cfg(test)]
mod bit_vector_testcase;
#[cfg(test)] #[cfg(test)]
mod EncoderTestCase; mod EncoderTestCase;
#[cfg(test)] #[cfg(test)]
mod MaskUtilTestCase; mod MaskUtilTestCase;
#[cfg(test)] #[cfg(test)]
mod matrix_util_testcase;
#[cfg(test)]
mod QRCodeTestCase; mod QRCodeTestCase;
#[cfg(test)]
mod bit_vector_testcase;
#[cfg(test)]
mod matrix_util_testcase;

View File

@@ -16,7 +16,7 @@
//package com.google.zxing; //package com.google.zxing;
use std::{ rc::Rc}; use std::rc::Rc;
use crate::pdf417::PDF417RXingResultMetadata; use crate::pdf417::PDF417RXingResultMetadata;

View File

@@ -1,4 +1,4 @@
use rxing::{MultiFormatReader}; use rxing::MultiFormatReader;
mod common; mod common;