/src/FreeRDP/winpr/libwinpr/crt/buffer.c
Line  | Count  | Source (jump to first uncovered line)  | 
1  |  | /**  | 
2  |  |  * WinPR: Windows Portable Runtime  | 
3  |  |  * Buffer Manipulation  | 
4  |  |  *  | 
5  |  |  * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>  | 
6  |  |  *  | 
7  |  |  * Licensed under the Apache License, Version 2.0 (the "License");  | 
8  |  |  * you may not use this file except in compliance with the License.  | 
9  |  |  * You may obtain a copy of the License at  | 
10  |  |  *  | 
11  |  |  *     http://www.apache.org/licenses/LICENSE-2.0  | 
12  |  |  *  | 
13  |  |  * Unless required by applicable law or agreed to in writing, software  | 
14  |  |  * distributed under the License is distributed on an "AS IS" BASIS,  | 
15  |  |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  | 
16  |  |  * See the License for the specific language governing permissions and  | 
17  |  |  * limitations under the License.  | 
18  |  |  */  | 
19  |  |  | 
20  |  | #include <winpr/config.h>  | 
21  |  |  | 
22  |  | #include <winpr/crt.h>  | 
23  |  |  | 
24  |  | /* Buffer Manipulation: http://msdn.microsoft.com/en-us/library/b3893xdy/ */  | 
25  |  |  | 
26  |  | #ifndef _WIN32  | 
27  |  |  | 
28  |  | #include <string.h>  | 
29  |  |  | 
30  |  | errno_t memmove_s(void* dest, size_t numberOfElements, const void* src, size_t count)  | 
31  | 0  | { | 
32  | 0  |   if (count > numberOfElements)  | 
33  | 0  |     return -1;  | 
34  |  |  | 
35  | 0  |   memmove(dest, src, count);  | 
36  |  | 
  | 
37  | 0  |   return 0;  | 
38  | 0  | }  | 
39  |  |  | 
40  |  | errno_t wmemmove_s(WCHAR* dest, size_t numberOfElements, const WCHAR* src, size_t count)  | 
41  | 0  | { | 
42  | 0  |   if (count * 2 > numberOfElements)  | 
43  | 0  |     return -1;  | 
44  |  |  | 
45  | 0  |   memmove(dest, src, count * 2);  | 
46  |  | 
  | 
47  | 0  |   return 0;  | 
48  | 0  | }  | 
49  |  |  | 
50  |  | #endif  |