From d1eb2f96b3082ad5cc58fd1ded3f1dfc0976877b Mon Sep 17 00:00:00 2001 From: xionglei6 Date: Tue, 29 Mar 2022 17:42:12 +0800 Subject: [PATCH] fix: inner source issue Signed-off-by: xionglei6 --- services/include/appspawn_message.h | 2 +- services/include/appspawn_process.h | 2 +- services/include/appspawn_service.h | 2 +- services/src/appspawn_message.c | 2 +- services/src/appspawn_process.c | 14 +++++++------- services/src/appspawn_service.c | 8 ++++---- .../test/unittest/common/message_func_test.cpp | 4 ++-- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/services/include/appspawn_message.h b/services/include/appspawn_message.h index 1b64942..5a6c83c 100644 --- a/services/include/appspawn_message.h +++ b/services/include/appspawn_message.h @@ -40,4 +40,4 @@ void FreeMessageSt(MessageSt* targetSt); #endif #endif -#endif // BASE_STARTUP_APPSPAWN_SERVICE_H \ No newline at end of file +#endif // BASE_STARTUP_APPSPAWN_SERVICE_H diff --git a/services/include/appspawn_process.h b/services/include/appspawn_process.h index 1319e45..a60a20e 100644 --- a/services/include/appspawn_process.h +++ b/services/include/appspawn_process.h @@ -32,4 +32,4 @@ pid_t CreateProcess(const MessageSt* msgSt); #endif #endif -#endif // BASE_STARTUP_APPSPAWN_SERVICE_H \ No newline at end of file +#endif // BASE_STARTUP_APPSPAWN_SERVICE_H diff --git a/services/include/appspawn_service.h b/services/include/appspawn_service.h index f7e4433..f474a2e 100644 --- a/services/include/appspawn_service.h +++ b/services/include/appspawn_service.h @@ -34,4 +34,4 @@ enum APPSPAWN_FUNCID { #endif #endif -#endif // BASE_STARTUP_APPSPAWN_SERVICE_H \ No newline at end of file +#endif // BASE_STARTUP_APPSPAWN_SERVICE_H diff --git a/services/src/appspawn_message.c b/services/src/appspawn_message.c index 3406693..3083fee 100644 --- a/services/src/appspawn_message.c +++ b/services/src/appspawn_message.c @@ -138,7 +138,7 @@ static int GetCaps(const cJSON* curItem, MessageSt* msgSt) } msgSt->caps[i] = (unsigned int)cJSON_GetNumberValue(capJ); if (msgSt->caps[i] > CAP_LAST_CAP) { - HILOG_ERROR(HILOG_MODULE_HIVIEW, "[appspawn] GetCaps, invalid cap value %{public}u detected!",\ + HILOG_ERROR(HILOG_MODULE_HIVIEW, "[appspawn] GetCaps, invalid cap value %{public}u detected!", \ msgSt->caps[i]); free(msgSt->caps); msgSt->caps = NULL; diff --git a/services/src/appspawn_process.c b/services/src/appspawn_process.c index 70cb0c2..5c1c874 100755 --- a/services/src/appspawn_process.c +++ b/services/src/appspawn_process.c @@ -76,19 +76,19 @@ static int SetPerms(uid_t uID, gid_t gID, unsigned int capsCnt, const unsigned i gid_t groups[GRP_NUM]; if (KeepCapability() != 0) { - HILOG_ERROR(HILOG_MODULE_HIVIEW, "[appspawn] KeepCapability failed, uID %{public}u, err: %{public}d.",\ + HILOG_ERROR(HILOG_MODULE_HIVIEW, "[appspawn] KeepCapability failed, uID %{public}u, err: %{public}d.", \ uID, errno); return -1; } if (setgid(gID) != 0) { - HILOG_ERROR(HILOG_MODULE_HIVIEW, "[appspawn] setgid failed, gID %{public}u, err: %{public}d.",\ + HILOG_ERROR(HILOG_MODULE_HIVIEW, "[appspawn] setgid failed, gID %{public}u, err: %{public}d.", \ gID, errno); return -1; } if (setuid(uID) != 0) { - HILOG_ERROR(HILOG_MODULE_HIVIEW, "[appspawn] setuid failed, uID %{public}u, err: %{public}d.",\ + HILOG_ERROR(HILOG_MODULE_HIVIEW, "[appspawn] setuid failed, uID %{public}u, err: %{public}d.", \ uID, errno); return -1; } @@ -98,7 +98,7 @@ static int SetPerms(uid_t uID, gid_t gID, unsigned int capsCnt, const unsigned i groups[0] = gID; groups[1] = DEVMGR_GRP; if (setgroups(GRP_NUM, groups)) { - HILOG_ERROR(HILOG_MODULE_HIVIEW, "[appspawn] setgroups failed, uID %{public}u, err: %{public}d.",\ + HILOG_ERROR(HILOG_MODULE_HIVIEW, "[appspawn] setgroups failed, uID %{public}u, err: %{public}d.", \ uID, errno); return -1; } @@ -144,7 +144,7 @@ pid_t CreateProcess(const MessageSt* msgSt) #ifdef OHOS_DEBUG struct timespec tmStart = {0}; if (clock_gettime(CLOCK_REALTIME, &tmStart) != 0) { - HILOG_ERROR(HILOG_MODULE_HIVIEW, "[appspawn] sub-process, pid %{public}d. get time err %{public}d.",\ + HILOG_ERROR(HILOG_MODULE_HIVIEW, "[appspawn] sub-process, pid %{public}d. get time err %{public}d.", \ getpid(), errno); } #endif // OHOS_DEBUG @@ -160,12 +160,12 @@ pid_t CreateProcess(const MessageSt* msgSt) #ifdef OHOS_DEBUG struct timespec tmEnd = {0}; if (clock_gettime(CLOCK_REALTIME, &tmEnd) != 0) { - HILOG_ERROR(HILOG_MODULE_HIVIEW, "[appspawn] sub-process, pid %{public}d. get time2 err %{public}d.",\ + HILOG_ERROR(HILOG_MODULE_HIVIEW, "[appspawn] sub-process, pid %{public}d. get time2 err %{public}d.", \ getpid(), errno); } // 1s = 1000000000ns long timeUsed = (tmEnd.tv_sec - tmStart.tv_sec) * 1000000000L + (tmEnd.tv_nsec - tmStart.tv_nsec); - HILOG_INFO(HILOG_MODULE_HIVIEW, "[appspawn] sub-process, pid %{public}d, timeused %ld ns.",\ + HILOG_INFO(HILOG_MODULE_HIVIEW, "[appspawn] sub-process, pid %{public}d, timeused %ld ns.", \ getpid(), timeUsed); #endif // OHOS_DEBUG diff --git a/services/src/appspawn_service.c b/services/src/appspawn_service.c index a85d24d..66ed3b0 100755 --- a/services/src/appspawn_service.c +++ b/services/src/appspawn_service.c @@ -62,7 +62,7 @@ static BOOL Initialize(Service* service, Identity identity) AppSpawnService* spawnService = (AppSpawnService*)service; spawnService->identity = identity; - HILOG_INFO(HILOG_MODULE_HIVIEW, "[appspawn] initialize, identity<%{public}d, %{public}d, %{public}p>",\ + HILOG_INFO(HILOG_MODULE_HIVIEW, "[appspawn] initialize, identity<%{public}d, %{public}d, %{public}p>", \ identity.serviceId, identity.featureId, identity.queueId); return TRUE; } @@ -136,7 +136,7 @@ static int Invoke(IServerProxy* iProxy, int funcId, void* origin, IpcIo* req, Ip (void)origin; if (reply == NULL || funcId != ID_CALL_CREATE_SERVICE || req == NULL) { - HILOG_ERROR(HILOG_MODULE_HIVIEW, "[appspawn] invoke, funcId %{public}d invalid, reply %{public}d.",\ + HILOG_ERROR(HILOG_MODULE_HIVIEW, "[appspawn] invoke, funcId %{public}d invalid, reply %{public}d.", \ funcId, INVALID_PID); IpcIoPushInt64(reply, INVALID_PID); return EC_BADPTR; @@ -149,7 +149,7 @@ static int Invoke(IServerProxy* iProxy, int funcId, void* origin, IpcIo* req, Ip return EC_FAILURE; } - HILOG_INFO(HILOG_MODULE_HIVIEW, "[appspawn] invoke, msg<%{public}s,%{public}s,%{public}d,%{public}d>",\ + HILOG_INFO(HILOG_MODULE_HIVIEW, "[appspawn] invoke, msg<%{public}s,%{public}s,%{public}d,%{public}d>", \ msgSt.bundleName, msgSt.identityID, msgSt.uID, msgSt.gID); pid_t newPid = CreateProcess(&msgSt); @@ -162,7 +162,7 @@ static int Invoke(IServerProxy* iProxy, int funcId, void* origin, IpcIo* req, Ip // 1s = 1000000000ns long timeUsed = (tmEnd.tv_sec - tmStart.tv_sec) * 1000000000L + (tmEnd.tv_nsec - tmStart.tv_nsec); - HILOG_INFO(HILOG_MODULE_HIVIEW, "[appspawn] invoke, reply pid %{public}d, timeused %{public}ld ns.",\ + HILOG_INFO(HILOG_MODULE_HIVIEW, "[appspawn] invoke, reply pid %{public}d, timeused %{public}ld ns.", \ newPid, timeUsed); #else HILOG_INFO(HILOG_MODULE_HIVIEW, "[appspawn] invoke, reply pid %{public}d.", newPid); diff --git a/services/test/unittest/common/message_func_test.cpp b/services/test/unittest/common/message_func_test.cpp index bdea322..c0fa019 100644 --- a/services/test/unittest/common/message_func_test.cpp +++ b/services/test/unittest/common/message_func_test.cpp @@ -208,7 +208,7 @@ HWTEST_F(StartupAppspawnUTest, msgFuncFreeTest_002, TestSize.Level1) static void GetCurrentTime(struct timespec* tmCur) { - if (tmCur == NULL) { + if (tmCur == nullptr) { return; } if (clock_gettime(CLOCK_REALTIME, tmCur) != 0) { @@ -247,7 +247,7 @@ HWTEST_F(StartupAppspawnUTest, msgFuncSplitTest_001, TestSize.Level1) struct timespec tmEnd = {0}; GetCurrentTime(&tmEnd); long timeUsed = (tmEnd.tv_sec - tmStart.tv_sec) * NANOSECONDS_PER_SECOND + (tmEnd.tv_nsec - tmStart.tv_nsec); - printf("[----------] StartupAppspawnUTest, msgFuncSplitTest_001, total time %ld ns, strCnt %u.\n",\ + printf("[----------] StartupAppspawnUTest, msgFuncSplitTest_001, total time %ld ns, strCnt %u.\n", \ timeUsed, g_badStrings.size()); } -- GitLab