STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
memory.h
Go to the documentation of this file.
1 /***
2 *memory.h - declarations for buffer (memory) manipulation routines
3 *
4 * Copyright (c) Microsoft Corporation. All rights reserved.
5 *
6 *Purpose:
7 * This include file contains the function declarations for the
8 * buffer (memory) manipulation routines.
9 * [System V]
10 *
11 * [Public]
12 *
13 ****/
14 
15 #pragma once
16 
17 #ifndef _INC_MEMORY
18 #define _INC_MEMORY
19 
20 #include <crtdefs.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif /* __cplusplus */
25 
26 #ifndef _CONST_RETURN
27 #ifdef __cplusplus
28 #define _CONST_RETURN const
29 #define _CRT_CONST_CORRECT_OVERLOADS
30 #else /* __cplusplus */
31 #define _CONST_RETURN
32 #endif /* __cplusplus */
33 #endif /* _CONST_RETURN */
34 
35 /* For backwards compatibility */
36 #define _WConst_return _CONST_RETURN
37 
38 /* Function prototypes */
39 #ifndef _CRT_MEMORY_DEFINED
40 #define _CRT_MEMORY_DEFINED
41 _CRTIMP void * __cdecl _memccpy( _Out_writes_bytes_opt_(_MaxCount) void * _Dst, _In_ const void * _Src, _In_ int _Val, _In_ size_t _MaxCount);
43 _Check_return_ _CRTIMP int __cdecl _memicmp(_In_reads_bytes_opt_(_Size) const void * _Buf1, _In_reads_bytes_opt_(_Size) const void * _Buf2, _In_ size_t _Size);
44 _Check_return_ _CRTIMP int __cdecl _memicmp_l(_In_reads_bytes_opt_(_Size) const void * _Buf1, _In_reads_bytes_opt_(_Size) const void * _Buf2, _In_ size_t _Size, _In_opt_ _locale_t _Locale);
45 _Check_return_ int __cdecl memcmp(_In_reads_bytes_(_Size) const void * _Buf1, _In_reads_bytes_(_Size) const void * _Buf2, _In_ size_t _Size);
47 _Post_equal_to_(_Dst)
48 _At_buffer_((unsigned char*)_Dst, _Iter_, _Size, _Post_satisfies_(((unsigned char*)_Dst)[_Iter_] == ((unsigned char*)_Src)[_Iter_]))
49 void * __cdecl memcpy(_Out_writes_bytes_all_(_Size) void * _Dst, _In_reads_bytes_(_Size) const void * _Src, _In_ size_t _Size);
50 #if __STDC_WANT_SECURE_LIB__
51 _CRTIMP errno_t __cdecl memcpy_s(_Out_writes_bytes_to_opt_(_DstSize, _MaxCount) void * _Dst, _In_ rsize_t _DstSize, _In_reads_bytes_opt_(_MaxCount) const void * _Src, _In_ rsize_t _MaxCount);
52 #if defined (__cplusplus) && _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_MEMORY
53 extern "C++"
54 {
55 #ifndef _CRT_ENABLE_IF_DEFINED
56  #define _CRT_ENABLE_IF_DEFINED
57  template<bool _Enable, typename _Ty>
58  struct _CrtEnableIf;
59 
60  template<typename _Ty>
61  struct _CrtEnableIf<true, _Ty>
62  {
63  typedef _Ty _Type;
64  };
65 #endif /* _CRT_ENABLE_IF_DEFINED */
66  template <size_t _Size, typename _DstType>
67  inline
68  typename _CrtEnableIf<(_Size > 1), void *>::_Type __cdecl memcpy(_DstType (&_Dst)[_Size], _In_reads_bytes_opt_(_SrcSize) const void *_Src, _In_ size_t _SrcSize) _CRT_SECURE_CPP_NOTHROW
69  {
70  return memcpy_s(_Dst, _Size * sizeof(_DstType), _Src, _SrcSize) == 0 ? _Dst : 0;
71  }
72 }
73 #endif /* defined (__cplusplus) && _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_MEMORY */
74 #if defined (__cplusplus) && _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES_MEMORY
75 extern "C++"
76 {
77  template <size_t _Size, typename _DstType>
78  inline
79  errno_t __CRTDECL memcpy_s(_DstType (&_Dst)[_Size], _In_reads_bytes_opt_(_SrcSize) const void * _Src, _In_ rsize_t _SrcSize) _CRT_SECURE_CPP_NOTHROW
80  {
81  return memcpy_s(_Dst, _Size * sizeof(_DstType), _Src, _SrcSize);
82  }
83 }
84 #endif /* defined (__cplusplus) && _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES_MEMORY */
85 #endif /* __STDC_WANT_SECURE_LIB__ */
86  _Post_equal_to_(_Dst)
87  _At_buffer_((unsigned char*)_Dst, _Iter_, _Size, _Post_satisfies_(((unsigned char*)_Dst)[_Iter_] == _Val))
88  void * __cdecl memset(_Out_writes_bytes_all_(_Size) void * _Dst, _In_ int _Val, _In_ size_t _Size);
89 
90 #if !__STDC__
91 /* Non-ANSI names for compatibility */
92 _CRT_NONSTDC_DEPRECATE(_memccpy) _CRTIMP void * __cdecl memccpy(_Out_writes_bytes_opt_(_Size) void * _Dst, _In_reads_bytes_opt_(_Size) const void * _Src, _In_ int _Val, _In_ size_t _Size);
93 _Check_return_ _CRT_NONSTDC_DEPRECATE(_memicmp) _CRTIMP int __cdecl memicmp(_In_reads_bytes_opt_(_Size) const void * _Buf1, _In_reads_bytes_opt_(_Size) const void * _Buf2, _In_ size_t _Size);
94 #endif /* !__STDC__ */
95 
96 #endif /* _CRT_MEMORY_DEFINED */
97 
98 #ifdef __cplusplus
99 #ifndef _CPP_MEMCHR_DEFINED
100 #define _CPP_MEMCHR_DEFINED
101 extern "C++" _Check_return_ inline void * __CRTDECL memchr( _In_reads_bytes_opt_(_N) void * _Pv , _In_ int _C, _In_ size_t _N)
102  { return (void*)memchr((const void*)_Pv, _C, _N); }
103 #endif /* _CPP_MEMCHR_DEFINED */
104 #endif /* __cplusplus */
105 
106 #ifdef __cplusplus
107 }
108 #endif /* __cplusplus */
109 
110 #endif /* _INC_MEMORY */
_Iter_
Definition: memory.h:48
_CRTIMP void *__cdecl _memccpy(_Out_writes_bytes_opt_(_MaxCount) void *_Dst, _In_ const void *_Src, _In_ int _Val, _In_ size_t _MaxCount)
_Post_satisfies_(((unsigned char *) _Dst)[_Iter_]==((unsigned char *) _Src)[_Iter_])) void *__cdecl memcpy(_Out_writes_bytes_all_(_Size) void *_Dst
#define _CRTIMP
Definition: crtdefs.h:23
_In_reads_bytes_(_Size) const void *_Src
Definition: regex:1520
_N
Definition: wchar.h:1269
_Check_return_ _CRTIMP int __cdecl _memicmp_l(_In_reads_bytes_opt_(_Size) const void *_Buf1, _In_reads_bytes_opt_(_Size) const void *_Buf2, _In_ size_t _Size, _In_opt_ _locale_t _Locale)
#define _CRT_SECURE_CPP_NOTHROW
Definition: crtdefs.h:475
#define _Out_writes_bytes_all_(size)
Definition: sal.h:368
#define _Out_writes_bytes_opt_(size)
Definition: sal.h:357
_Check_return_ _CRTIMP int __cdecl _memicmp(_In_reads_bytes_opt_(_Size) const void *_Buf1, _In_reads_bytes_opt_(_Size) const void *_Buf2, _In_ size_t _Size)
_Post_equal_to_(_Dst) _At_buffer_((unsigned char *) _Dst
#define _Check_return_
Definition: sal.h:563
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
#define _In_
Definition: sal.h:314
_CRTIMP errno_t __cdecl memcpy_s(_Out_writes_bytes_to_opt_(_DstSize, _MaxCount) void *_Dst, _In_ rsize_t _DstSize, _In_reads_bytes_opt_(_MaxCount) const void *_Src, _In_ rsize_t _MaxCount)
_Check_return_ _In_z_ const char * _Locale
Definition: locale.h:117
#define _In_opt_
Definition: sal.h:315
_CRT_NONSTDC_DEPRECATE(_memccpy) _CRTIMP void *__cdecl memccpy(_Out_writes_bytes_opt_(_Size) void *_Dst
_Check_return_ _CRTIMP _CONST_RETURN void *__cdecl memchr(_In_reads_bytes_opt_(_MaxCount) const void *_Buf, _In_ int _Val, _In_ size_t _MaxCount)
_In_reads_bytes_opt_(_Size) const void *_Src
_In_ wchar_t _C
Definition: wchar.h:1295
_In_ wctype_t _Type
Definition: ctype.h:205
int errno_t
Definition: crtdefs.h:563
#define __CRTDECL
Definition: crtdefs.h:622
size_t rsize_t
Definition: crtdefs.h:503
_Size
Definition: memory.h:48
#define _At_buffer_(target, iter, bound, annos)
Definition: sal.h:256
_In_ int _Val
Definition: memory.h:88
#define _CONST_RETURN
Definition: crtdefs.h:590
_In_z_ const unsigned char _In_ size_t _MaxCount
Definition: mbstring.h:154
#define _Out_writes_bytes_to_opt_(size, count)
Definition: sal.h:367
#define true
Definition: stdbool.h:12
_Check_return_ int __cdecl memcmp(_In_reads_bytes_(_Size) const void *_Buf1, _In_reads_bytes_(_Size) const void *_Buf2, _In_ size_t _Size)
Definition: crtdefs.h:2078
#define _CRT_INSECURE_DEPRECATE_MEMORY(_Replacement)
Definition: crtdefs.h:299