Lines Matching refs:freePcidJsonInfo

406 static int32_t CheckSysCapObj(struct FreeDecodePcidJsonInfo freePcidJsonInfo, PCIDMain *pcidMain,
409 if (freePcidJsonInfo.sysCapObj == NULL) {
411 freePcidJsonInfo.flag = -1;
414 if (GetOsSyscap(pcidMain, freePcidJsonInfo.sysCapObj) != 0) {
415 freePcidJsonInfo.flag = -1;
418 if (GetPriSyscap(pcidMain, freePcidJsonInfo.sysCapObj, contextBufLen) != 0) {
419 freePcidJsonInfo.flag = -1;
424 static int32_t CheckJsonRootObj(struct FreeDecodePcidJsonInfo freePcidJsonInfo, PCIDMain *pcidMain, char *systemType)
426 if (!cJSON_AddNumberToObject(freePcidJsonInfo.jsonRootObj, "api_version", NtohsInter(pcidMain->apiVersion))) {
430 if (!cJSON_AddNumberToObject(freePcidJsonInfo.jsonRootObj, "manufacturer_id",
435 if (!cJSON_AddStringToObject(freePcidJsonInfo.jsonRootObj, "system_type", systemType)) {
439 if (!cJSON_AddItemToObject(freePcidJsonInfo.jsonRootObj, "syscap", freePcidJsonInfo.sysCapObj)) {
446 static int32_t FreeAfterDecodePCID(struct FreeDecodePcidJsonInfo freePcidJsonInfo, int32_t type, int32_t ret)
450 cJSON_free(freePcidJsonInfo.strJson);
451 cJSON_Delete(freePcidJsonInfo.jsonRootObj);
452 FreeContextBuffer(freePcidJsonInfo.contextBuffer);
455 cJSON_Delete(freePcidJsonInfo.jsonRootObj);
456 cJSON_Delete(freePcidJsonInfo.sysCapObj);
457 FreeContextBuffer(freePcidJsonInfo.contextBuffer);
460 cJSON_Delete(freePcidJsonInfo.sysCapObj);
461 FreeContextBuffer(freePcidJsonInfo.contextBuffer);
464 cJSON_Delete(freePcidJsonInfo.sysCapObj);
465 FreeContextBuffer(freePcidJsonInfo.contextBuffer);
468 FreeContextBuffer(freePcidJsonInfo.contextBuffer);
477 struct FreeDecodePcidJsonInfo freePcidJsonInfo;
478 freePcidJsonInfo.strJson = NULL;
479 freePcidJsonInfo.contextBuffer = NULL;
480 freePcidJsonInfo.jsonRootObj = NULL;
481 freePcidJsonInfo.sysCapObj = NULL;
482 freePcidJsonInfo.flag = 0;
484 ret = CheckFileAndGetFileContext(inputFile, &freePcidJsonInfo.contextBuffer, (uint32_t *)&contextBufLen);
489 PCIDMain *pcidMain = (PCIDMain *)freePcidJsonInfo.contextBuffer;
494 return FreeAfterDecodePCID(freePcidJsonInfo, FREE_DECODE_PCID_CONTEXT_OUT, -1);
503 return FreeAfterDecodePCID(freePcidJsonInfo, FREE_DECODE_PCID_CONTEXT_OUT, -1);
507 freePcidJsonInfo.sysCapObj = cJSON_CreateObject();
508 ret = CheckSysCapObj(freePcidJsonInfo, pcidMain, contextBufLen, ret);
509 if (freePcidJsonInfo.flag == -1) {
510 return FreeAfterDecodePCID(freePcidJsonInfo, FREE_DECODE_PCID_CONTEXT_OUT, ret);
514 freePcidJsonInfo.jsonRootObj = cJSON_CreateObject();
515 if (freePcidJsonInfo.jsonRootObj == NULL) {
517 return FreeAfterDecodePCID(freePcidJsonInfo, FREE_DECODE_PCID_SYSCAP_OUT, -1);
520 ret = CheckJsonRootObj(freePcidJsonInfo, pcidMain, systemType);
522 return FreeAfterDecodePCID(freePcidJsonInfo, FREE_DECODE_PCID_ROOT_OUT, ret);
525 freePcidJsonInfo.strJson = cJSON_Print(freePcidJsonInfo.jsonRootObj);
528 ret = ConvertedContextSaveAsFile(outDirPath, outputFileName, freePcidJsonInfo.strJson,
529 strlen(freePcidJsonInfo.strJson));
533 return FreeAfterDecodePCID(freePcidJsonInfo, FREE_DECODE_PCID_CONVERT_OUT, ret);