Skip to content

Commit

Permalink
Do not require prefix for hex
Browse files Browse the repository at this point in the history
  • Loading branch information
jackpot51 committed Oct 17, 2018
1 parent 460f57b commit 3c2121d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/header/stdlib/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ pub unsafe fn convert_hex(s: *const c_char) -> Option<(c_ulong, isize, bool)> {
{
convert_integer(s.offset(2), 16).map(|(val, idx, overflow)| (val, idx + 2, overflow))
} else {
None
convert_integer(s, 16).map(|(val, idx, overflow)| (val, idx, overflow))
}
}

Expand Down
1 change: 1 addition & 0 deletions tests/expected/stdlib/strtol.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
1234567890
38acf
abcdef12
cafebeef
731
731
0
Expand Down
1 change: 1 addition & 0 deletions tests/stdlib/strtol.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ int main(int argc, char* argv[]) {

printf("%lx\n", strtol(" 0x38Acfg", NULL, 0));
printf("%lx\n", strtol("0Xabcdef12", NULL, 16));
printf("%lx\n", strtol("cafebeef", NULL, 16));

printf("%lo\n", strtol(" 073189", NULL, 0));
printf("%lo\n", strtol(" 073189", NULL, 8));
Expand Down

0 comments on commit 3c2121d

Please sign in to comment.