fix bugs of logs

Signed-off-by: duxbbo <duxiaobo@huawei.com>
Change-Id: I6af50b5b8548f90f73da2617ce18cd888b32c900
This commit is contained in:
duxbbo 2022-04-28 02:36:16 +00:00
parent 624c61963e
commit e373e06007
16 changed files with 65 additions and 52 deletions

View File

@ -426,7 +426,7 @@ static void DeleteAuth(AuthManager *auth)
SoftBusFree(auth->encryptDevData);
auth->encryptDevData = NULL;
}
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "delete auth manager, authId is %lld", auth->authId);
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "delete auth manager, authId is %" PRId64, auth->authId);
SoftBusFree(auth);
(void)SoftBusMutexUnlock(&g_authLock);
}
@ -451,11 +451,11 @@ int32_t AuthHandleLeaveLNN(int64_t authId)
AuthManager *auth = NULL;
auth = AuthGetManagerByAuthId(authId);
if (auth == NULL) {
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "no match auth(%llu) found, AuthHandleLeaveLNN failed",
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "no match auth(%" PRId64 ") found, AuthHandleLeaveLNN failed",
authId);
return SOFTBUS_ERR;
}
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "auth handle leave LNN, authId is %lld", authId);
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "auth handle leave LNN, authId is %" PRId64, authId);
if (SoftBusMutexLock(&g_authLock) != 0) {
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "lock mutex failed");
return SOFTBUS_ERR;
@ -528,7 +528,7 @@ static AuthManager *InitClientAuthManager(AuthVerifyModule moduleId, const Conne
}
ListNodeInsert(&g_authClientHead, &auth->node);
(void)SoftBusMutexUnlock(&g_authLock);
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "create auth as client side, authId = %lld.", auth->authId);
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "create auth as client side, authId = %" PRId64 ".", auth->authId);
return auth;
}
@ -571,7 +571,7 @@ int64_t AuthVerifyDevice(AuthVerifyModule moduleId, const ConnectionAddr *addr)
(void)AuthHandleLeaveLNN(auth->authId);
return SOFTBUS_ERR;
}
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "start authentication process, authId is %lld", auth->authId);
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "start authentication process, authId is %" PRId64, auth->authId);
return auth->authId;
}
@ -657,10 +657,11 @@ static void AuthOnSessionKeyReturned(int64_t authId, const uint8_t *sessionKey,
}
AuthManager *auth = AuthGetManagerByAuthId(authId);
if (auth == NULL) {
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "no match auth(%llu) found on sessionkey returned", authId);
SoftBusLog(
SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "no match auth(%" PRId64 ") found on sessionkey returned", authId);
return;
}
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "auth get session key succ, authId is %lld", authId);
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "auth get session key succ, authId is %" PRId64, authId);
NecessaryDevInfo devInfo = {0};
if (AuthGetDeviceKey(devInfo.deviceKey, MAX_DEVICE_KEY_LEN, &devInfo.deviceKeyLen, &auth->option) != SOFTBUS_OK) {
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "auth get device key failed");
@ -736,7 +737,7 @@ static void TryRemoveOldAuthManager(const AuthManager *auth, bool isClientSide)
SoftBusFree(item->encryptDevData);
item->encryptDevData = NULL;
}
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "remove old auth manager, authId = %lld", item->authId);
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "remove old auth manager, authId = %" PRId64, item->authId);
SoftBusFree(item);
}
}
@ -753,7 +754,8 @@ static void TryRemoveConnection(const AuthManager *auth)
return;
}
if (auth->option.type == CONNECT_BLE && auth->side == CLIENT_SIDE_FLAG) {
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "try remove ble connection, authId = %lld.", auth->authId);
SoftBusLog(
SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "try remove ble connection, authId = %" PRId64 ".", auth->authId);
if (ConnDisconnectDevice(auth->connectionId) != SOFTBUS_OK) {
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "disconnect ble device fail.");
}
@ -763,18 +765,18 @@ static void TryRemoveConnection(const AuthManager *auth)
static void ReceiveCloseAck(AuthManager *auth)
{
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO,
"receive close ack, status = %d, connType = %d, authId = %lld.",
"receive close ack, status = %" PRIu8", connType = %d, authId = %" PRId64 ".",
auth->status, auth->option.type, auth->authId);
if (auth->status == WAIT_CLOSE_ACK) {
EventRemove(auth->id);
auth->status = AUTH_PASSED;
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "auth passed, authId = %lld.", auth->authId);
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "auth passed, authId = %" PRId64 ".", auth->authId);
if (auth->cb->onDeviceVerifyPass != NULL) {
auth->cb->onDeviceVerifyPass(auth->authId);
}
TryRemoveConnection(auth);
} else {
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "close ack received before device info, authId = %lld.",
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "close ack received before device info, authId = %" PRId64 ".",
auth->authId);
auth->status = WAIT_PEER_DEV_INFO;
}
@ -790,7 +792,7 @@ static void AuthReportSyncDeviceInfoResults(AuthManager *auth, uint8_t *data, ui
/* For WIFI_WLAN device do verfiy, it means verify pass that received device info from peer device. */
EventRemove(auth->id);
auth->status = AUTH_PASSED;
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "auth passed, authId = %lld.", auth->authId);
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "auth passed, authId = %" PRId64 ".", auth->authId);
if (auth->cb->onDeviceVerifyPass != NULL) {
auth->cb->onDeviceVerifyPass(auth->authId);
}
@ -798,20 +800,21 @@ static void AuthReportSyncDeviceInfoResults(AuthManager *auth, uint8_t *data, ui
/* For device info already received from peer device. */
AuthSendCloseAck(auth->connectionId);
auth->status = WAIT_CLOSE_ACK;
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "wait close ack from peer device, authId = %lld.", auth->authId);
SoftBusLog(
SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "wait close ack from peer device, authId = %" PRId64 ".", auth->authId);
} else if (auth->status == WAIT_PEER_DEV_INFO) {
/* For close ack already received from peer device. */
AuthSendCloseAck(auth->connectionId);
EventRemove(auth->id);
auth->status = AUTH_PASSED;
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "auth passed, authId = %lld.", auth->authId);
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "auth passed, authId = %" PRId64 ".", auth->authId);
if (auth->cb->onDeviceVerifyPass != NULL) {
auth->cb->onDeviceVerifyPass(auth->authId);
}
TryRemoveConnection(auth);
} else {
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR,
"unexpected auth status, status = %d, authId = %lld.", auth->status, auth->authId);
"unexpected auth status, status = %d, authId = %" PRId64 ".", auth->status, auth->authId);
}
}
@ -944,14 +947,15 @@ static AuthManager *CreateServerAuth(uint32_t connectionId, AuthDataInfo *authDa
auth->option = option;
ListNodeInsert(&g_authServerHead, &auth->node);
(void)SoftBusMutexUnlock(&g_authLock);
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "create auth as server side, authId is %lld", auth->authId);
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "create auth as server side, authId is %" PRId64 "", auth->authId);
return auth;
}
static void HandleReceiveData(AuthManager *auth, const AuthDataInfo *info, uint8_t *recvData)
{
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "auth recv data, type = %u, authId = %lld, seq = %lld, flag = %d.",
info->type, auth->authId, info->seq, info->flag);
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO,
"auth recv data, type = %u, authId = %" PRId64 ", seq = %" PRId64 ", flag = %d.", info->type, auth->authId,
info->seq, info->flag);
switch (info->type) {
case DATA_TYPE_DEVICE_ID: {
HandleReceiveDeviceId(auth, recvData);
@ -987,7 +991,7 @@ void AuthOnDataReceived(uint32_t connectionId, ConnModule moduleId, int64_t seq,
return;
}
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO,
"auth receive data, connectionId is %u, moduleId is %d, seq is %lld", connectionId, moduleId, seq);
"auth receive data, connectionId is %u, moduleId is %d, seq is %" PRId64 "", connectionId, moduleId, seq);
AuthDataInfo info = {0};
if (AnalysisData(data, (uint32_t)len, &info) != SOFTBUS_OK) {
return;
@ -1019,7 +1023,7 @@ static void AuthOnError(int64_t authId, int operationCode, int errorCode, const
AuthManager *auth = NULL;
auth = AuthGetManagerByAuthId(authId);
if (auth == NULL) {
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "no match auth(%llu) found, AuthOnError failed", authId);
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "no match auth(%" PRId64 ") found, AuthOnError failed", authId);
return;
}
AuthHandleFail(auth, SOFTBUS_AUTH_HICHAIN_AUTH_ERROR);
@ -1032,7 +1036,8 @@ static char *AuthOnRequest(int64_t authReqId, int authForm, const char *reqParam
AuthManager *auth = NULL;
auth = AuthGetManagerByAuthId(authReqId);
if (auth == NULL) {
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "no match auth(%llu) found, AuthOnRequest failed", authReqId);
SoftBusLog(
SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "no match auth(%" PRId64 ") found, AuthOnRequest failed", authReqId);
return NULL;
}
cJSON *msg = cJSON_CreateObject();
@ -1572,7 +1577,7 @@ static int32_t AuthOpenWifiConn(const AuthConnInfo *info, uint32_t requestId, co
item->option.info.ipOption.port == info->info.ipInfo.port) {
authId = item->authId;
(void)SoftBusMutexUnlock(&g_authLock);
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "open wifi conn succ, authId = %lld.", item->authId);
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "open wifi conn succ, authId = %" PRId64 ".", item->authId);
callback->onConnOpened(requestId, authId);
return SOFTBUS_OK;
}
@ -1585,7 +1590,7 @@ static int32_t AuthOpenWifiConn(const AuthConnInfo *info, uint32_t requestId, co
item->option.info.ipOption.port == info->info.ipInfo.port) {
authId = item->authId;
(void)SoftBusMutexUnlock(&g_authLock);
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "open wifi conn succ, authId = %lld.", item->authId);
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "open wifi conn succ, authId = %" PRId64 ".", item->authId);
callback->onConnOpened(requestId, authId);
return SOFTBUS_OK;
}
@ -1747,7 +1752,7 @@ static int32_t AuthOpenCommonConn(const AuthConnInfo *info, uint32_t requestId,
DeleteAuth(auth);
return SOFTBUS_ERR;
}
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "open common conn started, type = %d, authId = %lld.",
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "open common conn started, type = %d, authId = %" PRId64 ".",
info->type, auth->authId);
return SOFTBUS_OK;
}
@ -1821,7 +1826,7 @@ int32_t AuthOpenConn(const AuthConnInfo *info, uint32_t requestId, const AuthCon
void AuthCloseConn(int64_t authId)
{
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "auth close conn, authId = %lld.", authId);
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "auth close conn, authId = %" PRId64 ".", authId);
AuthManager *auth = AuthGetManagerByAuthId(authId);
if (auth == NULL) {
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "auth manager not exist.");
@ -1908,7 +1913,7 @@ static AuthManager *GetAuthManagerInner(int64_t authId)
return item;
}
}
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "auth manager not found inner, authId = %lld.", authId);
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "auth manager not found inner, authId = %" PRId64 ".", authId);
return NULL;
}
@ -1945,7 +1950,7 @@ int32_t AuthSetP2pMac(int64_t authId, const char *mac)
AuthManager *auth = GetAuthManagerInner(authId);
if (auth == NULL) {
(void)SoftBusMutexUnlock(&g_authLock);
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "auth not found, authId = %lld.", authId);
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "auth not found, authId = %" PRId64 ".", authId);
return SOFTBUS_ERR;
}
if (strcpy_s(auth->peerP2pMac, sizeof(auth->peerP2pMac), mac) != EOK) {

View File

@ -342,7 +342,7 @@ static void TransactIpSubnetState(LnnPhysicalSubnet *subnet, SubnetManagerEvent
[SUBNET_MANAGER_EVENT_IF_CHANGED] = {LNN_SUBNET_RESETTING, subnet->status }
};
subnet->status = transactMap[event][isAccepted ? EVENT_RESULT_ACCEPTED : EVENT_RESULT_REJECTED];
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_DBG, "subnet [%s, %d] state change to %d", subnet->ifName,
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_DBG, "subnet [%s, %u] state change to %d", subnet->ifName,
subnet->protocolType, subnet->status);
}

