fix: 内核告警修复
【背景】 经代码扫描工具检测,内核代码中存在 可以修复的告警 【修改方案】 1.将单语句的if, while等加上括号 2.将C语言风格的类型转换变为C++风格 【影响】 对现有的产品编译不会有影响。 Signed-off-by: yinjiaming <yinjiaming@huawei.com> Change-Id: I7d4a04a8904abb3c33e843049bf15f4386d3efd8
This commit is contained in:
@@ -39,9 +39,9 @@ static UINT32 TestCase(VOID)
|
||||
int cflags;
|
||||
regex_t reg;
|
||||
char *a = NULL;
|
||||
char *b = (char *)"No error";
|
||||
char *testStr = (char *)"Hello World";
|
||||
char *regStr = (char *)"H.*";
|
||||
char *b = const_cast<char *>("No error");
|
||||
char *testStr = const_cast<char *>("Hello World");
|
||||
char *regStr = const_cast<char *>("H.*");
|
||||
|
||||
cflags = REG_EXTENDED | REG_ICASE | REG_NOSUB;
|
||||
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
static UINT32 TestCase(VOID)
|
||||
{
|
||||
char *val = NULL;
|
||||
const char *name = (char *)"ABC";
|
||||
char *env = (char *)"test-test";
|
||||
const char *name = "ABC";
|
||||
char *env = const_cast<char *>("test-test");
|
||||
int ret;
|
||||
|
||||
val = getenv(name);
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
static UINT32 TestCase(VOID)
|
||||
{
|
||||
char *plocale = NULL;
|
||||
char *buffer = (char *)"C";
|
||||
char *buffer = const_cast<char *>("C");
|
||||
int ret;
|
||||
|
||||
plocale = setlocale(LC_ALL, NULL);
|
||||
|
||||
@@ -34,8 +34,8 @@ static UINT32 TestCase(VOID)
|
||||
{
|
||||
char *val = NULL;
|
||||
char *val2 = NULL;
|
||||
const char *name = (char *)"ABC";
|
||||
char *env = (char *)"test-test";
|
||||
const char *name = "ABC";
|
||||
char *env = "test-test";
|
||||
int ret;
|
||||
|
||||
val = getenv(name);
|
||||
|
||||
@@ -38,7 +38,7 @@ struct q {
|
||||
|
||||
static struct q *New(int i)
|
||||
{
|
||||
struct q *q = (struct q *)malloc(sizeof *q);
|
||||
struct q *q = static_cast<struct q *>(malloc(sizeof *q));
|
||||
if (q != NULL) {
|
||||
q->i = i;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ static UINT32 TestCase(VOID)
|
||||
char *ptr = NULL;
|
||||
int ret;
|
||||
|
||||
ptr = basename((char *)".");
|
||||
ptr = basename(const_cast<char *>("."));
|
||||
ret = strcmp(ptr, ".");
|
||||
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user