mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-27 12:52:34 +00:00
warning cleanup
This commit is contained in:
@@ -64,11 +64,11 @@ impl DataBlock {
|
||||
let ecBlocks = version.getECBlocksForLevel(ecLevel);
|
||||
|
||||
// First count the total number of data blocks
|
||||
let mut totalBlocks = 0;
|
||||
let mut _totalBlocks = 0;
|
||||
let ecBlockArray = ecBlocks.getECBlocks();
|
||||
for ecBlock in ecBlockArray {
|
||||
// for (Version.ECB ecBlock : ecBlockArray) {
|
||||
totalBlocks += ecBlock.getCount();
|
||||
_totalBlocks += ecBlock.getCount();
|
||||
}
|
||||
|
||||
// Now establish DataBlocks of the appropriate size and number of data codewords
|
||||
|
||||
@@ -36,7 +36,7 @@ use super::{decoded_bit_stream_parser, BitMatrixParser, DataBlock, QRCodeDecoder
|
||||
|
||||
lazy_static! {
|
||||
//rsDecoder = new ReedSolomonDecoder(GenericGF.QR_CODE_FIELD_256);
|
||||
static ref rsDecoder : ReedSolomonDecoder = ReedSolomonDecoder::new(get_predefined_genericgf(PredefinedGenericGF::QrCodeField256));
|
||||
static ref RS_DECODER : ReedSolomonDecoder = ReedSolomonDecoder::new(get_predefined_genericgf(PredefinedGenericGF::QrCodeField256));
|
||||
}
|
||||
|
||||
pub fn decode_bool_array(image: &Vec<Vec<bool>>) -> Result<DecoderRXingResult, Exceptions> {
|
||||
@@ -200,7 +200,7 @@ fn correctErrors(codewordBytes: &mut [u8], numDataCodewords: usize) -> Result<()
|
||||
|
||||
let mut sending_code_words : Vec<i32> = codewordsInts.iter().map(|x| *x as i32).collect();
|
||||
|
||||
if let Err(e) = rsDecoder.decode(
|
||||
if let Err(e) = RS_DECODER.decode(
|
||||
&mut sending_code_words,
|
||||
(codewordBytes.len() - numDataCodewords) as i32,
|
||||
) {
|
||||
|
||||
@@ -134,7 +134,7 @@ impl FormatInformation {
|
||||
if masked_format_info1 != masked_format_info2 {
|
||||
// also try the other option
|
||||
bits_difference = Self::numBitsDiffering(masked_format_info2, targetInfo);
|
||||
if (bits_difference < best_difference) {
|
||||
if bits_difference < best_difference {
|
||||
best_format_info = decodeInfo[1] as u8;
|
||||
best_difference = bits_difference;
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ pub fn encode_with_hints(
|
||||
let encoding = if encoding.is_some() {
|
||||
encoding.unwrap()
|
||||
} else {
|
||||
if let Ok(encs) = DEFAULT_BYTE_MODE_ENCODING.encode(content, encoding::EncoderTrap::Strict){
|
||||
if let Ok(_encs) = DEFAULT_BYTE_MODE_ENCODING.encode(content, encoding::EncoderTrap::Strict){
|
||||
DEFAULT_BYTE_MODE_ENCODING
|
||||
}else {
|
||||
has_encoding_hint = true;
|
||||
|
||||
@@ -169,7 +169,7 @@ pub fn embedTypeInfo(
|
||||
matrix: &mut ByteMatrix,
|
||||
) -> Result<(), Exceptions> {
|
||||
let mut typeInfoBits = BitArray::new();
|
||||
makeTypeInfoBits(ecLevel, maskPattern as u32, &mut typeInfoBits);
|
||||
makeTypeInfoBits(ecLevel, maskPattern as u32, &mut typeInfoBits)?;
|
||||
|
||||
for i in 0..typeInfoBits.getSize() {
|
||||
// for (int i = 0; i < typeInfoBits.getSize(); ++i) {
|
||||
@@ -363,7 +363,7 @@ pub fn makeTypeInfoBits(
|
||||
|
||||
let mut maskBits = BitArray::new();
|
||||
maskBits.appendBits(TYPE_INFO_MASK_PATTERN, 15)?;
|
||||
bits.xor(&maskBits);
|
||||
bits.xor(&maskBits)?;
|
||||
|
||||
if bits.getSize() != 15 {
|
||||
// Just in case.
|
||||
|
||||
@@ -943,7 +943,7 @@ impl RXingResultList {
|
||||
*/
|
||||
pub fn getBits(&self, bits: &mut BitArray) -> Result<(), Exceptions> {
|
||||
for resultNode in &self.list {
|
||||
resultNode.getBits(bits);
|
||||
resultNode.getBits(bits)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -1078,19 +1078,19 @@ impl RXingResultNode {
|
||||
* appends the bits
|
||||
*/
|
||||
fn getBits(&self, bits: &mut BitArray) -> Result<(), Exceptions> {
|
||||
bits.appendBits(self.mode.getBits() as u32, 4);
|
||||
bits.appendBits(self.mode.getBits() as u32, 4)?;
|
||||
if self.characterLength > 0 {
|
||||
let length = self.getCharacterCountIndicator();
|
||||
bits.appendBits(
|
||||
length,
|
||||
self.mode.getCharacterCountBits(self.version) as usize,
|
||||
);
|
||||
)?;
|
||||
}
|
||||
if self.mode == Mode::ECI {
|
||||
bits.appendBits(
|
||||
self.encoders.getECIValue(self.charsetEncoderIndex as usize),
|
||||
8,
|
||||
);
|
||||
)?;
|
||||
} else if self.characterLength > 0 {
|
||||
// append data
|
||||
encoder::appendBytes(
|
||||
@@ -1100,7 +1100,7 @@ impl RXingResultNode {
|
||||
self.mode,
|
||||
bits,
|
||||
self.encoders.getCharset(self.charsetEncoderIndex as usize),
|
||||
);
|
||||
)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ impl Writer for QRCodeWriter {
|
||||
height: i32,
|
||||
hints: &crate::EncodingHintDictionary,
|
||||
) -> Result<crate::common::BitMatrix, crate::Exceptions> {
|
||||
if (contents.is_empty()) {
|
||||
if contents.is_empty() {
|
||||
return Err(Exceptions::IllegalArgumentException(
|
||||
"Found empty contents".to_owned(),
|
||||
));
|
||||
@@ -71,7 +71,7 @@ impl Writer for QRCodeWriter {
|
||||
// throw new IllegalArgumentException("Can only encode QR_CODE, but got " + format);
|
||||
}
|
||||
|
||||
if (width < 0 || height < 0) {
|
||||
if width < 0 || height < 0 {
|
||||
return Err(Exceptions::IllegalArgumentException(format!(
|
||||
"Requested dimensions are too small: {}x{}",
|
||||
width, height
|
||||
@@ -158,7 +158,7 @@ impl QRCodeWriter {
|
||||
outputY as u32,
|
||||
multiple as u32,
|
||||
multiple as u32,
|
||||
);
|
||||
)?;
|
||||
}
|
||||
|
||||
inputX += 1;
|
||||
|
||||
Reference in New Issue
Block a user