mirror of
https://github.com/openharmony/developtools_syscap_codec.git
synced 2026-08-27 10:21:25 -04:00
change global variable arraySyscap to g_arraySyscap.
Signed-off-by: yudechen <chenyude@huawei.com> Change-Id: Ia723dfc0bb1d78500e57ae823f33978c81ebd36b
This commit is contained in:
@@ -21,7 +21,7 @@
|
|||||||
#define SINGLE_SYSCAP_LEN (256 + 17)
|
#define SINGLE_SYSCAP_LEN (256 + 17)
|
||||||
|
|
||||||
typedef struct SystemCapabilityWithNum {
|
typedef struct SystemCapabilityWithNum {
|
||||||
char syscapStr[SINGLE_SYSCAP_LEN];
|
char str[SINGLE_SYSCAP_LEN];
|
||||||
uint16_t num;
|
uint16_t num;
|
||||||
} SyscapWithNum;
|
} SyscapWithNum;
|
||||||
|
|
||||||
@@ -181,7 +181,7 @@ typedef enum SystemCapabilityNum {
|
|||||||
} SyscapNum;
|
} SyscapNum;
|
||||||
|
|
||||||
/* sort by enum */
|
/* sort by enum */
|
||||||
const static SyscapWithNum arraySyscap[] = {
|
const static SyscapWithNum g_arraySyscap[] = {
|
||||||
{"SystemCapability.Account.AppAccount", ACCOUNT_APPACCOUNT},
|
{"SystemCapability.Account.AppAccount", ACCOUNT_APPACCOUNT},
|
||||||
{"SystemCapability.Account.OsAccount", ACCOUNT_OSACCOUNT},
|
{"SystemCapability.Account.OsAccount", ACCOUNT_OSACCOUNT},
|
||||||
{"SystemCapability.Ace.UiAppearance", ACE_UIAPPEARANCE},
|
{"SystemCapability.Ace.UiAppearance", ACE_UIAPPEARANCE},
|
||||||
|
|||||||
@@ -219,9 +219,9 @@ bool DecodeOsSyscap(const char input[PCID_MAIN_BYTES], char (**output)[SINGLE_SY
|
|||||||
*output = strSyscap;
|
*output = strSyscap;
|
||||||
|
|
||||||
for (i = 0; i < countOfSyscap; i++) {
|
for (i = 0; i < countOfSyscap; i++) {
|
||||||
for (j = 0; j < sizeof(arraySyscap) / sizeof(SyscapWithNum); j++) {
|
for (j = 0; j < sizeof(g_arraySyscap) / sizeof(SyscapWithNum); j++) {
|
||||||
if (arraySyscap[j].num == indexOfSyscap[i]) {
|
if (g_arraySyscap[j].num == indexOfSyscap[i]) {
|
||||||
nRet = strcpy_s(*strSyscap, SINGLE_SYSCAP_LEN, arraySyscap[j].syscapStr);
|
nRet = strcpy_s(*strSyscap, SINGLE_SYSCAP_LEN, g_arraySyscap[j].str);
|
||||||
if (nRet != EOK) {
|
if (nRet != EOK) {
|
||||||
printf("strcpy_s failed. error = %d\n", nRet);
|
printf("strcpy_s failed. error = %d\n", nRet);
|
||||||
*outputCnt = 0;
|
*outputCnt = 0;
|
||||||
@@ -322,10 +322,10 @@ static int SetOsSysCapBitMap(uint8_t *out, uint16_t outLen, uint16_t *index, uin
|
|||||||
|
|
||||||
static cJSON *CreateWholeSyscapJsonObj(void)
|
static cJSON *CreateWholeSyscapJsonObj(void)
|
||||||
{
|
{
|
||||||
size_t numOfSyscapAll = sizeof(arraySyscap) / sizeof(SyscapWithNum);
|
size_t numOfSyscapAll = sizeof(g_arraySyscap) / sizeof(SyscapWithNum);
|
||||||
cJSON *root = cJSON_CreateObject();
|
cJSON *root = cJSON_CreateObject();
|
||||||
for (size_t i = 0; i < numOfSyscapAll; i++) {
|
for (size_t i = 0; i < numOfSyscapAll; i++) {
|
||||||
cJSON_AddItemToObject(root, arraySyscap[i].syscapStr, cJSON_CreateNumber(arraySyscap[i].num));
|
cJSON_AddItemToObject(root, g_arraySyscap[i].str, cJSON_CreateNumber(g_arraySyscap[i].num));
|
||||||
}
|
}
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
@@ -592,7 +592,7 @@ int32_t ComparePcidString(const char *pcidString, const char *rpcidString, Compa
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ret = strcpy_s(temp, sizeof(char) * SINGLE_SYSCAP_LEN,
|
ret = strcpy_s(temp, sizeof(char) * SINGLE_SYSCAP_LEN,
|
||||||
arraySyscap[(i - 2) * INT_BIT + k].syscapStr); // 2, header of pcid & rpcid
|
g_arraySyscap[(i - 2) * INT_BIT + k].str); // 2, header of pcid & rpcid
|
||||||
if (ret != EOK) {
|
if (ret != EOK) {
|
||||||
PRINT_ERR("strcpy_s failed.\n");
|
PRINT_ERR("strcpy_s failed.\n");
|
||||||
FreeCompareError(result);
|
FreeCompareError(result);
|
||||||
|
|||||||
+10
-10
@@ -158,10 +158,10 @@ static int32_t ConvertedContextSaveAsFile(char *outDirPath, const char *filename
|
|||||||
|
|
||||||
static cJSON *CreateWholeSyscapJsonObj(void)
|
static cJSON *CreateWholeSyscapJsonObj(void)
|
||||||
{
|
{
|
||||||
size_t numOfSyscapAll = sizeof(arraySyscap) / sizeof(SyscapWithNum);
|
size_t numOfSyscapAll = sizeof(g_arraySyscap) / sizeof(SyscapWithNum);
|
||||||
cJSON *root = cJSON_CreateObject();
|
cJSON *root = cJSON_CreateObject();
|
||||||
for (size_t i = 0; i < numOfSyscapAll; i++) {
|
for (size_t i = 0; i < numOfSyscapAll; i++) {
|
||||||
cJSON_AddItemToObject(root, arraySyscap[i].syscapStr, cJSON_CreateNumber(arraySyscap[i].num));
|
cJSON_AddItemToObject(root, g_arraySyscap[i].str, cJSON_CreateNumber(g_arraySyscap[i].num));
|
||||||
}
|
}
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
@@ -393,9 +393,9 @@ int32_t DecodePCID(char *inputFile, char *outDirPath)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = 0; i < countOfSyscap; i++) {
|
for (i = 0; i < countOfSyscap; i++) {
|
||||||
for (j = 0; j < sizeof(arraySyscap) / sizeof(SyscapWithNum); j++) {
|
for (j = 0; j < sizeof(g_arraySyscap) / sizeof(SyscapWithNum); j++) {
|
||||||
if (arraySyscap[j].num == indexOfSyscap[i]) {
|
if (g_arraySyscap[j].num == indexOfSyscap[i]) {
|
||||||
if (!cJSON_AddItemToArray(capVectorPtr, cJSON_CreateString(arraySyscap[j].syscapStr))) {
|
if (!cJSON_AddItemToArray(capVectorPtr, cJSON_CreateString(g_arraySyscap[j].str))) {
|
||||||
printf("cJSON_AddItemToArray or cJSON_CreateString failed\n");
|
printf("cJSON_AddItemToArray or cJSON_CreateString failed\n");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto FREE_VECTOR_OUT;
|
goto FREE_VECTOR_OUT;
|
||||||
@@ -614,11 +614,11 @@ static int32_t AddOsSyscapToJsonObj(uint32_t *osSyscapArray, uint32_t osSyscapAr
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < osSyscapCount; i++) {
|
for (i = 0; i < osSyscapCount; i++) {
|
||||||
for (j = 0; j < sizeof(arraySyscap) / sizeof(SyscapWithNum); j++) {
|
for (j = 0; j < sizeof(g_arraySyscap) / sizeof(SyscapWithNum); j++) {
|
||||||
if (index[i] != arraySyscap[j].num) {
|
if (index[i] != g_arraySyscap[j].num) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!cJSON_AddItemToArray(sysCapArray, cJSON_CreateString(arraySyscap[j].syscapStr))) {
|
if (!cJSON_AddItemToArray(sysCapArray, cJSON_CreateString(g_arraySyscap[j].str))) {
|
||||||
PRINT_ERR("Add os syscap string to json failed.\n");
|
PRINT_ERR("Add os syscap string to json failed.\n");
|
||||||
free(sysCapArray);
|
free(sysCapArray);
|
||||||
return -1;
|
return -1;
|
||||||
@@ -732,8 +732,8 @@ PARSE_FAILED:
|
|||||||
int32_t EncodePcidscToString(char *inputFile, char *outDirPath)
|
int32_t EncodePcidscToString(char *inputFile, char *outDirPath)
|
||||||
{
|
{
|
||||||
int32_t ret = 0;
|
int32_t ret = 0;
|
||||||
size_t bufferLen, privateSyscapLen;
|
size_t bufferLen, privateSyscapLen, outputLen;
|
||||||
uint32_t i, j, outputLen;
|
uint32_t i, j;
|
||||||
uint32_t *mainSyscap = NULL;
|
uint32_t *mainSyscap = NULL;
|
||||||
uint16_t priSyscapCount = 0;
|
uint16_t priSyscapCount = 0;
|
||||||
char *contextBuffer = NULL;
|
char *contextBuffer = NULL;
|
||||||
|
|||||||
+3
-3
@@ -174,10 +174,10 @@ static int32_t ConvertedContextSaveAsFile(char *outDirPath, const char *filename
|
|||||||
|
|
||||||
static cJSON *CreateWholeSyscapJsonObj(void)
|
static cJSON *CreateWholeSyscapJsonObj(void)
|
||||||
{
|
{
|
||||||
size_t numOfSyscapAll = sizeof(arraySyscap) / sizeof(SyscapWithNum);
|
size_t numOfSyscapAll = sizeof(g_arraySyscap) / sizeof(SyscapWithNum);
|
||||||
cJSON *root = cJSON_CreateObject();
|
cJSON *root = cJSON_CreateObject();
|
||||||
for (size_t i = 0; i < numOfSyscapAll; i++) {
|
for (size_t i = 0; i < numOfSyscapAll; i++) {
|
||||||
cJSON_AddItemToObject(root, arraySyscap[i].syscapStr, cJSON_CreateNumber(arraySyscap[i].num));
|
cJSON_AddItemToObject(root, g_arraySyscap[i].str, cJSON_CreateNumber(g_arraySyscap[i].num));
|
||||||
}
|
}
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
@@ -699,7 +699,7 @@ int32_t ComparePcidWithRpcidString(char *pcidFile, char *rpcidFile)
|
|||||||
for (uint8_t k = 0; k < INT_BIT; k++) {
|
for (uint8_t k = 0; k < INT_BIT; k++) {
|
||||||
if (temp2 & (0x1 << k)) {
|
if (temp2 & (0x1 << k)) {
|
||||||
// 2, header of pcid & rpcid
|
// 2, header of pcid & rpcid
|
||||||
printf("Missing: %s\n", arraySyscap[(i - 2) * INT_BIT + k].syscapStr);
|
printf("Missing: %s\n", g_arraySyscap[(i - 2) * INT_BIT + k].str);
|
||||||
ossyscapFlag += 1;
|
ossyscapFlag += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user