|
|
@ -797,11 +797,7 @@ impl QrSegment {
|
|
|
|
bb.push((b >> i) & 1u8 != 0u8);
|
|
|
|
bb.push((b >> i) & 1u8 != 0u8);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
QrSegment {
|
|
|
|
QrSegment::new(&QrSegmentMode_BYTE, data.len(), bb)
|
|
|
|
mode: &QrSegmentMode_BYTE,
|
|
|
|
|
|
|
|
numchars: data.len(),
|
|
|
|
|
|
|
|
data: bb,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -822,11 +818,7 @@ impl QrSegment {
|
|
|
|
if accumcount > 0 { // 1 or 2 digits remaining
|
|
|
|
if accumcount > 0 { // 1 or 2 digits remaining
|
|
|
|
append_bits(&mut bb, accumdata, (accumcount as u8) * 3 + 1);
|
|
|
|
append_bits(&mut bb, accumdata, (accumcount as u8) * 3 + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
QrSegment {
|
|
|
|
QrSegment::new(&QrSegmentMode_NUMERIC, text.len(), bb)
|
|
|
|
mode: &QrSegmentMode_NUMERIC,
|
|
|
|
|
|
|
|
numchars: text.len(),
|
|
|
|
|
|
|
|
data: bb,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -850,11 +842,7 @@ impl QrSegment {
|
|
|
|
if accumcount > 0 { // 1 character remaining
|
|
|
|
if accumcount > 0 { // 1 character remaining
|
|
|
|
append_bits(&mut bb, accumdata, 6);
|
|
|
|
append_bits(&mut bb, accumdata, 6);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
QrSegment {
|
|
|
|
QrSegment::new(&QrSegmentMode_ALPHANUMERIC, text.len(), bb)
|
|
|
|
mode: &QrSegmentMode_ALPHANUMERIC,
|
|
|
|
|
|
|
|
numchars: text.len(),
|
|
|
|
|
|
|
|
data: bb,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -885,10 +873,15 @@ impl QrSegment {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
panic!("ECI assignment value out of range");
|
|
|
|
panic!("ECI assignment value out of range");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QrSegment::new(&QrSegmentMode_ECI, 0, bb)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn new(mode: &'static QrSegmentMode, numchars: usize, data: Vec<bool>) -> QrSegment {
|
|
|
|
QrSegment {
|
|
|
|
QrSegment {
|
|
|
|
mode: &QrSegmentMode_ECI,
|
|
|
|
mode: mode,
|
|
|
|
numchars: 0,
|
|
|
|
numchars: numchars,
|
|
|
|
data: bb,
|
|
|
|
data: data,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|