]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/LibC/Wchar/Concatenation.c
ShellPkg/for: Fix potential null pointer deference
[mirror_edk2.git] / StdLib / LibC / Wchar / Concatenation.c
CommitLineData
2aa62f2b 1/** @file\r
2 Concatenation Functions for <wchar.h>.\r
3\r
4 Unless explicitly stated otherwise, if the execution of a function declared\r
5 in this file causes copying to take place between objects that overlap, the\r
6 behavior is undefined.\r
7\r
8 Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
9 This program and the accompanying materials are licensed and made available under\r
10 the terms and conditions of the BSD License that accompanies this distribution.\r
11 The full text of the license may be found at\r
12 http://opensource.org/licenses/bsd-license.php.\r
13\r
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
16**/\r
17#include <Uefi.h>\r
18#include <Library/BaseLib.h>\r
19#include <Library/BaseMemoryLib.h>\r
20\r
21#include <LibConfig.h>\r
22\r
23#include <wchar.h>\r
24\r
25/** The wcscat function appends a copy of the wide string pointed to by s2\r
26 (including the terminating null wide character) to the end of the wide\r
27 string pointed to by s1. The initial wide character of s2 overwrites the\r
28 null wide character at the end of s1.\r
29\r
30 @return The wcscat function returns the value of s1.\r
31**/\r
32wchar_t *wcscat(wchar_t * __restrict s1, const wchar_t * __restrict s2)\r
33{\r
34 return (wchar_t *)StrCat( (CHAR16 *)s1, (CONST CHAR16 *)s2);\r
35}\r
36\r
37/** The wcsncat function appends not more than n wide characters (a null wide\r
38 character and those that follow it are not appended) from the array pointed\r
39 to by s2 to the end of the wide string pointed to by s1. The initial wide\r
40 character of s2 overwrites the null wide character at the end of s1.\r
41 A terminating null wide character is always appended to the result.\r
42\r
43 @return The wcsncat function returns the value of s1.\r
44**/\r
45wchar_t *wcsncat(wchar_t * __restrict s1, const wchar_t * __restrict s2, size_t n)\r
46{\r
47 return (wchar_t *)StrnCat( (CHAR16 *)s1, (CONST CHAR16 *)s2, (UINTN)n);\r
48}\r