1 //
2 // wmemmove_s.cpp
3 //
4 // Copyright (c) Microsoft Corporation. All rights reserved.
5 //
6 // Defines wmemmove_s(), which copies wide characters from a source buffer to a
7 // destination buffer. Overlapping buffers are treated specially, to avoid
8 // propagation.
9 //
10 // Returns 0 if successful; an error code on failure.
11 //
12 #include <corecrt_internal.h>
13 #include <wchar.h>
14
15
16
wmemmove_s(wchar_t * const destination,size_t const size_in_elements,wchar_t const * const source,size_t const count)17 extern "C" errno_t __cdecl wmemmove_s(
18 wchar_t* const destination,
19 size_t const size_in_elements,
20 wchar_t const* const source,
21 size_t const count
22 )
23 {
24 if (count == 0)
25 return 0;
26
27 #pragma warning(suppress:__WARNING_HIGH_PRIORITY_OVERFLOW_POSTCONDITION)
28 _VALIDATE_RETURN_ERRCODE(destination != nullptr, EINVAL);
29 _VALIDATE_RETURN_ERRCODE(source != nullptr, EINVAL);
30 _VALIDATE_RETURN_ERRCODE(size_in_elements >= count, ERANGE);
31
32 #pragma warning(suppress:__WARNING_BANNED_API_USAGEL2) /* 28726 */
33 wmemmove(destination, source, count);
34 return 0;
35 }
36