This commit is contained in:
kennytm 2014-09-24 16:02:36 +08:00
parent b7214af165
commit fa40eec147
2 changed files with 3 additions and 3 deletions

View file

@ -835,7 +835,7 @@ pub fn encode_auto(data: &[u8], ec_level: ErrorCorrectionLevel) -> QrResult<Bits
let min_version = find_min_version(total_len, ec_level);
let mut bits = Bits::new(min_version);
bits.reserve_additional(total_len);
try!(bits.push_segments(data, opt_segments.move_iter()));
try!(bits.push_segments(data, opt_segments.into_iter()));
try!(bits.push_terminator(ec_level));
return Ok(bits);
}

View file

@ -15,8 +15,8 @@ use types::{QrResult, QrVersion, ErrorCorrectionLevel};
/// GF(256), and then computes the polynomial modulus with a generator
/// polynomial of degree N.
pub fn create_error_correction_code(data: &[u8], ec_code_size: uint) -> Vec<u8> {
let mut res = Vec::from_slice(data);
res.grow(ec_code_size, &0);
let mut res = data.to_vec();
res.grow(ec_code_size, 0);
let data_len = data.len();
let log_den = GENERATOR_POLYNOMIALS[ec_code_size];