ruby-changes:4619
From: ko1@a...
Date: Mon, 21 Apr 2008 10:00:21 +0900 (JST)
Subject: [ruby-changes:4619] usa - Ruby:r16113 (trunk): * time.c (rb_strftime): check errno to detect strftime(3)'s error.
usa 2008-04-21 09:59:43 +0900 (Mon, 21 Apr 2008)
New Revision: 16113
Modified files:
trunk/ChangeLog
trunk/time.c
Log:
* time.c (rb_strftime): check errno to detect strftime(3)'s error.
this is workaround for recent version of MSVCRT.
[ruby-dev:34456]
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/time.c?r1=16113&r2=16112&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=16113&r2=16112&diff_format=u
Index: time.c
===================================================================
--- time.c (revision 16112)
+++ time.c (revision 16113)
@@ -2003,8 +2003,9 @@
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';
Index: ChangeLog
===================================================================
--- ChangeLog (revision 16112)
+++ ChangeLog (revision 16113)
@@ -1,3 +1,9 @@
+Mon Apr 21 09:58:04 2008 NAKAMURA Usaku <usa@r...>
+
+ * time.c (rb_strftime): check errno to detect strftime(3)'s error.
+ this is workaround for recent version of MSVCRT.
+ [ruby-dev:34456]
+
Mon Apr 21 08:54:30 2008 NAKAMURA Usaku <usa@r...>
* gc.c (ruby_xmalloc): use size_t for malloc argument instead of long.
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/