summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-11-30 09:23:23 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-11-30 09:23:23 +0000
commit38140960119f0404d44da1986cd18d8756051f71 (patch)
tree664c617d8b98a35efc59800386bd7eab80ae525f
parent58989128c1cd06a157853a9d14278281e5a860ce (diff)
merges r20355 from trunk into ruby_1_9_1.
* 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/branches/ruby_1_9_1@20413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog8
-rw-r--r--strftime.c10
2 files changed, 14 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 1b7bcbd020..6adfe52381 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/strftime.c b/strftime.c
index 5002c56c06..7913c792a5 100644
--- a/strftime.c
+++ b/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;
}