mirror of
https://github.com/ruby/ruby.git
synced 2025-09-17 09:33:59 +02:00
merge revision(s) 58210: [Backport #8916]
vsnprintf.c: prefix with precision * vsnprintf.c (BSD_vfprintf): sign and hex-prefix should not be counted in precision. [ruby-dev:47714] [Bug #8916] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@59299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c54593eddb
commit
f5b840074d
3 changed files with 6 additions and 10 deletions
12
vsnprintf.c
12
vsnprintf.c
|
@ -1119,11 +1119,11 @@ number: if ((dprec = prec) >= 0)
|
|||
*/
|
||||
fieldsz = size;
|
||||
long_len:
|
||||
if (sign)
|
||||
fieldsz++;
|
||||
if (flags & HEXPREFIX)
|
||||
fieldsz += 2;
|
||||
realsz = dprec > fieldsz ? dprec : fieldsz;
|
||||
if (sign)
|
||||
realsz++;
|
||||
if (flags & HEXPREFIX)
|
||||
realsz += 2;
|
||||
|
||||
/* right-adjusting blank padding */
|
||||
if ((flags & (LADJUST|ZEROPAD)) == 0)
|
||||
|
@ -1145,10 +1145,6 @@ long_len:
|
|||
|
||||
/* leading zeroes from decimal precision */
|
||||
PAD_L(dprec - fieldsz, zeroes);
|
||||
if (sign)
|
||||
fieldsz--;
|
||||
if (flags & HEXPREFIX)
|
||||
fieldsz -= 2;
|
||||
|
||||
/* the string or number proper */
|
||||
#ifdef FLOATING_POINT
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue