13d58139fSopenharmony_ci/*
23d58139fSopenharmony_ci * Copyright (c) Huawei Technologies Co., Ltd. 2014-2021. All rights reserved.
33d58139fSopenharmony_ci * Licensed under Mulan PSL v2.
43d58139fSopenharmony_ci * You can use this software according to the terms and conditions of the Mulan PSL v2.
53d58139fSopenharmony_ci * You may obtain a copy of Mulan PSL v2 at:
63d58139fSopenharmony_ci *          http://license.coscl.org.cn/MulanPSL2
73d58139fSopenharmony_ci * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
83d58139fSopenharmony_ci * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
93d58139fSopenharmony_ci * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
103d58139fSopenharmony_ci * See the Mulan PSL v2 for more details.
113d58139fSopenharmony_ci * Description: The user of this secure c library should include this header file in you source code.
123d58139fSopenharmony_ci *              This header file declare all supported API prototype of the library,
133d58139fSopenharmony_ci *              such as memcpy_s, strcpy_s, wcscpy_s,strcat_s, strncat_s, sprintf_s, scanf_s, and so on.
143d58139fSopenharmony_ci * Create: 2014-02-25
153d58139fSopenharmony_ci * Notes: Do not modify this file by yourself.
163d58139fSopenharmony_ci */
173d58139fSopenharmony_ci
183d58139fSopenharmony_ci#ifndef SECUREC_H_5D13A042_DC3F_4ED9_A8D1_882811274C27
193d58139fSopenharmony_ci#define SECUREC_H_5D13A042_DC3F_4ED9_A8D1_882811274C27
203d58139fSopenharmony_ci
213d58139fSopenharmony_ci#include "securectype.h"
223d58139fSopenharmony_ci#ifndef SECUREC_HAVE_STDARG_H
233d58139fSopenharmony_ci#define SECUREC_HAVE_STDARG_H 1
243d58139fSopenharmony_ci#endif
253d58139fSopenharmony_ci
263d58139fSopenharmony_ci#if SECUREC_HAVE_STDARG_H
273d58139fSopenharmony_ci#include <stdarg.h>
283d58139fSopenharmony_ci#endif
293d58139fSopenharmony_ci
303d58139fSopenharmony_ci#ifndef SECUREC_HAVE_ERRNO_H
313d58139fSopenharmony_ci#define SECUREC_HAVE_ERRNO_H 1
323d58139fSopenharmony_ci#endif
333d58139fSopenharmony_ci
343d58139fSopenharmony_ci/* EINVAL ERANGE may defined in errno.h */
353d58139fSopenharmony_ci#if SECUREC_HAVE_ERRNO_H
363d58139fSopenharmony_ci#if SECUREC_IN_KERNEL
373d58139fSopenharmony_ci#include <linux/errno.h>
383d58139fSopenharmony_ci#else
393d58139fSopenharmony_ci#include <errno.h>
403d58139fSopenharmony_ci#endif
413d58139fSopenharmony_ci#endif
423d58139fSopenharmony_ci
433d58139fSopenharmony_ci/* Define error code */
443d58139fSopenharmony_ci#if defined(SECUREC_NEED_ERRNO_TYPE) || !defined(__STDC_WANT_LIB_EXT1__) || \
453d58139fSopenharmony_ci    (defined(__STDC_WANT_LIB_EXT1__) && (!__STDC_WANT_LIB_EXT1__))
463d58139fSopenharmony_ci#ifndef SECUREC_DEFINED_ERRNO_TYPE
473d58139fSopenharmony_ci#define SECUREC_DEFINED_ERRNO_TYPE
483d58139fSopenharmony_ci/* Just check whether macrodefinition exists. */
493d58139fSopenharmony_ci#ifndef errno_t
503d58139fSopenharmony_citypedef int errno_t;
513d58139fSopenharmony_ci#endif
523d58139fSopenharmony_ci#endif
533d58139fSopenharmony_ci#endif
543d58139fSopenharmony_ci
553d58139fSopenharmony_ci/* Success */
563d58139fSopenharmony_ci#ifndef EOK
573d58139fSopenharmony_ci#define EOK 0
583d58139fSopenharmony_ci#endif
593d58139fSopenharmony_ci
603d58139fSopenharmony_ci#ifndef EINVAL
613d58139fSopenharmony_ci/* The src buffer is not correct and destination buffer can not be reset */
623d58139fSopenharmony_ci#define EINVAL 22
633d58139fSopenharmony_ci#endif
643d58139fSopenharmony_ci
653d58139fSopenharmony_ci#ifndef EINVAL_AND_RESET
663d58139fSopenharmony_ci/* Once the error is detected, the dest buffer must be reset! Value is 22 or 128 */
673d58139fSopenharmony_ci#define EINVAL_AND_RESET 150
683d58139fSopenharmony_ci#endif
693d58139fSopenharmony_ci
703d58139fSopenharmony_ci#ifndef ERANGE
713d58139fSopenharmony_ci/* The destination buffer is not long enough and destination buffer can not be reset */
723d58139fSopenharmony_ci#define ERANGE 34
733d58139fSopenharmony_ci#endif
743d58139fSopenharmony_ci
753d58139fSopenharmony_ci#ifndef ERANGE_AND_RESET
763d58139fSopenharmony_ci/* Once the error is detected, the dest buffer must be reset! Value is 34 or 128 */
773d58139fSopenharmony_ci#define ERANGE_AND_RESET  162
783d58139fSopenharmony_ci#endif
793d58139fSopenharmony_ci
803d58139fSopenharmony_ci#ifndef EOVERLAP_AND_RESET
813d58139fSopenharmony_ci/* Once the buffer overlap is detected, the dest buffer must be reset! Value is 54 or 128 */
823d58139fSopenharmony_ci#define EOVERLAP_AND_RESET 182
833d58139fSopenharmony_ci#endif
843d58139fSopenharmony_ci
853d58139fSopenharmony_ci/* If you need export the function of this library in Win32 dll, use __declspec(dllexport) */
863d58139fSopenharmony_ci#ifndef SECUREC_API
873d58139fSopenharmony_ci#if defined(SECUREC_DLL_EXPORT)
883d58139fSopenharmony_ci#if defined(_MSC_VER)
893d58139fSopenharmony_ci#define SECUREC_API __declspec(dllexport)
903d58139fSopenharmony_ci#else /* build for linux */
913d58139fSopenharmony_ci#define SECUREC_API __attribute__((visibility("default")))
923d58139fSopenharmony_ci#endif /* end of _MSC_VER and SECUREC_DLL_EXPORT */
933d58139fSopenharmony_ci#elif defined(SECUREC_DLL_IMPORT)
943d58139fSopenharmony_ci#if defined(_MSC_VER)
953d58139fSopenharmony_ci#define SECUREC_API __declspec(dllimport)
963d58139fSopenharmony_ci#else
973d58139fSopenharmony_ci#define SECUREC_API
983d58139fSopenharmony_ci#endif /* end of _MSC_VER and SECUREC_DLL_IMPORT */
993d58139fSopenharmony_ci#else
1003d58139fSopenharmony_ci/*
1013d58139fSopenharmony_ci * Standardized function declaration. If a security function is declared in the your code,
1023d58139fSopenharmony_ci * it may cause a compilation alarm,Please delete the security function you declared.
1033d58139fSopenharmony_ci * Adding extern under windows will cause the system to have inline functions to expand,
1043d58139fSopenharmony_ci * so do not add the extern in default
1053d58139fSopenharmony_ci */
1063d58139fSopenharmony_ci#if defined(_MSC_VER)
1073d58139fSopenharmony_ci#define SECUREC_API
1083d58139fSopenharmony_ci#else
1093d58139fSopenharmony_ci#define SECUREC_API extern
1103d58139fSopenharmony_ci#endif
1113d58139fSopenharmony_ci#endif
1123d58139fSopenharmony_ci#endif
1133d58139fSopenharmony_ci
1143d58139fSopenharmony_ci#ifdef __cplusplus
1153d58139fSopenharmony_ciextern "C" {
1163d58139fSopenharmony_ci#endif
1173d58139fSopenharmony_ci/*
1183d58139fSopenharmony_ci * Description: The GetHwSecureCVersion function get SecureC Version string and version number.
1193d58139fSopenharmony_ci * Parameter: verNumber - to store version number (for example value is 0x500 | 0xa)
1203d58139fSopenharmony_ci * Return:   version string
1213d58139fSopenharmony_ci */
1223d58139fSopenharmony_ciSECUREC_API const char *GetHwSecureCVersion(unsigned short *verNumber);
1233d58139fSopenharmony_ci
1243d58139fSopenharmony_ci#if SECUREC_ENABLE_MEMSET
1253d58139fSopenharmony_ci/*
1263d58139fSopenharmony_ci * Description: The memset_s function copies the value of c (converted to an unsigned char) into each of
1273d58139fSopenharmony_ci * the first count characters of the object pointed to by dest.
1283d58139fSopenharmony_ci * Parameter: dest - destination address
1293d58139fSopenharmony_ci * Parameter: destMax - The maximum length of destination buffer
1303d58139fSopenharmony_ci * Parameter: c - the value to be copied
1313d58139fSopenharmony_ci * Parameter: count - copies count bytes of value to dest
1323d58139fSopenharmony_ci * Return:    EOK if there was no runtime-constraint violation
1333d58139fSopenharmony_ci */
1343d58139fSopenharmony_ciSECUREC_API errno_t memset_s(void *dest, size_t destMax, int c, size_t count);
1353d58139fSopenharmony_ci#endif
1363d58139fSopenharmony_ci
1373d58139fSopenharmony_ci#ifndef SECUREC_ONLY_DECLARE_MEMSET
1383d58139fSopenharmony_ci#define SECUREC_ONLY_DECLARE_MEMSET     0
1393d58139fSopenharmony_ci#endif
1403d58139fSopenharmony_ci
1413d58139fSopenharmony_ci#if !SECUREC_ONLY_DECLARE_MEMSET
1423d58139fSopenharmony_ci
1433d58139fSopenharmony_ci#if SECUREC_ENABLE_MEMMOVE
1443d58139fSopenharmony_ci/*
1453d58139fSopenharmony_ci * Description: The memmove_s function copies n characters from the object pointed to by src
1463d58139fSopenharmony_ci * into the object pointed to by dest.
1473d58139fSopenharmony_ci * Parameter: dest - destination  address
1483d58139fSopenharmony_ci * Parameter: destMax - The maximum length of destination buffer
1493d58139fSopenharmony_ci * Parameter: src - source address
1503d58139fSopenharmony_ci * Parameter: count - copies count bytes from the src
1513d58139fSopenharmony_ci * Return:    EOK if there was no runtime-constraint violation
1523d58139fSopenharmony_ci */
1533d58139fSopenharmony_ciSECUREC_API errno_t memmove_s(void *dest, size_t destMax, const void *src, size_t count);
1543d58139fSopenharmony_ci#endif
1553d58139fSopenharmony_ci
1563d58139fSopenharmony_ci#if SECUREC_ENABLE_MEMCPY
1573d58139fSopenharmony_ci/*
1583d58139fSopenharmony_ci * Description: The memcpy_s function copies n characters from the object pointed to
1593d58139fSopenharmony_ci * by src into the object pointed to by dest.
1603d58139fSopenharmony_ci * Parameter: dest - destination  address
1613d58139fSopenharmony_ci * Parameter: destMax - The maximum length of destination buffer
1623d58139fSopenharmony_ci * Parameter: src - source address
1633d58139fSopenharmony_ci * Parameter: count - copies count bytes from the  src
1643d58139fSopenharmony_ci * Return:    EOK if there was no runtime-constraint violation
1653d58139fSopenharmony_ci */
1663d58139fSopenharmony_ciSECUREC_API errno_t memcpy_s(void *dest, size_t destMax, const void *src, size_t count);
1673d58139fSopenharmony_ci#endif
1683d58139fSopenharmony_ci
1693d58139fSopenharmony_ci#if SECUREC_ENABLE_STRCPY
1703d58139fSopenharmony_ci/*
1713d58139fSopenharmony_ci * Description: The strcpy_s function copies the string pointed to by strSrc (including
1723d58139fSopenharmony_ci * the terminating null character) into the array pointed to by strDest
1733d58139fSopenharmony_ci * Parameter: strDest - destination  address
1743d58139fSopenharmony_ci * Parameter: destMax - The maximum length of destination buffer(including the terminating null character)
1753d58139fSopenharmony_ci * Parameter: strSrc - source address
1763d58139fSopenharmony_ci * Return:    EOK if there was no runtime-constraint violation
1773d58139fSopenharmony_ci */
1783d58139fSopenharmony_ciSECUREC_API errno_t strcpy_s(char *strDest, size_t destMax, const char *strSrc);
1793d58139fSopenharmony_ci#endif
1803d58139fSopenharmony_ci
1813d58139fSopenharmony_ci#if SECUREC_ENABLE_STRNCPY
1823d58139fSopenharmony_ci/*
1833d58139fSopenharmony_ci * Description: The strncpy_s function copies not more than n successive characters (not including
1843d58139fSopenharmony_ci * the terminating null character) from the array pointed to by strSrc to the array pointed to by strDest.
1853d58139fSopenharmony_ci * Parameter: strDest - destination  address
1863d58139fSopenharmony_ci * Parameter: destMax - The maximum length of destination buffer(including the terminating null character)
1873d58139fSopenharmony_ci * Parameter: strSrc - source  address
1883d58139fSopenharmony_ci * Parameter: count - copies count characters from the src
1893d58139fSopenharmony_ci * Return:    EOK if there was no runtime-constraint violation
1903d58139fSopenharmony_ci */
1913d58139fSopenharmony_ciSECUREC_API errno_t strncpy_s(char *strDest, size_t destMax, const char *strSrc, size_t count);
1923d58139fSopenharmony_ci#endif
1933d58139fSopenharmony_ci
1943d58139fSopenharmony_ci#if SECUREC_ENABLE_STRCAT
1953d58139fSopenharmony_ci/*
1963d58139fSopenharmony_ci * Description: The strcat_s function appends a copy of the string pointed to by strSrc (including
1973d58139fSopenharmony_ci * the terminating null character) to the end of the string pointed to by strDest.
1983d58139fSopenharmony_ci * Parameter: strDest - destination  address
1993d58139fSopenharmony_ci * Parameter: destMax - The maximum length of destination buffer(including the terminating null wide character)
2003d58139fSopenharmony_ci * Parameter: strSrc - source address
2013d58139fSopenharmony_ci * Return:    EOK if there was no runtime-constraint violation
2023d58139fSopenharmony_ci */
2033d58139fSopenharmony_ciSECUREC_API errno_t strcat_s(char *strDest, size_t destMax, const char *strSrc);
2043d58139fSopenharmony_ci#endif
2053d58139fSopenharmony_ci
2063d58139fSopenharmony_ci#if SECUREC_ENABLE_STRNCAT
2073d58139fSopenharmony_ci/*
2083d58139fSopenharmony_ci * Description: The strncat_s function appends not more than n successive characters (not including
2093d58139fSopenharmony_ci * the terminating null character)
2103d58139fSopenharmony_ci * from the array pointed to by strSrc to the end of the string pointed to by strDest.
2113d58139fSopenharmony_ci * Parameter: strDest - destination address
2123d58139fSopenharmony_ci * Parameter: destMax - The maximum length of destination buffer(including the terminating null character)
2133d58139fSopenharmony_ci * Parameter: strSrc - source address
2143d58139fSopenharmony_ci * Parameter: count - copies count characters from the src
2153d58139fSopenharmony_ci * Return:    EOK if there was no runtime-constraint violation
2163d58139fSopenharmony_ci */
2173d58139fSopenharmony_ciSECUREC_API errno_t strncat_s(char *strDest, size_t destMax, const char *strSrc, size_t count);
2183d58139fSopenharmony_ci#endif
2193d58139fSopenharmony_ci
2203d58139fSopenharmony_ci#if SECUREC_ENABLE_VSPRINTF
2213d58139fSopenharmony_ci/*
2223d58139fSopenharmony_ci * Description: The vsprintf_s function is equivalent to the vsprintf function except for the parameter destMax
2233d58139fSopenharmony_ci * and the explicit runtime-constraints violation
2243d58139fSopenharmony_ci * Parameter: strDest -  produce output according to a format,write to the character string strDest.
2253d58139fSopenharmony_ci * Parameter: destMax - The maximum length of destination buffer(including the terminating null wide character)
2263d58139fSopenharmony_ci * Parameter: format - format string
2273d58139fSopenharmony_ci * Parameter: argList - instead of a variable number of arguments
2283d58139fSopenharmony_ci * Return:    the number of characters printed(not including the terminating null byte '\0'),
2293d58139fSopenharmony_ci * If an error occurred Return: -1.
2303d58139fSopenharmony_ci */
2313d58139fSopenharmony_ciSECUREC_API int vsprintf_s(char *strDest, size_t destMax, const char *format,
2323d58139fSopenharmony_ci                           va_list argList) SECUREC_ATTRIBUTE(3, 0);
2333d58139fSopenharmony_ci#endif
2343d58139fSopenharmony_ci
2353d58139fSopenharmony_ci#if SECUREC_ENABLE_SPRINTF
2363d58139fSopenharmony_ci/*
2373d58139fSopenharmony_ci * Description: The sprintf_s function is equivalent to the sprintf function except for the parameter destMax
2383d58139fSopenharmony_ci * and the explicit runtime-constraints violation
2393d58139fSopenharmony_ci * Parameter: strDest -  produce output according to a format ,write to the character string strDest.
2403d58139fSopenharmony_ci * Parameter: destMax - The maximum length of destination buffer(including the terminating null byte '\0')
2413d58139fSopenharmony_ci * Parameter: format - format string
2423d58139fSopenharmony_ci * Return:    the number of characters printed(not including the terminating null byte '\0'),
2433d58139fSopenharmony_ci * If an error occurred Return: -1.
2443d58139fSopenharmony_ci*/
2453d58139fSopenharmony_ciSECUREC_API int sprintf_s(char *strDest, size_t destMax, const char *format, ...) SECUREC_ATTRIBUTE(3, 4);
2463d58139fSopenharmony_ci#endif
2473d58139fSopenharmony_ci
2483d58139fSopenharmony_ci#if SECUREC_ENABLE_VSNPRINTF
2493d58139fSopenharmony_ci/*
2503d58139fSopenharmony_ci * Description: The vsnprintf_s function is equivalent to the vsnprintf function except for
2513d58139fSopenharmony_ci * the parameter destMax/count and the explicit runtime-constraints violation
2523d58139fSopenharmony_ci * Parameter: strDest -  produce output according to a format ,write to the character string strDest.
2533d58139fSopenharmony_ci * Parameter: destMax - The maximum length of destination buffer(including the terminating null  byte '\0')
2543d58139fSopenharmony_ci * Parameter: count - do not write more than count bytes to strDest(not including the terminating null  byte '\0')
2553d58139fSopenharmony_ci * Parameter: format - format string
2563d58139fSopenharmony_ci * Parameter: argList - instead of  a variable number of arguments
2573d58139fSopenharmony_ci * Return:    the number of characters printed(not including the terminating null byte '\0'),
2583d58139fSopenharmony_ci * If an error occurred Return: -1.Pay special attention to returning -1 when truncation occurs.
2593d58139fSopenharmony_ci */
2603d58139fSopenharmony_ciSECUREC_API int vsnprintf_s(char *strDest, size_t destMax, size_t count, const char *format,
2613d58139fSopenharmony_ci                            va_list argList) SECUREC_ATTRIBUTE(4, 0);
2623d58139fSopenharmony_ci#endif
2633d58139fSopenharmony_ci
2643d58139fSopenharmony_ci#if SECUREC_ENABLE_SNPRINTF
2653d58139fSopenharmony_ci/*
2663d58139fSopenharmony_ci * Description: The snprintf_s function is equivalent to the snprintf function except for
2673d58139fSopenharmony_ci * the parameter destMax/count and the explicit runtime-constraints violation
2683d58139fSopenharmony_ci * Parameter: strDest - produce output according to a format ,write to the character string strDest.
2693d58139fSopenharmony_ci * Parameter: destMax - The maximum length of destination buffer(including the terminating null  byte '\0')
2703d58139fSopenharmony_ci * Parameter: count - do not write more than count bytes to strDest(not including the terminating null  byte '\0')
2713d58139fSopenharmony_ci * Parameter: format - format string
2723d58139fSopenharmony_ci * Return:    the number of characters printed(not including the terminating null byte '\0'),
2733d58139fSopenharmony_ci * If an error occurred Return: -1.Pay special attention to returning -1 when truncation occurs.
2743d58139fSopenharmony_ci */
2753d58139fSopenharmony_ciSECUREC_API int snprintf_s(char *strDest, size_t destMax, size_t count, const char *format,
2763d58139fSopenharmony_ci                           ...) SECUREC_ATTRIBUTE(4, 5);
2773d58139fSopenharmony_ci#endif
2783d58139fSopenharmony_ci
2793d58139fSopenharmony_ci#if SECUREC_SNPRINTF_TRUNCATED
2803d58139fSopenharmony_ci/*
2813d58139fSopenharmony_ci * Description: The vsnprintf_truncated_s function is equivalent to the vsnprintf_s function except
2823d58139fSopenharmony_ci * no count parameter and return value
2833d58139fSopenharmony_ci * Parameter: strDest -  produce output according to a format ,write to the character string strDest
2843d58139fSopenharmony_ci * Parameter: destMax - The maximum length of destination buffer(including the terminating null  byte '\0')
2853d58139fSopenharmony_ci * Parameter: format - format string
2863d58139fSopenharmony_ci * Parameter: argList - instead of  a variable  number of arguments
2873d58139fSopenharmony_ci * Return:    the number of characters printed(not including the terminating null byte '\0'),
2883d58139fSopenharmony_ci * If an error occurred Return: -1.Pay special attention to returning destMax - 1 when truncation occurs
2893d58139fSopenharmony_ci*/
2903d58139fSopenharmony_ciSECUREC_API int vsnprintf_truncated_s(char *strDest, size_t destMax, const char *format,
2913d58139fSopenharmony_ci                                      va_list argList) SECUREC_ATTRIBUTE(3, 0);
2923d58139fSopenharmony_ci
2933d58139fSopenharmony_ci/*
2943d58139fSopenharmony_ci * Description: The snprintf_truncated_s function is equivalent to the snprintf_s function except
2953d58139fSopenharmony_ci * no count parameter and return value
2963d58139fSopenharmony_ci * Parameter: strDest - produce output according to a format,write to the character string strDest.
2973d58139fSopenharmony_ci * Parameter: destMax - The maximum length of destination buffer(including the terminating null byte '\0')
2983d58139fSopenharmony_ci * Parameter: format - format string
2993d58139fSopenharmony_ci * Return:    the number of characters printed(not including the terminating null byte '\0'),
3003d58139fSopenharmony_ci * If an error occurred Return: -1.Pay special attention to returning destMax - 1 when truncation occurs.
3013d58139fSopenharmony_ci */
3023d58139fSopenharmony_ciSECUREC_API int snprintf_truncated_s(char *strDest, size_t destMax,
3033d58139fSopenharmony_ci                                     const char *format, ...) SECUREC_ATTRIBUTE(3, 4);
3043d58139fSopenharmony_ci#endif
3053d58139fSopenharmony_ci
3063d58139fSopenharmony_ci#if SECUREC_ENABLE_SCANF
3073d58139fSopenharmony_ci/*
3083d58139fSopenharmony_ci * Description: The scanf_s function is equivalent to fscanf_s with the argument stdin
3093d58139fSopenharmony_ci * interposed before the arguments to scanf_s
3103d58139fSopenharmony_ci * Parameter: format - format string
3113d58139fSopenharmony_ci * Return:    the number of input items assigned, If an error occurred Return: -1.
3123d58139fSopenharmony_ci */
3133d58139fSopenharmony_ciSECUREC_API int scanf_s(const char *format, ...);
3143d58139fSopenharmony_ci#endif
3153d58139fSopenharmony_ci
3163d58139fSopenharmony_ci#if SECUREC_ENABLE_VSCANF
3173d58139fSopenharmony_ci/*
3183d58139fSopenharmony_ci * Description: The vscanf_s function is equivalent to scanf_s, with the variable argument list replaced by argList
3193d58139fSopenharmony_ci * Parameter: format - format string
3203d58139fSopenharmony_ci * Parameter: argList - instead of a variable number of arguments
3213d58139fSopenharmony_ci * Return:    the number of input items assigned, If an error occurred Return: -1.
3223d58139fSopenharmony_ci */
3233d58139fSopenharmony_ciSECUREC_API int vscanf_s(const char *format, va_list argList);
3243d58139fSopenharmony_ci#endif
3253d58139fSopenharmony_ci
3263d58139fSopenharmony_ci#if SECUREC_ENABLE_SSCANF
3273d58139fSopenharmony_ci/*
3283d58139fSopenharmony_ci * Description: The sscanf_s function is equivalent to fscanf_s, except that input is obtained from a
3293d58139fSopenharmony_ci * string (specified by the argument buffer) rather than from a stream
3303d58139fSopenharmony_ci * Parameter: buffer - read character from buffer
3313d58139fSopenharmony_ci * Parameter: format - format string
3323d58139fSopenharmony_ci * Return:    the number of input items assigned, If an error occurred Return: -1.
3333d58139fSopenharmony_ci */
3343d58139fSopenharmony_ciSECUREC_API int sscanf_s(const char *buffer, const char *format, ...);
3353d58139fSopenharmony_ci#endif
3363d58139fSopenharmony_ci
3373d58139fSopenharmony_ci#if SECUREC_ENABLE_VSSCANF
3383d58139fSopenharmony_ci/*
3393d58139fSopenharmony_ci * Description: The vsscanf_s function is equivalent to sscanf_s, with the variable argument list
3403d58139fSopenharmony_ci * replaced by argList
3413d58139fSopenharmony_ci * Parameter: buffer -  read character from buffer
3423d58139fSopenharmony_ci * Parameter: format - format string
3433d58139fSopenharmony_ci * Parameter: argList - instead of a variable number of arguments
3443d58139fSopenharmony_ci * Return:    the number of input items assigned, If an error occurred Return: -1.
3453d58139fSopenharmony_ci */
3463d58139fSopenharmony_ciSECUREC_API int vsscanf_s(const char *buffer, const char *format, va_list argList);
3473d58139fSopenharmony_ci#endif
3483d58139fSopenharmony_ci
3493d58139fSopenharmony_ci#if SECUREC_ENABLE_FSCANF
3503d58139fSopenharmony_ci/*
3513d58139fSopenharmony_ci * Description: The fscanf_s function is equivalent to fscanf except that the c, s, and [ conversion specifiers
3523d58139fSopenharmony_ci * apply to a pair of arguments (unless assignment suppression is indicated by a *)
3533d58139fSopenharmony_ci * Parameter: stream - stdio file stream
3543d58139fSopenharmony_ci * Parameter: format - format string
3553d58139fSopenharmony_ci * Return:    the number of input items assigned, If an error occurred Return: -1.
3563d58139fSopenharmony_ci */
3573d58139fSopenharmony_ciSECUREC_API int fscanf_s(FILE *stream, const char *format, ...);
3583d58139fSopenharmony_ci#endif
3593d58139fSopenharmony_ci
3603d58139fSopenharmony_ci#if SECUREC_ENABLE_VFSCANF
3613d58139fSopenharmony_ci/*
3623d58139fSopenharmony_ci * Description: The vfscanf_s function is equivalent to fscanf_s, with the variable argument list
3633d58139fSopenharmony_ci * replaced by argList
3643d58139fSopenharmony_ci * Parameter: stream - stdio file stream
3653d58139fSopenharmony_ci * Parameter: format - format string
3663d58139fSopenharmony_ci * Parameter: argList - instead of a variable number of arguments
3673d58139fSopenharmony_ci * Return:    the number of input items assigned, If an error occurred Return: -1.
3683d58139fSopenharmony_ci */
3693d58139fSopenharmony_ciSECUREC_API int vfscanf_s(FILE *stream, const char *format, va_list argList);
3703d58139fSopenharmony_ci#endif
3713d58139fSopenharmony_ci
3723d58139fSopenharmony_ci#if SECUREC_ENABLE_STRTOK
3733d58139fSopenharmony_ci/*
3743d58139fSopenharmony_ci * Description: The strtok_s function parses a string into a sequence of strToken,
3753d58139fSopenharmony_ci * replace all characters in strToken string that match to strDelimit set with 0.
3763d58139fSopenharmony_ci * On the first call to strtok_s the string to be parsed should be specified in strToken.
3773d58139fSopenharmony_ci * In each subsequent call that should parse the same string, strToken should be NULL
3783d58139fSopenharmony_ci * Parameter: strToken - the string to be delimited
3793d58139fSopenharmony_ci * Parameter: strDelimit - specifies a set of characters that delimit the tokens in the parsed string
3803d58139fSopenharmony_ci * Parameter: context - is a pointer to a char * variable that is used internally by strtok_s function
3813d58139fSopenharmony_ci * Return:  On the first call returns the address of the first non \0 character, otherwise NULL is returned.
3823d58139fSopenharmony_ci * In subsequent calls, the strtoken is set to NULL, and the context set is the same as the previous call,
3833d58139fSopenharmony_ci * return NULL if the *context string length is equal 0, otherwise return *context.
3843d58139fSopenharmony_ci */
3853d58139fSopenharmony_ciSECUREC_API char *strtok_s(char *strToken, const char *strDelimit, char **context);
3863d58139fSopenharmony_ci#endif
3873d58139fSopenharmony_ci
3883d58139fSopenharmony_ci#if SECUREC_ENABLE_GETS && !SECUREC_IN_KERNEL
3893d58139fSopenharmony_ci/*
3903d58139fSopenharmony_ci * Description: The gets_s function reads at most one less than the number of characters specified
3913d58139fSopenharmony_ci * by destMax from the stream pointed to by stdin, into the array pointed to by buffer
3923d58139fSopenharmony_ci * Parameter: buffer - destination address
3933d58139fSopenharmony_ci * Parameter: destMax - The maximum length of destination buffer(including the terminating null character)
3943d58139fSopenharmony_ci * Return:    buffer if there was no runtime-constraint violation,If an error occurred Return: NULL.
3953d58139fSopenharmony_ci */
3963d58139fSopenharmony_ciSECUREC_API char *gets_s(char *buffer, size_t destMax);
3973d58139fSopenharmony_ci#endif
3983d58139fSopenharmony_ci
3993d58139fSopenharmony_ci#if SECUREC_ENABLE_WCHAR_FUNC
4003d58139fSopenharmony_ci#if SECUREC_ENABLE_MEMCPY
4013d58139fSopenharmony_ci/*
4023d58139fSopenharmony_ci * Description: The wmemcpy_s function copies n successive wide characters from the object pointed to
4033d58139fSopenharmony_ci * by src into the object pointed to by dest.
4043d58139fSopenharmony_ci * Parameter: dest - destination  address
4053d58139fSopenharmony_ci * Parameter: destMax - The maximum length of destination buffer
4063d58139fSopenharmony_ci * Parameter: src - source address
4073d58139fSopenharmony_ci * Parameter: count - copies count wide characters from the  src
4083d58139fSopenharmony_ci * Return:    EOK if there was no runtime-constraint violation
4093d58139fSopenharmony_ci */
4103d58139fSopenharmony_ciSECUREC_API errno_t wmemcpy_s(wchar_t *dest, size_t destMax, const wchar_t *src, size_t count);
4113d58139fSopenharmony_ci#endif
4123d58139fSopenharmony_ci
4133d58139fSopenharmony_ci#if SECUREC_ENABLE_MEMMOVE
4143d58139fSopenharmony_ci/*
4153d58139fSopenharmony_ci * Description: The wmemmove_s function copies n successive wide characters from the object
4163d58139fSopenharmony_ci * pointed to by src into the object pointed to by dest.
4173d58139fSopenharmony_ci * Parameter: dest - destination  address
4183d58139fSopenharmony_ci * Parameter: destMax - The maximum length of destination buffer
4193d58139fSopenharmony_ci * Parameter: src - source address
4203d58139fSopenharmony_ci * Parameter: count - copies count wide characters from the  src
4213d58139fSopenharmony_ci * Return:    EOK if there was no runtime-constraint violation
4223d58139fSopenharmony_ci */
4233d58139fSopenharmony_ciSECUREC_API errno_t wmemmove_s(wchar_t *dest, size_t destMax, const wchar_t *src, size_t count);
4243d58139fSopenharmony_ci#endif
4253d58139fSopenharmony_ci
4263d58139fSopenharmony_ci#if SECUREC_ENABLE_STRCPY
4273d58139fSopenharmony_ci/*
4283d58139fSopenharmony_ci * Description: The wcscpy_s function copies the wide string pointed to by strSrc(including the terminating
4293d58139fSopenharmony_ci * null wide character) into the array pointed to by strDest
4303d58139fSopenharmony_ci * Parameter: strDest - destination address
4313d58139fSopenharmony_ci * Parameter: destMax - The maximum length of destination buffer
4323d58139fSopenharmony_ci * Parameter: strSrc - source address
4333d58139fSopenharmony_ci * Return:    EOK if there was no runtime-constraint violation
4343d58139fSopenharmony_ci */
4353d58139fSopenharmony_ciSECUREC_API errno_t wcscpy_s(wchar_t *strDest, size_t destMax, const wchar_t *strSrc);
4363d58139fSopenharmony_ci#endif
4373d58139fSopenharmony_ci
4383d58139fSopenharmony_ci#if SECUREC_ENABLE_STRNCPY
4393d58139fSopenharmony_ci/*
4403d58139fSopenharmony_ci * Description: The wcsncpy_s function copies not more than n successive wide characters (not including the
4413d58139fSopenharmony_ci * terminating null wide character) from the array pointed to by strSrc to the array pointed to by strDest
4423d58139fSopenharmony_ci * Parameter: strDest - destination address
4433d58139fSopenharmony_ci * Parameter: destMax - The maximum length of destination buffer(including the terminating wide character)
4443d58139fSopenharmony_ci * Parameter: strSrc - source address
4453d58139fSopenharmony_ci * Parameter: count - copies count wide characters from the src
4463d58139fSopenharmony_ci * Return:    EOK if there was no runtime-constraint violation
4473d58139fSopenharmony_ci */
4483d58139fSopenharmony_ciSECUREC_API errno_t wcsncpy_s(wchar_t *strDest, size_t destMax, const wchar_t *strSrc, size_t count);
4493d58139fSopenharmony_ci#endif
4503d58139fSopenharmony_ci
4513d58139fSopenharmony_ci#if SECUREC_ENABLE_STRCAT
4523d58139fSopenharmony_ci/*
4533d58139fSopenharmony_ci * Description: The wcscat_s function appends a copy of the wide string pointed to by strSrc (including the
4543d58139fSopenharmony_ci * terminating null wide character) to the end of the wide string pointed to by strDest
4553d58139fSopenharmony_ci * Parameter: strDest - destination  address
4563d58139fSopenharmony_ci * Parameter: destMax - The maximum length of destination buffer(including the terminating wide character)
4573d58139fSopenharmony_ci * Parameter: strSrc - source address
4583d58139fSopenharmony_ci * Return:    EOK if there was no runtime-constraint violation
4593d58139fSopenharmony_ci */
4603d58139fSopenharmony_ciSECUREC_API errno_t wcscat_s(wchar_t *strDest, size_t destMax, const wchar_t *strSrc);
4613d58139fSopenharmony_ci#endif
4623d58139fSopenharmony_ci
4633d58139fSopenharmony_ci#if SECUREC_ENABLE_STRNCAT
4643d58139fSopenharmony_ci/*
4653d58139fSopenharmony_ci * Description: The wcsncat_s function appends not more than n successive wide characters (not including the
4663d58139fSopenharmony_ci * terminating null wide character) from the array pointed to by strSrc to the end of the wide string pointed to
4673d58139fSopenharmony_ci * by strDest.
4683d58139fSopenharmony_ci * Parameter: strDest - destination  address
4693d58139fSopenharmony_ci * Parameter: destMax - The maximum length of destination buffer(including the terminating wide character)
4703d58139fSopenharmony_ci * Parameter: strSrc - source  address
4713d58139fSopenharmony_ci * Parameter: count - copies count wide characters from the  src
4723d58139fSopenharmony_ci * Return:    EOK if there was no runtime-constraint violation
4733d58139fSopenharmony_ci */
4743d58139fSopenharmony_ciSECUREC_API errno_t wcsncat_s(wchar_t *strDest, size_t destMax, const wchar_t *strSrc, size_t count);
4753d58139fSopenharmony_ci#endif
4763d58139fSopenharmony_ci
4773d58139fSopenharmony_ci#if SECUREC_ENABLE_STRTOK
4783d58139fSopenharmony_ci/*
4793d58139fSopenharmony_ci * Description: The wcstok_s function is the wide-character equivalent of the strtok_s function
4803d58139fSopenharmony_ci * Parameter: strToken - the string to be delimited
4813d58139fSopenharmony_ci * Parameter: strDelimit - specifies a set of characters that delimit the tokens in the parsed string
4823d58139fSopenharmony_ci * Parameter: context - is a pointer to a char * variable that is used internally by strtok_s function
4833d58139fSopenharmony_ci * Return:    a pointer to the first character of a token, or a null pointer if there is no token
4843d58139fSopenharmony_ci * or there is a runtime-constraint violation.
4853d58139fSopenharmony_ci */
4863d58139fSopenharmony_ciSECUREC_API wchar_t *wcstok_s(wchar_t *strToken, const wchar_t *strDelimit, wchar_t **context);
4873d58139fSopenharmony_ci#endif
4883d58139fSopenharmony_ci
4893d58139fSopenharmony_ci#if SECUREC_ENABLE_VSPRINTF
4903d58139fSopenharmony_ci/*
4913d58139fSopenharmony_ci * Description: The vswprintf_s function is the wide-character equivalent of the vsprintf_s function
4923d58139fSopenharmony_ci * Parameter: strDest - produce output according to a format,write to the character string strDest
4933d58139fSopenharmony_ci * Parameter: destMax - The maximum length of destination buffer(including the terminating null)
4943d58139fSopenharmony_ci * Parameter: format - format string
4953d58139fSopenharmony_ci * Parameter: argList - instead of a variable number of arguments
4963d58139fSopenharmony_ci * Return:    the number of characters printed(not including the terminating null wide character),
4973d58139fSopenharmony_ci * If an error occurred Return: -1.
4983d58139fSopenharmony_ci */
4993d58139fSopenharmony_ciSECUREC_API int vswprintf_s(wchar_t *strDest, size_t destMax, const wchar_t *format, va_list argList);
5003d58139fSopenharmony_ci#endif
5013d58139fSopenharmony_ci
5023d58139fSopenharmony_ci#if SECUREC_ENABLE_SPRINTF
5033d58139fSopenharmony_ci/*
5043d58139fSopenharmony_ci * Description: The swprintf_s function is the wide-character equivalent of the sprintf_s function
5053d58139fSopenharmony_ci * Parameter: strDest - produce output according to a format,write to the character string strDest
5063d58139fSopenharmony_ci * Parameter: destMax - The maximum length of destination buffer(including the terminating null)
5073d58139fSopenharmony_ci * Parameter: format - format string
5083d58139fSopenharmony_ci * Return:    the number of characters printed(not including the terminating null wide character),
5093d58139fSopenharmony_ci * If an error occurred Return: -1.
5103d58139fSopenharmony_ci */
5113d58139fSopenharmony_ciSECUREC_API int swprintf_s(wchar_t *strDest, size_t destMax, const wchar_t *format, ...);
5123d58139fSopenharmony_ci#endif
5133d58139fSopenharmony_ci
5143d58139fSopenharmony_ci#if SECUREC_ENABLE_FSCANF
5153d58139fSopenharmony_ci/*
5163d58139fSopenharmony_ci * Description: The fwscanf_s function is the wide-character equivalent of the fscanf_s function
5173d58139fSopenharmony_ci * Parameter: stream - stdio file stream
5183d58139fSopenharmony_ci * Parameter: format - format string
5193d58139fSopenharmony_ci * Return:    the number of input items assigned, If an error occurred Return: -1.
5203d58139fSopenharmony_ci */
5213d58139fSopenharmony_ciSECUREC_API int fwscanf_s(FILE *stream, const wchar_t *format, ...);
5223d58139fSopenharmony_ci#endif
5233d58139fSopenharmony_ci
5243d58139fSopenharmony_ci#if SECUREC_ENABLE_VFSCANF
5253d58139fSopenharmony_ci/*
5263d58139fSopenharmony_ci * Description: The vfwscanf_s function is the wide-character equivalent of the vfscanf_s function
5273d58139fSopenharmony_ci * Parameter: stream - stdio file stream
5283d58139fSopenharmony_ci * Parameter: format - format string
5293d58139fSopenharmony_ci * Parameter: argList - instead of  a variable number of arguments
5303d58139fSopenharmony_ci * Return:    the number of input items assigned, If an error occurred Return: -1.
5313d58139fSopenharmony_ci */
5323d58139fSopenharmony_ciSECUREC_API int vfwscanf_s(FILE *stream, const wchar_t *format, va_list argList);
5333d58139fSopenharmony_ci#endif
5343d58139fSopenharmony_ci
5353d58139fSopenharmony_ci#if SECUREC_ENABLE_SCANF
5363d58139fSopenharmony_ci/*
5373d58139fSopenharmony_ci * Description: The wscanf_s function is the wide-character equivalent of the scanf_s function
5383d58139fSopenharmony_ci * Parameter: format - format string
5393d58139fSopenharmony_ci * Return:    the number of input items assigned, If an error occurred Return: -1.
5403d58139fSopenharmony_ci */
5413d58139fSopenharmony_ciSECUREC_API int wscanf_s(const wchar_t *format, ...);
5423d58139fSopenharmony_ci#endif
5433d58139fSopenharmony_ci
5443d58139fSopenharmony_ci#if SECUREC_ENABLE_VSCANF
5453d58139fSopenharmony_ci/*
5463d58139fSopenharmony_ci * Description: The vwscanf_s function is the wide-character equivalent of the vscanf_s function
5473d58139fSopenharmony_ci * Parameter: format - format string
5483d58139fSopenharmony_ci * Parameter: argList - instead of  a variable number of arguments
5493d58139fSopenharmony_ci * Return:    the number of input items assigned, If an error occurred Return: -1.
5503d58139fSopenharmony_ci */
5513d58139fSopenharmony_ciSECUREC_API int vwscanf_s(const wchar_t *format, va_list argList);
5523d58139fSopenharmony_ci#endif
5533d58139fSopenharmony_ci
5543d58139fSopenharmony_ci#if SECUREC_ENABLE_SSCANF
5553d58139fSopenharmony_ci/*
5563d58139fSopenharmony_ci * Description: The swscanf_s function is the wide-character equivalent of the sscanf_s function
5573d58139fSopenharmony_ci * Parameter: buffer - read character from buffer
5583d58139fSopenharmony_ci * Parameter: format - format string
5593d58139fSopenharmony_ci * Return:    the number of input items assigned, If an error occurred Return: -1.
5603d58139fSopenharmony_ci */
5613d58139fSopenharmony_ciSECUREC_API int swscanf_s(const wchar_t *buffer, const wchar_t *format, ...);
5623d58139fSopenharmony_ci#endif
5633d58139fSopenharmony_ci
5643d58139fSopenharmony_ci#if SECUREC_ENABLE_VSSCANF
5653d58139fSopenharmony_ci/*
5663d58139fSopenharmony_ci * Description: The vswscanf_s function is the wide-character equivalent of the vsscanf_s function
5673d58139fSopenharmony_ci * Parameter: buffer -  read character from  buffer
5683d58139fSopenharmony_ci * Parameter: format - format string
5693d58139fSopenharmony_ci * Parameter: argList - instead of  a variable number of arguments
5703d58139fSopenharmony_ci * Return:    the number of input items assigned, If an error occurred Return: -1.
5713d58139fSopenharmony_ci */
5723d58139fSopenharmony_ciSECUREC_API int vswscanf_s(const wchar_t *buffer, const wchar_t *format, va_list argList);
5733d58139fSopenharmony_ci#endif
5743d58139fSopenharmony_ci#endif /* SECUREC_ENABLE_WCHAR_FUNC */
5753d58139fSopenharmony_ci#endif
5763d58139fSopenharmony_ci
5773d58139fSopenharmony_ci/* Those functions are used by macro,must declare hare, also for without function declaration warning */
5783d58139fSopenharmony_ciextern errno_t strncpy_error(char *strDest, size_t destMax, const char *strSrc, size_t count);
5793d58139fSopenharmony_ciextern errno_t strcpy_error(char *strDest, size_t destMax, const char *strSrc);
5803d58139fSopenharmony_ci
5813d58139fSopenharmony_ci#if SECUREC_WITH_PERFORMANCE_ADDONS
5823d58139fSopenharmony_ci/* Those functions are used by macro */
5833d58139fSopenharmony_ciextern errno_t memset_sOptAsm(void *dest, size_t destMax, int c, size_t count);
5843d58139fSopenharmony_ciextern errno_t memset_sOptTc(void *dest, size_t destMax, int c, size_t count);
5853d58139fSopenharmony_ciextern errno_t memcpy_sOptAsm(void *dest, size_t destMax, const void *src, size_t count);
5863d58139fSopenharmony_ciextern errno_t memcpy_sOptTc(void *dest, size_t destMax, const void *src, size_t count);
5873d58139fSopenharmony_ci
5883d58139fSopenharmony_ci/* The strcpy_sp is a macro, not a function in performance optimization mode. */
5893d58139fSopenharmony_ci#define strcpy_sp(dest, destMax, src)  ((__builtin_constant_p((destMax)) && \
5903d58139fSopenharmony_ci    __builtin_constant_p((src))) ?  \
5913d58139fSopenharmony_ci    SECUREC_STRCPY_SM((dest), (destMax), (src)) : \
5923d58139fSopenharmony_ci    strcpy_s((dest), (destMax), (src)))
5933d58139fSopenharmony_ci
5943d58139fSopenharmony_ci/* The strncpy_sp is a macro, not a function in performance optimization mode. */
5953d58139fSopenharmony_ci#define strncpy_sp(dest, destMax, src, count)  ((__builtin_constant_p((count)) && \
5963d58139fSopenharmony_ci    __builtin_constant_p((destMax)) && \
5973d58139fSopenharmony_ci    __builtin_constant_p((src))) ?  \
5983d58139fSopenharmony_ci    SECUREC_STRNCPY_SM((dest), (destMax), (src), (count)) : \
5993d58139fSopenharmony_ci    strncpy_s((dest), (destMax), (src), (count)))
6003d58139fSopenharmony_ci
6013d58139fSopenharmony_ci/* The strcat_sp is a macro, not a function in performance optimization mode. */
6023d58139fSopenharmony_ci#define strcat_sp(dest, destMax, src) ((__builtin_constant_p((destMax)) && \
6033d58139fSopenharmony_ci    __builtin_constant_p((src))) ?  \
6043d58139fSopenharmony_ci    SECUREC_STRCAT_SM((dest), (destMax), (src)) : \
6053d58139fSopenharmony_ci    strcat_s((dest), (destMax), (src)))
6063d58139fSopenharmony_ci
6073d58139fSopenharmony_ci/* The strncat_sp is a macro, not a function in performance optimization mode. */
6083d58139fSopenharmony_ci#define strncat_sp(dest, destMax, src, count) ((__builtin_constant_p((count)) &&  \
6093d58139fSopenharmony_ci    __builtin_constant_p((destMax)) && \
6103d58139fSopenharmony_ci    __builtin_constant_p((src))) ?  \
6113d58139fSopenharmony_ci    SECUREC_STRNCAT_SM((dest), (destMax), (src), (count)) : \
6123d58139fSopenharmony_ci    strncat_s((dest), (destMax), (src), (count)))
6133d58139fSopenharmony_ci
6143d58139fSopenharmony_ci/* The memcpy_sp is a macro, not a function in performance optimization mode. */
6153d58139fSopenharmony_ci#define memcpy_sp(dest, destMax, src, count)  (__builtin_constant_p((count)) ? \
6163d58139fSopenharmony_ci    (SECUREC_MEMCPY_SM((dest), (destMax), (src), (count))) : \
6173d58139fSopenharmony_ci    (__builtin_constant_p((destMax)) ? \
6183d58139fSopenharmony_ci    (((size_t)(destMax) > 0 && \
6193d58139fSopenharmony_ci    (((unsigned long long)(destMax) & (unsigned long long)(-2)) < SECUREC_MEM_MAX_LEN)) ? \
6203d58139fSopenharmony_ci    memcpy_sOptTc((dest), (destMax), (src), (count)) : ERANGE) : \
6213d58139fSopenharmony_ci    memcpy_sOptAsm((dest), (destMax), (src), (count))))
6223d58139fSopenharmony_ci
6233d58139fSopenharmony_ci/* The memset_sp is a macro, not a function in performance optimization mode. */
6243d58139fSopenharmony_ci#define memset_sp(dest, destMax, c, count)  (__builtin_constant_p((count)) ? \
6253d58139fSopenharmony_ci    (SECUREC_MEMSET_SM((dest), (destMax), (c), (count))) : \
6263d58139fSopenharmony_ci    (__builtin_constant_p((destMax)) ? \
6273d58139fSopenharmony_ci    (((((unsigned long long)(destMax) & (unsigned long long)(-2)) < SECUREC_MEM_MAX_LEN)) ? \
6283d58139fSopenharmony_ci    memset_sOptTc((dest), (destMax), (c), (count)) : ERANGE) : \
6293d58139fSopenharmony_ci    memset_sOptAsm((dest), (destMax), (c), (count))))
6303d58139fSopenharmony_ci
6313d58139fSopenharmony_ci#endif
6323d58139fSopenharmony_ci
6333d58139fSopenharmony_ci#ifdef __cplusplus
6343d58139fSopenharmony_ci}
6353d58139fSopenharmony_ci#endif
6363d58139fSopenharmony_ci#endif
6373d58139fSopenharmony_ci
638