diff --git a/include/syscap_tool.h b/include/syscap_tool.h index a606e32..e383c27 100644 --- a/include/syscap_tool.h +++ b/include/syscap_tool.h @@ -32,7 +32,7 @@ int32_t PCIDEncode(char *inputFile, char *outputPath); /* in: inputFile, file name format: .sc, out: outputPath/.json */ int32_t PCIDDecode(char *inputFile, char *outputPath); /* in: inputFile, out: outputPath/rpcid.sc */ -int32_t RPCIDEncode(char *inputFile, char *outputPath); +static int32_t RPCIDEncode(char *inputFile, char *outputPath); /* in: inputFile, out: outputPath/rpcid.json */ int32_t RPCIDDecode(char *inputFile, char *outputPath); /* in: inputFile, out: outputPath/rpcid.json */ diff --git a/src/syscap_tool.c b/src/syscap_tool.c index e579d5e..5322170 100644 --- a/src/syscap_tool.c +++ b/src/syscap_tool.c @@ -36,6 +36,7 @@ #define SYSCAP_PREFIX_LEN 17 #define SINGLE_FEAT_LEN (SINGLE_SYSCAP_LEN - SYSCAP_PREFIX_LEN) +#define DOUBLE_SPACE 2 #define UINT8_BIT 8 #define INT_BIT 32 #define RPCID_OUT_BUFFER 32 @@ -132,7 +133,8 @@ static int32_t FreeAfterRPCIDEncode( return ret; } -int32_t RPCIDEncode(char *inputFile, char *outputPath) { +static int32_t RPCIDEncode(char *inputFile, char *outputPath) +{ char *contextBuffer = NULL; uint32_t bufferLen, sysCapSize; struct JsonObjectSysCap gJsonObjectSysCap; @@ -168,7 +170,7 @@ int32_t RPCIDEncode(char *inputFile, char *outputPath) { // 2, to save SysCaptype & SysCapLength sysCapSize = (uint32_t) ret; uint32_t convertedBufLen = sizeof(RPCIDHead); - convertedBufLen += (2 * sizeof(uint16_t) + sysCapSize * SINGLE_FEAT_LEN); + convertedBufLen += (DOUBLE_SPACE * sizeof(uint16_t) + sysCapSize * SINGLE_FEAT_LEN); char *convertedBuffer = (char *) malloc(convertedBufLen); if (convertedBuffer == NULL) { PRINT_ERR("malloc failed\n");