[CRT] Add C++ const correct overloads

This commit is contained in:
Timo Kreuzer 2024-10-11 17:09:28 +02:00
parent 8c2b8c835a
commit 8ba61029e1
6 changed files with 167 additions and 7 deletions

View file

@ -11,6 +11,8 @@
#define __need___va_list
#include <stdarg.h>
#define __CORRECT_ISO_CPP_WCHAR_H_PROTO // For stl
#pragma pack(push,_CRT_PACKING)
#ifdef __cplusplus
@ -1926,6 +1928,16 @@ _CRTIMP int __cdecl iswblank(wint_t _C);
_In_z_ const wchar_t *_Str,
wchar_t _Ch);
#ifdef __cplusplus
extern "C++"
_Check_return_
_When_(return != NULL, _Ret_range_(_String, _String + _String_length_(_String) - 1))
inline wchar_t* __cdecl wcschr(_In_z_ wchar_t *_String, wchar_t _C)
{
return const_cast<wchar_t*>(wcschr(static_cast<const wchar_t*>(_String), _C));
}
#endif // __cplusplus
_Check_return_
int
__cdecl
@ -1992,6 +2004,15 @@ _CRTIMP int __cdecl iswblank(wint_t _C);
_In_z_ const wchar_t *_Str,
_In_z_ const wchar_t *_Control);
#ifdef __cplusplus
extern "C++"
_Check_return_
inline wchar_t* __cdecl wcspbrk(_In_z_ wchar_t *_Str, _In_z_ const wchar_t *_Control)
{
return const_cast<wchar_t*>(wcspbrk(static_cast<const wchar_t*>(_Str), _Control));
}
#endif // __cplusplus
_Check_return_
_CONST_RETURN
wchar_t*
@ -2000,6 +2021,15 @@ _CRTIMP int __cdecl iswblank(wint_t _C);
_In_z_ const wchar_t *_Str,
_In_ wchar_t _Ch);
#ifdef __cplusplus
extern "C++"
_Check_return_
inline wchar_t* __cdecl wcsrchr(_In_z_ wchar_t *_Str, _In_ wchar_t _Ch)
{
return const_cast<wchar_t*>(wcsrchr(static_cast<const wchar_t*>(_Str), _Ch));
}
#endif // __cplusplus
_Check_return_
size_t
__cdecl
@ -2014,6 +2044,16 @@ _CRTIMP int __cdecl iswblank(wint_t _C);
_In_z_ const wchar_t *_Str,
_In_z_ const wchar_t *_SubStr);
#ifdef __cplusplus
extern "C++"
_Check_return_ _Ret_maybenull_
_When_(return != NULL, _Ret_range_(_String, _String + _String_length_(_String) - 1))
inline wchar_t* __cdecl wcsstr(_In_z_ wchar_t *_String, _In_z_ const wchar_t *_SubStr)
{
return const_cast<wchar_t*>(wcsstr(static_cast<const wchar_t*>(_String), _SubStr));
}
#endif // __cplusplus
_Check_return_
wchar_t*
__cdecl
@ -2467,6 +2507,18 @@ __CRT_INLINE wchar_t *__cdecl _wctime(const time_t *_Time) { return _wctime64(_T
_In_ wchar_t _C,
_In_ size_t _N);
#ifdef __cplusplus
extern "C++"
inline wchar_t* __cdecl wmemchr(
_In_reads_(_N) wchar_t *_S,
_In_ wchar_t _C,
_In_ size_t _N)
{
const wchar_t *_SC = _S;
return const_cast<wchar_t*>(wmemchr(_SC, _C, _N));
}
#endif // __cplusplus
int
__cdecl
wmemcmp(