diff --git a/services/include/appspawn_message.h b/services/include/appspawn_message.h index 1b64942e5ec9f4f243e2a8f156675b837d8e15a8..5a6c83c263969bc892ef2ed49fa465ad7ceccbe6 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 1319e4568f40dfbf42c1ffdded1eb1454ed320b2..a60a20ee65bfdf853db4c31c511c31c58e7b7c33 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 f7e4433fb49bf4fb7eab238610ffc3a3a8d92041..f474a2ed092ea84a47aa31f967f7331a93833048 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 34066934f21dd30f06a20c4fe5ac270a65f40929..3083feea9341eb8ccd3d9ca03c465c7a881bbdd6 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 70cb0c2c1d9cbe549ec4d8f5a75bce1979c35c6a..5c1c8744a72f2c56e1eb4525fc5f56da1b07c730 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 a85d24dee277cff119e34d4d99c1b4ba1cd8653e..66ed3b0965dadd60761401e809fd581adeb7589b 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 bdea3226c70726d0a40dc17e2a7bf811f3aaeaf6..c0fa0195ab535ec601fbc7b5f439a92e9aa85cf5 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()); }