mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* strftime.c (rb_strftime): should not swallow incomplete
formatter, e.g. "%E". [ruby-dev:37170] fix: #787 * strftime.c (rb_strftime): clear flags before processing unknown formatter, e.g. "%i". [ruby-dev:37180] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a689e57283
commit
446ea127c3
2 changed files with 14 additions and 4 deletions
|
@ -1,3 +1,11 @@
|
|||
Tue Nov 25 15:54:07 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* strftime.c (rb_strftime): should not swallow incomplete
|
||||
formatter, e.g. "%E". [ruby-dev:37170] fix: #787
|
||||
|
||||
* strftime.c (rb_strftime): clear flags before processing unknown
|
||||
formatter, e.g. "%i". [ruby-dev:37180]
|
||||
|
||||
Tue Nov 25 10:35:29 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* strftime.c (rb_strftime): "%^P" should convert to upper case.
|
||||
|
|
10
strftime.c
10
strftime.c
|
@ -310,8 +310,8 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct tm *timept
|
|||
again:
|
||||
switch (*++format) {
|
||||
case '\0':
|
||||
*s++ = '%';
|
||||
goto out;
|
||||
format--;
|
||||
goto unknown;
|
||||
|
||||
case '%':
|
||||
*s++ = '%';
|
||||
|
@ -762,8 +762,11 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct tm *timept
|
|||
|
||||
default:
|
||||
unknown:
|
||||
tp = sp;
|
||||
i = format - sp + 1;
|
||||
tp = sp;
|
||||
precision = -1;
|
||||
flags = 0;
|
||||
padding = 0;
|
||||
break;
|
||||
}
|
||||
if (i) {
|
||||
|
@ -786,7 +789,6 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct tm *timept
|
|||
}
|
||||
}
|
||||
}
|
||||
out:
|
||||
if (s >= endp) {
|
||||
goto err;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue