1 Star 0 Fork 19

chenmaodong/mstflint

forked from src-openEuler/mstflint 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0001-Fix-compile-errors.patch 4.21 KB
一键复制 编辑 原始数据 按行查看 历史
lizhenhua 提交于 2020-05-20 13:57 . Fix compile errors
From a6ab27b854a63983403ee4376a0303629267c6c1 Mon Sep 17 00:00:00 2001
From: lizhenhua <lizhenhua@sina.com>
Date: Wed, 20 May 2020 13:49:21 +0800
Subject: [PATCH] Fix compile errors
---
ext_libs/muparser/muParserCallback.cpp | 16 ++++++++++++++++
ext_libs/muparser/muParserCallback.h | 1 +
mlxfwops/lib/fw_ops.cpp | 6 +++---
small_utils/mtserver.c | 4 ++--
4 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/ext_libs/muparser/muParserCallback.cpp b/ext_libs/muparser/muParserCallback.cpp
index 2044fe1..27c5b08 100755
--- a/ext_libs/muparser/muParserCallback.cpp
+++ b/ext_libs/muparser/muParserCallback.cpp
@@ -386,6 +386,22 @@ namespace mu
m_eOprtAsct = ref.m_eOprtAsct;
}
+ ParserCallback& ParserCallback::operator=(const ParserCallback& cb)
+ {
+ if (this != &cb)
+ {
+ m_pFun = cb.m_pFun;
+ m_iArgc = cb.m_iArgc;
+ m_bAllowOpti = cb.m_bAllowOpti;
+ m_iCode = cb.m_iCode;
+ m_iType = cb.m_iType;
+ m_iPri = cb.m_iPri;
+ m_eOprtAsct = cb.m_eOprtAsct;
+ }
+
+ return *this;
+ }
+
//---------------------------------------------------------------------------
/** \brief Clone this instance and return a pointer to the new instance. */
ParserCallback* ParserCallback::Clone() const
diff --git a/ext_libs/muparser/muParserCallback.h b/ext_libs/muparser/muParserCallback.h
index ef32b49..e8e274d 100755
--- a/ext_libs/muparser/muParserCallback.h
+++ b/ext_libs/muparser/muParserCallback.h
@@ -81,6 +81,7 @@ public:
ParserCallback(strfun_type3 a_pFun, bool a_bAllowOpti);
ParserCallback();
ParserCallback(const ParserCallback &a_Fun);
+ ParserCallback& operator=(const ParserCallback& cb);
ParserCallback* Clone() const;
diff --git a/mlxfwops/lib/fw_ops.cpp b/mlxfwops/lib/fw_ops.cpp
index fc06c50..4d7bcdf 100644
--- a/mlxfwops/lib/fw_ops.cpp
+++ b/mlxfwops/lib/fw_ops.cpp
@@ -768,16 +768,16 @@ void FwOperations::BackUpFwParams(fw_ops_params_t& fwParams)
_fwParams.errBuff = (char*)NULL;
_fwParams.errBuffSize = 0;
_fwParams.fileHndl = (fwParams.hndlType == FHT_FW_FILE && fwParams.fileHndl) ? \
- strncpy((char*)(new char[(strlen(fwParams.fileHndl) + 1)]), fwParams.fileHndl, strlen(fwParams.fileHndl) + 1) : (char*)NULL;
+ (char*)memmove((new char[(strlen(fwParams.fileHndl) + 1)]), fwParams.fileHndl, strlen(fwParams.fileHndl) + 1) : (char*)NULL;
// no support for flash params
_fwParams.flashParams = (flash_params_t*)NULL;
_fwParams.forceLock = fwParams.forceLock;
_fwParams.ignoreCacheRep = fwParams.ignoreCacheRep;
_fwParams.mstHndl = (fwParams.hndlType == FHT_MST_DEV && fwParams.mstHndl) ? \
- strncpy((char*)(new char[(strlen(fwParams.mstHndl) + 1)]), fwParams.mstHndl, strlen(fwParams.mstHndl) + 1) : (char*)NULL;
+ (char*)memmove((new char[(strlen(fwParams.mstHndl) + 1)]), fwParams.mstHndl, strlen(fwParams.mstHndl) + 1) : (char*)NULL;
_fwParams.noFlashVerify = fwParams.noFlashVerify;
_fwParams.numOfBanks = fwParams.numOfBanks;
- _fwParams.psid = fwParams.psid ? strncpy((char*)(new char[(strlen(fwParams.psid) + 1)]), fwParams.psid, strlen(fwParams.psid) + 1) : (char*)NULL;
+ _fwParams.psid = fwParams.psid ? (char*)memmove((new char[(strlen(fwParams.psid) + 1)]), fwParams.psid, strlen(fwParams.psid) + 1) : (char*)NULL;
_fwParams.readOnly = fwParams.readOnly;
_fwParams.shortErrors = fwParams.shortErrors;
_fwParams.uefiExtra = fwParams.uefiExtra;
diff --git a/small_utils/mtserver.c b/small_utils/mtserver.c
index 143c1f4..335a5ff 100644
--- a/small_utils/mtserver.c
+++ b/small_utils/mtserver.c
@@ -420,8 +420,8 @@ int parse_i2c_cmd(char *buf, u_int8_t *addr_width, u_int8_t *slave_addr, int *si
for (i = 0; i < *size; i++) {
char tmp_num[10];
// TODO: use 16 on the strtoul
- strncpy(tmp_num, "0x", 2);
- strncpy(tmp_num + 2, p, 2);
+ memmove(tmp_num, "0x", 2);
+ memmove(tmp_num + 2, p, 2);
tmp_num[4] = '\0';
((u_int8_t*)data)[i] = (u_int8_t)strtoul(tmp_num, 0, 0);
p += 2;
--
2.23.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/chenmaodong/mstflint.git
git@gitee.com:chenmaodong/mstflint.git
chenmaodong
mstflint
mstflint
master

搜索帮助