Skip to content

Commit 4752081

Browse files
committed
Merge pull request #4271 from ejholmes/ffi-crypto
Fix example in FFI tutorial.
2 parents 10e8e3e + 0100b02 commit 4752081

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

doc/tutorial-ffi.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extern mod crypto {
2222
2323
fn as_hex(data: ~[u8]) -> ~str {
2424
let mut acc = ~"";
25-
for data.each |byte| { acc += fmt!("%02x", byte as uint); }
25+
for data.each |&byte| { acc += fmt!("%02x", byte as uint); }
2626
return acc;
2727
}
2828
@@ -33,8 +33,8 @@ fn sha1(data: ~str) -> ~str unsafe {
3333
return as_hex(vec::from_buf(hash, 20));
3434
}
3535
36-
fn main(args: ~[~str]) {
37-
io::println(sha1(args[1]));
36+
fn main() {
37+
io::println(sha1(core::os::args()[1]));
3838
}
3939
~~~~
4040

0 commit comments

Comments
 (0)