diff --git a/core/frame/small/init/src/trans_server_stub.c b/core/frame/small/init/src/trans_server_stub.c index 10680840c..db8de6d2f 100644 --- a/core/frame/small/init/src/trans_server_stub.c +++ b/core/frame/small/init/src/trans_server_stub.c @@ -41,12 +41,12 @@ int32_t ServerCreateSessionServer(IpcIo *req, IpcIo *reply) const char *pkgName = (const char*)ReadString(req, &size); if (pkgName == NULL) { TRANS_LOGE(TRANS_CTRL, "ServerCreateSessionServer pkgName is null"); - return SOFTBUS_ERR; + return SOFTBUS_NO_INIT; } const char *sessionName = (const char *)ReadString(req, &size); if (sessionName == NULL) { TRANS_LOGE(TRANS_CTRL, "sessionName pkgName is null"); - return SOFTBUS_ERR; + return SOFTBUS_NO_INIT; } int32_t callingUid = GetCallingUid(); int32_t callingPid = GetCallingPid(); @@ -71,12 +71,12 @@ int32_t ServerRemoveSessionServer(IpcIo *req, IpcIo *reply) const char *pkgName = (const char*)ReadString(req, &size); if (pkgName == NULL) { TRANS_LOGE(TRANS_CTRL, "ServerRemoveSessionServer pkgName is null"); - return SOFTBUS_ERR; + return SOFTBUS_NO_INIT; } const char *sessionName = (const char *)ReadString(req, &size); if (sessionName == NULL) { TRANS_LOGE(TRANS_CTRL, "ServerRemoveSessionServer sessionName is null"); - return SOFTBUS_ERR; + return SOFTBUS_NO_INIT; } int32_t callingUid = GetCallingUid(); int32_t callingPid = GetCallingPid(); @@ -234,7 +234,7 @@ int32_t ServerOpenSession(IpcIo *req, IpcIo *reply) WriteUint32(reply, sizeof(TransSerializer)); bool value = WriteBuffer(reply, (void *)&transSerializer, sizeof(TransSerializer)); if (!value) { - return SOFTBUS_ERR; + return SOFTBUS_MALLOC_ERR; } return ret; } @@ -244,7 +244,7 @@ int32_t ServerOpenSession(IpcIo *req, IpcIo *reply) WriteUint32(reply, sizeof(TransSerializer)); bool value = WriteBuffer(reply, (void *)&transSerializer, sizeof(TransSerializer)); if (!value) { - return SOFTBUS_ERR; + return SOFTBUS_MALLOC_ERR; } return ret; } @@ -263,8 +263,8 @@ int32_t ServerOpenAuthSession(IpcIo *req, IpcIo *reply) ConnectionAddr *addr = (ConnectionAddr *)ReadRawData(req, sizeof(ConnectionAddr)); if (!LnnConvertAddrToOption(addr, &connOpt)) { TRANS_LOGE(TRANS_CTRL, "LnnConvertAddrToOption fail"); - WriteInt32(reply, SOFTBUS_ERR); - return SOFTBUS_ERR; + WriteInt32(reply, SOFTBUS_NO_INIT); + return SOFTBUS_NO_INIT; } ret = CheckOpenSessionPremission(sessionName, sessionName); if (ret != SOFTBUS_OK) { diff --git a/core/frame/standard/init/src/softbus_server.cpp b/core/frame/standard/init/src/softbus_server.cpp index f45491c40..3989fe603 100644 --- a/core/frame/standard/init/src/softbus_server.cpp +++ b/core/frame/standard/init/src/softbus_server.cpp @@ -72,7 +72,7 @@ int32_t SoftBusServer::SoftbusRegisterService(const char *clientPkgName, const s sptr abilityDeath = new (std::nothrow) SoftBusDeathRecipient(); if (abilityDeath == nullptr) { COMM_LOGE(COMM_SVC, "DeathRecipient object is nullptr"); - return SOFTBUS_TRANS_DEATH_RECIPIENT_IS_NULL; + return SOFTBUS_TRANS_DEATH_RECIPIENT_INVALID; } bool ret = object->AddDeathRecipient(abilityDeath); if (!ret) { diff --git a/core/transmission/interface/softbus_transmission_interface.h b/core/transmission/interface/softbus_transmission_interface.h index 414dd44fb..d64465a83 100644 --- a/core/transmission/interface/softbus_transmission_interface.h +++ b/core/transmission/interface/softbus_transmission_interface.h @@ -35,7 +35,6 @@ typedef struct { * @param[in] channelId indicates that channel is open. * @param[in] uuid indicates the pointer to the uuid. * @param[in] isServer indicates server side or client side. - * @return SOFTBUS_ERR the processing failed after the callback. * @return SOFTBUS_OK the processing success after the callback. */ int (*onChannelOpened)(int32_t channelId, const char *uuid, unsigned char isServer); @@ -104,7 +103,6 @@ int TransSendNetworkingMessage(int32_t channelId, const char *data, uint32_t dat * this interface is current only called once when the sync info manager. * @see {@link INetworkingListener} * @param[in] listener indicates regiestered function callback. - * @return SOFTBUS_ERR Failed to add listener to channel listener manager. * @return SOFTBUS_OK Success to register channel listener, return other internal errorcodes otherwise. */ int TransRegisterNetworkingChannelListener(const char *sessionName, const INetworkingListener *listener); diff --git a/core/transmission/trans_channel/proxy/src/softbus_proxychannel_listener.c b/core/transmission/trans_channel/proxy/src/softbus_proxychannel_listener.c index b17f03091..38dbf3a4d 100644 --- a/core/transmission/trans_channel/proxy/src/softbus_proxychannel_listener.c +++ b/core/transmission/trans_channel/proxy/src/softbus_proxychannel_listener.c @@ -86,7 +86,7 @@ static void GetProxyChannelInfo(int32_t channelId, const AppInfo *appInfo, bool static int32_t NotifyNormalChannelOpened(int32_t channelId, const AppInfo *appInfo, bool isServer) { ChannelInfo info = {0}; - int32_t ret = SOFTBUS_ERR; + int32_t ret; char buf[NETWORK_ID_BUF_LEN] = {0}; GetProxyChannelInfo(channelId, appInfo, isServer, &info); diff --git a/core/transmission/trans_channel/proxy/src/softbus_proxychannel_pipeline.c b/core/transmission/trans_channel/proxy/src/softbus_proxychannel_pipeline.c index e1c3582c6..8f62f1bec 100644 --- a/core/transmission/trans_channel/proxy/src/softbus_proxychannel_pipeline.c +++ b/core/transmission/trans_channel/proxy/src/softbus_proxychannel_pipeline.c @@ -560,7 +560,7 @@ static void OpenNetWorkingChannel(int32_t requestId, ITransProxyPipelineCallback g_manager.channels->cnt -= 1; SoftBusFree(target); (void)SoftBusMutexUnlock(&g_manager.channels->lock); - callback->onChannelOpenFailed(requestId, SOFTBUS_ERR); + callback->onChannelOpenFailed(requestId, INVALID_CHANNEL_ID); return; } target->channelId = channelId; diff --git a/core/transmission/trans_channel/proxy/src/softbus_proxychannel_transceiver.c b/core/transmission/trans_channel/proxy/src/softbus_proxychannel_transceiver.c index 1a66d39e0..6df937bb9 100644 --- a/core/transmission/trans_channel/proxy/src/softbus_proxychannel_transceiver.c +++ b/core/transmission/trans_channel/proxy/src/softbus_proxychannel_transceiver.c @@ -777,7 +777,7 @@ int32_t TransProxyOpenConnChannel(const AppInfo *appInfo, const ConnectOption *c TRANS_LOGE(TRANS_CTRL, "invalid param"); return SOFTBUS_INVALID_PARAM; } - int32_t ret = SOFTBUS_ERR; + int32_t ret; ProxyConnInfo conn; int32_t chanNewId = GenerateChannelId(false); if (chanNewId <= INVALID_CHANNEL_ID) { diff --git a/interfaces/inner_kits/transport/dfs_session.h b/interfaces/inner_kits/transport/dfs_session.h index d520656bb..e16da7443 100644 --- a/interfaces/inner_kits/transport/dfs_session.h +++ b/interfaces/inner_kits/transport/dfs_session.h @@ -68,7 +68,6 @@ extern "C" { * @return Returns SOFTBUS_OK if the operation is successful. * @return Returns SOFTBUS_INVALID_PARAM if invalid parameters are detected. * @return Returns SOFTBUS_TRANS_FUNC_NOT_SUPPORT if the session ID is not supported. - * @return Returns SOFTBUS_ERR if an error occurs in the internal processing of DSoftBus. * @return Returns SOFTBUS_MEM_ERR if the operation fails due to insufficient memory. * @since 1.0 * @version 1.0 @@ -84,7 +83,6 @@ int32_t GetSessionKey(int32_t sessionId, char *key, unsigned int len); * @return Returns SOFTBUS_OK if the operation is successful. * @return Returns SOFTBUS_INVALID_PARAM if invalid parameters are detected. * @return Returns SOFTBUS_TRANS_FUNC_NOT_SUPPORT if the session ID is not supported. - * @return Returns SOFTBUS_ERR if an error occurs in the internal processing of DSoftBus. * @return Returns SOFTBUS_MEM_ERR if the operation fails due to insufficient memory. * @since 1.0 * @version 1.0 @@ -99,7 +97,6 @@ int32_t GetSessionHandle(int32_t sessionId, int *handle); * @return Returns SOFTBUS_OK if the operation is successful. * @return Returns SOFTBUS_INVALID_PARAM if invalid parameters are detected. * @return Returns SOFTBUS_TRANS_FUNC_NOT_SUPPORT if the session ID is not supported. - * @return Returns SOFTBUS_ERR if an error occurs in the internal processing of DSoftBus. * @since 1.0 * @version 1.0 */ diff --git a/interfaces/kits/common/softbus_error_code.h b/interfaces/kits/common/softbus_error_code.h index 10f568bb3..f8c4245f6 100644 --- a/interfaces/kits/common/softbus_error_code.h +++ b/interfaces/kits/common/softbus_error_code.h @@ -369,18 +369,18 @@ enum SoftBusErrNo { SOFTBUS_TRANS_CREATE_SOCKET_SERVER_FAILED, SOFTBUS_TRANS_BUSINESSID_COUNT_FAILED, SOFTBUS_TRANS_ON_CONNECT_REQUEST_IS_NULL, - SOFTBUS_TRANS_ON_SOCKET_OPENED_IS_NULL, - SOFTBUS_TRANS_ON_SOCKET_REQUEST_IS_NULL, - SOFTBUS_TRANS_ON_SOCKET_CLOSED_IS_NULL, - SOFTBUS_TRANS_ON_DATA_RECEIVED_IS_NULL, - SOFTBUS_TRANS_ON_PREDATA_REQUEST_IS_NULL, - SOFTBUS_TRANS_ON_SERVICE_REQUEST_IS_NULL, - SOFTBUS_TRANS_ON_SESSION_REQUEST_IS_NULL, - SOFTBUS_TRANS_ON_SESSION_OPENED_IS_NULL, - SOFTBUS_TRANS_ON_SESSION_CLOSED_IS_NULL, + SOFTBUS_TRANS_ON_SOCKET_OPENED_INVALID, + SOFTBUS_TRANS_ON_SOCKET_REQUEST_INVALID, + SOFTBUS_TRANS_ON_SOCKET_CLOSED_INVALID, + SOFTBUS_TRANS_ON_DATA_RECEIVED_INVALID, + SOFTBUS_TRANS_ON_PREDATA_REQUEST_INVALID, + SOFTBUS_TRANS_ON_SERVICE_REQUEST_INVALID, + SOFTBUS_TRANS_ON_SESSION_REQUEST_INVALID, + SOFTBUS_TRANS_ON_SESSION_OPENED_INVALID, + SOFTBUS_TRANS_ON_SESSION_CLOSED_INVALID, SOFTBUS_TRANS_CREATE_LISTENER_MODULE_FAILED, SOFTBUS_TRANS_FILE_SCHEMA_LISTENER_FAILED, - SOFTBUS_TRANS_DEATH_RECIPIENT_IS_NULL, + SOFTBUS_TRANS_DEATH_RECIPIENT_INVALID, SOFTBUS_TRANS_ADD_DEATH_RECIPIENT_FAILED, SOFTBUS_TRANS_ON_CHANNEL_REQ_CALLBACK_FAILED, SOFTBUS_TRANS_ON_SERVICE_REQ_CALLBACK_FAILED, diff --git a/sdk/frame/small/src/trans_client_stub.c b/sdk/frame/small/src/trans_client_stub.c index c9774cb23..5ba748f65 100644 --- a/sdk/frame/small/src/trans_client_stub.c +++ b/sdk/frame/small/src/trans_client_stub.c @@ -42,7 +42,7 @@ int32_t ClientOnChannelOpened(IpcIo *data, IpcIo *reply) if (channel.groupId == NULL || channel.sessionKey == NULL || channel.peerSessionName == NULL || channel.peerDeviceId == NULL) { TRANS_LOGE(TRANS_CTRL, "pointer null error."); - return SOFTBUS_ERR; + return SOFTBUS_NO_INIT; } if (channel.channelType == CHANNEL_TYPE_TCP_DIRECT) { channel.myIp = (char *)ReadString(data, &size); @@ -57,7 +57,7 @@ int32_t ClientOnChannelOpened(IpcIo *data, IpcIo *reply) if (channel.isServer) { int32_t udpPort = TransOnChannelOpened(sessionName, &channel); WriteInt32(reply, udpPort); - return SOFTBUS_ERR; + return SOFTBUS_TRANS_CHANNEL_OPEN_FAILED; } ReadInt32(data, &(channel.peerPort)); channel.peerIp = (char *)ReadString(data, &size); diff --git a/sdk/frame/standard/src/softbus_server_proxy_frame.cpp b/sdk/frame/standard/src/softbus_server_proxy_frame.cpp index 1c8ea9129..888fa9490 100644 --- a/sdk/frame/standard/src/softbus_server_proxy_frame.cpp +++ b/sdk/frame/standard/src/softbus_server_proxy_frame.cpp @@ -140,7 +140,7 @@ static int32_t ServerProxyInit(void) OHOS::sptr(new (std::nothrow) OHOS::SoftBusClientDeathRecipient()); if (g_clientDeath == nullptr) { COMM_LOGE(COMM_SDK, "DeathRecipient object is nullptr"); - return SOFTBUS_TRANS_DEATH_RECIPIENT_IS_NULL; + return SOFTBUS_TRANS_DEATH_RECIPIENT_INVALID; } if (!g_serverProxy->AddDeathRecipient(g_clientDeath)) { COMM_LOGE(COMM_SDK, "AddDeathRecipient failed"); diff --git a/sdk/transmission/session/include/client_trans_session_manager.h b/sdk/transmission/session/include/client_trans_session_manager.h index a8ded95c2..06e78e841 100644 --- a/sdk/transmission/session/include/client_trans_session_manager.h +++ b/sdk/transmission/session/include/client_trans_session_manager.h @@ -159,7 +159,9 @@ int32_t ClientAddNewSession(const char *sessionName, SessionInfo *session); /** * @brief Add session. - * @return if session already added, return SOFTBUS_TRANS_SESSION_REPEATED, else return SOFTBUS_OK or SOFTBUS_ERR. + * @return if the operation is successful, return SOFTBUS_OK. + * @return if session already added, return SOFTBUS_TRANS_SESSION_REPEATED. + * @return return other error codes. */ int32_t ClientAddSession(const SessionParam *param, int32_t *sessionId, SessionEnableStatus *isEnabled); diff --git a/tests/core/bus_center/lnn/lane/trans_lane/lnn_trans_lane_test.cpp b/tests/core/bus_center/lnn/lane/trans_lane/lnn_trans_lane_test.cpp index 547d88e79..d15bb5650 100644 --- a/tests/core/bus_center/lnn/lane/trans_lane/lnn_trans_lane_test.cpp +++ b/tests/core/bus_center/lnn/lane/trans_lane/lnn_trans_lane_test.cpp @@ -497,8 +497,8 @@ HWTEST_F(LNNTransLaneMockTest, ALLOC_RAW_LANE_TEST_001, TestSize.Level1) EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM); ret = UpdateReqListLaneId(LANE_REQ_ID, NEW_LANE_REQ_ID); EXPECT_EQ(ret, SOFTBUS_LOCK_ERR); - NotifyFreeLaneResult(LANE_REQ_ID, SOFTBUS_ERR); - NotifyFreeLaneResult(NEW_LANE_REQ_ID, SOFTBUS_ERR); + NotifyFreeLaneResult(LANE_REQ_ID, SOFTBUS_LOCK_ERR); + NotifyFreeLaneResult(NEW_LANE_REQ_ID, SOFTBUS_LOCK_ERR); transObj->deinit(); } } // namespace OHOS \ No newline at end of file diff --git a/tests/core/bus_center/mock_common/src/lnn_trans_mock.cpp b/tests/core/bus_center/mock_common/src/lnn_trans_mock.cpp index 70c39a013..025cef577 100644 --- a/tests/core/bus_center/mock_common/src/lnn_trans_mock.cpp +++ b/tests/core/bus_center/mock_common/src/lnn_trans_mock.cpp @@ -66,7 +66,7 @@ int32_t LnnTransInterfaceMock::ActionOfTransRegister(const INetworkingListener * { if (listener == NULL) { LNN_LOGE(LNN_TEST, "listener is invalid para"); - return SOFTBUS_ERR; + return SOFTBUS_INVALID_PARAM; } g_networkListener = listener; return SOFTBUS_OK;