summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-15 13:16:03 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-15 13:16:03 +0000
commit9d85efb74d19a741f7da42b424868a32f117fa23 (patch)
treec5815ce5b001c8e45a0850fa42c1469d67eb4fb9
parente826790f3980451608701061a9a48b362d477426 (diff)
merge revision(s) 16114:
* time.c (rb_strftime): check errno to detect strftime(3)'s error. this is workaround for recent version of MSVCRT. [ruby-dev:34456] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_5@17248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--time.c4
-rw-r--r--version.h2
3 files changed, 10 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 1cbf21e..72e4667 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Sun Jun 15 22:13:13 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * time.c (rb_strftime): check errno to detect strftime(3)'s error.
+ this is workaround for recent version of MSVCRT.
+ [ruby-dev:34456]
+
Sun Jun 15 22:10:14 2008 Akinori MUSHA <knu@iDaemons.org>
* lib/yaml/types.rb: Likewise, pass self to YAML::quick_emit;
diff --git a/time.c b/time.c
index b8da863..308544e 100644
--- a/time.c
+++ b/time.c
@@ -18,6 +18,7 @@
#include <unistd.h>
#endif
+#include <errno.h>
#include <math.h>
VALUE rb_cTime;
@@ -1776,8 +1777,9 @@ rb_strftime(buf, format, time)
if (flen == 0) {
return 0;
}
+ errno = 0;
len = strftime(*buf, SMALLBUF, format, time);
- if (len != 0 || **buf == '\0') return len;
+ if (len != 0 || (**buf == '\0' && errno != ERANGE)) return len;
for (size=1024; ; size*=2) {
*buf = xmalloc(size);
(*buf)[0] = '\0';
diff --git a/version.h b/version.h
index d4b40c6..e5b60cd 100644
--- a/version.h
+++ b/version.h
@@ -2,7 +2,7 @@
#define RUBY_RELEASE_DATE "2008-06-15"
#define RUBY_VERSION_CODE 185
#define RUBY_RELEASE_CODE 20080615
-#define RUBY_PATCHLEVEL 195
+#define RUBY_PATCHLEVEL 196
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 8