Skip to content

Commit

Permalink
need to do more checks
Browse files Browse the repository at this point in the history
  • Loading branch information
lxaw committed Nov 9, 2023
1 parent a6c5cb4 commit 7048bca
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 52 deletions.
1 change: 0 additions & 1 deletion decoded.txt

This file was deleted.

Binary file removed out.bin
Binary file not shown.
Binary file removed out.binc
Binary file not shown.
50 changes: 0 additions & 50 deletions out.txt

This file was deleted.

7 changes: 6 additions & 1 deletion src/huffman.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,12 @@ pub fn decode_encoded_str(encoded_msg: &String, map: &BTreeMap<char,String>) ->
for (key,value) in map.iter(){
if value.len() <= msg_copy.len() && msg_copy.starts_with(value) {
// check if this key matches the current substring
ret.push(*key);
if *key == NEW_LINE{
ret.push('\n');
}
else{
ret.push(*key);
}
// remove len chars
msg_copy.drain(..value.len());
}
Expand Down

0 comments on commit 7048bca

Please sign in to comment.