rename helper methods

This commit is contained in:
Vukašin Stepanović
2023-02-15 12:52:59 +00:00
parent bfcdb397ad
commit 935519ced5
133 changed files with 858 additions and 1044 deletions

View File

@@ -50,7 +50,7 @@ impl OneDReader for Code128Reader {
CODE_START_A => CODE_CODE_A,
CODE_START_B => CODE_CODE_B,
CODE_START_C => CODE_CODE_C,
_ => return Err(Exceptions::formatEmpty()),
_ => return Err(Exceptions::format),
};
let mut done = false;
@@ -100,7 +100,7 @@ impl OneDReader for Code128Reader {
// Take care of illegal start codes
match code {
CODE_START_A | CODE_START_B | CODE_START_C => return Err(Exceptions::formatEmpty()),
CODE_START_A | CODE_START_B | CODE_START_C => return Err(Exceptions::format),
_ => {}
}
@@ -294,21 +294,21 @@ impl OneDReader for Code128Reader {
row.getSize().min(nextStart + (nextStart - lastStart) / 2),
false,
)? {
return Err(Exceptions::notFoundEmpty());
return Err(Exceptions::notFound);
}
// Pull out from sum the value of the penultimate check code
checksumTotal -= multiplier as usize * lastCode as usize;
// lastCode is the checksum then:
if (checksumTotal % 103) as u8 != lastCode {
return Err(Exceptions::checksumEmpty());
return Err(Exceptions::checksum);
}
// Need to pull out the check digits from string
let resultLength = result.chars().count();
if resultLength == 0 {
// false positive
return Err(Exceptions::notFoundEmpty());
return Err(Exceptions::notFound);
}
// Only bother if the result had at least one character, and if the checksum digit happened to
@@ -329,7 +329,7 @@ impl OneDReader for Code128Reader {
let rawCodesSize = rawCodes.len();
let mut rawBytes = vec![0u8; rawCodesSize];
for (i, rawByte) in rawBytes.iter_mut().enumerate().take(rawCodesSize) {
*rawByte = *rawCodes.get(i).ok_or(Exceptions::indexOutOfBoundsEmpty())?;
*rawByte = *rawCodes.get(i).ok_or(Exceptions::indexOutOfBounds)?;
}
let mut resultObject = RXingResult::new(
&result,
@@ -403,7 +403,7 @@ impl Code128Reader {
}
}
Err(Exceptions::notFoundEmpty())
Err(Exceptions::notFound)
}
fn decodeCode(
@@ -428,7 +428,7 @@ impl Code128Reader {
if bestMatch >= 0 {
Ok(bestMatch as u8)
} else {
Err(Exceptions::notFoundEmpty())
Err(Exceptions::notFound)
}
}
}