mirror of
https://github.com/openharmony/developtools_syscap_codec.git
synced 2026-08-26 17:56:33 -04:00
补充修改
Signed-off-by: zhaohang <zhaohang44@huawei.com> Signed-off-by: zhaohang <zhaohang44@huawei.com>
This commit is contained in:
@@ -625,9 +625,10 @@ static int32_t ComparePcidWithPriSyscap(struct PcidPriSyscapInfo pcidPriSyscapIn
|
||||
free(temp);
|
||||
return -1;
|
||||
}
|
||||
if (pcidPriSyscapInfo.ossyscapFlag + prisyscapFlag >= MAX_MISS_SYSCAP)
|
||||
{
|
||||
if (pcidPriSyscapInfo.ossyscapFlag + prisyscapFlag >= MAX_MISS_SYSCAP) {
|
||||
FreeCompareError(result);
|
||||
PRINT_ERR("array index out of bounds.\n");
|
||||
free(temp);
|
||||
return -1;
|
||||
}
|
||||
result->syscap[pcidPriSyscapInfo.ossyscapFlag + prisyscapFlag] = temp;
|
||||
|
||||
+21
-1
@@ -249,8 +249,13 @@ int32_t CreatePCID(char *inputFile, char *outDirPath)
|
||||
uint32_t privateCapSize, osCapSize;
|
||||
uint32_t contextBufLen;
|
||||
char *contextBuffer = NULL;
|
||||
cJSON *allOsSyscapObj = CreateWholeSyscapJsonObj();
|
||||
|
||||
if (inputFile == NULL) {
|
||||
PRINT_ERR("inputFile is null.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
cJSON *allOsSyscapObj = CreateWholeSyscapJsonObj();
|
||||
int32_t ret = GetFileContext(inputFile, &contextBuffer, (uint32_t *)&contextBufLen);
|
||||
if (ret != 0) {
|
||||
PRINT_ERR("GetFileContext failed, input file : %s\n", inputFile);
|
||||
@@ -482,6 +487,11 @@ int32_t DecodePCID(char *inputFile, char *outDirPath)
|
||||
freePcidJsonInfo.sysCapObj = NULL;
|
||||
freePcidJsonInfo.flag = 0;
|
||||
|
||||
if (inputFile == NULL) {
|
||||
PRINT_ERR("inputFile is null.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = GetFileContext(inputFile, &freePcidJsonInfo.contextBuffer, (uint32_t *)&contextBufLen);
|
||||
if (ret != 0) {
|
||||
PRINT_ERR("GetFileContext failed, input file : %s\n", inputFile);
|
||||
@@ -693,6 +703,10 @@ static int32_t AddPriSyscapToJsonObj(char *priSyscapString, uint32_t priSyscapSt
|
||||
|
||||
static int32_t GetSyscapStr(char *input, char const *priSyscapStr, uint32_t* osSyscap, uint32_t *pcidHeader)
|
||||
{
|
||||
if (input == NULL) {
|
||||
PRINT_ERR("inputFile is null.\n");
|
||||
return -1;
|
||||
}
|
||||
char *ctx = NULL;
|
||||
uint32_t fileContextLen;
|
||||
if (GetFileContext(input, &ctx, (uint32_t *)&fileContextLen) != 0) {
|
||||
@@ -715,6 +729,7 @@ int32_t DecodeStringPCIDToJson(char *input, char *outDirPath)
|
||||
uint32_t pcidHeader[PCID_HEADER];
|
||||
char *priSyscapStr = NULL;
|
||||
char *jsonBuffer = NULL;
|
||||
|
||||
ret = GetSyscapStr(input, priSyscapStr, osSyscap, pcidHeader);
|
||||
if (ret == -1) {
|
||||
return ret;
|
||||
@@ -872,6 +887,11 @@ int32_t EncodePcidscToString(char *inputFile, char *outDirPath)
|
||||
freePcidInfo.outDirPathFinal = outDirPath;
|
||||
PCIDMain *pcidMain = NULL;
|
||||
|
||||
if (inputFile == NULL) {
|
||||
PRINT_ERR("inputFile is null.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = GetFileContext(inputFile, &freePcidInfo.contextBuffer, (uint32_t *)&bufferLen);
|
||||
if (ret != 0) {
|
||||
PRINT_ERR("Get pcid file failed, pcid file path: %s\n", inputFile);
|
||||
|
||||
+3
-3
@@ -74,9 +74,9 @@ int main(int argc, char **argv)
|
||||
int32_t ret;
|
||||
uint16_t bitMap = 0x0;
|
||||
char curpath[PATH_MAX] = {0};
|
||||
g_customerfileinfo.inputfile = "";
|
||||
g_customerfileinfo.pcidfile = "";
|
||||
g_customerfileinfo.rpcidfile = "";
|
||||
g_customerfileinfo.inputfile = NULL;
|
||||
g_customerfileinfo.pcidfile = NULL;
|
||||
g_customerfileinfo.rpcidfile = NULL;
|
||||
char *outputpath = getcwd(curpath, sizeof(curpath));
|
||||
if (outputpath == NULL) {
|
||||
PRINT_ERR("Get outputpath failed.\n");
|
||||
|
||||
@@ -150,6 +150,11 @@ int32_t RPCIDEncode(char *inputFile, char *outputPath)
|
||||
gJsonObjectSysCap.cjsonObjectRoot = NULL;
|
||||
gJsonObjectSysCap.sysCapPtr = NULL;
|
||||
|
||||
if (inputFile == NULL) {
|
||||
PRINT_ERR("inputFile is null.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (GetFileContext(inputFile, &contextBuffer, &bufferLen) != 0) {
|
||||
PRINT_ERR("GetFileContext failed, input file : %s\n", inputFile);
|
||||
return -1;
|
||||
@@ -262,6 +267,11 @@ int32_t RPCIDDecode(char *inputFile, char *outputPath)
|
||||
char *convertedBuffer = NULL;
|
||||
uint32_t bufferLen;
|
||||
|
||||
if (inputFile == NULL) {
|
||||
PRINT_ERR("inputFile is null.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// check rpcid.sc
|
||||
if (CheckRpcidFormat(inputFile, &contextBuffer, &bufferLen)) {
|
||||
PRINT_ERR("Check rpcid.sc format failed. Input failed: %s\n", inputFile);
|
||||
@@ -480,6 +490,11 @@ int32_t EncodeRpcidscToString(char *inputFile, char *outDirPath)
|
||||
freeAfterEncodeRpcidscInfo.type = 0;
|
||||
freeAfterEncodeRpcidscInfo.flag = 0;
|
||||
|
||||
if (inputFile == NULL) {
|
||||
PRINT_ERR("inputFile is null.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// check rpcid.sc
|
||||
if (CheckRpcidFormat(inputFile, &freeAfterEncodeRpcidscInfo.contextBuffer, &bufferLen) != 0) {
|
||||
PRINT_ERR("Check rpcid.sc format failed. Input file: %s\n", inputFile);
|
||||
@@ -699,6 +714,11 @@ int32_t ComparePcidWithRpcidString(char *pcidFile, char *rpcidFile, uint32_t typ
|
||||
uint32_t pcidOsArray[PCID_OUT_BUFFER] = {0};
|
||||
uint32_t rpcidOsAarry[PCID_OUT_BUFFER] = {0};
|
||||
|
||||
if (pcidFile == NULL || rpcidFile == NULL) {
|
||||
PRINT_ERR("pcidFile or rpcidFile is null.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (type == TYPE_FILE) {
|
||||
if (GetFileContext(pcidFile, &pcidContent, &pcidContentLen)) {
|
||||
PRINT_ERR("Get pcid file context failed, input file : %s\n", pcidFile);
|
||||
|
||||
Reference in New Issue
Block a user