From f908a898ecd5286ac1bd056a0633ab63fa33cec4 Mon Sep 17 00:00:00 2001 From: Earnie Boyd Date: Tue, 4 Jun 2013 15:50:27 -0400 Subject: [PATCH] Modifications for _USE_32BIT_TIME_T issue. --- ChangeLog | 34 +++++++ include/_mingw.h | 39 +++++-- include/io.h | 285 +++++++++++++++++++++++++++++++++++++++++----------- include/sdkddkver.h | 13 +-- include/sys/stat.h | 123 +++++++++++++++++++---- include/sys/timeb.h | 63 +++++------- include/sys/types.h | 2 +- include/time.h | 93 ++++++++++------- include/wchar.h | 87 ++++++++++------ 9 files changed, 541 insertions(+), 198 deletions(-) diff --git a/ChangeLog b/ChangeLog index 90e68b5..fe71f0f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,37 @@ +2013-06-04 Earnie Boyd + + * include/_mingw.h (MSVCRT_VERSION): Determine a value based on the + _WIN32_WINNT value. Add a TODO for check to see if the older + __MSVCRT_VERSION__ macro is defined and use it as the value for + MSVCRT_VERSION. Give an error if both MSVCRT_VERSION and + __MSVCRT_VERSION__ are defined and the values do not match. + Remove warnings for value when _USE_32BIT_TIME_T is defined. + * include/io.h (_wfindfirst32, _wfindfirst64): Correct declaration of + parameter data type. Create _CRTALIAS rather than declaring _CRTIMP. + (_findfirst32(), _findnext32()): Create _CRTALIAS rather than declaring + a _CRTIMP. + (_findfirst64i32, _findfirst32i64, _findnext64i32, _findnext32i64): + Remove the _CRTIMP from the declaration, these become inline functions. + Also guard for __NO_INLINE__ and make appropriate defined alternatives. + (_wfindfirst64i32, _wfindfirst32i64, _wfindnext64i32, _wfindnext32i64): + Ditto. + * include/sdkddkver.h (_WIN32_WINNT_WIN8): Add definition. + * include/sys/stat.h (_stat32, _fstat32, _wstat32): Define as a + _CRTALIAS. + (_fstat32i64, _stat32i64, _wstat32i64): Add as __CRT_INLINE functions + and make appropriate alternative macros for __NO_INLINE__ use. + * include/sys/timeb.h (_time32): Create _CRTALIAS when MSVCRT_VERSION + < 800. + * include/sys/types.h (MSVCRT_VERSION): Remove guard for >= 800 with + _USE_32BIT_TIME_T. + * include/time.h (_time32, _difftime32, _mktime32, _ctime32, _gmtime32, + _localtime32, _wctime32): Create _CRTALIAS when MSVCRT_VERSION < 800. + (_difftime64, _mkgtime64): Guard declaration for MSVCRT_VERSION > 800. + These functions do not exist in MSVCRT.DLL before Vista. + * include/wchar.h (_wctime32): Create _CRTALIAS when MSVCRT_VERSION + < 800. + (_wfindfirst32, _wfindnext32): Create _CRTALIAS. + 2013-05-28 Earnie Boyd * include/time.h: Correct use of MSVCRT_VERSION. diff --git a/include/_mingw.h b/include/_mingw.h index 4d58f57..4706ddb 100644 --- a/include/_mingw.h +++ b/include/_mingw.h @@ -243,6 +243,21 @@ # endif #endif +/* @TODO: Need to convert __MSVCRT_VERSION__ value to MSVCRT_VERSION value. + * HEX to DECIMAL will not work. */ +#if 0 +#ifdef __MSVCRT_VERSION__ +#ifdef MSVCRT_VERSION +#if MSVCRT_VERSION != __MSVCRT_VERSION__ +#error You have specified __MSVCRT_VERSION__ and MSVCRT_VERSION and they are \ +not equal. +#endif /* MSVCRT_VERSION != __MSVCRT_VERSION__ */ +#else /* ndef MSVCRT_VERSION */ +#define MSVCRT_VERSION __MSVCRT_VERSION__ +#endif /* MSVCRT_VERSION */ +#endif /* __MSVCRT_VERSION__ */ +#endif /* 0 */ + /* * We need to set a default MSVCRT_VERSION which describes the MSVCRT.DLL on * the users system. We are defaulting to XP but we recommend the user define @@ -255,16 +270,22 @@ * WIN8 = 1010 */ #ifndef MSVCRT_VERSION +#if _WIN32_WINNT >= _WIN32_WINNT_WIN8 +#define MSVCRT_VERSION 1010 +#elif _WIN32_WINNT >= _WIN32_WINNT_WIN7 +#define MSVCRT_VERSION 900 +#elif _WIN32_WINNT >= _WIN32_WINNT_VISTA +#define MSVCRT_VERSION 800 +#elif _WIN32_WINNT >= _WIN32_WINNT_WINXP #define MSVCRT_VERSION 710 -#endif - -#ifdef _USE_32BIT_TIME_T -#if MSVCRT_VERSION < 800 -#warning Your MSVCRT_VERSION does not support the use of _USE_32BIT_TIME_T. -#warning You should define MSVCRT_VERSION based on your MSVCRT.DLL version. -#warning ME = 600, XP = 710, VISTA = 800, WIN7 = 900 and WIN8 = 1010. -#endif /* MSVCRT_VERSION < 800 */ -#endif /* _USE_32BIT_TIME_T */ +#elif _WIN32_WINNT >= _WIN32_WINNT_WIN2K +#define MSVCRT_VERSION 700 +#elif _WIN32_WINNT >= _WIN32_WINNT_WINME +#define MSVCRT_VERSION 600 +#else +#define MSVCRT_VERSION 700 +#endif /* _WIN32_WINNT >= _WIN32_WINNT_WINME */ +#endif /* ndef MSVCRT_VERSION */ struct threadlocalinfostruct; struct threadmbinfostruct; diff --git a/include/io.h b/include/io.h index f86f883..6581094 100644 --- a/include/io.h +++ b/include/io.h @@ -8,11 +8,11 @@ * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -109,26 +109,7 @@ struct _finddata64i32_t { _fsize_t size; char name[FILENAME_MAX]; }; -#if defined(_HAVE_32BIT_TIME_T) -#if defined(_USE_32BIT_TIME_T) -#define _finddata_t _finddata32_t -#define _finddatai64_t _finddata32i64_t -#define _findfirst _findfirst32 -#define _findnext _findnext32 -#define _findfirsti64 _findfirst32i64 -#define _findnexti64 _findnext32i64 -#else /* !_USE_32BIT_TIME_T */ -#define _finddata_t _finddata64i32_t -#define _finddatai64_t __finddata64_t -#define _findfirst _findfirst64i32 -#define _findnext _findnext64i32 -#define _findfirsti64 _findfirst64 -#define _findnexti64 _findnext64 -#endif /* _USE_32BIT_TIME_T */ -#else /* !_HAVE_32BIT_TIME_T */ -#define _finddata_t _finddata64i32_t -#define _finddatai64_t __finddata64_t -#endif /* _HAVE_32BIT_TIME_T */ + #define _FINDDATA_T_DEFINED #endif /* !_FINDDATA_T_DEFINED */ @@ -169,26 +150,6 @@ struct _wfinddata64i32_t { __int32 size; wchar_t name[FILENAME_MAX]; }; -#if defined(_HAVE_32BIT_TIME_T) -#if defined(_USE_32BIT_TIME_T) -#define _wfinddata_t _wfinddata32_t -#define _wfinddatai64_t _wfinddata32i64_t -#define _wfindfirst _wfindfirst32 -#define _wfindnext _wfindnext32 -#define _wfindfirsti64 _wfindfirst32i64 -#define _wfindnexti64 _wfindnext32i64 -#else /* ! _USE_32BIT_TIME_T */ -#define _wfinddata_t _wfinddata64i32_t -#define _wfinddatai64_t _wfinddata64_t -#define _wfindfirst _wfindfirst64i32 -#define _wfindnext _wfindnext64i32 -#define _wfindfirsti64 _wfindfirst64 -#define _wfindnexti64 _wfindnext64 -#endif /* _USE_32BIT_TIME_T */ -#else /* ! _HAVE_32BIT_TIME_T */ -#define _wfinddata_t _wfinddata64i32_t -#define _wfinddatai64_t _wfinddata64_t -#endif /* _HAVE_32BIT_TIME_T */ #define _WFINDDATA_T_DEFINED #endif /* ! _WFINDDATA_T_DEFINED */ @@ -211,8 +172,8 @@ intptr_t _findfirst32i64 (const char *filespec,struct _finddata32i64_t *fileinfo intptr_t _findfirst64i32 (const char *filespec,struct _finddata64i32_t *fileinfo); intptr_t _wfindfirst (const wchar_t *filespec,struct _wfinddata_t *fileinfo); -intptr_t _wfindfirst32 (const wchar_t *filespec,struct __wfinddata32_t *fileinfo); -intptr_t _wfindfirst64 (const wchar_t *filespec, struct __wfinddata64_t *fileinfo); +intptr_t _wfindfirst32 (const wchar_t *filespec,struct _wfinddata32_t *fileinfo); +intptr_t _wfindfirst64 (const wchar_t *filespec, struct _wfinddata64_t *fileinfo); intptr_t _wfindfirsti64 (const wchar_t *filespec, struct _wfinddatai64_t *fileinfo); intptr_t _wfindfirst32i64(const wchar_t *filespec, struct _wfinddata32i64_t *fileinfo); intptr_t _wfindfirst64i32(const wchar_t *filespec, struct _wfinddata64i32_t *fileinfo); @@ -243,8 +204,16 @@ _wfindfirst64i32 definition */ _CRTIMP int __cdecl __MINGW_NOTHROW _findclose (intptr_t); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _findfirst32 (const char*, struct _finddata32_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _findnext32 (intptr_t, struct _finddata32_t*); + +/* _findfirst32 and _findnext32 do not exist in MSVCRT.DLL */ +_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _findfirst (const char*, struct _finddata32_t*); +_CRTALIAS intptr_t __cdecl __MINGW_NOTHROW _findfirst32 (const char* _v1, struct _finddata32_t* _v2) { + return _findfirst(_v1, _v2); +} +_CRTIMP int __cdecl __MINGW_NOTHROW _findnext (intptr_t, struct _finddata32_t*); +_CRTALIAS int __cdecl __MINGW_NOTHROW _findnext32 (intptr_t _v1, struct _finddata32_t* _v2) { + return _findnext(_v1, _v2); +} _CRTIMP int __cdecl __MINGW_NOTHROW _chdir (const char*); _CRTIMP char* __cdecl __MINGW_NOTHROW _getcwd (char*, int); @@ -257,16 +226,87 @@ _CRTIMP int __cdecl __MINGW_NOTHROW _findnexti64(intptr_t, struct _finddatai64_t _CRTIMP __int64 __cdecl __MINGW_NOTHROW _lseeki64(int, __int64, int); _CRTIMP __int64 __cdecl __MINGW_NOTHROW _telli64(int); _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _findfirst64(const char*, struct __finddata64_t*); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _findfirst32i64(const char*, struct _finddata32i64_t*); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _findfirst64i32(const char*, struct _finddata64i32_t*); +intptr_t __cdecl __MINGW_NOTHROW _findfirst32i64(const char*, struct _finddata32i64_t*); +intptr_t __cdecl __MINGW_NOTHROW _findfirst64i32(const char*, struct _finddata64i32_t*); _CRTIMP int __cdecl __MINGW_NOTHROW _findnext64(intptr_t, struct __finddata64_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _findnext32i64(intptr_t, struct _finddata32i64_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _findnext64i32(intptr_t, struct _finddata64i32_t*); +int __cdecl __MINGW_NOTHROW _findnext32i64(intptr_t, struct _finddata32i64_t*); +int __cdecl __MINGW_NOTHROW _findnext64i32(intptr_t, struct _finddata64i32_t*); + +#ifndef __NO_INLINE__ +#include +__CRT_INLINE __cdecl __MINGW_NOTHROW intptr_t _findfirst32i64(const char* _filename, struct _finddata32i64_t* _fdata) { + struct __finddata64_t fd; + intptr_t ret = _findfirst64(_filename, &fd); + if (ret == -1) { + memset(_fdata, 0, sizeof(struct __finddata64_t)); + return ret; + } + _fdata->attrib = fd.attrib; + _fdata->time_create = (__time32_t)fd.time_create; + _fdata->time_access = (__time32_t)fd.time_access; + _fdata->time_write = (__time32_t)fd.time_write; + _fdata->size = fd.size; + strncpy(_fdata->name, fd.name, FILENAME_MAX); + return ret; +} + +__CRT_INLINE __cdecl __MINGW_NOTHROW intptr_t _findfirst64i32(const char* _filename, struct _finddata64i32_t* _fdata) { + struct _finddata32_t fd; + intptr_t ret = _findfirst32(_filename, &fd); + if (ret == -1) { + memset(_fdata, 0, sizeof(struct _finddata32_t)); + return ret; + } + _fdata->attrib = fd.attrib; + _fdata->time_create = (__time64_t)fd.time_create; + _fdata->time_access = (__time64_t)fd.time_access; + _fdata->time_write = (__time64_t)fd.time_write; + _fdata->size = fd.size; + strncpy(_fdata->name, fd.name, FILENAME_MAX); + return ret; +} + +__CRT_INLINE __cdecl __MINGW_NOTHROW intptr_t _findnext32i64(intptr_t _fp, struct _finddata32i64_t* _fdata) { + struct __finddata64_t fd; + int ret = _findnext64(_fp,&fd); + if (ret == -1) { + memset(_fdata, 0, sizeof(struct _finddata32i64_t)); + return ret; + } + _fdata->attrib = fd.attrib; + _fdata->time_create = (__time32_t)fd.time_create; + _fdata->time_access = (__time32_t)fd.time_access; + _fdata->time_write = (__time32_t)fd.time_write; + _fdata->size = fd.size; + strncpy(_fdata->name, fd.name, FILENAME_MAX); + return ret; +} + +__CRT_INLINE __cdecl __MINGW_NOTHROW intptr_t _findnext64i32(intptr_t _fp, struct _finddata64i32_t* _fdata) { + struct _finddata32_t fd; + int ret = _findnext32(_fp, &fd); + if (ret == -1) { + memset(_fdata, 0, sizeof(struct _finddata64i32_t)); + return ret; + } + _fdata->attrib = fd.attrib; + _fdata->time_create = (__time64_t)fd.time_create; + _fdata->time_access = (__time64_t)fd.time_access; + _fdata->time_write = (__time64_t)fd.time_write; + _fdata->size = fd.size; + strncpy(_fdata->name, fd.name, FILENAME_MAX); + return ret; +} +#else /* def __NO_INLINE__ */ +#define _findfirst64i32 _findfirst64 +#define _findfirst32i64 _findfirst32 +#define _findnext64i32 _findnext64 +#define _findnext32i64 _findnext32 +#endif /* ndef __NO_INLINE__ */ #ifndef __NO_MINGW_LFS __CRT_INLINE off64_t lseek64 (int, off64_t, int); -__CRT_INLINE off64_t lseek64 (int fd, off64_t offset, int whence) -{ +__CRT_INLINE off64_t lseek64 (int fd, off64_t offset, int whence) { return _lseeki64(fd, (__int64) offset, whence); } #endif @@ -296,7 +336,7 @@ _CRTIMP int __cdecl __MINGW_NOTHROW chmod (const char*, int); * it doesn't seem to hurt to add them). */ #define F_OK 0 /* Check for file existence */ /* Well maybe it does hurt. On newer versions of MSVCRT, an access mode - of 1 causes invalid parameter error. */ + of 1 causes invalid parameter error. */ #define X_OK 1 /* MS access() doesn't check for execute permission. */ #define W_OK 2 /* Check for write permission */ #define R_OK 4 /* Check for read permission */ @@ -360,22 +400,116 @@ _CRTIMP int __cdecl __MINGW_NOTHROW _write (int, const void*, unsigned int); /* Wide character versions. Also declared in wchar.h. */ #if !defined (_WIO_DEFINED) +#define _WIO_DEFINED _CRTIMP int __cdecl __MINGW_NOTHROW _waccess(const wchar_t*, int); _CRTIMP int __cdecl __MINGW_NOTHROW _wchmod(const wchar_t*, int); _CRTIMP int __cdecl __MINGW_NOTHROW _wcreat(const wchar_t*, int); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wfindfirst32 (const wchar_t*, struct __wfinddata32_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wfindnext32 (intptr_t, struct __wfinddata32_t*); + +/* _wfindfirst32 and _wfindnext32 do not exist in MSVCRT.DLL */ +_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wfindfirst (const wchar_t*, struct _wfinddata32_t*); +intptr_t __cdecl __MINGW_NOTHROW _wfindfirst32 (const wchar_t*, struct _wfinddata32_t*); +_CRTALIAS intptr_t __cdecl __MINGW_NOTHROW _wfindfirst32 (const wchar_t* _v1, struct _wfinddata32_t* _v2) { + return _wfindfirst(_v1, _v2); +} +_CRTIMP int __cdecl __MINGW_NOTHROW _wfindnext (intptr_t, struct _wfinddata32_t*); +int __cdecl __MINGW_NOTHROW _wfindnext32 (intptr_t, struct _wfinddata32_t*); +_CRTALIAS int __cdecl __MINGW_NOTHROW _wfindnext32 (intptr_t _v1, struct _wfinddata32_t* _v2) { + return _wfindnext(_v1, _v2); +} + _CRTIMP int __cdecl __MINGW_NOTHROW _wunlink(const wchar_t*); _CRTIMP int __cdecl __MINGW_NOTHROW _wopen(const wchar_t*, int, ...); _CRTIMP int __cdecl __MINGW_NOTHROW _wsopen(const wchar_t*, int, int, ...); _CRTIMP wchar_t * __cdecl __MINGW_NOTHROW _wmktemp(wchar_t*); _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wfindfirst64(const wchar_t*, struct _wfinddata64_t*); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wfindfirst32i64 (const wchar_t*, struct _wfinddata32i64_t*); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wfindfirst64i32 (const wchar_t*, struct _wfinddata64i32_t*); +intptr_t __cdecl __MINGW_NOTHROW _wfindfirst32i64 (const wchar_t*, struct _wfinddata32i64_t*); +intptr_t __cdecl __MINGW_NOTHROW _wfindfirst64i32 (const wchar_t*, struct _wfinddata64i32_t*); _CRTIMP int __cdecl __MINGW_NOTHROW _wfindnext64(intptr_t, struct _wfinddata64_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wfindnext32i64 (intptr_t, struct _wfinddata32i64_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wfindnext64i32 (intptr_t, struct _wfinddata64i32_t*); -#define _WIO_DEFINED +int __cdecl __MINGW_NOTHROW _wfindnext32i64 (intptr_t, struct _wfinddata32i64_t*); +int __cdecl __MINGW_NOTHROW _wfindnext64i32 (intptr_t, struct _wfinddata64i32_t*); + +#ifndef __NO_INLINE__ +#include +__CRT_INLINE __cdecl __MINGW_NOTHROW intptr_t _wfindfirst32i64(const wchar_t* _filename, struct _wfinddata32i64_t* _fdata) { + struct _wfinddata64_t fd; + intptr_t ret = _wfindfirst64(_filename, &fd); + if (ret == -1) { + memset(_fdata, 0, sizeof(struct _wfinddata64_t)); + return ret; + } + _fdata->attrib = fd.attrib; + _fdata->time_create = (__time32_t)fd.time_create; + _fdata->time_access = (__time32_t)fd.time_access; + _fdata->time_write = (__time32_t)fd.time_write; + _fdata->size = fd.size; + wcsncpy(_fdata->name, fd.name, FILENAME_MAX); + return ret; +} + +__CRT_INLINE __cdecl __MINGW_NOTHROW intptr_t _wfindfirst64i32(const wchar_t* _filename, struct _wfinddata64i32_t* _fdata) { + struct _wfinddata32_t fd; + intptr_t ret = _wfindfirst32(_filename, &fd); + if (ret == -1) { + memset(_fdata, 0, sizeof(struct _wfinddata32_t)); + return ret; + } + _fdata->attrib = fd.attrib; + _fdata->time_create = (__time64_t)fd.time_create; + _fdata->time_access = (__time64_t)fd.time_access; + _fdata->time_write = (__time64_t)fd.time_write; + _fdata->size = fd.size; + wcsncpy(_fdata->name, fd.name, FILENAME_MAX); + return ret; +} + +__CRT_INLINE __cdecl __MINGW_NOTHROW intptr_t _wfindnext32i64(intptr_t _fp, struct _wfinddata32i64_t* _fdata) { + struct _wfinddata64_t fd; + int ret = _wfindnext64(_fp,&fd); + if (ret == -1) { + memset(_fdata, 0, sizeof(struct _wfinddata32i64_t)); + return ret; + } + _fdata->attrib = fd.attrib; + _fdata->time_create = (__time32_t)fd.time_create; + _fdata->time_access = (__time32_t)fd.time_access; + _fdata->time_write = (__time32_t)fd.time_write; + _fdata->size = fd.size; + wcsncpy(_fdata->name, fd.name, FILENAME_MAX); + return ret; +} + +__CRT_INLINE __cdecl __MINGW_NOTHROW intptr_t _wfindnext64i32(intptr_t _fp, struct _wfinddata64i32_t* _fdata) { + struct _wfinddata32_t fd; + int ret = _wfindnext32(_fp, &fd); + if (ret == -1) { + memset(_fdata, 0, sizeof(struct _wfinddata64i32_t)); + return ret; + } + _fdata->attrib = fd.attrib; + _fdata->time_create = (__time64_t)fd.time_create; + _fdata->time_access = (__time64_t)fd.time_access; + _fdata->time_write = (__time64_t)fd.time_write; + _fdata->size = fd.size; + wcsncpy(_fdata->name, fd.name, FILENAME_MAX); + return ret; +} + +#else /* def __NO_INLINE__ */ +#define _findfirst64i32 _findfirst64 +#define _finddata64i32_t __finddata64_t +#define _findfirst32i64 _findfirst32 +#define _finddata32i64_t _finddata32_t +#define _findnext64i32 _findnext64 +#define _findnext32i64 _findnext32 + +#define _wfindfirst64i32 _wfindfirst64 +#define _wfindnext64i32 _wfindnext64 +#define _wfinddata64i32_t _wfinddata64_t +#define _wfindfirst32i64 _wfindfirst32 +#define _wfindnext32i64 _wfindnext32 +#define _wfinddata32i64_t _wfinddata32_t +#endif /* ndef __NO_INLINE__ */ + #endif /* _WIO_DEFINED */ #ifndef _NO_OLDNAMES @@ -433,6 +567,37 @@ wchar_t * wmktemp(wchar_t *); } #endif +#if defined(_USE_32BIT_TIME_T) +#define _finddata_t _finddata32_t +#define _finddatai64_t _finddata32i64_t +#define _findfirst _findfirst32 +#define _findnext _findnext32 +#define _findfirsti64 _findfirst32i64 +#define _findnexti64 _findnext32i64 +#define _wfinddata_t _wfinddata32_t +#define _wfinddatai64_t _wfinddata32i64_t +#define _wfindfirst _wfindfirst32 +#define _wfindnext _wfindnext32 +#define _wfindfirsti64 _wfindfirst32i64 +#define _wfindnexti64 _wfindnext32i64 + +#else /* !_USE_32BIT_TIME_T */ +#define _finddata_t _finddata64i32_t +#define _finddatai64_t __finddata64_t +#define _findfirst _findfirst64i32 +#define _findnext _findnext64i32 +#define _findfirsti64 _findfirst64 +#define _findnexti64 _findnext64 +#define _wfinddata_t _wfinddata64i32_t +#define _wfinddatai64_t _wfinddata64_t +#define _wfindfirst _wfindfirst64i32 +#define _wfindnext _wfindnext64i32 +#define _wfindfirsti64 _wfindfirst64 +#define _wfindnexti64 _wfindnext64 + +#endif /* _USE_32BIT_TIME_T */ + + #endif /* Not RC_INVOKED */ #endif /* _IO_H_ not defined */ diff --git a/include/sdkddkver.h b/include/sdkddkver.h index f674460..7040a5c 100644 --- a/include/sdkddkver.h +++ b/include/sdkddkver.h @@ -8,11 +8,11 @@ * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -57,10 +57,10 @@ * http://msdn.microsoft.com/en-us/library/windows/desktop/aa383745(v=vs.85).aspx */ #define _WIN32_WINNT_NT4 0x0400 -#define _WIN32_WINNT_NT4E 0x0401 -#define _WIN32_WINNT_WIN95 0x0400 -#define _WIN32_WINNT_WIN98 0x0410 -#define _WIN32_WINNT_WINME 0x0490 +#define _WIN32_WINNT_NT4E 0x0401 +#define _WIN32_WINNT_WIN95 0x0400 +#define _WIN32_WINNT_WIN98 0x0410 +#define _WIN32_WINNT_WINME 0x0490 #define _WIN32_WINNT_WIN2K 0x0500 #define _WIN32_WINNT_WINXP 0x0501 #define _WIN32_WINNT_WS03 0x0502 @@ -69,6 +69,7 @@ #define _WIN32_WINNT_WS08 0x0600 #define _WIN32_WINNT_LONGORN 0x0600 #define _WIN32_WINNT_WIN7 0x0601 +#define _WIN32_WINNT_WIN8 0x0602 /** * Version constants defining _WIN32_IE versions. diff --git a/include/sys/stat.h b/include/sys/stat.h index e8b85ab..35b4023 100644 --- a/include/sys/stat.h +++ b/include/sys/stat.h @@ -170,33 +170,28 @@ struct _stat64i32 { __time64_t st_ctime; }; -#define __stat64 _stat64 -#if defined(_USE_32BIT_TIME_T) && MSVCRT_VERSION >= 800 -#define _fstat _fstat32 -#define _fstati64 _fstat32i64 -#define _stat _stat32 -#define _stati64 _stat32i64 -#else /* !_USE_32BIT_TIME_T */ -#define _fstat _fstat64i32 -#define _fstati64 _fstat64 -#define _stat _stat64i32 -#define _stati64 _stat64 -#endif /* _USE_32BIT_TIME_T */ -#define _STAT_DEFINED -#endif /* _STAT_DEFINED */ - #ifdef __cplusplus extern "C" { #endif +/* _stat32 does not exist in MSVCRT.DLL */ +_CRTIMP int __cdecl __MINGW_NOTHROW _stat (const char*, struct _stat32*); +_CRTALIAS int __cdecl __MINGW_NOTHROW _stat32 (const char* _v1, struct _stat32* _v2) { + return _stat(_v1, _v2); +} -_CRTIMP int __cdecl __MINGW_NOTHROW _stat32 (const char*, struct _stat32*); _CRTIMP int __cdecl __MINGW_NOTHROW _stat64 (const char*, struct _stat64*); -_CRTIMP int __cdecl __MINGW_NOTHROW _stat32i64 (const char*, struct _stat32i64*); +int __cdecl __MINGW_NOTHROW _stat32i64 (const char*, struct _stat32i64*); int __cdecl __MINGW_NOTHROW _stat64i32 (const char*, struct _stat64i32*); -_CRTIMP int __cdecl __MINGW_NOTHROW _fstat32 (int, struct _stat32*); + +/* _fstat32 does not exist in MSVCRT.DLL */ +_CRTIMP int __cdecl __MINGW_NOTHROW _fstat (int, struct _stat32*); +_CRTALIAS int __cdecl __MINGW_NOTHROW _fstat32 (int _v1, struct _stat32* _v2) { + return _fstat(_v1, _v2); +} + _CRTIMP int __cdecl __MINGW_NOTHROW _fstat64 (int, struct _stat64*); -_CRTIMP int __cdecl __MINGW_NOTHROW _fstat32i64 (int, struct _stat32i64*); +int __cdecl __MINGW_NOTHROW _fstat32i64 (int, struct _stat32i64*); int __cdecl __MINGW_NOTHROW _fstat64i32 (int, struct _stat64i32*); #ifndef __NO_INLINE__ #include /* Need memset declaration */ @@ -221,6 +216,27 @@ int __cdecl __MINGW_NOTHROW _fstat64i32 (int, struct _stat64i32*); _stat->st_ctime = st.st_ctime; return ret; } + __CRT_INLINE int __cdecl _fstat32i64(int desc, struct _stat32i64 *_stat) + { + struct _stat32 st; + int ret = _fstat32(desc, &st); + if (ret == -1) { + memset(_stat, 0, sizeof(struct _stat32i64)); + return -1; + } + _stat->st_dev = st.st_dev; + _stat->st_ino = st.st_ino; + _stat->st_mode = st.st_mode; + _stat->st_nlink = st.st_nlink; + _stat->st_uid = st.st_uid; + _stat->st_gid = st.st_gid; + _stat->st_rdev = st.st_rdev; + _stat->st_size = (_off_t) st.st_size; + _stat->st_atime = st.st_atime; + _stat->st_mtime = st.st_mtime; + _stat->st_ctime = st.st_ctime; + return ret; + } __CRT_INLINE int __cdecl _stat64i32(const char *fname, struct _stat64i32 *_stat) { struct _stat64 st; @@ -242,18 +258,61 @@ int __cdecl __MINGW_NOTHROW _fstat64i32 (int, struct _stat64i32*); _stat->st_ctime = st.st_ctime; return ret; } + __CRT_INLINE int __cdecl _stat32i64(const char *fname, struct _stat32i64 *_stat) + { + struct _stat32 st; + int ret = _stat32(fname, &st); + if (ret == -1) { + memset(_stat, 0, sizeof(struct _stat32i64)); + return -1; + } + _stat->st_dev = st.st_dev; + _stat->st_ino = st.st_ino; + _stat->st_mode = st.st_mode; + _stat->st_nlink = st.st_nlink; + _stat->st_uid = st.st_uid; + _stat->st_gid = st.st_gid; + _stat->st_rdev = st.st_rdev; + _stat->st_size = (_off_t) st.st_size; + _stat->st_atime = st.st_atime; + _stat->st_mtime = st.st_mtime; + _stat->st_ctime = st.st_ctime; + return ret; + } #else +#define _stat32i64 _stat32 +#define _fstat32i64 _fstat32 #define _stat64i32 _stat64 #define _fstat64i32 _fstat64 #endif +#define __stat64 _stat64 +#if defined(_USE_32BIT_TIME_T) +#define _fstat _fstat32 +#define _fstati64 _fstat32i64 +#define _stat _stat32 +#define _stati64 _stat32i64 +#else /* !_USE_32BIT_TIME_T */ +#define _fstat _fstat64i32 +#define _fstati64 _fstat64 +#define _stat _stat64i32 +#define _stati64 _stat64 +#endif /* _USE_32BIT_TIME_T */ +#define _STAT_DEFINED +#endif /* _STAT_DEFINED */ + #if !defined(_NO_OLDNAMES) && !defined(__STRICT_ANSI__) #define stat _stat #define fstat _fstat #endif /* !defined(_NO_OLDNAMES) && !defined(__STRICT_ANSI__) */ #if !defined ( _WSTAT_DEFINED) /* also declared in wchar.h */ -_CRTIMP int __cdecl __MINGW_NOTHROW _wstat32 (const wchar_t*, struct _stat32*); +/* _wstat32 does not exist in MSVCRT.DLL */ +_CRTALIAS int __cdecl __MINGW_NOTHROW _wstat32 (const wchar_t* _v1, struct _stat32* _v2) { + _CRTIMP int __cdecl __MINGW_NOTHROW _wstat (const wchar_t*, struct _stat32*); + return _wstat(_v1, _v2); +} + _CRTIMP int __cdecl __MINGW_NOTHROW _wstat64 (const wchar_t*, struct _stat64*); _CRTIMP int __cdecl __MINGW_NOTHROW _wstat32i64 (const wchar_t*, struct _stat32i64*); int __cdecl __MINGW_NOTHROW _wstat64i32 (const wchar_t*, struct _stat64i32*); @@ -280,11 +339,33 @@ int __cdecl __MINGW_NOTHROW _wstat64i32 (const wchar_t*, struct _stat64i32*); _stat->st_ctime = st.st_ctime; return ret; } + __CRT_INLINE int __cdecl _wstat32i64(const wchar_t *fname, struct _stat32i64 *_stat) + { + struct _stat32 st; + int ret = _wstat32(fname, &st); + if (ret == -1) { + memset(_stat, 0, sizeof(struct _stat32i64)); + return -1; + } + _stat->st_dev = st.st_dev; + _stat->st_ino = st.st_ino; + _stat->st_mode = st.st_mode; + _stat->st_nlink = st.st_nlink; + _stat->st_uid = st.st_uid; + _stat->st_gid = st.st_gid; + _stat->st_rdev = st.st_rdev; + _stat->st_size = (_off_t) st.st_size; + _stat->st_atime = st.st_atime; + _stat->st_mtime = st.st_mtime; + _stat->st_ctime = st.st_ctime; + return ret; + } #else +#define _wstat32i64 _wstat32 #define _wstat64i32 _wstat64 #endif -#if defined(_USE_32BIT_TIME_T) && MSVCRT_VERSION >= 800 +#if defined(_USE_32BIT_TIME_T) #define _wstat _wstat32 #define _wstati64 _wstat32i64 #else /* !_USE_32BIT_TIME_T */ diff --git a/include/sys/timeb.h b/include/sys/timeb.h index c6e02f0..17a73bc 100644 --- a/include/sys/timeb.h +++ b/include/sys/timeb.h @@ -34,16 +34,9 @@ #ifndef RC_INVOKED -/* - * TODO: Structure not tested. - */ -struct _timeb -{ - time_t time; - short millitm; - short timezone; - short dstflag; -}; +#ifdef __cplusplus +extern "C" { +#endif /* * TODO: Structure not tested. @@ -56,30 +49,6 @@ struct __timeb32 short dstflag; }; -#ifndef _NO_OLDNAMES -/* - * TODO: Structure not tested. - */ -struct timeb -{ - time_t time; - short millitm; - short timezone; - short dstflag; -}; -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* TODO: Not tested. */ -_CRTIMP void __cdecl __MINGW_NOTHROW _ftime (struct _timeb*); - -#ifndef _NO_OLDNAMES -_CRTIMP void __cdecl __MINGW_NOTHROW ftime (struct timeb*); -#endif /* Not _NO_OLDNAMES */ - /* This requires newer versions of msvcrt.dll (6.10 or higher). */ struct __timeb64 { @@ -89,17 +58,35 @@ struct __timeb64 short dstflag; }; +#ifdef _USE_32BIT_TIME_T +#define _timeb __timeb32 +#else +#define _timeb __timeb64 +#endif + +_CRTIMP void __cdecl __MINGW_NOTHROW _ftime (struct _timeb*); _CRTIMP void __cdecl __MINGW_NOTHROW _ftime64 (struct __timeb64*); +#if MSVCRT_VERSION >= 800 _CRTIMP void __cdecl __MINGW_NOTHROW _ftime32 (struct __timeb32*); - -#if defined(_USE_32BIT_TIME_T) && MSVCRT_VERSION >= 800 -_CRTALIAS void __cdecl __MINGW_NOTHROW _ftime (struct _timeb* _v) { return(_ftime32 ((struct __timeb32*)_v)); } #else +_CRTALIAS void __cdecl __MINGW_NOTHROW _ftime32 (struct __timeb32* _v1) { + return _ftime((struct _timeb *)_v1); +} +#endif -_CRTALIAS void __cdecl __MINGW_NOTHROW _ftime (struct _timeb* _v) { return(_ftime64 ((struct __timeb64*)_v)); } +#if defined(_USE_32BIT_TIME_T) +#define _ftime _ftime32 + +#else +#define _ftime _ftime64 #endif +#ifndef _NO_OLDNAMES +#define ftime _ftime +#define timeb _timeb +#endif /* Not _NO_OLDNAMES */ + #ifdef __cplusplus } #endif diff --git a/include/sys/types.h b/include/sys/types.h index 06ed622..1c16260 100644 --- a/include/sys/types.h +++ b/include/sys/types.h @@ -48,7 +48,7 @@ typedef __int64 __time64_t; #ifndef _TIME_T_DEFINED /* FIXME __STRICT_ANSI__ ! */ -#if defined(_USE_32BIT_TIME_T) && MSVCRT_VERSION >= 800 +#if defined(_USE_32BIT_TIME_T) typedef __time32_t time_t; #else diff --git a/include/time.h b/include/time.h index 1161a04..5578518 100644 --- a/include/time.h +++ b/include/time.h @@ -61,7 +61,7 @@ typedef __int64 __time64_t; #endif #ifndef _TIME_T_DEFINED -# if defined(_USE_32BIT_TIME_T) && MSVCRT_VERSION >= 800 +# if defined(_USE_32BIT_TIME_T) typedef __time32_t time_t; # else typedef __time64_t time_t; @@ -103,9 +103,6 @@ extern "C" { #endif _CRTIMP clock_t __cdecl __MINGW_NOTHROW clock (void); -_CRTIMP time_t __cdecl __MINGW_NOTHROW time (time_t*); -_CRTIMP double __cdecl __MINGW_NOTHROW difftime (time_t, time_t); -_CRTIMP time_t __cdecl __MINGW_NOTHROW mktime (struct tm*); /* * These functions write to and return pointers to static buffers that may @@ -117,19 +114,24 @@ _CRTIMP time_t __cdecl __MINGW_NOTHROW mktime (struct tm*); * Fault and crap out your program. Guess how I know. Hint: stat called on * a directory gives 'invalid' times in st_atime etc... */ -_CRTIMP char* __cdecl __MINGW_NOTHROW asctime (const struct tm*); -_CRTIMP char* __cdecl __MINGW_NOTHROW ctime (const time_t*); -_CRTIMP struct tm* __cdecl __MINGW_NOTHROW gmtime (const time_t*); -_CRTIMP struct tm* __cdecl __MINGW_NOTHROW localtime (const time_t*); +_CRTIMP char* __cdecl __MINGW_NOTHROW asctime (const struct tm*); +_CRTIMP size_t __cdecl __MINGW_NOTHROW strftime (char*, size_t, const char*, const struct tm*); +#if MSVCRT_VERSION < 800 +_CRTIMP char* __cdecl __MINGW_NOTHROW ctime (const time_t*); +_CRTIMP struct tm* __cdecl __MINGW_NOTHROW gmtime (const time_t*); +_CRTIMP struct tm* __cdecl __MINGW_NOTHROW localtime (const time_t*); -_CRTIMP size_t __cdecl __MINGW_NOTHROW strftime (char*, size_t, const char*, const struct tm*); +_CRTIMP time_t __cdecl __MINGW_NOTHROW time (time_t*); +_CRTIMP double __cdecl __MINGW_NOTHROW difftime (time_t, time_t); +_CRTIMP time_t __cdecl __MINGW_NOTHROW mktime (struct tm*); +#endif #ifndef __STRICT_ANSI__ -extern _CRTIMP void __cdecl __MINGW_NOTHROW _tzset (void); +extern _CRTIMP void __cdecl __MINGW_NOTHROW _tzset (void); #ifndef _NO_OLDNAMES -extern _CRTIMP void __cdecl __MINGW_NOTHROW tzset (void); +extern _CRTIMP void __cdecl __MINGW_NOTHROW tzset (void); #endif _CRTIMP char* __cdecl __MINGW_NOTHROW _strdate(char*); @@ -153,32 +155,58 @@ _CRTIMP __time64_t __cdecl __MINGW_NOTHROW _mkgmtime64 (struct tm*); _CRTIMP char* __cdecl __MINGW_NOTHROW _ctime32 (const __time32_t*); _CRTIMP struct tm* __cdecl __MINGW_NOTHROW _gmtime32 (const __time32_t*); _CRTIMP struct tm* __cdecl __MINGW_NOTHROW _localtime32(const __time32_t*); +#else /* MSVCRT_VERSION < 800 */ +_CRTALIAS __time32_t __cdecl __MINGW_NOTHROW _time32 (__time32_t *_v) { + return ((__time32_t)time((time_t)_v)); +} +_CRTALIAS double __cdecl __MINGW_NOTHROW _difftime32 (__time32_t _v1, __time32_t _v2) { + return (difftime((time_t)_v1, (time_t)_v2)); +} +_CRTALIAS __time32_t __cdecl __MINGW_NOTHROW _mktime32(struct tm* _v1) { + return ((__time32_t)mktime(_v1)); +} +_CRTALIAS char* __cdecl __MINGW_NOTHROW _ctime32(const __time32_t* _v1) { + return (ctime((time_t)_v1)); +} +_CRTALIAS struct tm* __cdecl __MINGW_NOTHROW _gmtime32(const __time32_t* _v1) { + return (gmtime((time_t)_v1)); +} +_CRTALIAS struct tm* __cdecl __MINGW_NOTHROW _localtime32(const __time32_t* _v1) { + return (localtime((time_t)_v1)); +} +#endif /* MSVCRT_VERSION >= 800 */ #if defined(_USE_32BIT_TIME_T) -_CRTALIAS time_t __cdecl __MINGW_NOTHROW time (time_t* _v) +/* Prevent circular recursion. */ +#if MSVCRT_VERSION >= 800 +_CRTALIAS time_t __cdecl __MINGW_NOTHROW time (time_t* _v) { return(_time32 (_v)); } -_CRTALIAS double __cdecl __MINGW_NOTHROW difftime(time_t _v1, time_t _v2) +_CRTALIAS double __cdecl __MINGW_NOTHROW difftime(time_t _v1, time_t _v2) { return(_difftime32 (_v1,_v2)); } -_CRTALIAS time_t __cdecl __MINGW_NOTHROW mktime (struct tm* _v) +_CRTALIAS time_t __cdecl __MINGW_NOTHROW mktime (struct tm* _v) { return(_mktime32 (_v)); } -_CRTALIAS time_t __cdecl __MINGW_NOTHROW _mkgmtime (struct tm* _v) +_CRTALIAS time_t __cdecl __MINGW_NOTHROW _mkgmtime (struct tm* _v) { return(_mkgmtime32 (_v)); } -_CRTALIAS char* __cdecl __MINGW_NOTHROW ctime (const time_t* _v) +_CRTALIAS char* __cdecl __MINGW_NOTHROW ctime (const time_t* _v) { return(_ctime32 (_v)); } -_CRTALIAS struct tm* __cdecl __MINGW_NOTHROW gmtime (const time_t* _v) +_CRTALIAS struct tm* __cdecl __MINGW_NOTHROW gmtime (const time_t* _v) { return(_gmtime32 (_v)); } -_CRTALIAS struct tm* __cdecl __MINGW_NOTHROW localtime (const time_t* _v) +_CRTALIAS struct tm* __cdecl __MINGW_NOTHROW localtime (const time_t* _v) { return(_localtime32 (_v)); } +#endif /* MSVCRT_VERSION >= 800 */ -#else -_CRTALIAS time_t __cdecl __MINGW_NOTHROW time (time_t* _v) - { return(_time64 (_v)); } +#else /* !defined(_USE_32BIT_TIME_T) */ +/* _difftime64 and _mkgmtime64 are missing from MSVCRT.DLL pre Vista. */ +#if MSVCRT_VERSION >= 800 _CRTALIAS double __cdecl __MINGW_NOTHROW difftime(time_t _v1, time_t _v2) { return(_difftime64 (_v1,_v2)); } -_CRTALIAS time_t __cdecl __MINGW_NOTHROW mktime (struct tm* _v) - { return(_mktime64 (_v)); } _CRTALIAS time_t __cdecl __MINGW_NOTHROW _mkgmtime (struct tm* _v) { return(_mkgmtime64 (_v)); } +#endif /* MSVCRT_VERSION >= 800 */ +_CRTALIAS time_t __cdecl __MINGW_NOTHROW time (time_t* _v) + { return(_time64 (_v)); } +_CRTALIAS time_t __cdecl __MINGW_NOTHROW mktime (struct tm* _v) + { return(_mktime64 (_v)); } _CRTALIAS char* __cdecl __MINGW_NOTHROW ctime (const time_t* _v) { return(_ctime64 (_v)); } _CRTALIAS struct tm* __cdecl __MINGW_NOTHROW gmtime (const time_t* _v) @@ -187,15 +215,6 @@ _CRTALIAS struct tm* __cdecl __MINGW_NOTHROW localtime (const time_t* _v) { return(_localtime64 (_v)); } #endif /* _USE_32BIT_TIME_T */ -#else /* MSVCRT_VERSION < 800 */ -_CRTIMP time_t __cdecl __MINGW_NOTHROW time (time_t*); -_CRTIMP double __cdecl __MINGW_NOTHROW difftime (time_t, time_t); -_CRTIMP time_t __cdecl __MINGW_NOTHROW mktime (struct tm*); -_CRTIMP char* __cdecl __MINGW_NOTHROW ctime (const time_t*); -_CRTIMP struct tm* __cdecl __MINGW_NOTHROW gmtime (const time_t*); -_CRTIMP struct tm* __cdecl __MINGW_NOTHROW localtime (const time_t*); -#endif /* MSVCRT_VERSION >= 800 */ - /* * _daylight: non zero if daylight savings time is used. * _timezone: difference in seconds between GMT and local time. @@ -226,15 +245,19 @@ __MINGW_IMPORT char *tzname[2]; #ifndef __STRICT_ANSI__ _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wasctime(const struct tm*); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wctime(const time_t*); _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wstrdate(wchar_t*); _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wstrtime(wchar_t*); +_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wctime(const time_t*); _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wctime64 (const __time64_t*); #ifdef MSVCRT_VERSION >= 800 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wctime32 (const __time32_t*); -#endif +#else +_CRTALIAS whcar_t* __cdecl __MINGW_NOTHROW _wctime32 (const __time32_t* _v) { + return(_wctime((time_t)_v)); +} +#endif /* MSVCRT_VERSION >= 800 */ -#ifdef _USE_32BIT_TIME_T && MSVCRT_VERSION >= 800 +#ifdef _USE_32BIT_TIME_T _CRTALIAS wchar_t* __cdecl __MINGW_NOTHROW _wctime (const time_t* _v) { return(_wctime32 (_v)); } #else _CRTALIAS wchar_t* __cdecl __MINGW_NOTHROW _wctime (const time_t* _v) { return(_wctime64 (_v)); } diff --git a/include/wchar.h b/include/wchar.h index 38224e4..4bd32da 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -118,7 +118,7 @@ _CRTIMP wint_t __cdecl __MINGW_NOTHROW ungetwc (wchar_t, FILE*); #ifndef __STRICT_ANSI__ _CRTIMP int __cdecl __MINGW_NOTHROW swprintf (wchar_t*, const wchar_t*, ...); _CRTIMP int __cdecl __MINGW_NOTHROW vswprintf (wchar_t*, const wchar_t*, __VALIST); -#endif +#endif /* ndef __STRICT_ANSI__ */ _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW fgetws (wchar_t*, int, FILE*); _CRTIMP int __cdecl __MINGW_NOTHROW fputws (const wchar_t*, FILE*); @@ -157,7 +157,7 @@ int __cdecl __MINGW_NOTHROW vfwscanf (FILE * __restrict__, const wchar_t * __restrict__, __VALIST); int __cdecl __MINGW_NOTHROW vswscanf (const wchar_t * __restrict__, const wchar_t * __restrict__, __VALIST); -#endif +#endif /* ndef __NO_ISOCEXT__ */ #define _WSTDIO_DEFINED #endif /* _WSTDIO_DEFINED */ @@ -190,19 +190,39 @@ _CRTIMP unsigned __int64 __cdecl _wcstoui64_l(const wchar_t *, wchar_t **, int, #ifndef __STRICT_ANSI__ /* wide function prototypes, also declared in time.h */ _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wasctime (const struct tm*); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wctime (const time_t*); _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wstrdate (wchar_t*); _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wstrtime (wchar_t*); _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wctime64 (const __time64_t*); + +/* MSVCRT.DLL may not have _wctime32 depending on OS version */ +#if MSVCRT_VERSION >= 800 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wctime32 (const __time32_t*); -#if defined(_USE_32BIT_TIME_T) && MSVCRT_VERSION >= 800 +#else /* MSVCRT_VERSION < 800 */ +_CRTALIAS wchar_t* __cdecl __MINGW_NOTHROW _wctime32 (const __time32_t* _v1) { + _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wctime (const __time32_t*); + return _wctime(_v1); +} +#endif /* MSVCRT_VERSION >= 800 */ + +#if MSVCRT_VERSION >= 800 +#if defined(_USE_32BIT_TIME_T) _CRTALIAS wchar_t* __cdecl __MINGW_NOTHROW _wctime (const time_t* _v) { return(_wctime32 (_v)); } -#else +#else /* MSVCRT_VERSION < 800 */ _CRTALIAS wchar_t* __cdecl __MINGW_NOTHROW _wctime (const time_t* _v) { return(_wctime64 (_v)); } -#endif +#endif /* defined(_USE_32BIT_TIME_T) */ +#endif /* MSVCRT_VERSION >= 800 */ + +#else /* MSVCRT_VERSION < 800 */ +#ifdef _USE_32BIT_TIME_T +#define _wctime _wctime32 +#else /* ndef _USE_32BIT_TIME_T */ +#define _wctime _wctime64 + +#endif /* def _USE_32BIT_TIME_T */ +#endif /* MSVCRT_VERSION >= 800 */ #endif /* __STRICT_ANSI__ */ _CRTIMP size_t __cdecl __MINGW_NOTHROW wcsftime (wchar_t*, size_t, const wchar_t*, const struct tm*); @@ -351,7 +371,7 @@ struct _wfinddatai64_t { __int64 size; wchar_t name[260]; }; -struct __wfinddata64_t { +struct _wfinddata64_t { unsigned attrib; __time64_t time_create; __time64_t time_access; @@ -361,7 +381,7 @@ struct __wfinddata64_t { wchar_t name[260]; }; #include -struct __wfinddata32_t { +struct _wfinddata32_t { unsigned attrib; __time32_t time_create; __time32_t time_access; @@ -392,12 +412,11 @@ struct _wfinddata64i32_t { /* Wide character versions. Also defined in io.h. */ #if !defined (_WIO_DEFINED) +#define _WIO_DEFINED #include /* For intptr_t. */ _CRTIMP int __cdecl __MINGW_NOTHROW _waccess (const wchar_t*, int); _CRTIMP int __cdecl __MINGW_NOTHROW _wchmod (const wchar_t*, int); _CRTIMP int __cdecl __MINGW_NOTHROW _wcreat (const wchar_t*, int); -_CRTIMP long __cdecl __MINGW_NOTHROW _wfindfirst (const wchar_t*, struct _wfinddata_t *); -_CRTIMP int __cdecl __MINGW_NOTHROW _wfindnext (long, struct _wfinddata_t *); _CRTIMP int __cdecl __MINGW_NOTHROW _wunlink (const wchar_t*); _CRTIMP int __cdecl __MINGW_NOTHROW _wopen (const wchar_t*, int, ...); _CRTIMP int __cdecl __MINGW_NOTHROW _wsopen (const wchar_t*, int, int, ...); @@ -408,25 +427,37 @@ _CRTIMP long __cdecl __MINGW_NOTHROW _wfindfirst32i64 (const wchar_t*, struct _w _CRTIMP long __cdecl __MINGW_NOTHROW _wfindfirst64i32 (const wchar_t*, struct _wfinddata64i32_t*); _CRTIMP int __cdecl __MINGW_NOTHROW _wfindnext32i64 (long, struct _wfinddata32i64_t*); _CRTIMP int __cdecl __MINGW_NOTHROW _wfindnext64i32 (long, struct _wfinddata64i32_t*); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wfindfirst64(const wchar_t*, struct __wfinddata64_t*); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wfindnext64(intptr_t, struct __wfinddata64_t*); -_CRTIMP long __cdecl __MINGW_NOTHROW _wfindfirst32 (const wchar_t*, struct __wfinddata32_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wfindnext32 (long, struct __wfinddata32_t*); +_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wfindfirst64(const wchar_t*, struct _wfinddata64_t*); +_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wfindnext64(intptr_t, struct _wfinddata64_t*); + +/* _wfindfirst32 and _wfindnext32 do not exist in MSVCRT.DLL */ +_CRTALIAS intptr_t __cdecl __MINGW_NOTHROW _wfindfirst32 (const wchar_t* _v1, struct _wfinddata32_t* _v2) { + _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wfindfirst (const wchar_t*, struct _wfinddata32_t*); + return _wfindfirst(_v1, _v2); +} +_CRTALIAS int __cdecl __MINGW_NOTHROW _wfindnext32 (intptr_t _v1, struct _wfinddata32_t* _v2) { + _CRTIMP int __cdecl __MINGW_NOTHROW _wfindnext (intptr_t, struct _wfinddata32_t*); + return _wfindnext(_v1, _v2); +} + +#if defined(_USE_32BIT_TIME_T) +#define _wfinddata_t _wfinddata32_t +#define _wfinddatai64_t _wfinddata32i64_t +#define _wfindfirst _wfindfirst32 +#define _wfindnext _wfindnext32 +#define _wfindfirsti64 _wfindfirst32i64 +#define _wfindnexti64 _wfindnext32i64 + +#else /* !defined(_USE_32BIT_TIME_T) +#define _wfinddata_t _wfinddata64i32_t +#define _wfinddatai64_t _wfinddata64_t +#define _wfindfirst _wfindfirst64i32 +#define _wfindnext _wfindnext64i32 +#define _wfindfirsti64 _wfindfirst64 +#define _wfindnexti64 _wfindnext64 + +#endif /* defined(_USE_32BIT_TIME_T) */ -#if defined(_USE_32BIT_TIME_T) && MSVCRT_VERSION >= 800 -_CRTALIAS long __cdecl __MINGW_NOTHROW _wfindfirst (const wchar_t* _v1, struct _wfinddata_t* _v2) { return(_wfindfirst32 (_v1,(struct __wfinddata32_t*)_v2)); } -_CRTALIAS int __cdecl __MINGW_NOTHROW _wfindnext (long _v1, struct _wfinddata_t* _v2) { return(_wfindnext32 (_v1,(struct __wfinddata32_t*)_v2)); } -_CRTALIAS long __cdecl __MINGW_NOTHROW _wfindfirsti64 (const wchar_t* _v1, struct _wfinddatai64_t* _v2) { return(_wfindfirst32i64 (_v1,(struct _wfinddata32i64_t*)_v2)); } -_CRTALIAS int __cdecl __MINGW_NOTHROW _wfindnexti64 (long _v1, struct _wfinddatai64_t* _v2) { return(_wfindnext32i64 (_v1,(struct _wfinddata32i64_t*)_v2)); } -#else - -_CRTALIAS long __cdecl __MINGW_NOTHROW _wfindfirst (const wchar_t* _v1, struct _wfinddata_t* _v2) { return(_wfindfirst64i32 (_v1,(struct _wfinddata64i32_t*)_v2)); } -_CRTALIAS int __cdecl __MINGW_NOTHROW _wfindnext (long _v1, struct _wfinddata_t* _v2) { return(_wfindnext64i32 (_v1,(struct _wfinddata64i32_t*)_v2)); } -_CRTALIAS long __cdecl __MINGW_NOTHROW _wfindfirsti64 (const wchar_t* _v1, struct _wfinddatai64_t* _v2) { return(_wfindfirst64 (_v1,(struct __wfinddata64_t*)_v2)); } -_CRTALIAS int __cdecl __MINGW_NOTHROW _wfindnexti64 (long _v1, struct _wfinddatai64_t* _v2) { return(_wfindnext64 (_v1,(struct __wfinddata64_t*)_v2)); } -#endif /* !_USE_32BIT_TIME_T*/ - -#define _WIO_DEFINED #endif /* _WIO_DEFINED */ #ifndef _WDIRECT_DEFINED -- 2.11.0