2010-02-14 Roumen Petrov <rumen@users.sourceforge.net>

Issue [2134161]: time64 functions and types for msvcrt >= 8.0
        (initial implementation)

        * new type: __time32_t

        * new structures: _finddata32_t, _finddata32i64_t, _finddata64i32_t,
        __stat32, _stat32i64, _stat64i32, __timeb32, __utimbuf32,
        __wfinddata32_t, _wfinddata32i64_t, _wfinddata64i32_t

        * new functions: _ctime32, _difftime32, _difftime64, _findfirst32
        _findfirst32i64, _findfirst64i32, _findnext32, _findnext32i64,
        _findnext64i32, _fstat32, _fstat32i64, _fstat64i32, _ftime32,
        _futime32, _gmtime32, _localtime32, _mkgmtime32, _mkgmtime64,
        _mktime32, _stat32, _stat32i64, _stat64i32, _time32, _utime32,
        _wctime32, _wfindfirst32, _wfindfirst32i64, _wfindfirst64i32,
        _wfindnext32, _wfindnext32i64, _wfindnext64i32, _wstat32,
        _wstat32i64, _wstat64i32,_wutime32

        * new define _USE_32BIT_TIME_T set 32 or 64 aliases for: time_t,
        ctime, difftime, _findfirst, _findfirsti64, _findnext, _findnexti64,
        _fstat, _fstati64, _ftime, _futime, gmtime, localtime, mktime,
        _stat, _stati64, time, _utime, _wctime, _wfindfirst, _wfindfirsti64,
        _wfindnext, _wfindnexti64, _wstat, _wstati64, _wutime
This commit is contained in:
Chris Sutcliffe
2010-02-17 02:41:06 +00:00
parent 38d09c90de
commit f94e2b9f58
13 changed files with 674 additions and 11 deletions

View File

