Skip to content

Commit

Permalink
Correct C style string output
Browse files Browse the repository at this point in the history
  • Loading branch information
0xflux committed Apr 24, 2024
1 parent 586c702 commit f235a1a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "chx"
version = "1.0.0"
version = "1.0.1"
edition = "2021"

[profile.release]
Expand Down
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ impl Chx {
self.processed_data = data;
} else {
// convert to a u8 byte array
let data = self.data.iter().map(|byte| format!(r"\x{:02x}", byte)).collect::<String>();
let mut data = self.data.iter().map(|byte| format!(r"0x{:02x},", byte)).collect::<String>();
data.truncate(data.len() - 1); // remove trailing comma
self.processed_data = data;
}

Expand Down

0 comments on commit f235a1a

Please sign in to comment.