Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in # flag #50

Open
ledvinap opened this issue Apr 18, 2019 · 0 comments
Open

Bug in # flag #50

ledvinap opened this issue Apr 18, 2019 · 0 comments

Comments

@ledvinap
Copy link

sprintf("%#4x", 0x1234); produces `"0x34"
It is caused by wrong '0x' space compensation when width equals output

BTW: I'm fixing issues reported, no need to work on it immediately

ledvinap added a commit to ledvinap/printf that referenced this issue May 13, 2019
Handle 0x / 0b when width is equal to string size (issue mpaland#50):
printf("%#4x", 0x1234); -> "0x1234"

Do not print # prefix if it does not fit into PRINTF_NTOA_BUFFER_SIZE

%#<prec>o is implemented as in libc:
- printf("%#0o", 0); does output octal prefix ("0")

- printf("%#3o", 1); printf "001" - padding zero is used as octal
  prefix (issue mpaland#53)

Left padding and precision is handled correctly (issue mpaland#49):
- printf("%-10.6d", 1024); -> "001024    "
ledvinap added a commit to ledvinap/printf that referenced this issue May 13, 2019
Handle 0x / 0b when width is equal to string size (issue mpaland#50):
printf("%#4x", 0x1234); -> "0x1234"

Do not print # prefix if it does not fit into PRINTF_NTOA_BUFFER_SIZE

%#<prec>o is implemented as in libc:
- printf("%#0o", 0); does output octal prefix ("0")

- printf("%#3o", 1); printf "001" - padding zero is used as octal
  prefix (issue mpaland#53)

Left padding and precision is handled correctly (issue mpaland#49):
- printf("%-10.6d", 1024); -> "001024    "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant