!64 修复无符号数和有符号数混用等问题。

Merge pull request !64 from chenyude/rpcid
This commit is contained in:
openharmony_ci
2022-06-10 06:33:40 +00:00
committed by Gitee
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");