From e373e060072e896ad7a21df7830325b3d28b5754 Mon Sep 17 00:00:00 2001 From: duxbbo Date: Thu, 28 Apr 2022 02:36:16 +0000 Subject: [PATCH] fix bugs of logs Signed-off-by: duxbbo Change-Id: I6af50b5b8548f90f73da2617ce18cd888b32c900 --- core/authentication/src/auth_manager.c | 61 ++++++++++--------- .../net_buscenter/src/lnn_ip_network_impl.c | 2 +- .../net_buscenter/src/lnn_network_manager.c | 2 +- .../src/lnn_distributed_net_ledger.c | 2 +- core/common/BUILD.gn | 4 +- core/common/include/softbus_log.h | 1 + core/common/message_handler/message_handler.c | 16 ++--- .../common/src/softbus_tcp_socket.c | 4 +- core/frame/BUILD.gn | 3 + .../common/src/softbus_message_open_channel.c | 2 +- .../src/trans_udp_channel_manager.c | 2 +- .../src/trans_udp_negotiation.c | 2 +- .../standard/src/softbus_client_stub.cpp | 2 +- .../proxy/src/client_trans_proxy_manager.c | 6 +- .../adaptor/include/stream_adaptor_listener.h | 6 +- .../src/client_trans_udp_stream_interface.cpp | 2 +- 16 files changed, 65 insertions(+), 52 deletions(-) diff --git a/core/authentication/src/auth_manager.c b/core/authentication/src/auth_manager.c index 2cb2dd0bf4..c3e7836227 100644 --- a/core/authentication/src/auth_manager.c +++ b/core/authentication/src/auth_manager.c @@ -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) { diff --git a/core/bus_center/lnn/net_buscenter/src/lnn_ip_network_impl.c b/core/bus_center/lnn/net_buscenter/src/lnn_ip_network_impl.c index 462cfa0419..59b5dab058 100644 --- a/core/bus_center/lnn/net_buscenter/src/lnn_ip_network_impl.c +++ b/core/bus_center/lnn/net_buscenter/src/lnn_ip_network_impl.c @@ -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); } diff --git a/core/bus_center/lnn/net_buscenter/src/lnn_network_manager.c b/core/bus_center/lnn/net_buscenter/src/lnn_network_manager.c index 0e46e41528..074da0deb0 100644 --- a/core/bus_center/lnn/net_buscenter/src/lnn_network_manager.c +++ b/core/bus_center/lnn/net_buscenter/src/lnn_network_manager.c @@ -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); diff --git a/core/bus_center/lnn/net_ledger/distributed_ledger/src/lnn_distributed_net_ledger.c b/core/bus_center/lnn/net_ledger/distributed_ledger/src/lnn_distributed_net_ledger.c index 4d725dcd62..ab4efac0f0 100644 --- a/core/bus_center/lnn/net_ledger/distributed_ledger/src/lnn_distributed_net_ledger.c +++ b/core/bus_center/lnn/net_ledger/distributed_ledger/src/lnn_distributed_net_ledger.c @@ -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) { diff --git a/core/common/BUILD.gn b/core/common/BUILD.gn index a5e62de39f..4bebcf896a 100644 --- a/core/common/BUILD.gn +++ b/core/common/BUILD.gn @@ -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" ] } diff --git a/core/common/include/softbus_log.h b/core/common/include/softbus_log.h index ae058b91c7..5d3540564f 100644 --- a/core/common/include/softbus_log.h +++ b/core/common/include/softbus_log.h @@ -17,6 +17,7 @@ #define SOFTBUS_LOG_H #include +#include #include "softbus_adapter_log.h" #ifdef __cplusplus diff --git a/core/common/message_handler/message_handler.c b/core/common/message_handler/message_handler.c index 0b793ad8d2..38102a1528 100644 --- a/core/common/message_handler/message_handler.c +++ b/core/common/message_handler/message_handler.c @@ -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) { diff --git a/core/connection/common/src/softbus_tcp_socket.c b/core/connection/common/src/softbus_tcp_socket.c index ea49f65a73..d82ecf809e 100644 --- a/core/connection/common/src/softbus_tcp_socket.c +++ b/core/connection/common/src/softbus_tcp_socket.c @@ -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; } diff --git a/core/frame/BUILD.gn b/core/frame/BUILD.gn index 5de7b51316..90151cbc38 100644 --- a/core/frame/BUILD.gn +++ b/core/frame/BUILD.gn @@ -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", diff --git a/core/transmission/common/src/softbus_message_open_channel.c b/core/transmission/common/src/softbus_message_open_channel.c index 492dc72e03..16f8d095ad 100644 --- a/core/transmission/common/src/softbus_message_open_channel.c +++ b/core/transmission/common/src/softbus_message_open_channel.c @@ -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) { diff --git a/core/transmission/trans_channel/udp_negotiation/src/trans_udp_channel_manager.c b/core/transmission/trans_channel/udp_negotiation/src/trans_udp_channel_manager.c index 3039c192d5..46cc40718d 100644 --- a/core/transmission/trans_channel/udp_negotiation/src/trans_udp_channel_manager.c +++ b/core/transmission/trans_channel/udp_negotiation/src/trans_udp_channel_manager.c @@ -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; } diff --git a/core/transmission/trans_channel/udp_negotiation/src/trans_udp_negotiation.c b/core/transmission/trans_channel/udp_negotiation/src/trans_udp_negotiation.c index aba7221784..2639646cc5 100644 --- a/core/transmission/trans_channel/udp_negotiation/src/trans_udp_negotiation.c +++ b/core/transmission/trans_channel/udp_negotiation/src/trans_udp_negotiation.c @@ -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) { diff --git a/sdk/frame/standard/src/softbus_client_stub.cpp b/sdk/frame/standard/src/softbus_client_stub.cpp index fd3373484e..86fc1943a3 100644 --- a/sdk/frame/standard/src/softbus_client_stub.cpp +++ b/sdk/frame/standard/src/softbus_client_stub.cpp @@ -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; diff --git a/sdk/transmission/trans_channel/proxy/src/client_trans_proxy_manager.c b/sdk/transmission/trans_channel/proxy/src/client_trans_proxy_manager.c index 4d0e384c6d..db55e9556e 100644 --- a/sdk/transmission/trans_channel/proxy/src/client_trans_proxy_manager.c +++ b/sdk/transmission/trans_channel/proxy/src/client_trans_proxy_manager.c @@ -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) { diff --git a/sdk/transmission/trans_channel/udp/stream/adaptor/include/stream_adaptor_listener.h b/sdk/transmission/trans_channel/udp/stream/adaptor/include/stream_adaptor_listener.h index adb48430ce..719de03d84 100644 --- a/sdk/transmission/trans_channel/udp/stream/adaptor/include/stream_adaptor_listener.h +++ b/sdk/transmission/trans_channel/udp/stream/adaptor/include/stream_adaptor_listener.h @@ -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()); } } diff --git a/sdk/transmission/trans_channel/udp/stream/adaptor/src/client_trans_udp_stream_interface.cpp b/sdk/transmission/trans_channel/udp/stream/adaptor/src/client_trans_udp_stream_interface.cpp index 183bf90293..713181138a 100644 --- a/sdk/transmission/trans_channel/udp/stream/adaptor/src/client_trans_udp_stream_interface.cpp +++ b/sdk/transmission/trans_channel/udp/stream/adaptor/src/client_trans_udp_stream_interface.cpp @@ -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 data = std::make_unique(dataLen); ssize_t encLen = adaptor->Encrypt(indata->buf, indata->bufLen, data.get(), dataLen, adaptor->GetSessionKey()); if (encLen != dataLen) { -- Gitee