mirror of
https://gitee.com/openharmony/communication_dsoftbus
synced 2024-11-26 18:30:47 +00:00
fix:code sync
Signed-off-by: quyh <quyihao@huawei.com>
This commit is contained in:
parent
9206b938ce
commit
18ba36dd53
6
Kconfig
6
Kconfig
@ -39,12 +39,6 @@ config dsoftbus_feature_conn_br
|
||||
help
|
||||
Answer Y to enable connection with br
|
||||
|
||||
config dsoftbus_feature_conn_wifi
|
||||
bool "Enable connection with wifi"
|
||||
default n
|
||||
help
|
||||
Answer Y to enable connection with wifi
|
||||
|
||||
config dsoftbus_feature_conn_ble
|
||||
bool "Enable connection with ble"
|
||||
default n
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2022-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
# Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
@ -297,7 +297,7 @@ static void InstSetUdidForRemoteInfoByUuid(InstantRemoteInfo *remoteInfo)
|
||||
COMM_LOGE(COMM_DFX, "invalid param");
|
||||
return;
|
||||
}
|
||||
NodeInfo nodeInfo = { 0 };
|
||||
NodeInfo nodeInfo = { { 0 } };
|
||||
if (LnnGetRemoteNodeInfoById(remoteInfo->uuid.c_str(), CATEGORY_UUID, &nodeInfo) == SOFTBUS_OK) {
|
||||
(void)InstSetPeerDeviceIdForRemoteInfo(remoteInfo->udid, nodeInfo.deviceInfo.deviceUdid);
|
||||
}
|
||||
@ -309,7 +309,7 @@ static void InstSetUuidForRemoteInfoByUdid(InstantRemoteInfo *remoteInfo)
|
||||
COMM_LOGE(COMM_DFX, "invalid param");
|
||||
return;
|
||||
}
|
||||
NodeInfo nodeInfo = { 0 };
|
||||
NodeInfo nodeInfo = { { 0 } };
|
||||
if (LnnGetRemoteNodeInfoById(remoteInfo->udid.c_str(), CATEGORY_UDID, &nodeInfo) == SOFTBUS_OK) {
|
||||
(void)InstSetPeerDeviceIdForRemoteInfo(remoteInfo->uuid, nodeInfo.uuid);
|
||||
}
|
||||
@ -839,7 +839,7 @@ static void InstUpdateRemoteInfoByLnn(InstantRemoteInfo *remoteInfo, NodeBasicIn
|
||||
if (remoteInfo == NULL || info == NULL) {
|
||||
return;
|
||||
}
|
||||
NodeInfo nodeInfo = { 0 };
|
||||
NodeInfo nodeInfo = { { 0 } };
|
||||
if (LnnGetRemoteNodeInfoById(info->networkId, CATEGORY_NETWORK_ID, &nodeInfo) == SOFTBUS_OK) {
|
||||
remoteInfo->udid = std::string(nodeInfo.deviceInfo.deviceUdid);
|
||||
remoteInfo->uuid = std::string(nodeInfo.uuid);
|
||||
|
@ -211,18 +211,18 @@ bool AddStringToJsonObject(cJSON *json, const char * const string, const char *v
|
||||
|
||||
bool AddStringArrayToJsonObject(cJSON *json, const char * const string, const char * const *strings, int32_t count)
|
||||
{
|
||||
COMM_CHECK_AND_RETURN_RET_LOGE(json != NULL && string != NULL && strings != NULL, false, COMM_EVENT,
|
||||
COMM_CHECK_AND_RETURN_RET_LOGE(json != NULL && string != NULL && strings != NULL, false, COMM_UTILS,
|
||||
"param is null");
|
||||
COMM_CHECK_AND_RETURN_RET_LOGE(count > 0, false, COMM_EVENT, "count <= 0");
|
||||
COMM_CHECK_AND_RETURN_RET_LOGE(count > 0, false, COMM_UTILS, "count <= 0");
|
||||
|
||||
cJSON *item = cJSON_CreateStringArray(strings, count);
|
||||
if (item == NULL) {
|
||||
COMM_LOGE(COMM_EVENT, "Cannot create cJSON string array object. string=%{public}s", string);
|
||||
COMM_LOGE(COMM_UTILS, "Cannot create cJSON string array object. string=%{public}s", string);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!cJSON_AddItemToObject(json, string, item)) {
|
||||
COMM_LOGE(COMM_EVENT, "Cannot add string array object to json. string=%{public}s", string);
|
||||
COMM_LOGE(COMM_UTILS, "Cannot add string array object to json. string=%{public}s", string);
|
||||
cJSON_Delete(item);
|
||||
return false;
|
||||
}
|
||||
@ -314,23 +314,23 @@ char *GetDynamicStringItemByJsonObject(const cJSON * const json, const char * co
|
||||
|
||||
cJSON *item = cJSON_GetObjectItemCaseSensitive(json, string);
|
||||
if (item == NULL || !cJSON_IsString(item)) {
|
||||
COMM_LOGD(COMM_EVENT, "Cannot find or invalid string. string=%{public}s", string);
|
||||
COMM_LOGD(COMM_UTILS, "Cannot find or invalid string. string=%{public}s", string);
|
||||
return NULL;
|
||||
}
|
||||
uint32_t length = strlen(item->valuestring);
|
||||
if (length > limit) {
|
||||
COMM_LOGE(COMM_EVENT,
|
||||
COMM_LOGE(COMM_UTILS,
|
||||
"key length is large than limit. string=%{public}s, length=%{public}u, limit=%{public}u", string, length,
|
||||
limit);
|
||||
return NULL;
|
||||
}
|
||||
char *value = SoftBusCalloc(length + 1);
|
||||
if (value == NULL) {
|
||||
COMM_LOGE(COMM_EVENT, "malloc failed, length=%{public}u", length);
|
||||
COMM_LOGE(COMM_UTILS, "malloc failed, length=%{public}u", length);
|
||||
return NULL;
|
||||
}
|
||||
if (strcpy_s(value, length + 1, item->valuestring) != EOK) {
|
||||
COMM_LOGE(COMM_EVENT, "copy failed, length=%{public}u", length);
|
||||
COMM_LOGE(COMM_UTILS, "copy failed, length=%{public}u", length);
|
||||
SoftBusFree(value);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -18,8 +18,8 @@
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
|
||||
#include "convert/conn_event_converter.h"
|
||||
#include "convert/conn_audit_converter.h"
|
||||
#include "convert/conn_event_converter.h"
|
||||
#include "hisysevent_c.h"
|
||||
#include "softbus_event.h"
|
||||
|
||||
|
@ -47,6 +47,7 @@ static void DoJsonUtilsFuzz(const char *data)
|
||||
AddStringToJsonObject(object, "name", data);
|
||||
int32_t age = *(reinterpret_cast<const int32_t *>(data));
|
||||
AddNumberToJsonObject(object, "age", age);
|
||||
cJSON_Delete(object);
|
||||
}
|
||||
} // namespace OHOS
|
||||
|
||||
|
@ -46,6 +46,10 @@ if (defined(ohos_lite)) {
|
||||
"$dsoftbus_root_path/core/common:softbus_utils",
|
||||
"$dsoftbus_root_path/core/frame:softbus_server",
|
||||
]
|
||||
external_deps = [
|
||||
"c_utils:utils",
|
||||
"hilog:libhilog",
|
||||
]
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
Loading…
Reference in New Issue
Block a user