mirror of
https://gitee.com/openharmony/startup_init
synced 2025-03-03 01:56:22 +00:00
codex
Signed-off-by: chengjinsong <chengjinsong2@huawei.com>
This commit is contained in:
parent
702e2df0a5
commit
1756b28947
@ -183,7 +183,7 @@ INIT_LOCAL_API int GetDevUdid_(char *udid, int size)
|
||||
return EC_FAILURE;
|
||||
}
|
||||
|
||||
uint32_t len = size;
|
||||
uint32_t len = (uint32_t)size;
|
||||
int ret = SystemGetParameter("const.product.udid", udid, &len);
|
||||
BEGET_CHECK(ret != 0, return ret);
|
||||
|
||||
|
@ -107,13 +107,13 @@ static void SetCallbackWork(napi_env env, StorageAsyncContextPtr asyncContext)
|
||||
napi_create_async_work(
|
||||
env, nullptr, resource,
|
||||
[](napi_env env, void *data) {
|
||||
StorageAsyncContext *asyncContext = (StorageAsyncContext *)data;
|
||||
StorageAsyncContext *asyncContext = reinterpret_cast<StorageAsyncContext *>(data);
|
||||
asyncContext->status = SetParameter(asyncContext->key, asyncContext->value);
|
||||
PARAM_JS_LOGV("JSApp set status: %d, key: '%s', value: '%s'.",
|
||||
asyncContext->status, asyncContext->key, asyncContext->value);
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
StorageAsyncContext *asyncContext = (StorageAsyncContext *)data;
|
||||
StorageAsyncContext *asyncContext = reinterpret_cast<StorageAsyncContext *>(data);
|
||||
napi_value result[ARGC_NUMBER] = { 0 };
|
||||
if (asyncContext->status == 0) {
|
||||
napi_get_undefined(env, &result[0]);
|
||||
@ -139,7 +139,7 @@ static void SetCallbackWork(napi_env env, StorageAsyncContextPtr asyncContext)
|
||||
napi_delete_async_work(env, asyncContext->work);
|
||||
delete asyncContext;
|
||||
},
|
||||
(void *)asyncContext, &asyncContext->work);
|
||||
reinterpret_cast<void *>(asyncContext), &asyncContext->work);
|
||||
napi_queue_async_work(env, asyncContext->work);
|
||||
}
|
||||
|
||||
@ -285,7 +285,7 @@ static void GetCallbackWork(napi_env env, StorageAsyncContextPtr asyncContext)
|
||||
napi_create_async_work(
|
||||
env, nullptr, resource,
|
||||
[](napi_env env, void *data) {
|
||||
StorageAsyncContext *asyncContext = (StorageAsyncContext *)data;
|
||||
StorageAsyncContext *asyncContext = reinterpret_cast<StorageAsyncContext *>(data);
|
||||
std::vector<char> value(MAX_VALUE_LENGTH, 0);
|
||||
asyncContext->status = GetParameter(asyncContext->key,
|
||||
(asyncContext->valueLen == 0) ? nullptr : asyncContext->value, value.data(), MAX_VALUE_LENGTH);
|
||||
@ -294,7 +294,7 @@ static void GetCallbackWork(napi_env env, StorageAsyncContextPtr asyncContext)
|
||||
asyncContext->status, asyncContext->key, asyncContext->getValue.c_str(), asyncContext->value);
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
StorageAsyncContext *asyncContext = (StorageAsyncContext *)data;
|
||||
StorageAsyncContext *asyncContext = reinterpret_cast<StorageAsyncContext *>(data);
|
||||
napi_value result[ARGC_NUMBER] = { 0 };
|
||||
if (asyncContext->status > 0) {
|
||||
napi_get_undefined(env, &result[0]);
|
||||
@ -321,7 +321,7 @@ static void GetCallbackWork(napi_env env, StorageAsyncContextPtr asyncContext)
|
||||
napi_delete_async_work(env, asyncContext->work);
|
||||
delete asyncContext;
|
||||
},
|
||||
(void *)asyncContext, &asyncContext->work);
|
||||
reinterpret_cast<void *>(asyncContext), &asyncContext->work);
|
||||
napi_queue_async_work(env, asyncContext->work);
|
||||
}
|
||||
|
||||
|
@ -570,7 +570,6 @@ class GenBpfPolicy:
|
||||
|
||||
return bpf_policy
|
||||
|
||||
#parse (argn & mask) == value
|
||||
def compile_mask_equal_atom(self, atom, cur_size):
|
||||
bpf_policy = []
|
||||
left_brace_pos = atom.find('(')
|
||||
|
@ -20,7 +20,6 @@
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int ret = 0;
|
||||
int sockFd = GetControlSocket("serversock");
|
||||
if (sockFd < 0) {
|
||||
INIT_LOGE("Failed to get server socket");
|
||||
@ -28,8 +27,7 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
char buffer[MAX_BUFFER_SIZE] = { 0 };
|
||||
while (1) {
|
||||
ret = read(sockFd, buffer, sizeof(buffer) - 1);
|
||||
if (ret > 0) {
|
||||
if (read(sockFd, buffer, sizeof(buffer) - 1) > 0) {
|
||||
INIT_LOGI("Read message: %s", buffer);
|
||||
(void)memset_s(buffer, MAX_BUFFER_SIZE, 0, MAX_BUFFER_SIZE);
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ namespace OHOS {
|
||||
CloseStdout();
|
||||
Cookie instance = {0, nullptr};
|
||||
Cookie *cookie = &instance;
|
||||
if (size <= 0) {
|
||||
if (size == 0) {
|
||||
return false;
|
||||
}
|
||||
if (size > PARAM_CONST_VALUE_LEN_MAX + PARAM_NAME_LEN_MAX) {
|
||||
|
@ -198,8 +198,8 @@ public:
|
||||
LE_BaseInfo info = {TASK_EVENT, NULL};
|
||||
int testfd = 65535; // 65535 is not exist fd
|
||||
BaseTask *task = CreateTask(LE_GetDefaultLoop(), testfd, &info, sizeof(StreamClientTask));
|
||||
task->handleEvent = TestHandleTaskEvent;
|
||||
if (task != nullptr) {
|
||||
task->handleEvent = TestHandleTaskEvent;
|
||||
ProcessEvent((EventLoop *)LE_GetDefaultLoop(), testfd, Event_Read);
|
||||
}
|
||||
((HashTab *)(((EventLoop *)LE_GetDefaultLoop())->taskMap))->nodeFree(&task->hashNode);
|
||||
|
@ -155,6 +155,7 @@ bool MakeFileByJson(cJSON * mJson, const char *sandboxFileName)
|
||||
int ret1 = write(fd, cjValue1, strlen(cjValue1));
|
||||
if (-1 == ret1) {
|
||||
std::cout << "Write file ERROR" << errno << " fd is :" << fd << std::endl;
|
||||
close(fd);
|
||||
return false;
|
||||
}
|
||||
free(cjValue1);
|
||||
|
@ -110,6 +110,7 @@ static void TestPermission()
|
||||
int ret;
|
||||
|
||||
ParamSecurityOps *paramSecurityOps = GetParamSecurityOps(0);
|
||||
EXPECT_NE(paramSecurityOps, nullptr);
|
||||
paramSecurityOps->securityCheckParamPermission = TestCheckParamPermission;
|
||||
SetTestPermissionResult(DAC_RESULT_FORBIDED);
|
||||
if ((GetParamSecurityLabel() != nullptr)) {
|
||||
|
@ -55,7 +55,7 @@ static int TestGenHashCode(const char *buff)
|
||||
|
||||
static void TestSetSelinuxLogCallback(void) {}
|
||||
|
||||
static const char *forbidWriteParamName[] = {
|
||||
static const char *g_forbidWriteParamName[] = {
|
||||
"ohos.servicectrl.",
|
||||
"test.permission.read",
|
||||
"test.persmission.watch"
|
||||
@ -64,8 +64,8 @@ static const char *forbidWriteParamName[] = {
|
||||
static int TestSetParamCheck(const char *paraName, const char *context, const SrcInfo *info)
|
||||
{
|
||||
// forbid to read ohos.servicectrl.
|
||||
for (size_t i = 0; i < ARRAY_LENGTH(forbidWriteParamName); i++) {
|
||||
if (strncmp(paraName, forbidWriteParamName[i], strlen(forbidWriteParamName[i])) == 0) {
|
||||
for (size_t i = 0; i < ARRAY_LENGTH(g_forbidWriteParamName); i++) {
|
||||
if (strncmp(paraName, g_forbidWriteParamName[i], strlen(g_forbidWriteParamName[i])) == 0) {
|
||||
return g_testPermissionResult;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user