diff --git a/net/lwip-2.1/enhancement/src/api_shell.c b/net/lwip-2.1/enhancement/src/api_shell.c index 5c56d3652ea03825a15a05262284439787c2b328..4d2487cb0926694b2fcd89df44b71e3f54758747 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 7740e7581a0e6ae2724c6b0913447cdd2fc0c7da..d605e033956b2a49bba6ac8585d0aec365db1791 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 ac34a0dd1b73e660147ca8d50e5cc138c2800131..9819361c792ddb3d26b649df82fe631ae1ef2d5b 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);