mbctype.h: fix broken _mbctype[] and _mbcasemap[] declarations
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Sun, 14 Dec 2008 23:41:51 +0000 (23:41 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Sun, 14 Dec 2008 23:41:51 +0000 (23:41 +0000)
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
reactos/include/crt/sec_api/time_s.h
reactos/include/crt/stdio.h
reactos/include/crt/sys/utime.h
reactos/include/crt/tchar.h

index a30de52..39b3265 100644 (file)
@@ -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
index 9603b94..a914217 100644 (file)
@@ -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);
index 6ae3df7..5933200 100644 (file)
@@ -352,14 +352,14 @@ extern FILE (*_imp___iob)[];      /* A pointer to an array of FILE */
 #include <vadefs.h>
 #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);
index 5125051..e5cd41a 100644 (file)
@@ -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) {
index cd44bec..63526fc 100644 (file)
@@ -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