source: Daodan/MSYS2/mingw32/i686-w64-mingw32/include/_mingw_secapi.h@ 1172

Last change on this file since 1172 was 1166, checked in by rossy, 3 years ago

Daodan: Replace MinGW build env with an up-to-date MSYS2 env

File size: 3.4 KB
RevLine 
[1166]1/**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the mingw-w64 runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5 */
6
7#ifndef _INC_MINGW_SECAPI
8#define _INC_MINGW_SECAPI
9
10/* http://msdn.microsoft.com/en-us/library/ms175759%28v=VS.100%29.aspx */
11#if defined(__cplusplus)
12#ifndef _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES
13#define _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES 1 /* default to 1 */
14#endif /*_CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES*/
15#ifndef _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES_MEMORY
16#define _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES_MEMORY 0 /* default to 0 */
17#endif /*_CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES_MEMORY*/
18#ifndef _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES
19#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 0 /* default to 0 */
20#endif /* _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES */
21#ifndef _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT
22#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT 0 /* default to 0 */
23#endif /* _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT */
24#ifndef _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_MEMORY
25#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_MEMORY 0 /* default to 0 */
26#endif /* _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_MEMORY */
27#else
28/* Templates won't work in C, will break if secure API is not enabled, disabled */
29#undef _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES
30#undef _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES_MEMORY
31#undef _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES
32#undef _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT
33#undef _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_MEMORY
34#define _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES 0
35#define _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES_MEMORY 0
36#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 0
37#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT 0
38#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_MEMORY 0
39#endif /*defined(__cplusplus)*/
40
41#define __MINGW_CRT_NAME_CONCAT2(sym) ::sym##_s
42
43#ifdef __cplusplus
44extern "C++" {
45template <bool __test, typename __dsttype>
46 struct __if_array;
47template <typename __dsttype>
48 struct __if_array <true, __dsttype> {
49 typedef __dsttype __type;
50};
51}
52#endif /*__cplusplus*/
53
54/* https://blogs.msdn.com/b/sdl/archive/2010/02/16/vc-2010-and-memcpy.aspx?Redirected=true */
55/* fallback on default implementation if we can't know the size of the destination */
56#if (_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_MEMORY == 1)
57#define __CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_MEMORY_0_3_(__ret,__func,__type1,__attrib1,__arg1,__type2,__attrib2,__arg2,__type3,__attrib3,__arg3)\
58 extern "C" {_CRTIMP __ret __cdecl __func(__type1 * __attrib1 __arg1, __type2 __attrib2 __arg2, __type3 __attrib3 __arg3) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;}\
59 extern "C++" {\
60 template <size_t __size, typename __dsttype> inline\
61 typename __if_array < (__size > 1), void * >::__type __cdecl __func(\
62 __dsttype (&__arg1)[__size],\
63 __type2 __attrib2 (__arg2),\
64 __type3 __attrib3 (__arg3)) {\
65 return __MINGW_CRT_NAME_CONCAT2(__func) (__arg1,__size * sizeof(__dsttype),__arg2,__arg3) == 0 ? __arg1 : NULL;\
66 }\
67 }
68#else
69#define __CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_MEMORY_0_3_(__ret,__func,__type1,__attrib1,__arg1,__type2,__attrib2,__arg2,__type3,__attrib3,__arg3)\
70 _CRTIMP __ret __cdecl __func(__type1 * __attrib1 __arg1, __type2 __attrib2 __arg2, __type3 __attrib3 __arg3) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
71#endif
72
73#endif /*_INC_MINGW_SECAPI*/
Note: See TracBrowser for help on using the repository browser.