STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
corecrt_memory.h
Go to the documentation of this file.
1 //
2 // corecrt_memory.h
3 //
4 // Copyright (c) Microsoft Corporation. All rights reserved.
5 //
6 // The buffer (memory) manipulation library. These declarations are split out
7 // so that they may be included by both <string.h> and <memory.h>. <string.h>
8 // does not include <memory.h> to avoid introducing conflicts with other user
9 // headers named <memory.h>.
10 //
11 #pragma once
12 
13 #include <corecrt.h>
14 #include <corecrt_memcpy_s.h>
15 #include <vcruntime_string.h>
16 
17 #ifndef __midl
18 
20 
21 
22 
24 _ACRTIMP int __cdecl _memicmp(
25  _In_reads_bytes_opt_(_Size) void const* _Buf1,
26  _In_reads_bytes_opt_(_Size) void const* _Buf2,
27  _In_ size_t _Size
28  );
29 
31 _ACRTIMP int __cdecl _memicmp_l(
32  _In_reads_bytes_opt_(_Size) void const* _Buf1,
33  _In_reads_bytes_opt_(_Size) void const* _Buf2,
34  _In_ size_t _Size,
36  );
37 
38 
39 
40 #if !defined RC_INVOKED && __STDC_WANT_SECURE_LIB__
41 
42  #if defined __cplusplus && _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_MEMORY
43  extern "C++"
44  {
45  template <size_t _Size, typename _DstType>
46  inline typename _CrtEnableIf<(_Size > 1), void *>::_Type __cdecl memcpy(
47  _DstType (&_Dst)[_Size],
48  _In_reads_bytes_opt_(_SrcSize) void const* _Src,
49  _In_ size_t _SrcSize
51  {
52  return memcpy_s(_Dst, _Size * sizeof(_DstType), _Src, _SrcSize) == 0 ? _Dst : 0;
53  }
54  }
55  #endif
56 
57  #if defined __cplusplus && _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES_MEMORY
58  extern "C++"
59  {
60  template <size_t _Size, typename _DstType>
61  inline errno_t __CRTDECL memcpy_s(
62  _DstType (&_Dst)[_Size],
63  _In_reads_bytes_opt_(_SrcSize) void const* _Src,
64  _In_ rsize_t _SrcSize
66  {
67  return memcpy_s(_Dst, _Size * sizeof(_DstType), _Src, _SrcSize);
68  }
69  }
70  #endif
71 
72 #endif // !defined RC_INVOKED && __STDC_WANT_SECURE_LIB__
73 
74 
75 
76 #if _CRT_INTERNAL_NONSTDC_NAMES
77 
79  _ACRTIMP void* __cdecl memccpy(
80  _Out_writes_bytes_opt_(_Size) void* _Dst,
81  _In_reads_bytes_opt_(_Size) void const* _Src,
82  _In_ int _Val,
83  _In_ size_t _Size
84  );
85 
87  _ACRTIMP int __cdecl memicmp(
88  _In_reads_bytes_opt_(_Size) void const* _Buf1,
89  _In_reads_bytes_opt_(_Size) void const* _Buf2,
90  _In_ size_t _Size
91  );
92 
93 #endif // _CRT_INTERNAL_NONSTDC_NAMES
94 
95 
96 
97 #if defined __cplusplus
98 
99  extern "C++" _Check_return_
100  inline void* __CRTDECL memchr(
101  _In_reads_bytes_opt_(_N) void* _Pv,
102  _In_ int _C,
103  _In_ size_t _N
104  )
105  {
106  void const* const _Pvc = _Pv;
107  return const_cast<void*>(memchr(_Pvc, _C, _N));
108  }
109 
110 #endif
111 
112 
113 
115 
116 #endif // !__midl
Definition: corecrt.h:489
#define _ACRTIMP
Definition: corecrt.h:27
_Check_return_ _CRT_NONSTDC_DEPRECATE(_memicmp) _ACRTIMP int __cdecl memicmp(_In_reads_bytes_opt_(_Size) void const *_Buf1
_In_ size_t _Deref_pre_opt_z_ char const _In_ size_t _N
Definition: wchar.h:78
int errno_t
Definition: corecrt.h:476
size_t rsize_t
Definition: corecrt.h:527
#define _CRT_BEGIN_C_HEADER
Definition: vcruntime.h:73
_ACRTIMP void *__cdecl memccpy(_Out_writes_bytes_opt_(_Size) void *_Dst, _In_reads_bytes_opt_(_Size) void const *_Src, _In_ int _Val, _In_ size_t _Size)
#define _Out_writes_bytes_opt_(size)
Definition: sal.h:348
#define __CRTDECL
Definition: vcruntime.h:156
_CRT_BEGIN_C_HEADER _Check_return_ _ACRTIMP int __cdecl _memicmp(_In_reads_bytes_opt_(_Size) void const *_Buf1, _In_reads_bytes_opt_(_Size) void const *_Buf2, _In_ size_t _Size)
_CRT_BEGIN_C_HEADER _Check_return_ _VCRTIMP void _CONST_RETURN *__cdecl memchr(_In_reads_bytes_opt_(_MaxCount) void const *_Buf, _In_ int _Val, _In_ size_t _MaxCount)
#define _CRT_SECURE_CPP_NOTHROW
Definition: corecrt.h:466
#define _Check_return_
Definition: sal.h:554
#define _In_
Definition: sal.h:305
_In_ wctype_t _Type
Definition: corecrt_wctype.h:111
#define _In_opt_
Definition: sal.h:306
_CRT_BEGIN_C_HEADER typedef void(__CRTDECL *terminate_handler)()
_In_ size_t _Out_opt_ int _In_z_ unsigned char const * _Src
Definition: mbstring.h:1039
_Check_return_ _In_ size_t _Size
Definition: corecrt_memory.h:91
_In_ wchar_t _C
Definition: wchar.h:253
_Check_return_ _ACRTIMP int __cdecl _memicmp_l(_In_reads_bytes_opt_(_Size) void const *_Buf1, _In_reads_bytes_opt_(_Size) void const *_Buf2, _In_ size_t _Size, _In_opt_ _locale_t _Locale)
memcpy(_Destination, _Source, _SourceSize)
#define _CRT_END_C_HEADER
Definition: vcruntime.h:76
_ACRTIMP void *__cdecl _memccpy(_Out_writes_bytes_opt_(_MaxCount) void *_Dst, _In_ void const *_Src, _In_ int _Val, _In_ size_t _MaxCount)
_Check_return_ _In_reads_bytes_opt_(_Size) void const *_Buf2
_Check_return_opt_ _In_opt_ _locale_t const _Locale
Definition: corecrt_wconio.h:289
_FwdIt const _Ty _Val
Definition: algorithm:1938