fix printf alt-form octal with value 0 and no explicit precision
commit 78897b0d wrongly simplified Dmitry Levin's original submitted patch fixing alt-form octal with the zero flag and field width present, omitting the special case where the value is zero. as a result, printf("%#o",0) wrongly prints "00" rather than "0". the logic prior to this commit was actually better, in that it was aligned with how the alt-form flag (#) for printf is specified ("it shall increase the precision"). at the time there was no good way to avoid the zero flag issue with the old logic, but commit 167dfe96 added tracking of whether an explicit precision was provided. revert commit 78897b0d and switch to using the explicit precision indicator for suppressing the zero flag.
Showing
想要评论请 注册 或 登录