View File

@ -101,7 +101,7 @@ static LnnNetIfMgr *NetifMgrFactory(LnnNetIfNameType type, const char *ifName)
return NULL;
}
if (g_netifBuilders[type] == NULL) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "netif type %d not supportted!");
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "netif type %d not supportted!", type);
return NULL;
}
LnnNetIfMgr *netifMgr = g_netifBuilders[type](ifName);

View File

@ -1155,7 +1155,7 @@ int32_t LnnGetLaneCount(int32_t laneId)
int32_t LnnSetLaneCount(int32_t laneId, int32_t num)
{
if (laneId < 0 || laneId >= LNN_LINK_TYPE_BUTT) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "laneId is error! laneId:", laneId);
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "laneId is error! laneId:%d", laneId);
return SOFTBUS_ERR;
}
if (SoftBusMutexLock(&g_distributedNetLedger.lock) != 0) {

View File

@ -75,8 +75,10 @@ if (defined(ohos_lite)) {
]
if (ohos_kernel_type == "liteos_m") {
defines = [ "SOFTBUS_MINI_SYSTEM" ]
defines += [ "__STDC_FORMAT_MACROS" ]
} else {
defines = [ "DEFAULT_STORAGE_PATH=\"/usr\"" ]
defines += [ "__STDC_FORMAT_MACROS" ]
defines += [ "SOFTBUS_SMALL_SYSTEM" ]
}
deps = [ "$dsoftbus_root_path/adapter:softbus_adapter" ]
@ -101,7 +103,7 @@ if (defined(ohos_lite)) {
sources += conn_common_src + trans_common_src
defines = [ "DEFAULT_STORAGE_PATH=\"/data/service/el1/public\"" ]
defines += [ "SOFTBUS_STANDARD_SYSTEM" ]
defines += [ "__STDC_FORMAT_MACROS" ]
if (is_asan) {
defines += [ "ASAN_BUILD" ]
}

View File

@ -17,6 +17,7 @@
#define SOFTBUS_LOG_H
#include <stdint.h>
#include <inttypes.h>
#include "softbus_adapter_log.h"
#ifdef __cplusplus

View File

@ -142,8 +142,9 @@ static void *LoopTask(void *arg)
SoftBusFree(itemNode);
context->msgSize--;
if (looper->dumpable) {
SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_DBG, "LoopTask[%s], get message. handle=%s,what=%d,msgSize=%u",
context->name, msg->handler->name, msg->what, context->msgSize);
SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_DBG,
"LoopTask[%s], get message. handle=%s,what=%" PRId32 ",msgSize=%u", context->name,
msg->handler->name, msg->what, context->msgSize);
}
} else {
SoftBusSysTime tv;
@ -159,8 +160,9 @@ static void *LoopTask(void *arg)
context->currentMsg = msg;
(void)SoftBusMutexUnlock(&context->lock);
if (looper->dumpable) {
SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_DBG, "LoopTask[%s], HandleMessage message. handle=%s,what=%d",
context->name, msg->handler->name, msg->what);
SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_DBG,
"LoopTask[%s], HandleMessage message. handle=%s,what=%" PRId32, context->name, msg->handler->name,
msg->what);
}
if (msg->handler->HandleMessage != NULL) {
@ -168,7 +170,7 @@ static void *LoopTask(void *arg)
}
if (looper->dumpable) {
SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_INFO,
"LoopTask[%s], after HandleMessage message. handle=%s,what=%d",
"LoopTask[%s], after HandleMessage message. handle=%s,what=%" PRId32,
context->name, msg->handler->name, msg->what);
}
(void)SoftBusMutexLock(&context->lock);
@ -224,7 +226,7 @@ static void DumpLooperLocked(const SoftBusLooperContext *context)
SoftBusMessageNode *itemNode = LIST_ENTRY(item, SoftBusMessageNode, node);
SoftBusMessage *msg = itemNode->msg;
SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_DBG,
"DumpLooper. i=%d,handler=%s,what =%d,arg1=%llu arg2=%llu, time=%lld",
"DumpLooper. i=%d,handler=%s,what =%" PRId32 ",arg1=%" PRIu64 " arg2=%" PRIu64 ", time=%" PRId64,
i, msg->handler->name, msg->what, msg->arg1, msg->arg2, msg->time);
i++;
}
@ -249,7 +251,7 @@ void DumpLooper(const SoftBusLooper *looper)
static void PostMessageAtTime(const SoftBusLooper *looper, SoftBusMessage *msgPost)
{
if (looper->dumpable) {
SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_DBG, "[%s]PostMessageAtTime what =%d time=%lld us",
SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_DBG, "[%s]PostMessageAtTime what =%d time=% " PRId64 " us",
looper->context->name, msgPost->what, msgPost->time);
}
if (msgPost->handler == NULL) {

View File

@ -283,7 +283,7 @@ ssize_t SendTcpData(int32_t fd, const char *buf, size_t len, int32_t timeout)
if (bytes == 0) {
bytes = -1;
}
SoftBusLog(SOFTBUS_LOG_CONN, SOFTBUS_LOG_ERROR, "tcp send fail %d %d", rc, errno);
SoftBusLog(SOFTBUS_LOG_CONN, SOFTBUS_LOG_ERROR, "tcp send fail %zd %d", rc, errno);
break;
}
bytes += rc;
@ -308,7 +308,7 @@ ssize_t SendTcpData(int32_t fd, const char *buf, size_t len, int32_t timeout)
static ssize_t OnRecvData(int32_t fd, char *buf, size_t len, int timeout, int flags)
{
if (fd < 0 || buf == NULL || len == 0) {
SoftBusLog(SOFTBUS_LOG_CONN, SOFTBUS_LOG_ERROR, "fd[%d] len[%d] invalid params", fd, len);
SoftBusLog(SOFTBUS_LOG_CONN, SOFTBUS_LOG_ERROR, "fd[%d] len[%zu] invalid params", fd, len);
return -1;
}

View File

@ -41,6 +41,7 @@ if (defined(ohos_lite)) {
if (ohos_kernel_type == "liteos_m") {
static_library("softbus_server_frame") {
defines = AUTH_SERVER_DEFINES
defines += [ "__STDC_FORMAT_MACROS" ]
include_dirs = dsoftbus_server_common_inc
include_dirs += [
"$dsoftbus_root_path/core/frame/common/include",
@ -72,6 +73,7 @@ if (defined(ohos_lite)) {
} else {
shared_library("softbus_server_frame") {
defines = AUTH_SERVER_DEFINES
defines += [ "__STDC_FORMAT_MACROS" ]
include_dirs = dsoftbus_server_common_inc
include_dirs += [
"common/include",
@ -139,6 +141,7 @@ if (defined(ohos_lite)) {
}
ohos_shared_library("softbus_server") {
defines = AUTH_SERVER_DEFINES
defines += [ "__STDC_FORMAT_MACROS" ]
include_dirs = dsoftbus_server_common_inc
include_dirs += [
"$dsoftbus_root_path/core/frame/common/include",

View File

@ -123,7 +123,7 @@ int UnpackRequest(const cJSON *msg, AppInfo *appInfo)
&len, (unsigned char *)sessionKey, strlen(sessionKey));
(void)memset_s(sessionKey, sizeof(sessionKey), 0, sizeof(sessionKey));
if (len != SESSION_KEY_LENGTH) {
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "Failed to decode sessionKey %d, len %d", ret, len);
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "Failed to decode sessionKey %d, len %zu", ret, len);
return SOFTBUS_ERR;
}
if (apiVersion == API_V1) {

View File

@ -400,7 +400,7 @@ int32_t TransGetUdpChannelByRequestId(uint32_t requestId, UdpChannelInfo *channe
}
}
(void)SoftBusMutexUnlock(&(g_udpChannelMgr->lock));
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "udp channel not found.[requestId = %lld]", requestId);
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "udp channel not found.[requestId = %u]", requestId);
return SOFTBUS_ERR;
}

View File

@ -530,7 +530,7 @@ EXIT_ERR:
static void UdpOnAuthConnOpenFailed(uint32_t requestId, int32_t reason)
{
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_INFO, "UdpOnAuthConnOpenFailed: requestId=%u, reason=%lld",
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_INFO, "UdpOnAuthConnOpenFailed: requestId=%u, reason=%d",
requestId, reason);
UdpChannelInfo *channel = (UdpChannelInfo *)SoftBusCalloc(sizeof(UdpChannelInfo));
if (channel == NULL) {

View File

@ -73,7 +73,7 @@ SoftBusClientStub::SoftBusClientStub()
int32_t SoftBusClientStub::OnRemoteRequest(uint32_t code,
MessageParcel &data, MessageParcel &reply, MessageOption &option)
{
SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_INFO, "SoftBusClientStub::OnReceived, code = %{public}u", code);
SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_INFO, "SoftBusClientStub::OnReceived, code = %u", code);
if (data.ReadInterfaceToken() != GetDescriptor()) {
SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "SoftBusClientStub: ReadInterfaceToken faild!");
return SOFTBUS_ERR;

View File

@ -529,7 +529,7 @@ static int32_t GetAndCheckFileSize(const char *sourceFile, uint64_t *fileSize)
}
if (*fileSize > MAX_FILE_SIZE) {
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "file is too large, filesize : %llu", *fileSize);
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "file is too large, filesize : %" PRIu64, *fileSize);
return SOFTBUS_FILE_ERR;
}
@ -690,7 +690,7 @@ static int32_t FileToFrameAndSendFile(SendListenerInfo sendInfo, const char *sou
goto EXIT_ERR;
}
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_INFO,
"channelId:%d, fileName:%s, fileSize:%llu, frameNum:%llu, destPath:%s",
"channelId:%" PRId32 ", fileName:%s, fileSize:%" PRIu64 ", frameNum:%" PRIu64 ", destPath:%s",
sendInfo.channelId, absSrcPath, fileSize, frameNum, destFile);
if (FileToFrame(sendInfo, frameNum, fd, destFile, fileSize) != SOFTBUS_OK) {
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "File To Frame fail");
@ -1072,7 +1072,7 @@ static int32_t ProcessOneFrame(FileFrame fileFrame, SingleFileInfo fileInfo, int
fileInfo.fileOffset += (uint64_t)writeLength;
if (fileInfo.fileOffset > MAX_FILE_SIZE) {
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "file is too large, offset:%llu", fileInfo.fileOffset);
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "file is too large, offset:%" PRIu64, fileInfo.fileOffset);
return SOFTBUS_ERR;
}
if (UpdateRecvInfo(fileInfo) != SOFTBUS_OK) {

View File

@ -51,7 +51,7 @@ public:
int32_t plainDataLength = buflen - adaptor_->GetEncryptOverhead();
if (plainDataLength < 0) {
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR,
"StreamAdaptorListener:OnStreamReceived:buflen:%d < GetEncryptOverhead:%d",
"StreamAdaptorListener:OnStreamReceived:buflen:%d < GetEncryptOverhead:%zd",
buflen, adaptor_->GetEncryptOverhead());
return;
}
@ -92,12 +92,12 @@ public:
void OnQosEvent(int32_t eventId, int32_t tvCount, const QosTv *tvList)
{
if (adaptor_->GetListenerCallback() != nullptr && adaptor_->GetListenerCallback()->OnQosEvent != nullptr) {
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_INFO, "StreamAdaptorListener: OnQosEvent for channelId = %ld",
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_INFO, "StreamAdaptorListener: OnQosEvent for channelId = %" PRId64,
adaptor_->GetChannelId());
adaptor_->GetListenerCallback()->OnQosEvent(adaptor_->GetChannelId(), eventId, tvCount, tvList);
} else {
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR,
"Get ListenerCallback by StreamAdaptor is failed, channelId = %ld", adaptor_->GetChannelId());
"Get ListenerCallback by StreamAdaptor is failed, channelId = %" PRId64, adaptor_->GetChannelId());
}
}

View File

@ -56,7 +56,7 @@ int32_t SendVtpStream(int32_t channelId, const StreamData *indata, const StreamD
if (adaptor->GetStreamType() == RAW_STREAM) {
ssize_t dataLen = indata->bufLen + adaptor->GetEncryptOverhead();
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_DBG,
"bufLen = %zd, GetEncryptOverhead() = %zd", indata->bufLen, adaptor->GetEncryptOverhead());
"bufLen = %d, GetEncryptOverhead() = %zd", indata->bufLen, adaptor->GetEncryptOverhead());
std::unique_ptr<char[]> data = std::make_unique<char[]>(dataLen);
ssize_t encLen = adaptor->Encrypt(indata->buf, indata->bufLen, data.get(), dataLen, adaptor->GetSessionKey());
if (encLen != dataLen) {