From 49292588294b033dc74105788d4b640ebc10c53e Mon Sep 17 00:00:00 2001 From: liutuantuan Date: Wed, 29 May 2024 18:09:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9RPCIDEncode=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liutuantuan --- src/syscap_tool.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/syscap_tool.c b/src/syscap_tool.c index 18414a2..3bcd76a 100644 --- a/src/syscap_tool.c +++ b/src/syscap_tool.c @@ -141,10 +141,9 @@ int32_t RPCIDEncode(char *inputFile, char *outputPath) gJsonObjectSysCap.cjsonObjectRoot = NULL; gJsonObjectSysCap.sysCapPtr = NULL; - int32_t ret = GetFileContext(inputFile, &contextBuffer, &bufferLen); - if (ret != 0) { + if (GetFileContext(inputFile, &contextBuffer, &bufferLen) != 0) { PRINT_ERR("GetFileContext failed, input file : %s\n", inputFile); - return ret; + return -1; } gJsonObjectSysCap.cjsonObjectRoot = cJSON_ParseWithLength(contextBuffer, bufferLen); @@ -161,7 +160,7 @@ int32_t RPCIDEncode(char *inputFile, char *outputPath) FREE_CONTEXT_OUT_RPCID_ENCODE, -1); } - ret = cJSON_GetArraySize(gJsonObjectSysCap.sysCapPtr); + int32_t ret = cJSON_GetArraySize(gJsonObjectSysCap.sysCapPtr); if (ret < 0) { PRINT_ERR("get \"syscap\" array size failed\n"); return FreeAfterRPCIDEncode(gJsonObjectSysCap.cjsonObjectRoot, NULL, contextBuffer, @@ -184,7 +183,8 @@ int32_t RPCIDEncode(char *inputFile, char *outputPath) return FreeAfterRPCIDEncode(gJsonObjectSysCap.cjsonObjectRoot, convertedBuffer, contextBuffer, FREE_CONVERT_OUT_RPCID_ENCODE, -1); } - if (ConvertedContextSaveAsFile(outputPath, "rpcid.sc", convertedBuffer, convertedBufLen) != 0) { + ret = ConvertedContextSaveAsFile(outputPath, "rpcid.sc", convertedBuffer, convertedBufLen); + if (ret != 0) { PRINT_ERR("ConvertedContextSaveAsFile failed, outputPath:%s, filename:rpcid.sc\n", outputPath); } return FreeAfterRPCIDEncode(gJsonObjectSysCap.cjsonObjectRoot, convertedBuffer, contextBuffer,