mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05: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_3@59233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
75b1146985
commit
896d9fb995
4 changed files with 11 additions and 10 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Fri Jun 30 21:23:20 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* 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@atdot.net>
|
Fri Jun 30 21:20:14 2017 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* thread.c (ruby_thread_stack_overflow): disable VM events when stack
|
* thread.c (ruby_thread_stack_overflow): disable VM events when stack
|
||||||
|
|
|
@ -497,7 +497,7 @@ rb_strftime_with_timespec(char *s, size_t maxsize, const char *format, rb_encodi
|
||||||
goto unknown;
|
goto unknown;
|
||||||
}
|
}
|
||||||
i = snprintf(s, endp - s, (padding == ' ' ? "%+*ld" : "%+.*ld"),
|
i = snprintf(s, endp - s, (padding == ' ' ? "%+*ld" : "%+.*ld"),
|
||||||
precision + 1, sign * (off / 3600));
|
precision + (padding == ' '), sign * (off / 3600));
|
||||||
if (i < 0) goto err;
|
if (i < 0) goto err;
|
||||||
if (sign < 0 && off < 3600) {
|
if (sign < 0 && off < 3600) {
|
||||||
*(padding == ' ' ? s + i - 2 : s) = '-';
|
*(padding == ' ' ? s + i - 2 : s) = '-';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#define RUBY_VERSION "2.3.5"
|
#define RUBY_VERSION "2.3.5"
|
||||||
#define RUBY_RELEASE_DATE "2017-06-30"
|
#define RUBY_RELEASE_DATE "2017-06-30"
|
||||||
#define RUBY_PATCHLEVEL 329
|
#define RUBY_PATCHLEVEL 330
|
||||||
|
|
||||||
#define RUBY_RELEASE_YEAR 2017
|
#define RUBY_RELEASE_YEAR 2017
|
||||||
#define RUBY_RELEASE_MONTH 6
|
#define RUBY_RELEASE_MONTH 6
|
||||||
|
|
12
vsnprintf.c
12
vsnprintf.c
|
@ -1117,11 +1117,11 @@ number: if ((dprec = prec) >= 0)
|
||||||
*/
|
*/
|
||||||
fieldsz = size;
|
fieldsz = size;
|
||||||
long_len:
|
long_len:
|
||||||
if (sign)
|
|
||||||
fieldsz++;
|
|
||||||
if (flags & HEXPREFIX)
|
|
||||||
fieldsz += 2;
|
|
||||||
realsz = dprec > fieldsz ? dprec : fieldsz;
|
realsz = dprec > fieldsz ? dprec : fieldsz;
|
||||||
|
if (sign)
|
||||||
|
realsz++;
|
||||||
|
if (flags & HEXPREFIX)
|
||||||
|
realsz += 2;
|
||||||
|
|
||||||
/* right-adjusting blank padding */
|
/* right-adjusting blank padding */
|
||||||
if ((flags & (LADJUST|ZEROPAD)) == 0)
|
if ((flags & (LADJUST|ZEROPAD)) == 0)
|
||||||
|
@ -1143,10 +1143,6 @@ long_len:
|
||||||
|
|
||||||
/* leading zeroes from decimal precision */
|
/* leading zeroes from decimal precision */
|
||||||
PAD_L(dprec - fieldsz, zeroes);
|
PAD_L(dprec - fieldsz, zeroes);
|
||||||
if (sign)
|
|
||||||
fieldsz--;
|
|
||||||
if (flags & HEXPREFIX)
|
|
||||||
fieldsz -= 2;
|
|
||||||
|
|
||||||
/* the string or number proper */
|
/* the string or number proper */
|
||||||
#ifdef FLOATING_POINT
|
#ifdef FLOATING_POINT
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue