From 8d55bb1d8c97f941a7907190a4b127a876b4f512 Mon Sep 17 00:00:00 2001 From: yinjiaming Date: Tue, 25 Oct 2022 17:07:44 +0800 Subject: [PATCH] =?UTF-8?q?=20fix:=20=E5=86=85=E6=A0=B8=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E6=B8=85=E7=90=86=20=E3=80=90=E8=83=8C=E6=99=AF=E3=80=91=20?= =?UTF-8?q?=E5=86=85=E6=A0=B8=E5=91=8A=E8=AD=A6=E6=B8=85=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【修改方案】 删去了多余的空格,更改了魔数字 【影响】 对现有的产品编译不会有影响。 Signed-off-by: yinjiaming Change-Id: Iba21be6cb23027dfb369576847d7d21e85f936b4 --- net/lwip-2.1/enhancement/src/api_shell.c | 2 +- .../unittest/basic/mem/shm/full/shm_test_002.cpp | 11 ++++++----- testsuites/unittest/libc/time/clock/lt_clock_test.h | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/net/lwip-2.1/enhancement/src/api_shell.c b/net/lwip-2.1/enhancement/src/api_shell.c index 5c56d365..4d2487cb 100644 --- a/net/lwip-2.1/enhancement/src/api_shell.c +++ b/net/lwip-2.1/enhancement/src/api_shell.c @@ -356,7 +356,7 @@ int print_netif(struct netif *netif, char *print_buf, unsigned int buf_len) buf_len -= (unsigned int)ret; } - ret = snprintf_s(tmp, buf_len, (buf_len - 1), " %s\n", + ret = snprintf_s(tmp, buf_len, (buf_len - 1), " %s\n", (netif->flags & NETIF_FLAG_LINK_UP) ? "Link UP" : "Link Down"); if ((ret <= 0) || ((unsigned int)ret >= buf_len)) goto out; diff --git a/testsuites/unittest/basic/mem/shm/full/shm_test_002.cpp b/testsuites/unittest/basic/mem/shm/full/shm_test_002.cpp index 7740e758..d605e033 100644 --- a/testsuites/unittest/basic/mem/shm/full/shm_test_002.cpp +++ b/testsuites/unittest/basic/mem/shm/full/shm_test_002.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. + * Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: @@ -31,6 +31,7 @@ #include "it_test_shm.h" #define SHMID_MAX 192 +#define SHM_FLAG 0777 static int Testcase(VOID) { @@ -44,24 +45,24 @@ static int Testcase(VOID) ICUNIT_ASSERT_EQUAL(ret, SHMID_MAX, ret); leftShmIds = SHMID_MAX - shmInfo.used_ids; - shmid[0] = shmget((key_t)0x1234, PAGE_SIZE, 0777 | IPC_CREAT); + shmid[0] = shmget((key_t)0x1234, PAGE_SIZE, SHM_FLAG | IPC_CREAT); // 0x1234: a key used to create shared memory ICUNIT_ASSERT_NOT_EQUAL(shmid[0], -1, shmid[0]); ret = shmctl(shmid[0], IPC_RMID, NULL); ICUNIT_ASSERT_EQUAL(ret, 0, ret); - shmid[0] = shmget(IPC_PRIVATE, PAGE_SIZE, 0777 | IPC_CREAT); + shmid[0] = shmget(IPC_PRIVATE, PAGE_SIZE, SHM_FLAG | IPC_CREAT); ICUNIT_ASSERT_NOT_EQUAL(shmid[0], -1, shmid[0]); ret = shmctl(shmid[0], IPC_RMID, NULL); ICUNIT_ASSERT_EQUAL(ret, 0, ret); for (i = 0; i < leftShmIds; i++) { - shmid[i] = shmget(IPC_PRIVATE, PAGE_SIZE, 0777 | IPC_CREAT); + shmid[i] = shmget(IPC_PRIVATE, PAGE_SIZE, SHM_FLAG | IPC_CREAT); ICUNIT_ASSERT_NOT_EQUAL(shmid[i], -1, shmid[i]); } - shmid[leftShmIds] = shmget(IPC_PRIVATE, PAGE_SIZE, 0777 | IPC_CREAT); + shmid[leftShmIds] = shmget(IPC_PRIVATE, PAGE_SIZE, SHM_FLAG | IPC_CREAT); ICUNIT_ASSERT_EQUAL(shmid[leftShmIds], -1, shmid[leftShmIds]); for (i = 0; i < leftShmIds; i++) { diff --git a/testsuites/unittest/libc/time/clock/lt_clock_test.h b/testsuites/unittest/libc/time/clock/lt_clock_test.h index ac34a0dd..9819361c 100644 --- a/testsuites/unittest/libc/time/clock/lt_clock_test.h +++ b/testsuites/unittest/libc/time/clock/lt_clock_test.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. + * Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: @@ -41,7 +41,7 @@ #define CLOCK_RES_NSEC 1000 #define CLOCK_COARSE_RES_SEC 0 #define CLOCK_COARSE_RES_NSEC 1000000 -#define CLOCK_GET_CPU_CLOCKID(pid) ((-pid - 1) * 8U + 2) +#define CLOCK_GET_CPU_CLOCKID(pid) ((-(pid) - 1) * 8U + 2) void ClockTestSmoke(void); void ClockTest001(void); -- GitLab