[前][次][番号順一覧][スレッド一覧]

ruby-changes:24505

From: shirosaki <ko1@a...>
Date: Sat, 28 Jul 2012 16:37:03 +0900 (JST)
Subject: [ruby-changes:24505] shirosaki:r36556 (trunk): win32/win32.c: fix localtime_r() on x64-mingw

shirosaki	2012-07-28 16:36:51 +0900 (Sat, 28 Jul 2012)

  New Revision: 36556

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36556

  Log:
    win32/win32.c: fix localtime_r() on x64-mingw
    
    * win32/win32.c (gmtime_r): use _gmtime64_s() with x86_64-w64-mingw32.
    
    * win32/win32.c (localtime_r): use _localtime64_s() with
      x86_64-w64-mingw32. Since FileTimeToSystemTime() seems not work with
      large value under x64. Mingw-w64 doesn't have these declaration.
      [ruby-core:46780] [Bug #6794]

  Modified files:
    trunk/ChangeLog
    trunk/win32/win32.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 36555)
+++ ChangeLog	(revision 36556)
@@ -1,3 +1,12 @@
+Sat Jul 28 16:26:09 2012  Hiroshi Shirosaki  <h.shirosaki@g...>
+
+	* win32/win32.c (gmtime_r): use _gmtime64_s() with x86_64-w64-mingw32.
+
+	* win32/win32.c (localtime_r): use _localtime64_s() with
+	  x86_64-w64-mingw32. Since FileTimeToSystemTime() seems not work with
+	  large value under x64. Mingw-w64 doesn't have these declaration.
+	  [ruby-core:46780] [Bug #6794]
+
 Fri Jul 27 18:25:51 2012  Nobuyoshi Nakada  <nobu@r...>
 
 	* io.c (rb_io_check_io): make public.
Index: win32/win32.c
===================================================================
--- win32/win32.c	(revision 36555)
+++ win32/win32.c	(revision 36556)
@@ -6555,7 +6555,7 @@
     return _osfile(fd) & FTEXT;
 }
 
-#if RUBY_MSVCRT_VERSION < 80
+#if RUBY_MSVCRT_VERSION < 80 && !defined(__MINGW64__)
 /* License: Ruby's */
 static int
 unixtime_to_systemtime(const time_t t, SYSTEMTIME *st)
@@ -6617,6 +6617,17 @@
 }
 #endif
 
+#ifdef __MINGW64__
+#ifndef gmtime_s
+# define gmtime_s _gmtime64_s
+  errno_t gmtime_s(struct tm* _tm, const time_t *time);
+#endif
+#ifndef localtime_s
+# define localtime_s _localtime64_s
+  errno_t localtime_s(struct tm* _tm, const time_t *time);
+#endif
+#endif
+
 /* License: Ruby's */
 struct tm *
 gmtime_r(const time_t *tp, struct tm *rp)
@@ -6627,7 +6638,7 @@
 	errno = e;
 	return NULL;
     }
-#if RUBY_MSVCRT_VERSION >= 80
+#if RUBY_MSVCRT_VERSION >= 80 || defined(__MINGW64__)
     e = gmtime_s(rp, tp);
     if (e != 0) goto error;
 #else
@@ -6651,7 +6662,7 @@
 	errno = e;
 	return NULL;
     }
-#if RUBY_MSVCRT_VERSION >= 80
+#if RUBY_MSVCRT_VERSION >= 80 || defined(__MINGW64__)
     e = localtime_s(rp, tp);
     if (e) goto error;
 #else

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]