Skip to content

Commit

Permalink
remove TODO mark
Browse files Browse the repository at this point in the history
  • Loading branch information
overcat committed Sep 6, 2024
1 parent 7cb6aa0 commit dba717d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ pub fn encode(ver: u8, input: &[u8], output: &mut [u8]) {
d[1..=input.len()].copy_from_slice(input);
let crc = checksum(&d[..=input.len()]);
d[1 + input.len()..1 + input.len() + 2].copy_from_slice(&crc);
// TODO
assert_eq!(encode_len(input.len()), output.len());
data_encoding::BASE32_NOPAD.encode_mut(&d[..input.len() + 3], output);
}
Expand Down Expand Up @@ -91,8 +90,10 @@ pub fn decode_len(input_len: usize) -> Result<usize, DecodeError> {
/// // let v = decode(input, &mut output[..output_len]).unwrap();
/// ```
pub fn decode(input: &[u8], output: &mut [u8]) -> Result<u8, DecodeError> {
let len = decode_len(input.len())? + 3;
assert_eq!(output.len(), len - 3);
let len = decode_len(input.len())?;
assert_eq!(output.len(), len);

let len = 1 + len + 2;
let mut decoded = [0u8; 1 + typ::MAX_PAYLOAD_LEN + 2];
let _ = data_encoding::BASE32_NOPAD
.decode_mut(input, &mut decoded[..len])
Expand Down

0 comments on commit dba717d

Please sign in to comment.