fix some codex problems.

Signed-off-by: yudechen <chenyude@huawei.com>
Change-Id: Ic0e8ed2f20d320698edbf56afe9665472241a2bd
This commit is contained in:
yudechen
2022-06-10 12:45:46 +08:00
parent b7cddb91be
commit 656b2afe22
2 changed files with 8 additions and 4 deletions
+4
View File
@@ -80,6 +80,10 @@ int main(int argc, char **argv)
break;
case 'C':
pcidfile = optarg;
if (optind < 0 || optind > argc) {
PRINT_ERR("Input file path too few or too many.\n");
return -1;
}
rpcidfile = argv[optind];
break;
case 'i':
+4 -4
View File
@@ -490,9 +490,9 @@ int32_t DecodeRpcidToString(char *inputFile, char *outDirPath)
cJSON *cJsonItem = cJSON_GetArrayItem(sysCapArray, i);
cJsonTemp = cJSON_GetObjectItem(sysCapDefine, cJsonItem->valuestring);
if (cJsonTemp != NULL) {
osSysCapIndex[indexOs++] = cJsonTemp->valueint;
osSysCapIndex[indexOs++] = (uint16_t)(cJsonTemp->valueint);
} else {
ret = strncpy_s(priSyscapArray, sysCapArraySize * SINGLE_FEAT_LENGTH,
ret = strncpy_s(priSyscapArray, SINGLE_FEAT_LENGTH,
cJsonItem->valuestring, SINGLE_FEAT_LENGTH - 1);
if (ret != EOK) {
PRINT_ERR("strcpy_s failed.\n");
@@ -512,7 +512,7 @@ int32_t DecodeRpcidToString(char *inputFile, char *outDirPath)
}
uint16_t outBufferLen = U32_TO_STR_MAX_LEN * RPCID_OUT_BUFFER
+ (SINGLE_FEAT_LENGTH + 1) * sysCapArraySize;
+ (SINGLE_FEAT_LENGTH + 1) * (uint16_t)sysCapArraySize;
char *outBuffer = (char *)malloc(outBufferLen);
if (outBuffer == NULL) {
PRINT_ERR("malloc(%u) failed.\n", outBufferLen);
@@ -609,7 +609,7 @@ static int32_t SeparateSyscapFromString(char *input, uint32_t *osArray, uint32_t
temp = strtok_r(input, ",", &tok);
while (temp) {
ret = strncpy_s(priSysCapOut, SINGLE_FEAT_LENGTH * count,
ret = strncpy_s(priSysCapOut, SINGLE_FEAT_LENGTH,
temp, SINGLE_FEAT_LENGTH - 1);
if (ret != EOK) {
PRINT_ERR("strncpy_s failed.\n");