headers: crt: move mbwc convert to corecrt_wstdio.h Also remove __MINGW_MBWC_CONVERT_DEFINED and use reserved identifiers for parameters. Signed-off-by: Zhongteng Gui <dragon-archer@outlook.com> Co-authored-by: LIU Hao <lh_mouse@126.com> Signed-off-by: LIU Hao <lh_mouse@126.com>
diff --git a/mingw-w64-headers/crt/corecrt_wstdio.h b/mingw-w64-headers/crt/corecrt_wstdio.h index 9e3b37a..7f5e25a 100644 --- a/mingw-w64-headers/crt/corecrt_wstdio.h +++ b/mingw-w64-headers/crt/corecrt_wstdio.h
@@ -679,6 +679,40 @@ #define _getwc_nolock(_c) _fgetwc_nolock(_c) #endif +/** + * __mingw_str_wide_utf8 + * Converts a null terminated UCS-2 string to a multibyte (UTF-8) equivalent. + * Caller is supposed to free allocated buffer with __mingw_str_free(). + * @param[in] wptr Pointer to wide string. + * @param[out] mbptr Pointer to multibyte string. + * @param[out] buflen Optional parameter for length of allocated buffer. + * @return bytes written by WideCharToMultiByte conversion, 0 for failure. + * + * WideCharToMultiByte - http://msdn.microsoft.com/en-us/library/dd374130(VS.85).aspx + */ +int __cdecl __mingw_str_wide_utf8 (const wchar_t * const _Wptr, char ** _Mbptr, size_t * _Buflen); + +/** + * __mingw_str_utf8_wide + * Converts a null terminated UTF-8 string to a UCS-2 equivalent. + * Caller is supposed to free allocated buffer with __mingw_str_free(). + * @param[out] mbptr Pointer to multibyte string. + * @param[in] wptr Pointer to wide string. + * @param[out] buflen Optional parameter for length of allocated buffer. + * @return bytes written by WideCharToMultiByte conversion, 0 for failure. + * + * MultiByteToWideChar - http://msdn.microsoft.com/en-us/library/dd319072(VS.85).aspx + */ +int __cdecl __mingw_str_utf8_wide (const char *const _Mbptr, wchar_t ** _Wptr, size_t * _Buflen); + +/** + * __mingw_str_free + * Frees buffer create by __mingw_str_wide_utf8 and __mingw_str_utf8_wide. + * @param[in] ptr memory block to free. + * + */ +void __cdecl __mingw_str_free(void * _Ptr); + _CRT_END_C_HEADER #endif /* _INC_CORECRT_WSTDIO */
diff --git a/mingw-w64-headers/crt/stdio.h b/mingw-w64-headers/crt/stdio.h index 3dc54b5..330caca 100644 --- a/mingw-w64-headers/crt/stdio.h +++ b/mingw-w64-headers/crt/stdio.h
@@ -882,47 +882,6 @@ int __cdecl rmtmp(void) __MINGW_ATTRIB_DEPRECATED_MSVC2005; #endif -#ifndef __MINGW_MBWC_CONVERT_DEFINED -#define __MINGW_MBWC_CONVERT_DEFINED - -/** - * __mingw_str_wide_utf8 - * Converts a null terminated UCS-2 string to a multibyte (UTF-8) equivalent. - * Caller is supposed to free allocated buffer with __mingw_str_free(). - * @param[in] wptr Pointer to wide string. - * @param[out] mbptr Pointer to multibyte string. - * @param[out] buflen Optional parameter for length of allocated buffer. - * @return Number of characters converted, 0 for failure. - * - * WideCharToMultiByte - http://msdn.microsoft.com/en-us/library/dd374130(VS.85).aspx - */ -int __cdecl __mingw_str_wide_utf8 (const wchar_t * const wptr, char **mbptr, size_t * buflen); - -/** - * __mingw_str_utf8_wide - * Converts a null terminated UTF-8 string to a UCS-2 equivalent. - * Caller is supposed to free allocated buffer with __mingw_str_free(). - * @param[out] mbptr Pointer to multibyte string. - * @param[in] wptr Pointer to wide string. - * @param[out] buflen Optional parameter for length of allocated buffer. - * @return Number of characters converted, 0 for failure. - * - * MultiByteToWideChar - http://msdn.microsoft.com/en-us/library/dd319072(VS.85).aspx - */ - -int __cdecl __mingw_str_utf8_wide (const char *const mbptr, wchar_t ** wptr, size_t * buflen); - -/** - * __mingw_str_free - * Frees buffer create by __mingw_str_wide_utf8 and __mingw_str_utf8_wide. - * @param[in] ptr memory block to free. - * - */ - -void __cdecl __mingw_str_free(void *ptr); - -#endif /* __MINGW_MBWC_CONVERT_DEFINED */ - #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP #ifndef _WSPAWN_DEFINED #define _WSPAWN_DEFINED
diff --git a/mingw-w64-headers/crt/wchar.h b/mingw-w64-headers/crt/wchar.h index d5057ab..95582e8 100644 --- a/mingw-w64-headers/crt/wchar.h +++ b/mingw-w64-headers/crt/wchar.h
@@ -405,47 +405,6 @@ } #endif /* !__CRT__NO_INLINE */ -#ifndef __MINGW_MBWC_CONVERT_DEFINED -#define __MINGW_MBWC_CONVERT_DEFINED - -/** - * __mingw_str_wide_utf8 - * Converts a null terminated UCS-2 string to a multibyte (UTF-8) equivalent. - * Caller is supposed to free allocated buffer with __mingw_str_free(). - * @param[in] wptr Pointer to wide string. - * @param[out] mbptr Pointer to multibyte string. - * @param[out] buflen Optional parameter for length of allocated buffer. - * @return bytes written by WideCharToMultiByte conversion, 0 for failure. - * - * WideCharToMultiByte - http://msdn.microsoft.com/en-us/library/dd374130(VS.85).aspx - */ -int __cdecl __mingw_str_wide_utf8 (const wchar_t * const wptr, char **mbptr, size_t * buflen); - -/** - * __mingw_str_utf8_wide - * Converts a null terminated UTF-8 string to a UCS-2 equivalent. - * Caller is supposed to free allocated buffer with __mingw_str_free(). - * @param[out] mbptr Pointer to multibyte string. - * @param[in] wptr Pointer to wide string. - * @param[out] buflen Optional parameter for length of allocated buffer. - * @return bytes written by WideCharToMultiByte conversion, 0 for failure. - * - * MultiByteToWideChar - http://msdn.microsoft.com/en-us/library/dd319072(VS.85).aspx - */ - -int __cdecl __mingw_str_utf8_wide (const char *const mbptr, wchar_t ** wptr, size_t * buflen); - -/** - * __mingw_str_free - * Frees buffer create by __mingw_str_wide_utf8 and __mingw_str_utf8_wide. - * @param[in] ptr memory block to free. - * - */ - -void __cdecl __mingw_str_free(void *ptr); - -#endif /* __MINGW_MBWC_CONVERT_DEFINED */ - _CRT_END_C_HEADER #include <sec_api/wchar_s.h>