!902 修复代码静态检查(0704)

Merge pull request !902 from Mupceet/codex
This commit is contained in:
openharmony_ci 2022-07-04 08:12:38 +00:00 committed by Gitee
commit 0345a384be
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 6 additions and 4 deletions

View File

@ -321,6 +321,8 @@ static int GetUid(cJSON *json, uid_t *uid)
*uid = DecodeUid(str); *uid = DecodeUid(str);
} else if (cJSON_IsNumber(json)) { } else if (cJSON_IsNumber(json)) {
*uid = (uid_t)cJSON_GetNumberValue(json); *uid = (uid_t)cJSON_GetNumberValue(json);
} else {
*uid = (uid_t)(-1);
} }
INIT_CHECK_RETURN_VALUE(*uid != (uid_t)(-1), SERVICE_FAILURE); INIT_CHECK_RETURN_VALUE(*uid != (uid_t)(-1), SERVICE_FAILURE);
return SERVICE_SUCCESS; return SERVICE_SUCCESS;
@ -967,12 +969,12 @@ void ParseAllServices(const cJSON *fileRoot)
cJSON *curItem = cJSON_GetArrayItem(serviceArr, i); cJSON *curItem = cJSON_GetArrayItem(serviceArr, i);
int ret = GetStringItem(curItem, "name", serviceName, MAX_SERVICE_NAME); int ret = GetStringItem(curItem, "name", serviceName, MAX_SERVICE_NAME);
if (ret != 0) { if (ret != 0) {
INIT_LOGE("Failed to get service name %s", serviceName); INIT_LOGE("Failed to get service name");
continue; continue;
} }
Service *service = GetServiceByName(serviceName); Service *service = GetServiceByName(serviceName);
if (service != NULL) { if (service != NULL) {
INIT_LOGE("Service name %s has been exist", serviceName); INIT_LOGE("Service \' %s \' already exist", serviceName);
continue; continue;
} }
service = AddService(serviceName); service = AddService(serviceName);

View File

@ -222,8 +222,8 @@ static void HandlerFdHolder(int sock)
} else { } else {
INIT_LOGE("Unexpected action: %s", action); INIT_LOGE("Unexpected action: %s", action);
} }
FreeFds(fds);
CloseFds(fds, fdCount); CloseFds(fds, fdCount);
FreeFds(fds);
FreeStringVector(msg, msgCount); FreeStringVector(msg, msgCount);
} }

View File

@ -278,7 +278,7 @@ int ConvertInfixToPrefix(const char *condition, char *prefix, uint32_t prefixLen
uint32_t prefixIndex = 0; uint32_t prefixIndex = 0;
size_t conditionLen = strlen(condition); size_t conditionLen = strlen(condition);
LogicCalculator calculator; LogicCalculator calculator;
CalculatorInit(&calculator, MAX_CALC_PARAM, 1, 0); PARAM_CHECK(CalculatorInit(&calculator, MAX_CALC_PARAM, 1, 0) == 0, return -1, "Failed to init calculator");
while (curr < conditionLen) { while (curr < conditionLen) {
if (condition[curr] == ')') { if (condition[curr] == ')') {