1 /** @file
2     Miscelaneous Functions for <wchar.h>.
3 
4   Unless explicitly stated otherwise, if the execution of a function declared
5   in this file causes copying to take place between objects that overlap, the
6   behavior is undefined.
7 
8   Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
9   This program and the accompanying materials are licensed and made available under
10   the terms and conditions of the BSD License that accompanies this distribution.
11   The full text of the license may be found at
12   http://opensource.org/licenses/bsd-license.php.
13 
14   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 **/
17 #include  <Uefi.h>
18 #include  <Library/BaseLib.h>
19 #include  <Library/BaseMemoryLib.h>
20 
21 #include  <LibConfig.h>
22 
23 #include  <wchar.h>
24 
25 /** The wcslen function computes the length of the wide string pointed to by s.
26 
27     @return   The wcslen function returns the number of wide characters that
28               precede the terminating null wide character.
29 **/
wcslen(const wchar_t * s)30 size_t wcslen(const wchar_t *s)
31 {
32   return (size_t)StrLen( (CONST CHAR16 *)s);
33 }
34 
35 /** The wmemset function copies the value of c into each of the first n wide
36     characters of the object pointed to by s.
37 
38     @return   The wmemset function returns the value of s.
39 **/
wmemset(wchar_t * s,wchar_t c,size_t n)40 wchar_t *wmemset(wchar_t *s, wchar_t c, size_t n)
41 {
42   return (wchar_t *)SetMem16( s, (UINTN)(n * sizeof(wchar_t)), (UINT16)c);
43 }
44