From c93db5f1b84687c00622ef8644a6d07c80c0a372 Mon Sep 17 00:00:00 2001 From: yudechen Date: Thu, 21 Jul 2022 11:47:27 +0800 Subject: [PATCH] fix: modify syscap_define.h and clear compile warnings. Signed-off-by: yudechen Change-Id: I1e5abe8d15aa4096d2c48621a7fdb790c0dd4697 Signed-off-by: yudechen --- RELEASE-NOTE.txt | 3 +++ include/syscap_define.h | 4 +++- napi/napi_query_syscap.cpp | 11 +++++------ src/main.c | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/RELEASE-NOTE.txt b/RELEASE-NOTE.txt index d24a011..08c9e97 100644 --- a/RELEASE-NOTE.txt +++ b/RELEASE-NOTE.txt @@ -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. \ No newline at end of file diff --git a/include/syscap_define.h b/include/syscap_define.h index 9e1c899..6c50287 100644 --- a/include/syscap_define.h +++ b/include/syscap_define.h @@ -25,7 +25,7 @@ typedef struct SystemCapabilityWithNum { uint16_t num; } SyscapWithNum; -/* add last */ +/* New syscap index must be added last */ typedef enum SystemCapabilityNum { ACCOUNT_APPACCOUNT, ACCOUNT_OSACCOUNT, @@ -177,6 +177,8 @@ typedef enum SystemCapabilityNum { USERIAM_USERAUTH_FINGERPRINTAUTH, USERIAM_USERAUTH_PINAUTH, USERIAM_USERIDM, + ARKUI_UIAPPEARANCE, + // Add here SYSCAP_NUM_MAX = 960 } SyscapNum; diff --git a/napi/napi_query_syscap.cpp b/napi/napi_query_syscap.cpp index 8228f6e..09dc080 100644 --- a/napi/napi_query_syscap.cpp +++ b/napi/napi_query_syscap.cpp @@ -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(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."); diff --git a/src/main.c b/src/main.c index 3b3c9d1..72372c4 100644 --- a/src/main.c +++ b/src/main.c @@ -29,7 +29,7 @@ printf("ERROR: [%s: %d] -> ", __FILE__, __LINE__); \ printf(__VA_ARGS__); \ } while (0) -#define SYSCAP_VERSION "1.0.1" +#define SYSCAP_VERSION "1.1.2" #define OUTPUT_VERSION_LEN 200 #define ENCODE 0 #define DECODE 1 -- Gitee