ruby-changes:47118
From: usa <ko1@a...>
Date: Fri, 30 Jun 2017 21:24:26 +0900 (JST)
Subject: [ruby-changes:47118] usa:r59233 (ruby_2_3): merge revision(s) 58210: [Backport #8916]
usa 2017-06-30 21:24:21 +0900 (Fri, 30 Jun 2017) New Revision: 59233 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59233 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_3/ Modified files: branches/ruby_2_3/ChangeLog branches/ruby_2_3/strftime.c branches/ruby_2_3/version.h branches/ruby_2_3/vsnprintf.c Index: ruby_2_3/ChangeLog =================================================================== --- ruby_2_3/ChangeLog (revision 59232) +++ ruby_2_3/ChangeLog (revision 59233) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1 +Fri Jun 30 21:23:20 2017 Nobuyoshi Nakada <nobu@r...> + + * vsnprintf.c (BSD_vfprintf): sign and hex-prefix should not be counted + in precision. [Bug #8916] + Fri Jun 30 21:20:14 2017 Koichi Sasada <ko1@a...> * thread.c (ruby_thread_stack_overflow): disable VM events when stack Index: ruby_2_3/vsnprintf.c =================================================================== --- ruby_2_3/vsnprintf.c (revision 59232) +++ ruby_2_3/vsnprintf.c (revision 59233) @@ -1117,11 +1117,11 @@ number: if ((dprec = prec) >= 0) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/vsnprintf.c#L1117 */ 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) @@ -1143,10 +1143,6 @@ long_len: https://github.com/ruby/ruby/blob/trunk/ruby_2_3/vsnprintf.c#L1143 /* 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_3/strftime.c =================================================================== --- ruby_2_3/strftime.c (revision 59232) +++ ruby_2_3/strftime.c (revision 59233) @@ -497,7 +497,7 @@ rb_strftime_with_timespec(char *s, size_ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/strftime.c#L497 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_3/version.h =================================================================== --- ruby_2_3/version.h (revision 59232) +++ ruby_2_3/version.h (revision 59233) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1 #define RUBY_VERSION "2.3.5" #define RUBY_RELEASE_DATE "2017-06-30" -#define RUBY_PATCHLEVEL 329 +#define RUBY_PATCHLEVEL 330 #define RUBY_RELEASE_YEAR 2017 #define RUBY_RELEASE_MONTH 6 Index: ruby_2_3 =================================================================== --- ruby_2_3 (revision 59232) +++ ruby_2_3 (revision 59233) Property changes on: ruby_2_3 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r58210 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/