1
0
Fork 0
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:
matz 2008-11-25 14:24:47 +00:00
parent a689e57283
commit 446ea127c3
2 changed files with 14 additions and 4 deletions

View file

@ -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> Tue Nov 25 10:35:29 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* strftime.c (rb_strftime): "%^P" should convert to upper case. * strftime.c (rb_strftime): "%^P" should convert to upper case.

View file

@ -310,8 +310,8 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct tm *timept
again: again:
switch (*++format) { switch (*++format) {
case '\0': case '\0':
*s++ = '%'; format--;
goto out; goto unknown;
case '%': case '%':
*s++ = '%'; *s++ = '%';
@ -762,8 +762,11 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct tm *timept
default: default:
unknown: unknown:
tp = sp;
i = format - sp + 1; i = format - sp + 1;
tp = sp;
precision = -1;
flags = 0;
padding = 0;
break; break;
} }
if (i) { if (i) {
@ -786,7 +789,6 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct tm *timept
} }
} }
} }
out:
if (s >= endp) { if (s >= endp) {
goto err; goto err;
} }