mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 04:12:34 +00:00
remove even more needless string conversions
This commit is contained in:
@@ -164,7 +164,7 @@ fn get_encoded_data(corrected_bits: &[bool]) -> Result<String, Exceptions> {
|
||||
result.push_str(
|
||||
&encdr
|
||||
.decode(&decoded_bytes, encoding::DecoderTrap::Strict)
|
||||
.map_err(|a| Exceptions::illegalState(a.to_string()))?,
|
||||
.map_err(|a| Exceptions::illegalState(a))?,
|
||||
);
|
||||
|
||||
decoded_bytes.clear();
|
||||
|
||||
@@ -755,7 +755,7 @@ fn decodeBase256Segment(
|
||||
result.append_string(
|
||||
&encoding::all::ISO_8859_1
|
||||
.decode(&bytes, encoding::DecoderTrap::Strict)
|
||||
.map_err(|e| Exceptions::parse(e.to_string()))?,
|
||||
.map_err(|e| Exceptions::parse(e))?,
|
||||
);
|
||||
byteSegments.push(bytes);
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ pub fn decode(
|
||||
// for (int i = 0; i < errorLocations.length; i++) {
|
||||
let position = received.len() as isize - 1 - field.log(errorLocations[i])? as isize;
|
||||
if position < 0 {
|
||||
return Err(Exceptions::checksum(file!().to_string()));
|
||||
return Err(Exceptions::checksum(file!()));
|
||||
}
|
||||
received[position as usize] =
|
||||
field.subtract(received[position as usize], errorMagnitudes[i]);
|
||||
@@ -140,7 +140,7 @@ fn runEuclideanAlgorithm(
|
||||
// Divide rLastLast by rLast, with quotient in q and remainder in r
|
||||
if rLast.isZero() {
|
||||
// Oops, Euclidean algorithm already terminated?
|
||||
return Err(Exceptions::checksum(file!().to_string()));
|
||||
return Err(Exceptions::checksum(file!()));
|
||||
}
|
||||
r = rLastLast;
|
||||
let mut q = ModulusPoly::getZero(field); //field.getZero();
|
||||
@@ -162,7 +162,7 @@ fn runEuclideanAlgorithm(
|
||||
|
||||
let sigmaTildeAtZero = t.getCoefficient(0);
|
||||
if sigmaTildeAtZero == 0 {
|
||||
return Err(Exceptions::checksum(file!().to_string()));
|
||||
return Err(Exceptions::checksum(file!()));
|
||||
}
|
||||
|
||||
let inverse = field.inverse(sigmaTildeAtZero)?;
|
||||
@@ -190,7 +190,7 @@ fn findErrorLocations(
|
||||
i += 1;
|
||||
}
|
||||
if e != numErrors {
|
||||
return Err(Exceptions::checksum(file!().to_string()));
|
||||
return Err(Exceptions::checksum(file!()));
|
||||
}
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user