From 2cd7d89ec58c0e308c5f434fbb65acf686cdf133 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Fri, 14 Jan 2022 17:14:02 +0100 Subject: [PATCH] Android: Remove a cast in AndroidDeployQtStep::init Don't do an additional dynamic_cast. Change-Id: Icf3beda4e78bc03232689439e8ba264287b603ab Reviewed-by: Assam Boudjelthia --- src/plugins/android/androiddeployqtstep.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/plugins/android/androiddeployqtstep.cpp b/src/plugins/android/androiddeployqtstep.cpp index 16177ca1afa..1d76083a6e0 100644 --- a/src/plugins/android/androiddeployqtstep.cpp +++ b/src/plugins/android/androiddeployqtstep.cpp @@ -164,14 +164,15 @@ bool AndroidDeployQtStep::init() if (selectedAbis.isEmpty()) selectedAbis.append(bs->extraData(buildKey, Constants::AndroidAbi).toString()); - // TODO: use AndroidDevice directly instead of AndroidDeviceInfo. if (!info.isValid()) { - const IDevice *dev = DeviceKitAspect::device(kit()).data(); + const auto dev = + static_cast(DeviceKitAspect::device(kit()).data()); if (!dev) { reportWarningOrError(tr("No valid deployment device is set."), Task::Error); return false; } + // TODO: use AndroidDevice directly instead of AndroidDeviceInfo. info = AndroidDevice::androidDeviceInfoFromIDevice(dev); m_deviceInfo = info; // Keep around for later steps @@ -181,18 +182,17 @@ bool AndroidDeployQtStep::init() return false; } - const AndroidDevice *androidDev = static_cast(dev); - if (androidDev && !androidDev->canSupportAbis(selectedAbis)) { + if (!dev->canSupportAbis(selectedAbis)) { const QString error = tr("The deployment device \"%1\" does not support the " "architectures used by the kit.\n" "The kit supports \"%2\", but the device uses \"%3\".") .arg(dev->displayName()).arg(selectedAbis.join(", ")) - .arg(androidDev->supportedAbis().join(", ")); + .arg(dev->supportedAbis().join(", ")); reportWarningOrError(error, Task::Error); return false; } - if (androidDev && !androidDev->canHandleDeployments()) { + if (!dev->canHandleDeployments()) { reportWarningOrError(tr("The deployment device \"%1\" is disconnected.") .arg(dev->displayName()), Task::Error); return false;