@ -147,7 +147,49 @@ struct __stat64
__time64_t st_mtime;
__time64_t st_ctime;
};
#endif /* __MSVCRT_VERSION__ */
#endif /* __MSVCRT_VERSION__ >= 0x0601 */
#if __MSVCRT_VERSION__ >= 0x0800
struct __stat32
{
_dev_t st_dev;
_ino_t st_ino;
_mode_t st_mode;
short st_nlink;
short st_uid;
short st_gid;
_dev_t st_rdev;
__int32 st_size;
__time32_t st_atime;
__time32_t st_mtime;
__time32_t st_ctime;
};
struct _stat32i64 {
_dev_t st_dev;
_ino_t st_ino;
_mode_t st_mode;
short st_nlink;
short st_uid;
short st_gid;
_dev_t st_rdev;
__int64 st_size;
__time32_t st_atime;
__time32_t st_mtime;
__time32_t st_ctime;
};
struct _stat64i32 {
_dev_t st_dev;
_ino_t st_ino;
_mode_t st_mode;
short st_nlink;
short st_uid;
short st_gid;
_dev_t st_rdev;
__int32 st_size;
__time64_t st_atime;
__time64_t st_mtime;
__time64_t st_ctime;
};
#endif /* __MSVCRT_VERSION__ >= 0x0800 */
#endif /* __MSVCRT__ */
#define _STAT_DEFINED
#endif /* _STAT_DEFINED */
@ -156,12 +198,16 @@ struct __stat64
extern "C" {
#endif
#if __MSVCRT_VERSION__ < 0x0800
_CRTIMP int __cdecl __MINGW_NOTHROW _fstat (int, struct _stat*);
#endif
_CRTIMP int __cdecl __MINGW_NOTHROW _chmod (const char*, int);
#if __MSVCRT_VERSION__ < 0x0800
_CRTIMP int __cdecl __MINGW_NOTHROW _stat (const char*, struct _stat*);
#endif
#ifndef _NO_OLDNAMES
/* FIXME for __MSVCRT_VERSION__ >= 0x0800 */
/* These functions live in liboldnames.a. */
_CRTIMP int __cdecl __MINGW_NOTHROW fstat (int, struct stat*);
_CRTIMP int __cdecl __MINGW_NOTHROW chmod (const char*, int);
@ -170,19 +216,56 @@ _CRTIMP int __cdecl __MINGW_NOTHROW stat (const char*, struct stat*);
#endif /* Not _NO_OLDNAMES */
#if defined (__MSVCRT__)
#if __MSVCRT_VERSION__ < 0x0800
_CRTIMP int __cdecl __MINGW_NOTHROW _fstati64(int, struct _stati64 *);
_CRTIMP int __cdecl __MINGW_NOTHROW _stati64(const char *, struct _stati64 *);
#endif
/* These require newer versions of msvcrt.dll (6.10 or higher). */
#if __MSVCRT_VERSION__ >= 0x0601
_CRTIMP int __cdecl __MINGW_NOTHROW _fstat64 (int, struct __stat64*);
_CRTIMP int __cdecl __MINGW_NOTHROW _stat64 (const char*, struct __stat64*);
#endif /* __MSVCRT_VERSION__ >= 0x0601 */
#if __MSVCRT_VERSION__ >= 0x0800
_CRTIMP int __cdecl __MINGW_NOTHROW _fstat32 (int, struct __stat32*);
_CRTIMP int __cdecl __MINGW_NOTHROW _stat32 (const char*, struct __stat32*);
_CRTIMP int __cdecl __MINGW_NOTHROW _fstat32i64 (int, struct _stat32i64*);
_CRTIMP int __cdecl __MINGW_NOTHROW _fstat64i32 (int, struct _stat64i32*);
_CRTIMP int __cdecl __MINGW_NOTHROW _stat32i64 (const char*, struct _stat32i64*);
_CRTIMP int __cdecl __MINGW_NOTHROW _stat64i32 (const char*, struct _stat64i32*);
#ifndef _USE_32BIT_TIME_T
_CRTALIAS int __cdecl __MINGW_NOTHROW _fstat (int _v1, struct _stat* _v2) { return(_fstat64i32 (_v1,(struct _stat64i32*)_v2)); }
_CRTALIAS int __cdecl __MINGW_NOTHROW _stat (const char* _v1, struct _stat* _v2) { return(_stat64i32 (_v1,(struct _stat64i32*)_v2)); }
_CRTALIAS int __cdecl __MINGW_NOTHROW _fstati64 (int _v1, struct _stati64* _v2) { return(_fstat64 (_v1,(struct __stat64*)_v2)); }
_CRTALIAS int __cdecl __MINGW_NOTHROW _stati64 (const char* _v1, struct _stati64* _v2) { return(_stat64 (_v1,(struct __stat64*)_v2)); }
#else
_CRTALIAS int __cdecl __MINGW_NOTHROW _fstat (int _v1, struct _stat* _v2) { return(_fstat32 (_v1,(struct __stat32*)_v2)); }
_CRTALIAS int __cdecl __MINGW_NOTHROW _stat (const char* _v1, struct _stat* _v2) { return(_stat32 (_v1,(struct __stat32*)_v2)); }
_CRTALIAS int __cdecl __MINGW_NOTHROW _fstati64 (int _v1, struct _stati64* _v2) { return(_fstat32i64 (_v1,(struct _stat32i64*)_v2)); }
_CRTALIAS int __cdecl __MINGW_NOTHROW _stati64 (const char* _v1, struct _stati64* _v2) { return(_stat32i64 (_v1,(struct _stat32i64*)_v2)); }
#endif /* !_USE_32BIT_TIME_T */
#endif /* __MSVCRT_VERSION__ >= 0x0800 */
#if !defined ( _WSTAT_DEFINED) /* also declared in wchar.h */
#if __MSVCRT_VERSION__ < 0x0800
_CRTIMP int __cdecl __MINGW_NOTHROW _wstat(const wchar_t*, struct _stat*);
_CRTIMP int __cdecl __MINGW_NOTHROW _wstati64 (const wchar_t*, struct _stati64*);
#endif
#if __MSVCRT_VERSION__ >= 0x0601
_CRTIMP int __cdecl __MINGW_NOTHROW _wstat64 (const wchar_t*, struct __stat64*);
#endif /* __MSVCRT_VERSION__ >= 0x0601 */
#if __MSVCRT_VERSION__ >= 0x0800
_CRTIMP int __cdecl __MINGW_NOTHROW _wstat32 (const wchar_t*, struct __stat32*);
_CRTIMP int __cdecl __MINGW_NOTHROW _wstat32i64 (const wchar_t*, struct _stat32i64*);
_CRTIMP int __cdecl __MINGW_NOTHROW _wstat64i32 (const wchar_t*, struct _stat64i32*);
#ifndef _USE_32BIT_TIME_T
_CRTALIAS int __cdecl __MINGW_NOTHROW _wstat (const wchar_t* _v1, struct _stat* _v2) { return(_wstat64i32 (_v1,(struct _stat64i32*)_v2)); }
_CRTALIAS int __cdecl __MINGW_NOTHROW _wstati64 (const wchar_t* _v1, struct _stati64* _v2) { return(_wstat64 (_v1,(struct __stat64*)_v2)); }
#else
_CRTALIAS int __cdecl __MINGW_NOTHROW _wstat (const wchar_t* _v1, struct _stat* _v2) { return(_wstat32 (_v1,(struct __stat32*)_v2)); }
_CRTALIAS int __cdecl __MINGW_NOTHROW _wstati64 (const wchar_t* _v1, struct _stati64* _v2) { return(_wstat32i64 (_v1,(struct _stat32i64*)_v2)); }
#endif /* !_USE_32BIT_TIME_T */
#endif /* __MSVCRT_VERSION__ >= 0x0800 */
#define _WSTAT_DEFINED
#endif /* _WSTAT_DEFIND */
#endif /* __MSVCRT__ */

View File

@ -28,6 +28,19 @@ struct _timeb
short dstflag;
};
#if __MSVCRT_VERSION__ >= 0x0800
/*
* TODO: Structure not tested.
*/
struct __timeb32
{
__time32_t time;
short millitm;
short timezone;
short dstflag;
};
#endif /* __MSVCRT_VERSION__ >= 0x0800 */
#ifndef _NO_OLDNAMES
/*
* TODO: Structure not tested.
@ -49,6 +62,7 @@ extern "C" {
_CRTIMP void __cdecl __MINGW_NOTHROW _ftime (struct _timeb*);
#ifndef _NO_OLDNAMES
/* FIXME for __MSVCRT_VERSION__ >= 0x0800 */
_CRTIMP void __cdecl __MINGW_NOTHROW ftime (struct timeb*);
#endif /* Not _NO_OLDNAMES */
@ -65,6 +79,15 @@ struct __timeb64
_CRTIMP void __cdecl __MINGW_NOTHROW _ftime64 (struct __timeb64*);
#endif /* __MSVCRT_VERSION__ >= 0x0601 */
#if __MSVCRT_VERSION__ >= 0x0800
_CRTIMP void __cdecl __MINGW_NOTHROW _ftime32 (struct __timeb32*);
#ifndef _USE_32BIT_TIME_T
_CRTALIAS void __cdecl __MINGW_NOTHROW _ftime (struct _timeb* _v) { return(_ftime64 ((struct __timeb64*)_v)); }
#else
_CRTALIAS void __cdecl __MINGW_NOTHROW _ftime (struct _timeb* _v) { return(_ftime32 ((struct __timeb32*)_v)); }
#endif
#endif /* __MSVCRT_VERSION__ >= 0x0800 */
#ifdef __cplusplus
}
#endif

