From ab01f059f1d6a8bd577750934df18375c40ed0ae Mon Sep 17 00:00:00 2001 From: liutuantuan Date: Wed, 29 May 2024 10:29:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9rpcid.sc=E6=B2=A1=E7=94=9F?= =?UTF-8?q?=E6=88=90=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liutuantuan --- src/syscap_tool.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/syscap_tool.c b/src/syscap_tool.c index fb4ba32..5663b64 100644 --- a/src/syscap_tool.c +++ b/src/syscap_tool.c @@ -161,7 +161,8 @@ int32_t RPCIDEncode(char *inputFile, char *outputPath) FREE_CONTEXT_OUT_RPCID_ENCODE, -1); } - if (cJSON_GetArraySize(gJsonObjectSysCap.sysCapPtr) < 0) { + ret = cJSON_GetArraySize(gJsonObjectSysCap.sysCapPtr); + if (ret < 0) { PRINT_ERR("get \"syscap\" array size failed\n"); return FreeAfterRPCIDEncode(gJsonObjectSysCap.cjsonObjectRoot, NULL, contextBuffer, FREE_CONTEXT_OUT_RPCID_ENCODE, -1); @@ -179,13 +180,11 @@ int32_t RPCIDEncode(char *inputFile, char *outputPath) } (void) memset_s(convertedBuffer, convertedBufLen, 0, convertedBufLen); - ret = FillOsCapLength(convertedBuffer, contextBuffer, gJsonObjectSysCap, sysCapSize, ret); - if (ret == -1) { + if (FillOsCapLength(convertedBuffer, contextBuffer, gJsonObjectSysCap, sysCapSize, ret) == -1) { return FreeAfterRPCIDEncode(gJsonObjectSysCap.cjsonObjectRoot, convertedBuffer, contextBuffer, FREE_CONVERT_OUT_RPCID_ENCODE, ret); } - ret = ConvertedContextSaveAsFile(outputPath, "rpcid.sc", convertedBuffer, convertedBufLen); - if (ret != 0) { + if (ConvertedContextSaveAsFile(outputPath, "rpcid.sc", convertedBuffer, convertedBufLen) != 0) { PRINT_ERR("ConvertedContextSaveAsFile failed, outputPath:%s, filename:rpcid.sc\n", outputPath); } return FreeAfterRPCIDEncode(gJsonObjectSysCap.cjsonObjectRoot, convertedBuffer, contextBuffer,