Merge branch 'main' into pr/point_refactor

This commit is contained in:
Vukašin Stepanović
2023-02-16 16:43:24 +00:00
132 changed files with 1048 additions and 1329 deletions

View File

@@ -143,7 +143,7 @@ impl OneDReader for ITFReader {
lengthOK = true;
}
if !lengthOK {
return Err(Exceptions::FormatException(None));
return Err(Exceptions::format);
}
let mut resultObject = RXingResult::new(
@@ -198,13 +198,9 @@ impl ITFReader {
}
let mut bestMatch = self.decodeDigit(&counterBlack)?;
resultString.push(
char::from_u32('0' as u32 + bestMatch).ok_or(Exceptions::ParseException(None))?,
);
resultString.push(char::from_u32('0' as u32 + bestMatch).ok_or(Exceptions::parse)?);
bestMatch = self.decodeDigit(&counterWhite)?;
resultString.push(
char::from_u32('0' as u32 + bestMatch).ok_or(Exceptions::ParseException(None))?,
);
resultString.push(char::from_u32('0' as u32 + bestMatch).ok_or(Exceptions::parse)?);
payloadStart += counterDigitPair.iter().sum::<u32>() as usize;
}
@@ -265,7 +261,7 @@ impl ITFReader {
if quietCount != 0 {
// Unable to find the necessary number of quiet zone pixels.
Err(Exceptions::NotFoundException(None))
Err(Exceptions::notFound)
} else {
Ok(())
}
@@ -282,7 +278,7 @@ impl ITFReader {
let width = row.getSize();
let endStart = row.getNextSet(0);
if endStart == width {
return Err(Exceptions::NotFoundException(None));
return Err(Exceptions::notFound);
}
Ok(endStart)
@@ -377,7 +373,7 @@ impl ITFReader {
isWhite = !isWhite;
}
}
Err(Exceptions::NotFoundException(None))
Err(Exceptions::notFound)
}
/**
@@ -406,7 +402,7 @@ impl ITFReader {
if bestMatch >= 0 {
Ok(bestMatch as u32 % 10)
} else {
Err(Exceptions::NotFoundException(None))
Err(Exceptions::notFound)
}
}
}