diff --git a/ext/pin_auth/src/ability/standard/dm_ability_manager.cpp b/ext/pin_auth/src/ability/standard/dm_ability_manager.cpp index e2b026f1cab3f551dab8d12e5f645c5b8ad9a237..b1ea6b992a7f88591f169e9e1a41be49fa5504f1 100644 --- a/ext/pin_auth/src/ability/standard/dm_ability_manager.cpp +++ b/ext/pin_auth/src/ability/standard/dm_ability_manager.cpp @@ -61,7 +61,7 @@ void DmAbilityManager::waitForTimeout(uint32_t timeout_s) { struct timespec ts; clock_gettime(CLOCK_REALTIME, &ts); - ts.tv_sec += timeout_s; + ts.tv_sec += (int32_t)timeout_s; sem_timedwait(&mSem_, &ts); } diff --git a/ext/profile/src/profile_connector.cpp b/ext/profile/src/profile_connector.cpp index 4a709238e404ab155ff1e7d537371a2366b1fa5e..fe46916b15043b67905847bf773f98aaa22a6b7d 100644 --- a/ext/profile/src/profile_connector.cpp +++ b/ext/profile/src/profile_connector.cpp @@ -53,7 +53,7 @@ int32_t ProfileConnector::SubscribeProfileEvents(const std::list &s subscribeInfos.emplace_back(eventSync); std::list failedEvents; - u_int32_t errCode = DistributedDeviceProfileClient::GetInstance().SubscribeProfileEvents( + int32_t errCode = DistributedDeviceProfileClient::GetInstance().SubscribeProfileEvents( subscribeInfos, profileEventCallback_, failedEvents); LOGI("ProfileConnector::SubscribeProfileEvents result=%d", errCode); return DM_OK; @@ -65,7 +65,7 @@ int32_t ProfileConnector::UnSubscribeProfileEvents() profileEvents.emplace_back(ProfileEvent::EVENT_PROFILE_CHANGED); profileEvents.emplace_back(ProfileEvent::EVENT_SYNC_COMPLETED); std::list failedEvents; - u_int32_t errCode = DistributedDeviceProfileClient::GetInstance().UnsubscribeProfileEvents( + int32_t errCode = DistributedDeviceProfileClient::GetInstance().UnsubscribeProfileEvents( profileEvents, profileEventCallback_, failedEvents); LOGI("ProfileConnector::UnSubscribeProfileEvents result=%d", errCode); return DM_OK; @@ -100,4 +100,4 @@ void ProfileEventCallback::OnSyncCompleted(const SyncResult &syncResults) } } } // namespace DistributedHardware -} // namespace OHOS \ No newline at end of file +} // namespace OHOS diff --git a/interfaces/inner_kits/native_cpp/include/dm_app_image_info.h b/interfaces/inner_kits/native_cpp/include/dm_app_image_info.h index 1f48f40b65781502729173707316cd28a701ae97..26475008b4e014f07a2aeaa8f5e0ea18610be33d 100644 --- a/interfaces/inner_kits/native_cpp/include/dm_app_image_info.h +++ b/interfaces/inner_kits/native_cpp/include/dm_app_image_info.h @@ -68,7 +68,7 @@ public: return -1; } - if (memcpy_s(appThumbnail + copyIndex, appThumbnailLen - copyIndex, srcBuffer, copyLen) != 0) { + if (memcpy_s(appThumbnail + copyIndex, appThumbnailLen - copyIndex, srcBuffer, (uint32_t)copyLen) != 0) { return -1; } @@ -145,7 +145,7 @@ private: } if (appIcon != nullptr) { appIconLen = appIconLen_; - if (memcpy_s(appIcon, appIconLen, appIcon_, appIconLen_) != 0) { + if (memcpy_s(appIcon, (uint32_t)appIconLen, appIcon_, appIconLen_) != 0) { return; } } @@ -165,7 +165,7 @@ private: } if (appThumbnail != nullptr) { appThumbnailLen = appThumbnailLen_; - if (memcpy_s(appThumbnail, appThumbnailLen, appThumbnail_, appThumbnailLen_) != 0) { + if (memcpy_s(appThumbnail, (uint32_t)appThumbnailLen, appThumbnail_, appThumbnailLen_) != 0) { return; } } diff --git a/interfaces/inner_kits/native_cpp/src/ipc/standard/ipc_client_server_proxy.cpp b/interfaces/inner_kits/native_cpp/src/ipc/standard/ipc_client_server_proxy.cpp index 0a8e9304041149f0c8abb62fc799d1abe69b9780..c81222fb8eb66db6633a35cc25a19db4ef250579 100644 --- a/interfaces/inner_kits/native_cpp/src/ipc/standard/ipc_client_server_proxy.cpp +++ b/interfaces/inner_kits/native_cpp/src/ipc/standard/ipc_client_server_proxy.cpp @@ -36,7 +36,7 @@ int32_t IpcClientServerProxy::SendCmd(int32_t cmdCode, std::shared_ptr r if (IpcCmdRegister::GetInstance().SetRequest(cmdCode, req, data) != DM_OK) { return DM_IPC_SEND_REQUEST_FAILED; } - if (remote->SendRequest(cmdCode, data, reply, option) != DM_OK) { + if (remote->SendRequest((uint32_t)cmdCode, data, reply, option) != DM_OK) { LOGE("SendRequest fail, cmd:%d", cmdCode); return DM_IPC_SEND_REQUEST_FAILED; } diff --git a/interfaces/inner_kits/native_cpp/src/ipc/standard/ipc_client_stub.cpp b/interfaces/inner_kits/native_cpp/src/ipc/standard/ipc_client_stub.cpp index 798e5f36128e5eadba41f32a1b884a6881e1f450..9cacbbf9c2fcbbb0628b6b6cffc9bd08ce0d9670 100644 --- a/interfaces/inner_kits/native_cpp/src/ipc/standard/ipc_client_stub.cpp +++ b/interfaces/inner_kits/native_cpp/src/ipc/standard/ipc_client_stub.cpp @@ -26,7 +26,7 @@ namespace DistributedHardware { int32_t IpcClientStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { LOGI("code = %d, flags= %d.", code, option.GetFlags()); - if (IpcCmdRegister::GetInstance().OnIpcCmd(code, data, reply) == DM_OK) { + if (IpcCmdRegister::GetInstance().OnIpcCmd((int32_t)code, data, reply) == DM_OK) { LOGE("on ipc cmd success"); return DM_OK; } diff --git a/interfaces/inner_kits/native_cpp/src/ipc/standard/ipc_cmd_parser.cpp b/interfaces/inner_kits/native_cpp/src/ipc/standard/ipc_cmd_parser.cpp index be759e55e1057e56de3f5f2561f2fa21f8947279..5858e834d138221856836682dbd64de3623ada4e 100644 --- a/interfaces/inner_kits/native_cpp/src/ipc/standard/ipc_cmd_parser.cpp +++ b/interfaces/inner_kits/native_cpp/src/ipc/standard/ipc_cmd_parser.cpp @@ -101,7 +101,7 @@ ON_IPC_READ_RESPONSE(GET_TRUST_DEVICE_LIST, MessageParcel &reply, std::shared_pt DmDeviceInfo *pDmDeviceinfo = nullptr; for (int32_t i = 0; i < deviceNum; ++i) { pDmDeviceinfo = nullptr; - pDmDeviceinfo = (DmDeviceInfo *)reply.ReadRawData((int32_t)sizeof(DmDeviceInfo)); + pDmDeviceinfo = (DmDeviceInfo *)reply.ReadRawData(sizeof(DmDeviceInfo)); if (pDmDeviceinfo == nullptr) { LOGE("GetTrustedDeviceList read node info failed!"); pRsp->SetErrCode(DM_IPC_TRANSACTION_FAILED); @@ -212,7 +212,7 @@ ON_IPC_SET_REQUEST(STOP_DEVICE_DISCOVER, std::shared_ptr pBaseReq, Messa LOGE("write pkgName failed"); return DM_IPC_FLATTEN_OBJECT; } - if (!data.WriteInt16(subscribeId)) { + if (!data.WriteInt16((int16_t)subscribeId)) { LOGE("write subscribeId failed"); return DM_IPC_FLATTEN_OBJECT; } @@ -384,7 +384,7 @@ ON_IPC_CMD(SERVER_DEVICE_STATE_NOTIFY, MessageParcel &data, MessageParcel &reply ON_IPC_CMD(SERVER_DEVICE_FOUND, MessageParcel &data, MessageParcel &reply) { std::string pkgName = data.ReadString(); - uint16_t subscribeId = data.ReadInt16(); + int16_t subscribeId = data.ReadInt16(); DmDeviceInfo dmDeviceInfo; size_t deviceSize = sizeof(DmDeviceInfo); void *deviceInfo = (void *)data.ReadRawData(deviceSize); @@ -400,7 +400,7 @@ ON_IPC_CMD(SERVER_DEVICE_FOUND, MessageParcel &data, MessageParcel &reply) ON_IPC_CMD(SERVER_DISCOVER_FINISH, MessageParcel &data, MessageParcel &reply) { std::string pkgName = data.ReadString(); - uint16_t subscribeId = data.ReadInt16(); + int16_t subscribeId = data.ReadInt16(); int32_t failedReason = data.ReadInt32(); if (failedReason == DM_OK) { @@ -419,7 +419,7 @@ ON_IPC_CMD(SERVER_AUTH_RESULT, MessageParcel &data, MessageParcel &reply) std::string token = data.ReadString(); int32_t status = data.ReadInt32(); int32_t reason = data.ReadInt32(); - DeviceManagerNotify::GetInstance().OnAuthResult(pkgName, deviceId, token, status, reason); + DeviceManagerNotify::GetInstance().OnAuthResult(pkgName, deviceId, token, (uint32_t)status, reason); reply.WriteInt32(DM_OK); return DM_OK; } diff --git a/interfaces/inner_kits/native_cpp/src/notify/device_manager_notify.cpp b/interfaces/inner_kits/native_cpp/src/notify/device_manager_notify.cpp index 987ca17c59d945707a9b04cebe7f114c6cb8f810..9d68e364fe5bc24852ebf5b925a5963f56a94b6b 100644 --- a/interfaces/inner_kits/native_cpp/src/notify/device_manager_notify.cpp +++ b/interfaces/inner_kits/native_cpp/src/notify/device_manager_notify.cpp @@ -250,7 +250,7 @@ void DeviceManagerNotify::OnAuthResult(const std::string &pkgName, const std::st LOGE("DeviceManager OnAuthResult: no register authCallback for deviceID "); return; } - iter->second->OnAuthResult(deviceId, token, status, reason); + iter->second->OnAuthResult(deviceId, token, status, (int32_t)reason); authenticateCallback_[pkgName].erase(deviceId); if (authenticateCallback_[pkgName].empty()) { authenticateCallback_.erase(pkgName); diff --git a/interfaces/kits/js/src/native_devicemanager_js.cpp b/interfaces/kits/js/src/native_devicemanager_js.cpp index bb96c37a7044c5a55a282bc3077f4f9ed3ee30f6..644386adf99511a04928c0371fd5ddd949158b53 100644 --- a/interfaces/kits/js/src/native_devicemanager_js.cpp +++ b/interfaces/kits/js/src/native_devicemanager_js.cpp @@ -725,7 +725,7 @@ void DeviceManagerNapi::JsToDmBuffer(const napi_env &env, const napi_value &obje *bufferPtr = nullptr; return; } - bufferLen = length; + bufferLen = (int32_t)length; } void DeviceManagerNapi::JsToJsonObject(const napi_env &env, const napi_value &object, const std::string &fieldStr, @@ -971,7 +971,7 @@ void DeviceManagerNapi::CallGetTrustedDeviceListStatusSync(napi_env env, napi_st LOGE("napi_create_array fail"); } for (unsigned int i = 0; i != deviceInfoAsyncCallbackInfo->devList.size(); ++i) { - DeviceInfoToJsArray(env, deviceInfoAsyncCallbackInfo->devList, i, array[1]); + DeviceInfoToJsArray(env, deviceInfoAsyncCallbackInfo->devList, (int32_t)i, array[1]); } napi_resolve_deferred(env, deviceInfoAsyncCallbackInfo->deferred, array[1]); LOGE("devList is OK"); @@ -1045,7 +1045,7 @@ void DeviceManagerNapi::CallGetTrustedDeviceListStatus(napi_env env, napi_status LOGE("napi_create_array fail"); } - for (size_t i = 0; i != deviceInfoAsyncCallbackInfo->devList.size(); ++i) { + for (int32_t i = 0; i != deviceInfoAsyncCallbackInfo->devList.size(); ++i) { DeviceInfoToJsArray(env, deviceInfoAsyncCallbackInfo->devList, i, array[1]); } LOGE("devList is OK"); @@ -1252,7 +1252,7 @@ napi_value DeviceManagerNapi::GetTrustedDeviceListSync(napi_env env, napi_callba LOGI("DeviceManager::GetTrustedDeviceListSync"); if (devList.size() > 0) { for (size_t i = 0; i != devList.size(); ++i) { - DeviceInfoToJsArray(env, devList, i, result); + DeviceInfoToJsArray(env, devList, (int32_t)i, result); } } return result; @@ -1685,7 +1685,7 @@ napi_value DeviceManagerNapi::ReleaseDeviceManager(napi_env env, napi_callback_i int32_t ret = DeviceManager::GetInstance().UnInitDeviceManager(deviceManagerWrapper->bundleName_); if (ret != 0) { LOGE("ReleaseDeviceManager for bunderName %s failed, ret %d", deviceManagerWrapper->bundleName_.c_str(), ret); - napi_create_uint32(env, ret, &result); + napi_create_uint32(env, (uint32_t)ret, &result); return result; } diff --git a/services/devicemanagerservice/src/authentication/auth_message_processor.cpp b/services/devicemanagerservice/src/authentication/auth_message_processor.cpp index 9ba556f4a188c3e4bf57fd6ff8f48da531b2ad7a..922c5cdfc4747ae13e083e3c9f9f8d44e31baccc 100644 --- a/services/devicemanagerservice/src/authentication/auth_message_processor.cpp +++ b/services/devicemanagerservice/src/authentication/auth_message_processor.cpp @@ -35,7 +35,7 @@ std::vector AuthMessageProcessor::CreateAuthRequestMessage() { LOGI("AuthMessageProcessor::CreateAuthRequestMessage start."); std::vector jsonStrVec; - int32_t thumbnailSize = authRequestContext_->appThumbnail.size(); + int32_t thumbnailSize = (int32_t)(authRequestContext_->appThumbnail.size()); int32_t thumbnailSlice = ((thumbnailSize / MSG_MAX_SIZE) + (thumbnailSize % MSG_MAX_SIZE) == 0 ? 0 : 1); nlohmann::json jsonObj; jsonObj[TAG_VER] = DM_ITF_VER; @@ -69,7 +69,7 @@ std::vector AuthMessageProcessor::CreateAuthRequestMessage() int32_t leftLen = thumbnailSize - idx * MSG_MAX_SIZE; int32_t sliceLen = (leftLen > MSG_MAX_SIZE) ? MSG_MAX_SIZE : leftLen; - LOGI("TAG_APP_THUMBNAIL encode, idx %d, sliceLen %d, thumbnailSize %d", idx, sliceLen, thumbnailSize); + LOGI("TAG_APP_THUMBNAIL encode, idx %d, sliceLen %d, thumbnailSize %d", idx, (uint32_t)sliceLen, thumbnailSize); jsonObj[TAG_APP_THUMBNAIL] = authRequestContext_->appThumbnail.substr(idx * MSG_MAX_SIZE, sliceLen); jsonStrVec.push_back(jsonThumbnailObj.dump()); } @@ -289,4 +289,4 @@ std::shared_ptr AuthMessageProcessor::GetRequestContext() return authRequestContext_; } } // namespace DistributedHardware -} // namespace OHOS \ No newline at end of file +} // namespace OHOS diff --git a/services/devicemanagerservice/src/device_manager_service_listener.cpp b/services/devicemanagerservice/src/device_manager_service_listener.cpp index c67191a3e23b33d5aba67b98ab756b07663d5893..108fefb2e8502b949ed7d29307fbeab8c26479a1 100644 --- a/services/devicemanagerservice/src/device_manager_service_listener.cpp +++ b/services/devicemanagerservice/src/device_manager_service_listener.cpp @@ -72,7 +72,7 @@ void DeviceManagerServiceListener::OnDiscoverySuccess(const std::string &pkgName std::shared_ptr pRsp = std::make_shared(); pReq->SetPkgName(pkgName); - pReq->SetSubscribeId(subscribeId); + pReq->SetSubscribeId((uint16_t)subscribeId); pReq->SetResult(DM_OK); ipcServerListener_.SendRequest(SERVER_DISCOVER_FINISH, pReq, pRsp); } diff --git a/services/devicemanagerservice/src/discovery/dm_discovery_manager.cpp b/services/devicemanagerservice/src/discovery/dm_discovery_manager.cpp index f48689431b9de61d7542b476b8ee9910f766459d..a3a6663d186954b4302db5de3501ea2742139492 100644 --- a/services/devicemanagerservice/src/discovery/dm_discovery_manager.cpp +++ b/services/devicemanagerservice/src/discovery/dm_discovery_manager.cpp @@ -98,14 +98,14 @@ void DmDiscoveryManager::OnDeviceFound(const std::string &pkgName, const DmDevic void DmDiscoveryManager::OnDiscoveryFailed(const std::string &pkgName, int32_t subscribeId, int32_t failedReason) { LOGI("DmDiscoveryManager::OnDiscoveryFailed subscribeId=%d reason=%d", subscribeId, failedReason); - StopDeviceDiscovery(pkgName, subscribeId); - listener_->OnDiscoveryFailed(pkgName, subscribeId, failedReason); + StopDeviceDiscovery(pkgName, (uint32_t)subscribeId); + listener_->OnDiscoveryFailed(pkgName, (uint32_t)subscribeId, failedReason); } void DmDiscoveryManager::OnDiscoverySuccess(const std::string &pkgName, int32_t subscribeId) { LOGI("DmDiscoveryManager::OnDiscoverySuccess subscribeId=%d", subscribeId); - discoveryContextMap_[pkgName].subscribeId = subscribeId; + discoveryContextMap_[pkgName].subscribeId = (uint32_t)subscribeId; listener_->OnDiscoverySuccess(pkgName, subscribeId); } diff --git a/services/devicemanagerservice/src/ipc/standard/ipc_cmd_parser.cpp b/services/devicemanagerservice/src/ipc/standard/ipc_cmd_parser.cpp index 2a61266b53f6988a4c8f1df2a628f3bd1d931ed2..d5da15591b08205a2b46f362287a4f307190df71 100644 --- a/services/devicemanagerservice/src/ipc/standard/ipc_cmd_parser.cpp +++ b/services/devicemanagerservice/src/ipc/standard/ipc_cmd_parser.cpp @@ -68,7 +68,7 @@ ON_IPC_SET_REQUEST(SERVER_DEVICE_FOUND, std::shared_ptr pBaseReq, Messag LOGE("write pkgName failed"); return DM_FLATTEN_OBJECT; } - if (!data.WriteInt16(subscribeId)) { + if (!data.WriteInt16((int16_t)subscribeId)) { LOGE("write subscribeId failed"); return DM_FLATTEN_OBJECT; } @@ -95,7 +95,7 @@ ON_IPC_SET_REQUEST(SERVER_DISCOVER_FINISH, std::shared_ptr pBaseReq, Mes LOGE("write pkgName failed"); return DM_FLATTEN_OBJECT; } - if (!data.WriteInt16(subscribeId)) { + if (!data.WriteInt16((int16_t)subscribeId)) { LOGE("write subscribeId failed"); return DM_FLATTEN_OBJECT; } @@ -211,7 +211,7 @@ ON_IPC_CMD(GET_TRUST_DEVICE_LIST, MessageParcel &data, MessageParcel &reply) LOGI("pkgName:%s, extra:%s", pkgName.c_str(), extra.c_str()); std::vector deviceList; int32_t result = DeviceManagerService::GetInstance().GetTrustedDeviceList(pkgName, extra, deviceList); - int32_t infoNum = deviceList.size(); + int32_t infoNum =(int32_t)(deviceList.size()); DmDeviceInfo deviceInfo; if (!reply.WriteInt32(infoNum)) { LOGE("write infoNum failed"); @@ -280,7 +280,7 @@ ON_IPC_CMD(START_DEVICE_DISCOVER, MessageParcel &data, MessageParcel &reply) ON_IPC_CMD(STOP_DEVICE_DISCOVER, MessageParcel &data, MessageParcel &reply) { std::string pkgName = data.ReadString(); - uint16_t subscribeId = data.ReadInt32(); + uint16_t subscribeId = (uint16_t)(data.ReadInt32()); LOGI("pkgName:%s, subscribeId: %d", pkgName.c_str(), subscribeId); int32_t result = DeviceManagerService::GetInstance().StopDeviceDiscovery(pkgName, subscribeId); if (!reply.WriteInt32(result)) { @@ -394,7 +394,7 @@ ON_IPC_CMD(SERVER_GET_DMFA_INFO, MessageParcel &data, MessageParcel &reply) int32_t ret = DM_OK; ret = DeviceManagerService::GetInstance().GetFaParam(packName, authParam); int32_t appIconLen = authParam.imageinfo.GetAppIconLen(); - int32_t appThumbnailLen = authParam.imageinfo.GetAppThumbnailLen(); + uint32_t appThumbnailLen = authParam.imageinfo.GetAppThumbnailLen(); if (!reply.WriteInt32(authParam.direction) || !reply.WriteInt32(authParam.authType) || !reply.WriteString(authParam.authToken) || !reply.WriteString(authParam.packageName) || diff --git a/services/devicemanagerservice/src/ipc/standard/ipc_server_client_proxy.cpp b/services/devicemanagerservice/src/ipc/standard/ipc_server_client_proxy.cpp index 28dbc5a5fdfcb834f934aa586cb783d97ac4d707..fd6adb81556cd42a89ad177792841b8fa1a27f82 100644 --- a/services/devicemanagerservice/src/ipc/standard/ipc_server_client_proxy.cpp +++ b/services/devicemanagerservice/src/ipc/standard/ipc_server_client_proxy.cpp @@ -36,7 +36,7 @@ int32_t IpcServerClientProxy::SendCmd(int32_t cmdCode, std::shared_ptr r if (IpcCmdRegister::GetInstance().SetRequest(cmdCode, req, data) != DM_OK) { return DM_IPC_FAILED; } - if (remote->SendRequest(cmdCode, data, reply, option) != DM_OK) { + if (remote->SendRequest((uint32_t)cmdCode, data, reply, option) != DM_OK) { LOGE("SendRequest fail, cmd:%d", cmdCode); return DM_IPC_FAILED; } diff --git a/services/devicemanagerservice/src/ipc/standard/ipc_server_stub.cpp b/services/devicemanagerservice/src/ipc/standard/ipc_server_stub.cpp index ff7e3a14886a0b544c8234831e4f51adef54a387..a20ed41098730de36c3d605e8df187d564d1a33e 100644 --- a/services/devicemanagerservice/src/ipc/standard/ipc_server_stub.cpp +++ b/services/devicemanagerservice/src/ipc/standard/ipc_server_stub.cpp @@ -82,7 +82,7 @@ int32_t IpcServerStub::OnRemoteRequest(uint32_t code, MessageParcel &data, Messa { LOGI("code = %d, flags= %d.", code, option.GetFlags()); int32_t ret = DM_OK; - ret = IpcCmdRegister::GetInstance().OnIpcCmd(code, data, reply); + ret = IpcCmdRegister::GetInstance().OnIpcCmd((int32_t)code, data, reply); if (ret == DM_IPC_NOT_REGISTER_FUNC) { LOGW("unsupport code: %d", code); return IPCObjectStub::OnRemoteRequest(code, data, reply, option); diff --git a/test/unittest/UTTest_dm_device_state_manager.cpp b/test/unittest/UTTest_dm_device_state_manager.cpp index 507cdca5d066332d489fb0997d800cd881ce6b0e..52e341847fe8cedbc26af61351bed556ef20af75 100644 --- a/test/unittest/UTTest_dm_device_state_manager.cpp +++ b/test/unittest/UTTest_dm_device_state_manager.cpp @@ -205,4 +205,4 @@ HWTEST_F(DmDeviceStateManagerTest, RegisterSoftbusStateCallback_001, testing::ex } } // namespace } // namespace DistributedHardware -} // namespace OHOS \ No newline at end of file +} // namespace OHOS diff --git a/test/unittest/UTTest_dm_discovery_manager.cpp b/test/unittest/UTTest_dm_discovery_manager.cpp index 03fff20ce718c6046f9610262fad6b5fa17f0f8a..088a392d8f2c0c9e7c3e119cb36a7a2815765165 100644 --- a/test/unittest/UTTest_dm_discovery_manager.cpp +++ b/test/unittest/UTTest_dm_discovery_manager.cpp @@ -236,7 +236,7 @@ HWTEST_F(DmDiscoveryManagerTest, OnDiscoverySuccess_002, testing::ext::TestSize. std::string pkgName; int32_t subscribeId = 1; discoveryMgr_->OnDiscoverySuccess(pkgName, subscribeId); - int ret1 = discoveryMgr_->discoveryContextMap_.count(pkgName); + uint32_t ret1 = discoveryMgr_->discoveryContextMap_.count(pkgName); EXPECT_EQ(ret1, 1); std::shared_ptr pReq = std::static_pointer_cast(listener_->ipcServerListener_.req_); @@ -254,7 +254,7 @@ HWTEST_F(DmDiscoveryManagerTest, HandleDiscoveryTimeout_001, testing::ext::TestS { std::string pkgName = "com.ohos.helloworld"; discoveryMgr_->HandleDiscoveryTimeout(); - int ret = discoveryMgr_->discoveryContextMap_.count(pkgName); + uint32_t ret = discoveryMgr_->discoveryContextMap_.count(pkgName); EXPECT_EQ(ret, 1); } } // namespace diff --git a/test/unittest/UTTest_softbus_connector.cpp b/test/unittest/UTTest_softbus_connector.cpp index 4cf2039ce2468a4175bfd94dc5e523d51e54b57b..32491e69256ed4367dff0a1415a191fb977f976d 100644 --- a/test/unittest/UTTest_softbus_connector.cpp +++ b/test/unittest/UTTest_softbus_connector.cpp @@ -87,7 +87,7 @@ HWTEST_F(SoftbusConnectorTest, UnRegisterSoftbusDiscoveryCallback_001, testing:: { std::string pkgName = "com.ohos.helloworld"; int ret = softbusConnector->UnRegisterSoftbusDiscoveryCallback(pkgName); - int ret1 = SoftbusConnector::discoveryCallbackMap_.count(pkgName); + uint32_t ret1 = SoftbusConnector::discoveryCallbackMap_.count(pkgName); EXPECT_EQ(ret1, 0); EXPECT_EQ(ret, DM_OK); } @@ -330,4 +330,4 @@ HWTEST_F(SoftbusConnectorTest, OnParameterChgCallback_001, testing::ext::TestSiz } } // namespace } // namespace DistributedHardware -} // namespace OHOS \ No newline at end of file +} // namespace OHOS diff --git a/utils/src/dm_anonymous.cpp b/utils/src/dm_anonymous.cpp index 8d9a7be38150da21a5f2b8a01a9d383e4542d484..907c9f20880f77eabe86f5524587e762e7bbb7f7 100644 --- a/utils/src/dm_anonymous.cpp +++ b/utils/src/dm_anonymous.cpp @@ -58,4 +58,4 @@ std::string GetAnonyInt32(const int32_t value) return tempString; } } // namespace DistributedHardware -} // namespace OHOS \ No newline at end of file +} // namespace OHOS diff --git a/utils/src/dm_random.cpp b/utils/src/dm_random.cpp index d7d03c24273532cb710028944211dbeac5684f6a..7a1d6a71647d23aa10ee0aa9dbb73d311e54ecf9 100644 --- a/utils/src/dm_random.cpp +++ b/utils/src/dm_random.cpp @@ -87,7 +87,7 @@ bool MbedtlsGenRandomStr(char *szOut, int32_t szOutLen, bool numberOnly) return false; } szOut[--szOutLen] = 0; - GetRandomData((uint8_t *)szOut, szOutLen); + GetRandomData((uint8_t *)szOut, (uint32_t)szOutLen); const int32_t NUMBER_COUNT = 10; const int32_t ALPHA_COUNT = 26; const int32_t ALPHA_BYTE_COUNT = 2;