ruby-changes:47184
From: nagachika <ko1@a...>
Date: Mon, 10 Jul 2017 05:02:19 +0900 (JST)
Subject: [ruby-changes:47184] nagachika:r59299 (ruby_2_4): merge revision(s) 58210: [Backport #8916]
nagachika 2017-07-10 05:02:04 +0900 (Mon, 10 Jul 2017) New Revision: 59299 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59299 Log: 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] Modified directories: branches/ruby_2_4/ Modified files: branches/ruby_2_4/strftime.c branches/ruby_2_4/version.h branches/ruby_2_4/vsnprintf.c Index: ruby_2_4/vsnprintf.c =================================================================== --- ruby_2_4/vsnprintf.c (revision 59298) +++ ruby_2_4/vsnprintf.c (revision 59299) @@ -1119,11 +1119,11 @@ number: if ((dprec = prec) >= 0) https://github.com/ruby/ruby/blob/trunk/ruby_2_4/vsnprintf.c#L1119 */ fieldsz = size; long_len: + realsz = dprec > fieldsz ? dprec : fieldsz; if (sign) - fieldsz++; + realsz++; if (flags & HEXPREFIX) - fieldsz += 2; - realsz = dprec > fieldsz ? dprec : fieldsz; + realsz += 2; /* right-adjusting blank padding */ if ((flags & (LADJUST|ZEROPAD)) == 0) @@ -1145,10 +1145,6 @@ long_len: https://github.com/ruby/ruby/blob/trunk/ruby_2_4/vsnprintf.c#L1145 /* 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 Index: ruby_2_4/version.h =================================================================== --- ruby_2_4/version.h (revision 59298) +++ ruby_2_4/version.h (revision 59299) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_4/version.h#L1 #define RUBY_VERSION "2.4.2" #define RUBY_RELEASE_DATE "2017-07-10" -#define RUBY_PATCHLEVEL 139 +#define RUBY_PATCHLEVEL 140 #define RUBY_RELEASE_YEAR 2017 #define RUBY_RELEASE_MONTH 7 Index: ruby_2_4/strftime.c =================================================================== --- ruby_2_4/strftime.c (revision 59298) +++ ruby_2_4/strftime.c (revision 59299) @@ -582,7 +582,7 @@ rb_strftime_with_timespec(VALUE ftime, c https://github.com/ruby/ruby/blob/trunk/ruby_2_4/strftime.c#L582 goto unknown; } i = snprintf(s, endp - s, (padding == ' ' ? "%+*ld" : "%+.*ld"), - precision + 1, sign * (off / 3600)); + precision + (padding == ' '), sign * (off / 3600)); if (i < 0) goto err; if (sign < 0 && off < 3600) { *(padding == ' ' ? s + i - 2 : s) = '-'; Index: ruby_2_4 =================================================================== --- ruby_2_4 (revision 59298) +++ ruby_2_4 (revision 59299) Property changes on: ruby_2_4 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r58210 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/