View File

@ -23,9 +23,9 @@
#ifndef RC_INVOKED
#ifndef _TIME_T_DEFINED
typedef long time_t;
#define _TIME_T_DEFINED
#ifndef _TIME32_T_DEFINED
typedef __int32 __time32_t;
#define _TIME32_T_DEFINED
#endif
#ifndef _TIME64_T_DEFINED
@ -33,6 +33,20 @@ typedef __int64 __time64_t;
#define _TIME64_T_DEFINED
#endif
#ifndef _TIME_T_DEFINED
/* FIXME __STRICT_ANSI__ ! */
#if __MSVCRT_VERSION__ >= 0x0800
#ifndef _USE_32BIT_TIME_T
typedef __time64_t time_t;
#else
typedef __time32_t time_t;
#endif /* !_USE_32BIT_TIME_T */
#else
typedef __time32_t time_t;
#endif /* __MSVCRT_VERSION__ >= 0x0800 */
#define _TIME_T_DEFINED
#endif
#ifndef _OFF_T_
#define _OFF_T_
typedef long _off_t;

View File

@ -30,6 +30,13 @@ struct _utimbuf
time_t actime; /* Access time */
time_t modtime; /* Modification time */
};
#if __MSVCRT_VERSION__ >= 0x0800
struct __utimbuf32
{
__time32_t actime;
__time32_t modtime;
};
#endif /* __MSVCRT_VERSION__ >= 0x0800 */
#ifndef _NO_OLDNAMES
@ -45,18 +52,25 @@ struct utimbuf
extern "C" {
#endif
#if __MSVCRT_VERSION__ < 0x0800
_CRTIMP int __cdecl __MINGW_NOTHROW _utime (const char*, struct _utimbuf*);
#endif
#ifndef _NO_OLDNAMES
/* FIXME for __MSVCRT_VERSION__ >= 0x0800 */
_CRTIMP int __cdecl __MINGW_NOTHROW utime (const char*, struct utimbuf*);
#endif /* Not _NO_OLDNAMES */
#if __MSVCRT_VERSION__ < 0x0800
_CRTIMP int __cdecl __MINGW_NOTHROW _futime (int, struct _utimbuf*);
#endif
/* The wide character version, only available for MSVCRT versions of the
* C runtime library. */
#ifdef __MSVCRT__
#if __MSVCRT_VERSION__ < 0x0800
_CRTIMP int __cdecl __MINGW_NOTHROW _wutime (const wchar_t*, struct _utimbuf*);
#endif
#endif /* MSVCRT runtime */
/* These require newer versions of msvcrt.dll (6.10 or higher). */
@ -72,6 +86,21 @@ _CRTIMP int __cdecl __MINGW_NOTHROW _wutime64 (const wchar_t*, struct __utimbuf6
_CRTIMP int __cdecl __MINGW_NOTHROW _futime64 (int, struct __utimbuf64*);
#endif /* __MSVCRT_VERSION__ >= 0x0601 */
#if __MSVCRT_VERSION__ >= 0x0800
_CRTIMP int __cdecl __MINGW_NOTHROW _utime32 (const char*, struct __utimbuf32*);
_CRTIMP int __cdecl __MINGW_NOTHROW _wutime32 (const wchar_t*, struct __utimbuf32*);
_CRTIMP int __cdecl __MINGW_NOTHROW _futime32 (int, struct __utimbuf32*);
#ifndef _USE_32BIT_TIME_T
_CRTALIAS int __cdecl __MINGW_NOTHROW _utime (const char* _v1, struct _utimbuf* _v2) { return(_utime64 (_v1,(struct __utimbuf64*)_v2)); }
_CRTALIAS int __cdecl __MINGW_NOTHROW _wutime (const wchar_t* _v1, struct _utimbuf* _v2) { return(_wutime64 (_v1,(struct __utimbuf64*)_v2)); }
_CRTALIAS int __cdecl __MINGW_NOTHROW _futime (int _v1, struct _utimbuf* _v2) { return(_futime64 (_v1,(struct __utimbuf64*)_v2)); }
#else
_CRTALIAS int __cdecl __MINGW_NOTHROW _utime (const char* _v1, struct _utimbuf* _v2) { return(_utime32 (_v1,(struct __utimbuf32*)_v2)); }
_CRTALIAS int __cdecl __MINGW_NOTHROW _wutime (const wchar_t* _v1, struct _utimbuf* _v2) { return(_wutime32 (_v1,(struct __utimbuf32*)_v2)); }
_CRTALIAS int __cdecl __MINGW_NOTHROW _futime (int _v1, struct _utimbuf* _v2) { return(_futime32 (_v1,(struct __utimbuf32*)_v2)); }
#endif
#endif /* __MSVCRT_VERSION__ >= 0x0800 */
#ifdef __cplusplus
}
#endif