fix: modify syscap_define.h and clear compile warnings.

Signed-off-by: yudechen <chenyude@huawei.com>
Change-Id: I1e5abe8d15aa4096d2c48621a7fdb790c0dd4697
This commit is contained in:
yudechen
2022-07-21 11:47:27 +08:00
parent 694aac0706
commit b5c4769a6e
4 changed files with 12 additions and 9 deletions
+3
View File
@@ -1 +1,4 @@
v1.1.2 add syscap "SystemCapability.ArkUI.UiAppearance".
v1.1.1 add compare string pcid with rpcid function.
v1.1.0 add encode/decode string format PCID/RPCID.
v1.0.0 first release.
+3 -2
View File
@@ -25,13 +25,12 @@ typedef struct SystemCapabilityWithNum {
uint16_t num;
} SyscapWithNum;
/* add last */
/* New syscap index must be added last */
typedef enum SystemCapabilityNum {
ACCOUNT_APPACCOUNT,
ACCOUNT_OSACCOUNT,
ACE_ACEENGINELITE,
ACE_UIAPPEARANCE,
ARKUI_UIAPPEARANCE,
AI_AIENGINE,
APPLICATIONS_CONTACTSDATA,
BARRIERFREE_ACCESSIBILITY_CORE,
@@ -178,6 +177,8 @@ typedef enum SystemCapabilityNum {
USERIAM_USERAUTH_FINGERPRINTAUTH,
USERIAM_USERAUTH_PINAUTH,
USERIAM_USERIDM,
ARKUI_UIAPPEARANCE,
// Add here
SYSCAP_NUM_MAX = 960
} SyscapNum;
+5 -6
View File
@@ -60,7 +60,6 @@ static char* getSystemCapability()
{
bool retBool;
int retError, priOutputLen, priCapArrayCnt, sumLen;
int i = 0;
char osOutput[SINGLE_SYSCAP_LEN] = {};
errno_t err = EOK;
uint32_t *osCapU32 = nullptr;
@@ -82,7 +81,7 @@ static char* getSystemCapability()
}
osCapU32 = reinterpret_cast<uint32_t *>(osOutput);
for (i = 0; i < PCID_MAIN_U32; i++) { // 2, header of pcid.sc
for (size_t i = 0; i < PCID_MAIN_U32; i++) { // 2, header of pcid.sc
retError = sprintf_s(osCapArray[i], U32_TO_STR_MAX_LEN, "%u", osCapU32[i]);
if (retError == -1) {
PRINT_ERR("get uint32_t syscap string failed.");
@@ -98,10 +97,10 @@ static char* getSystemCapability()
// calculate all string length
sumLen = 0;
for (i = 0; i < PCID_MAIN_U32; i++) {
for (size_t i = 0; i < PCID_MAIN_U32; i++) {
sumLen += strlen(osCapArray[i]);
}
for (i = 0; i < priCapArrayCnt; i++) {
for (int i = 0; i < priCapArrayCnt; i++) {
sumLen += strlen(*(priCapArray + i));
}
sumLen += (PCID_MAIN_U32 + priCapArrayCnt + 1); // split with ','
@@ -121,7 +120,7 @@ static char* getSystemCapability()
}
temp = *osCapArray;
for (i = 1; i < PCID_MAIN_U32; i++) {
for (size_t i = 1; i < PCID_MAIN_U32; i++) {
retError = sprintf_s(allSyscapBUffer, sumLen, "%s,%s", temp, osCapArray[i]);
if (retError == -1) {
PRINT_ERR("splicing os syscap string failed.");
@@ -131,7 +130,7 @@ static char* getSystemCapability()
}
temp = allSyscapBUffer;
}
for (i = 0; i < priCapArrayCnt; i++) {
for (int i = 0; i < priCapArrayCnt; i++) {
retError = sprintf_s(allSyscapBUffer, sumLen, "%s,%s", temp, *(priCapArray + i));
if (retError == -1) {
PRINT_ERR("splicing pri syscap string failed.");
+1 -1
View File
@@ -29,7 +29,7 @@
printf("ERROR: [%s: %d] -> ", __FILE__, __LINE__); \
printf(__VA_ARGS__); \
} while (0)
#define SYSCAP_VERSION "1.1.1"
#define SYSCAP_VERSION "1.1.2"
#define OUTPUT_VERSION_LEN 200
#define ENCODE 0
#define DECODE 1