1 Star 0 Fork 77

terryxian/libboundscheck

forked from openEuler/libboundscheck
关闭
 
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
vfwscanf_s.c 2.45 KB
一键复制 编辑 原始数据 按行查看 历史
Plus_Liu 提交于 2021-05-07 16:32 +08:00 . commit the code of the new version v1.1.11
/*
* Copyright (c) Huawei Technologies Co., Ltd. 2014-2021. All rights reserved.
* Licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
* Description: vfwscanf_s function
* Create: 2014-02-25
*/
#ifndef SECUREC_FOR_WCHAR
#define SECUREC_FOR_WCHAR
#endif
#include "secinput.h"
/*
* <FUNCTION DESCRIPTION>
* The vfwscanf_s function is the wide-character equivalent of the vfscanf_s function
* The vfwscanf_s function reads data from the current position of stream into
* the locations given by argument (if any). Each argument must be a pointer
* to a variable of a type that corresponds to a type specifier in format.
* format controls the interpretation of the input fields and has the same form
* and function as the format argument for scanf.
*
* <INPUT PARAMETERS>
* stream Pointer to FILE structure.
* format Format control string, see Format Specifications.
* argList pointer to list of arguments
*
* <OUTPUT PARAMETERS>
* argList the converted value stored in user assigned address
*
* <RETURN VALUE>
* Each of these functions returns the number of fields successfully converted
* and assigned; the return value does not include fields that were read but
* not assigned. A return value of 0 indicates that no fields were assigned.
* return -1 if an error occurs.
*/
int vfwscanf_s(FILE *stream, const wchar_t *format, va_list argList)
{
int retVal; /* If initialization causes e838 */
SecFileStream fStr;
if (stream == NULL || format == NULL) {
SECUREC_ERROR_INVALID_PARAMTER("vfwscanf_s");
return SECUREC_SCANF_EINVAL;
}
if (stream == SECUREC_STREAM_STDIN) {
return vwscanf_s(format, argList);
}
SECUREC_LOCK_FILE(stream);
SECUREC_FILE_STREAM_FROM_FILE(&fStr, stream);
retVal = SecInputSW(&fStr, format, argList);
SECUREC_UNLOCK_FILE(stream);
if (retVal < 0) {
SECUREC_ERROR_INVALID_PARAMTER("vfwscanf_s");
return SECUREC_SCANF_EINVAL;
}
return retVal;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/terryxian/libboundscheck.git
git@gitee.com:terryxian/libboundscheck.git
terryxian
libboundscheck
libboundscheck
master

搜索帮助