Re: [Mingw-w64-public] [PATCH] wchar.h missing functions

2016-08-25 Thread JonY
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

On 8/25/2016 17:12, David Wohlferd wrote:
> In mingw-w64-headers/crt/time.h there is some code that does:
> 
> #ifndef _WTIME_DEFINED #define _WTIME_DEFINED
> 
> After that, it defines a number of functions.
> 
> mingw-w64-headers/crt/wchar.h has this same #if block, using that
> exact same define, but it defines fewer functions.  So if you
> include time.h first, you get all the functions.  But if you
> include wchar.h first, you never get the prototypes for the extra
> functions, even if you later include time.h.
> 
> This patch makes sure you get the same list of functions no matter
> which file you include first.
> 
> dw
> 

Thanks for noticing this, patch OK. I wonder if moving them to a
common file would be better.


-BEGIN PGP SIGNATURE-

iF4EAREIAAYFAle+z7gACgkQk721PNTrx0APRAD/elyiTGqwhgNv6u6UdjM3M3+I
hXwUyaR7DYx12K72M4wA/jiQJ+S2lHwPzAqPo7XcOFiBaQBIpmJ8u0UqZAXYFPyG
=s4ls
-END PGP SIGNATURE-
--
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] [PATCH] wchar.h missing functions

2016-08-25 Thread David Wohlferd

In mingw-w64-headers/crt/time.h there is some code that does:

 #ifndef _WTIME_DEFINED
 #define _WTIME_DEFINED

After that, it defines a number of functions.

mingw-w64-headers/crt/wchar.h has this same #if block, using that exact 
same define, but it defines fewer functions.  So if you include time.h 
first, you get all the functions.  But if you include wchar.h first, you 
never get the prototypes for the extra functions, even if you later 
include time.h.


This patch makes sure you get the same list of functions no matter which 
file you include first.


dw

diff --git a/mingw-w64-headers/crt/wchar.h b/mingw-w64-headers/crt/wchar.h
index 88cb24c..9265d0b 100644
--- a/mingw-w64-headers/crt/wchar.h
+++ b/mingw-w64-headers/crt/wchar.h
@@ -913,12 +913,17 @@ int vsnwprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, __builti
 #define _WTIME_DEFINED
 
   _CRTIMP wchar_t *__cdecl _wasctime(const struct tm *_Tm);
+  _CRTIMP errno_t __cdecl _wasctime_s (wchar_t *_Buf,size_t _SizeInWords,const struct tm *_Tm);
   wchar_t *__cdecl _wctime32(const __time32_t *_Time) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
+  _CRTIMP errno_t __cdecl _wctime32_s (wchar_t *_Buf,size_t _SizeInWords,const __time32_t *_Time);
   size_t __cdecl wcsftime(wchar_t * __restrict__ _Buf,size_t _SizeInWords,const wchar_t * __restrict__ _Format,const struct tm * __restrict__ _Tm);
   _CRTIMP size_t __cdecl _wcsftime_l(wchar_t * __restrict__ _Buf,size_t _SizeInWords,const wchar_t * __restrict__ _Format,const struct tm * __restrict__ _Tm,_locale_t _Locale);
   _CRTIMP wchar_t *__cdecl _wstrdate(wchar_t *_Buffer) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
+  _CRTIMP errno_t __cdecl _wstrdate_s (wchar_t *_Buf,size_t _SizeInWords);
   _CRTIMP wchar_t *__cdecl _wstrtime(wchar_t *_Buffer) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
+  _CRTIMP errno_t __cdecl _wstrtime_s (wchar_t *_Buf,size_t _SizeInWords);
   _CRTIMP wchar_t *__cdecl _wctime64(const __time64_t *_Time) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
+  _CRTIMP errno_t __cdecl _wctime64_s (wchar_t *_Buf,size_t _SizeInWords,const __time64_t *_Time);
 
 #if !defined (RC_INVOKED) && !defined (_INC_WTIME_INL)
 #define _INC_WTIME_INL
@@ -931,6 +936,19 @@ int vsnwprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, __builti
 #endif
 #endif /* __CRT__NO_INLINE */
 #endif
+
+#if !defined (RC_INVOKED) && !defined (_INC_WTIME_S_INL)
+#define _INC_WTIME_S_INL
+  errno_t __cdecl _wctime_s(wchar_t *, size_t, const time_t *);
+#ifndef __CRT__NO_INLINE
+#ifndef _USE_32BIT_TIME_T
+  __CRT_INLINE errno_t __cdecl _wctime_s (wchar_t *_Buffer,size_t _SizeInWords,const time_t *_Time) { return _wctime64_s (_Buffer,_SizeInWords,_Time); }
+#else
+  __CRT_INLINE errno_t __cdecl _wctime_s (wchar_t *_Buffer,size_t _SizeInWords,const time_t *_Time) { return _wctime32_s (_Buffer,_SizeInWords,_Time); }
+#endif /* _USE_32BIT_TIME_T */
+#endif  /* __CRT__NO_INLINE */
+#endif /* !defined (RC_INVOKED) && !defined (_INC_WTIME_S_INL) */
+
 #endif
 
   typedef int mbstate_t;
--
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public