--
Best regards,
LIU Hao
From 0b2dba1baf8698bdcdde615a8a7cdb9d567fe754 Mon Sep 17 00:00:00 2001
From: LIU Hao <lh_mo...@126.com>
Date: Mon, 26 Feb 2024 23:00:13 +0800
Subject: [PATCH] include/tchar: Add more macros

This should match latest Windows SDK except for `strtold_l()` and `wcstold_l()`.
The Microsoft implementations produce 64-bit numbers that do not match the GNU
ABI, and we at the moment do not have locale-aware implementations.

Signed-off-by: LIU Hao <lh_mo...@126.com>
---
 mingw-w64-headers/crt/sec_api/tchar_s.h | 10 +++++-
 mingw-w64-headers/crt/tchar.h           | 46 ++++++++++++++++++++++++-
 2 files changed, 54 insertions(+), 2 deletions(-)

diff --git a/mingw-w64-headers/crt/sec_api/tchar_s.h 
b/mingw-w64-headers/crt/sec_api/tchar_s.h
index 22e368bc3..405583dd2 100644
--- a/mingw-w64-headers/crt/sec_api/tchar_s.h
+++ b/mingw-w64-headers/crt/sec_api/tchar_s.h
@@ -83,6 +83,7 @@ extern "C" {
 
 #define _tgetenv_s _wgetenv_s
 #define _tdupenv_s _wdupenv_s
+#define _tdupenv_s_dbg _wdupenv_s_dbg
 #define _tmakepath_s _wmakepath_s
 #define _tputenv_s _wputenv_s
 #define _tsearchenv_s _wsearchenv_s
@@ -93,11 +94,14 @@ extern "C" {
 #define _ttmpnam_s _wtmpnam_s
 #define _taccess_s _waccess_s
 #define _tmktemp_s _wmktemp_s
+#define _tsopen_s _wsopen_s
 
 #define _tcsnccat_s wcsncat_s
 #define _tcsnccat_s_l _wcsncat_s_l
 #define _tcsnccpy_s wcsncpy_s
 #define _tcsnccpy_s_l _wcsncpy_s_l
+#define _tcsncset_s _wcsnset_s
+#define _tcsncset_s_l _wcsnset_s_l
 
 #define _tcslwr_s _wcslwr_s
 #define _tcslwr_s_l _wcslwr_s_l
@@ -166,6 +170,7 @@ extern "C" {
 
 #define _tgetenv_s getenv_s
 #define _tdupenv_s _dupenv_s
+#define _tdupenv_s_dbg _dupenv_s_dbg
 #define _tmakepath_s _makepath_s
 #define _tputenv_s _putenv_s
 #define _tsearchenv_s _searchenv_s
@@ -226,11 +231,12 @@ extern "C" {
   _CRTIMP char *__cdecl _tcsnccat_s_l(char *_Dst,size_t _DstSizeInChars,const 
char *_Src,size_t _MaxCount,_locale_t _Locale);
   _CRTIMP char *__cdecl _tcsnccpy_s(char *_Dst,size_t _DstSizeInChars,const 
char *_Src,size_t _MaxCount);
   _CRTIMP char *__cdecl _tcsnccpy_s_l(char *_Dst,size_t _DstSizeInChars,const 
char *_Src,size_t _MaxCount,_locale_t _Locale);
+  _CRTIMP char *__cdecl _tcsncset_s(char *_Str,size_t _SizeInChars,unsigned 
int _Val,size_t _MaxCount);
+  _CRTIMP char *__cdecl _tcsncset_s_l(char *_Str,size_t _SizeInChars,unsigned 
int _Val,size_t _MaxCount,_locale_t _Locale);
   _CRTIMP char *__cdecl _tcslwr_s(char *_Str,size_t _SizeInChars);
   _CRTIMP char *__cdecl _tcslwr_s_l(char *_Str,size_t _SizeInChars,_locale_t 
_Locale);
   _CRTIMP char *__cdecl _tcsupr_s(char *_Str,size_t _SizeInChars);
   _CRTIMP char *__cdecl _tcsupr_s_l(char *_Str,size_t _SizeInChars,_locale_t 
_Locale);
-
 #endif
 
 #else
@@ -252,6 +258,8 @@ extern "C" {
 #define _tcsnccat_s_l _strncat_s_l
 #define _tcsnccpy_s strncpy_s
 #define _tcsnccpy_s_l _strncpy_s_l
+#define _tcsncset_s _strnset_s
+#define _tcsncset_s_l _strnset_s_l
 
 #define _tcslwr_s _strlwr_s
 #define _tcslwr_s_l _strlwr_s_l
diff --git a/mingw-w64-headers/crt/tchar.h b/mingw-w64-headers/crt/tchar.h
index 5ae9479c6..14e0069e0 100644
--- a/mingw-w64-headers/crt/tchar.h
+++ b/mingw-w64-headers/crt/tchar.h
@@ -211,30 +211,44 @@ extern "C" {
 
 #define _tcstof wcstof
 #define _tcstod wcstod
+#define _tcstold wcstold
 #define _tcstol wcstol
 #define _tcstoul wcstoul
+#define _tcstoll _wcstoi64
+#define _tcstoull _wcstoui64
 #define _tcstoi64 _wcstoi64
 #define _tcstoui64 _wcstoui64
+#define _tcstoimax _wcstoi64
+#define _tcstoumax _wcstoui64
 #define _tstof _wtof
 #define _tstol _wtol
 #define _tstoi _wtoi
+#define _tstoll _wtoi64
 #define _tstoi64 _wtoi64
 #define _tcstof_l _wcstof_l
 #define _tcstod_l _wcstod_l
+/* TODO: #define _tcstold_l _wcstold_l  */
 #define _tcstol_l _wcstol_l
 #define _tcstoul_l _wcstoul_l
+#define _tcstoll_l _wcstoi64_l
+#define _tcstoull_l _wcstoui64_l
 #define _tcstoi64_l _wcstoi64_l
 #define _tcstoui64_l _wcstoui64_l
+#define _tcstoimax_l _wcstoi64_l
+#define _tcstoumax_l _wcstoui64_l
 #define _tstof_l _wtof_l
 #define _tstol_l _wtol_l
+#define _tstoll_l _wtoi64_l
 #define _tstoi_l _wtoi_l
 #define _tstoi64_l _wtoi64_l
 
 #define _itot _itow
 #define _ltot _ltow
 #define _ultot _ultow
+#define _ttof _wtof
 #define _ttoi _wtoi
 #define _ttol _wtol
+#define _ttoll _wtoi64
 
 #define _ttoi64 _wtoi64
 #define _i64tot _i64tow
@@ -260,6 +274,7 @@ extern "C" {
 #define __tcserror __wcserror
 
 #define _tcsdup _wcsdup
+#define _tcsdup_dbg _wcsdup_dbg
 #define _tcsnset _wcsnset
 #define _tcsnset_l _wcsnset_l
 #define _tcsrev _wcsrev
@@ -317,18 +332,22 @@ extern "C" {
 #define _tstrdate _wstrdate
 #define _tstrtime _wstrtime
 #define _tutime _wutime
-#define _tutime32 _wutime
+#define _tutime32 _wutime32
 #define _tutime64 _wutime64
 #define _tcsftime wcsftime
 #define _tcsftime_l _wcsftime_l
 
 #define _tchdir _wchdir
 #define _tgetcwd _wgetcwd
+#define _tgetcwd_dbg _wgetcwd_dbg
 #define _tgetdcwd _wgetdcwd
+#define _tgetdcwd_dbg _wgetdcwd_dbg
+#define _tgetdcwd_lk_dbg _wgetdcwd_lk_dbg
 #define _tmkdir _wmkdir
 #define _trmdir _wrmdir
 
 #define _tfullpath _wfullpath
+#define _tfullpath_dbg _wfullpath_dbg
 #define _tgetenv _wgetenv
 #define _tmakepath _wmakepath
 #define _tpgmptr _wpgmptr
@@ -344,6 +363,7 @@ extern "C" {
 #define _tperror _wperror
 #define _tpopen _wpopen
 #define _ttempnam _wtempnam
+#define _ttempnam_dbg _wtempnam_dbg
 #define _ttmpnam _wtmpnam
 
 #define _taccess _waccess
@@ -393,6 +413,7 @@ extern "C" {
 #define _tcsnccpy wcsncpy
 #define _tcsnccpy_l _wcsncpy_l
 #define _tcsncset _wcsnset
+#define _tcsncset_l _wcsnset_l
 
 #define _tcsdec _wcsdec
 #define _tcsinc _wcsinc
@@ -577,38 +598,53 @@ extern "C" {
 
 #define _tcstof strtof
 #define _tcstod strtod
+#define _tcstold strtold
 #define _tcstol strtol
 #define _tcstoul strtoul
+#define _tcstoll _strtoi64
+#define _tcstoull _strtoui64
 #define _tstof atof
 #define _tstol atol
+#define _tstoll _atoi64
 #define _tstoi atoi
 #define _tstoi64 _atoi64
 #define _tcstof_l _strtof_l
 #define _tcstod_l _strtod_l
+/* TODO: #define _tcstold_l _strtold_l  */
 #define _tcstol_l _strtol_l
 #define _tcstoul_l _strtoul_l
+#define _tcstoll_l _strtoi64_l
+#define _tcstoull_l _strtoui64_l
 #define _tstof_l _atof_l
 #define _tstol_l _atol_l
 #define _tstoi_l _atoi_l
+#define _tstoll_l _atoi64_l
 #define _tstoi64_l _atoi64_l
 
 #define _itot _itoa
 #define _ltot _ltoa
 #define _ultot _ultoa
+#define _ttof atof
 #define _ttoi atoi
 #define _ttol atol
+#define _ttoll _atoi64
 
 #define _ttoi64 _atoi64
 #define _tcstoi64 _strtoi64
 #define _tcstoi64_l _strtoi64_l
 #define _tcstoui64 _strtoui64
 #define _tcstoui64_l _strtoui64_l
+#define _tcstoimax _strtoi64
+#define _tcstoumax _strtoui64
+#define _tcstoimax_l _strtoi64_l
+#define _tcstoumax_l _strtoui64_l
 #define _i64tot _i64toa
 #define _ui64tot _ui64toa
 
 #define _tcscat strcat
 #define _tcscpy strcpy
 #define _tcsdup _strdup
+#define _tcsdup_dbg _strdup_dbg
 #define _tcslen strlen
 #define _tcsnlen strnlen
 #define _tcsxfrm strxfrm
@@ -650,11 +686,15 @@ extern "C" {
 
 #define _tchdir _chdir
 #define _tgetcwd _getcwd
+#define _tgetcwd_dbg _getcwd_dbg
 #define _tgetdcwd _getdcwd
+#define _tgetdcwd_dbg _getdcwd_dbg
+#define _tgetdcwd_lk_dbg _getdcwd_lk_dbg
 #define _tmkdir _mkdir
 #define _trmdir _rmdir
 
 #define _tfullpath _fullpath
+#define _tfullpath_dbg _fullpath_dbg
 #define _tgetenv getenv
 #define _tmakepath _makepath
 #define _tpgmptr _pgmptr
@@ -674,6 +714,7 @@ extern "C" {
 #define _tperror perror
 #define _tpopen _popen
 #define _ttempnam _tempnam
+#define _ttempnam_dbg _tempnam_dbg
 #define _ttmpnam tmpnam
 
 #define _tchmod _chmod
@@ -906,6 +947,7 @@ extern "C" {
   _CRTIMP char *__cdecl _tcsnccpy(char *_Dst,const char *_Src,size_t 
_MaxCount);
   _CRTIMP char *__cdecl _tcsnccpy_l(char *_Dst,const char *_Src,size_t 
_MaxCount,_locale_t _Locale);
   _CRTIMP char *__cdecl _tcsncset(char *_Str,unsigned int _Val,size_t 
_MaxCount);
+  _CRTIMP char *__cdecl _tcsncset_l(char *_Str,unsigned int _Val,size_t 
_MaxCount,_locale_t _Locale);
   _CRTIMP char *__cdecl _tcsdec(const char *_Start,const char *_Pos);
   _CRTIMP char *__cdecl _tcsinc(const char *_Ptr);
   _CRTIMP size_t __cdecl _tcsnbcnt(const char *_Str,size_t _MaxCount);
@@ -1005,6 +1047,7 @@ extern "C" {
 #define _tcsnset_l _strnset_l
 #define _tcsrev _strrev
 #define _tcsset _strset
+#define _tcsset_l _strset_l
 
 #define _tcscmp strcmp
 #define _tcsicmp _stricmp
@@ -1038,6 +1081,7 @@ extern "C" {
 #define _tcsnccpy strncpy
 #define _tcsnccpy_l _strncpy_l
 #define _tcsncset _strnset
+#define _tcsncset_l _strnset_l
 
 #define _tcsdec _strdec
 #define _tcsinc _strinc
-- 
2.44.0

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to