• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) Huawei Technologies Co., Ltd. 2014-2020. All rights reserved.
3  * Licensed under Mulan PSL v2.
4  * You can use this software according to the terms and conditions of the Mulan PSL v2.
5  * You may obtain a copy of Mulan PSL v2 at:
6  *          http://license.coscl.org.cn/MulanPSL2
7  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8  * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9  * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10  * See the Mulan PSL v2 for more details.
11  * Description: Provides internal functions used by this library, such as memory
12  *              copy and memory move. Besides, include some helper function for
13  *              printf family API, such as SecVsnprintfImpl
14  * Author: lishunda
15  * Create: 2014-02-25
16  */
17 
18 /* Avoid duplicate header files,not include securecutil.h */
19 #include "securecutil.h"
20 
21 #if defined(ANDROID) && (SECUREC_HAVE_WCTOMB || SECUREC_HAVE_MBTOWC)
22 #include <wchar.h>
23 #if SECUREC_HAVE_WCTOMB
24 /*
25  * Convert wide characters to narrow multi-bytes
26  */
wctomb(char * s,wchar_t wc)27 int wctomb(char *s, wchar_t wc)
28 {
29     return wcrtomb(s, wc, NULL);
30 }
31 #endif
32 
33 #if SECUREC_HAVE_MBTOWC
34 /*
35  * Converting narrow multi-byte characters to wide characters
36  */
mbtowc(wchar_t * pwc,const char * s,size_t n)37 int mbtowc(wchar_t *pwc, const char *s, size_t n)
38 {
39     return mbrtowc(pwc, s, n, NULL);
40 }
41 #endif
42 #endif
43 
44