mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-27 21:02:35 +00:00
rename helper methods
This commit is contained in:
@@ -49,10 +49,8 @@ impl UPCEANReader for UPCEReader {
|
||||
let mut x = 0;
|
||||
while x < 6 && rowOffset < end {
|
||||
let bestMatch = self.decodeDigit(row, &mut counters, rowOffset, &L_AND_G_PATTERNS)?;
|
||||
resultString.push(
|
||||
char::from_u32('0' as u32 + bestMatch as u32 % 10)
|
||||
.ok_or(Exceptions::parseEmpty())?,
|
||||
);
|
||||
resultString
|
||||
.push(char::from_u32('0' as u32 + bestMatch as u32 % 10).ok_or(Exceptions::parse)?);
|
||||
rowOffset += counters.iter().sum::<u32>() as usize;
|
||||
|
||||
if bestMatch >= 10 {
|
||||
@@ -68,9 +66,7 @@ impl UPCEANReader for UPCEReader {
|
||||
}
|
||||
|
||||
fn checkChecksum(&self, s: &str) -> Result<bool, Exceptions> {
|
||||
self.checkStandardUPCEANChecksum(
|
||||
&convertUPCEtoUPCA(s).ok_or(Exceptions::illegalArgumentEmpty())?,
|
||||
)
|
||||
self.checkStandardUPCEANChecksum(&convertUPCEtoUPCA(s).ok_or(Exceptions::illegalArgument)?)
|
||||
}
|
||||
|
||||
fn decodeEnd(
|
||||
@@ -132,17 +128,15 @@ impl UPCEReader {
|
||||
if lgPatternFound == Self::NUMSYS_AND_CHECK_DIGIT_PATTERNS[numSys][d] {
|
||||
resultString.insert(
|
||||
0,
|
||||
char::from_u32('0' as u32 + numSys as u32)
|
||||
.ok_or(Exceptions::parseEmpty())?,
|
||||
);
|
||||
resultString.push(
|
||||
char::from_u32('0' as u32 + d as u32).ok_or(Exceptions::parseEmpty())?,
|
||||
char::from_u32('0' as u32 + numSys as u32).ok_or(Exceptions::parse)?,
|
||||
);
|
||||
resultString
|
||||
.push(char::from_u32('0' as u32 + d as u32).ok_or(Exceptions::parse)?);
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(Exceptions::notFoundEmpty())
|
||||
Err(Exceptions::notFound)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user