1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shirosaki 2012-07-28 07:36:51 +00:00
parent c1ef657b39
commit ce2a1e109c
2 changed files with 23 additions and 3 deletions

View file

@ -1,3 +1,12 @@
Sat Jul 28 16:26:09 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
* 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@ruby-lang.org>
* io.c (rb_io_check_io): make public.

View file

@ -6555,7 +6555,7 @@ rb_w32_fd_is_text(int fd) {
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 @@ systemtime_to_localtime(TIME_ZONE_INFORMATION *tz, SYSTEMTIME *gst, SYSTEMTIME *
}
#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 @@ gmtime_r(const time_t *tp, struct tm *rp)
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 @@ localtime_r(const time_t *tp, struct tm *rp)
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