From e9d55d0638bc4a5c6963fd4a193cc2e885ccf2d7 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sun, 14 Dec 2008 23:41:51 +0000 Subject: [PATCH] mbctype.h: fix broken _mbctype[] and _mbcasemap[] declarations sec_api/time_s.h: add asctime_s stdio.h: comment out defines for non-conforming swprintfs sys/utime.h: fix definition of _utime / _utime32 to be compatible to msvc while linking to msvcrt.dll tchar.h: add secure time functions fixes msvcrt_winetest svn path=/trunk/; revision=38088 --- reactos/include/crt/mbctype.h | 25 ++++---------- reactos/include/crt/sec_api/time_s.h | 1 + reactos/include/crt/stdio.h | 16 ++++----- reactos/include/crt/sys/utime.h | 49 ++++++++++++++-------------- reactos/include/crt/tchar.h | 14 ++++++++ 5 files changed, 54 insertions(+), 51 deletions(-) diff --git a/reactos/include/crt/mbctype.h b/reactos/include/crt/mbctype.h index a30de52174d..39b32651777 100644 --- a/reactos/include/crt/mbctype.h +++ b/reactos/include/crt/mbctype.h @@ -14,29 +14,16 @@ extern "C" { #endif /* CRT stuff */ -#if 1 -#if defined (_DLL) && defined (_M_IX86) +#if defined(_M_CEE_PURE) /* Retained for compatibility with VC++ 5.0 and earlier versions */ _CRTIMP unsigned char * __cdecl __p__mbctype(void); _CRTIMP unsigned char * __cdecl __p__mbcasemap(void); -#endif /* defined (_DLL) && defined (_M_IX86) */ -#endif -#ifndef _mbctype -#ifdef _MSVCRT_ - extern unsigned char _mbctype[257]; + #define _mbctype (__p__mbctype()) + #define _mbcasemap (__p__mbcasemap()) #else -#define _mbctype (*_imp___mbctype) - extern unsigned char **_imp___mbctype; -#endif -#endif -#ifndef _mbcasemap -#ifdef _MSVCRT_ - extern unsigned char *_mbcasemap; -#else -#define _mbcasemap (*_imp___mbcasemap) - extern unsigned char **_imp___mbcasemap; -#endif -#endif + _CRTIMP extern unsigned char _mbctype[]; + _CRTIMP extern unsigned char _mbcasemap[]; +#endif // defined(_M_CEE_PURE) /* CRT stuff */ #if 1 diff --git a/reactos/include/crt/sec_api/time_s.h b/reactos/include/crt/sec_api/time_s.h index 9603b94fc20..a9142177990 100644 --- a/reactos/include/crt/sec_api/time_s.h +++ b/reactos/include/crt/sec_api/time_s.h @@ -14,6 +14,7 @@ extern "C" { #endif + _CRTIMP errno_t __cdecl asctime_s(char *_Buf,size_t _SizeInWords,const struct tm *_Tm); _CRTIMP errno_t __cdecl _ctime32_s(char *_Buf,size_t _SizeInBytes,const __time32_t *_Time); _CRTIMP errno_t __cdecl _gmtime32_s(struct tm *_Tm,const __time32_t *_Time); _CRTIMP errno_t __cdecl _localtime32_s(struct tm *_Tm,const __time32_t *_Time); diff --git a/reactos/include/crt/stdio.h b/reactos/include/crt/stdio.h index 6ae3df75708..5933200d6b6 100644 --- a/reactos/include/crt/stdio.h +++ b/reactos/include/crt/stdio.h @@ -352,14 +352,14 @@ extern FILE (*_imp___iob)[]; /* A pointer to an array of FILE */ #include #endif -#ifdef _CRT_NON_CONFORMING_SWPRINTFS -#ifndef __cplusplus -#define swprintf _swprintf -#define vswprintf _vswprintf -#define _swprintf_l __swprintf_l -#define _vswprintf_l __vswprintf_l -#endif -#endif +//#ifdef _CRT_NON_CONFORMING_SWPRINTFS +//#ifndef __cplusplus +//#define swprintf _swprintf +//#define vswprintf _vswprintf +//#define _swprintf_l __swprintf_l +//#define _vswprintf_l __vswprintf_l +//#endif +//#endif _CRTIMP wchar_t *__cdecl _wtempnam(const wchar_t *_Directory,const wchar_t *_FilePrefix); _CRTIMP int __cdecl _vscwprintf(const wchar_t *_Format,va_list _ArgList); diff --git a/reactos/include/crt/sys/utime.h b/reactos/include/crt/sys/utime.h index 51250516020..e5cd41a549d 100644 --- a/reactos/include/crt/sys/utime.h +++ b/reactos/include/crt/sys/utime.h @@ -103,31 +103,32 @@ extern "C" { _CRTIMP int __cdecl _wutime64(const wchar_t *_Filename,struct __utimbuf64 *_Time); #endif -#if 0 +// Do it like this to keep compatibility to MSVC while using msvcrt.dll #ifndef RC_INVOKED -#ifdef _USE_32BIT_TIME_T -__CRT_INLINE int __cdecl _utime32(const char *_Filename,struct _utimbuf *_Utimbuf) { - return _utime32(_Filename,(struct __utimbuf32 *)_Utimbuf); -} -__CRT_INLINE int __cdecl _futime(int _Desc,struct _utimbuf *_Utimbuf) { - return _futime32(_Desc,(struct __utimbuf32 *)_Utimbuf); -} -__CRT_INLINE int __cdecl _wutime(const wchar_t *_Filename,struct _utimbuf *_Utimbuf) { - return _wutime32(_Filename,(struct __utimbuf32 *)_Utimbuf); -} -#else -__CRT_INLINE int __cdecl _utime(const char *_Filename,struct _utimbuf *_Utimbuf) { - return _utime64(_Filename,(struct __utimbuf64 *)_Utimbuf); -} -__CRT_INLINE int __cdecl _futime(int _Desc,struct _utimbuf *_Utimbuf) { - return _futime64(_Desc,(struct __utimbuf64 *)_Utimbuf); -} -__CRT_INLINE int __cdecl _wutime(const wchar_t *_Filename,struct _utimbuf *_Utimbuf) { - return _wutime64(_Filename,(struct __utimbuf64 *)_Utimbuf); -} -#endif -#endif -#endif + #ifdef _USE_32BIT_TIME_T + __CRT_INLINE int __cdecl _utime32(const char *_Filename,struct __utimbuf32 *_Utimbuf) { + return _utime(_Filename,(struct __timbuf *)_Utimbuf); + } + __CRT_INLINE int __cdecl _futime32(int _Desc,struct __utimbuf32 *_Utimbuf) { + return _futime(_Desc,(struct _utimbuf *)_Utimbuf); + } + __CRT_INLINE int __cdecl _wutime32(const wchar_t *_Filename,struct __utimbuf32 *_Utimbuf) { + return _wutime(_Filename,(struct _utimbuf *)_Utimbuf); + } + #else // !_USE_32BIT_TIME_T + #ifndef _WIN64 + __CRT_INLINE int __cdecl _utime(const char *_Filename,struct _utimbuf *_Utimbuf) { + return _utime64(_Filename,(struct __utimbuf64 *)_Utimbuf); + } + __CRT_INLINE int __cdecl _futime(int _Desc,struct _utimbuf *_Utimbuf) { + return _futime64(_Desc,(struct __utimbuf64 *)_Utimbuf); + } + __CRT_INLINE int __cdecl _wutime(const wchar_t *_Filename,struct _utimbuf *_Utimbuf) { + return _wutime64(_Filename,(struct __utimbuf64 *)_Utimbuf); + } + #endif + #endif // _USE_32BIT_TIME_T +#endif // RC_INVOKED #ifndef NO_OLDNAMES __CRT_INLINE int __cdecl utime(const char *_Filename,struct utimbuf *_Utimbuf) { diff --git a/reactos/include/crt/tchar.h b/reactos/include/crt/tchar.h index cd44beca154..63526fc8ee5 100644 --- a/reactos/include/crt/tchar.h +++ b/reactos/include/crt/tchar.h @@ -320,6 +320,13 @@ extern "C" { #define _tcsftime wcsftime #define _tcsftime_l _wcsftime_l +#define _tasctime_s _wasctime_s +#define _tctime_s _wctime_s +#define _tctime32_s _wctime32_s +#define _tctime64_s _wctime64_s +#define _tstrdate_s _wstrdate_s +#define _tstrtime_s _wstrtime_s + #define _tchdir _wchdir #define _tgetcwd _wgetcwd #define _tgetdcwd _wgetdcwd @@ -654,6 +661,13 @@ extern "C" { #define _tcsftime strftime #define _tcsftime_l _strftime_l +#define _tasctime_s asctime_s +#define _tctime_s ctime_s +#define _tctime32_s _ctime32_s +#define _tctime64_s _ctime64_s +#define _tstrdate_s _strdate_s +#define _tstrtime_s _strtime_s + #define _tchdir _chdir #define _tgetcwd _getcwd #define _tgetdcwd _getdcwd -- 2.17.1