Don't specify a conflicting type for setField calls
On 32bit builds, jlong is `long long`, so passing in a long and claiming that it's a jlong is wrong. This causes a build failure after the addition of optional exception handling for QJniObject calls in qtbase:d045e2d2b604152450a45846fc87cb53d89bf50a. Fix that by not specifying the field type explicitly, and instead consistently cast to jlong (using reinterpret_cast if we have a pointer, otherwise construct the jlong in place). This is not a problem for calls that specify e.g. jboolean and then pass a bool, as those are the same types on all platforms. Fixes: QTBUG-142334 Change-Id: Icbcab1b20157b2e9d002d2de8efd9fe4acef291d Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit is contained in:
parent
064d855c00
commit
2cc77bcc4a
|
|
@ -23,7 +23,7 @@ AndroidBroadcastReceiver::AndroidBroadcastReceiver(QObject* parent)
|
|||
broadcastReceiverObject = QJniObject::construct<QtJniTypes::QtBtBroadcastReceiver>();
|
||||
if (!broadcastReceiverObject.isValid())
|
||||
return;
|
||||
broadcastReceiverObject.setField<jlong>("qtObject", reinterpret_cast<long>(this));
|
||||
broadcastReceiverObject.setField("qtObject", reinterpret_cast<jlong>(this));
|
||||
|
||||
intentFilterObject = QJniObject::construct<QtJniTypes::IntentFilter>();
|
||||
if (!intentFilterObject.isValid())
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ bool InputStreamThread::run()
|
|||
|
||||
javaInputStreamThread.callMethod<void>("setInputStream",
|
||||
m_socket_p->inputStream.object<QtJniTypes::InputStream>());
|
||||
javaInputStreamThread.setField<jlong>("qtObject", reinterpret_cast<long>(this));
|
||||
javaInputStreamThread.setField("qtObject", reinterpret_cast<jlong>(this));
|
||||
javaInputStreamThread.setField<jboolean>("logEnabled", QT_BT_ANDROID().isDebugEnabled());
|
||||
|
||||
javaInputStreamThread.callMethod<void>("start");
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ LowEnergyNotificationHub::LowEnergyNotificationHub(const QBluetoothAddress &remo
|
|||
hubMap()->insert(javaToCtoken, this);
|
||||
lock.unlock();
|
||||
|
||||
jBluetoothLe.setField<jlong>("qtObject", javaToCtoken);
|
||||
jBluetoothLe.setField("qtObject", jlong(javaToCtoken));
|
||||
}
|
||||
|
||||
LowEnergyNotificationHub::~LowEnergyNotificationHub()
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ void ServerAcceptanceThread::run()
|
|||
if (!javaThread.isValid())
|
||||
return;
|
||||
|
||||
javaThread.setField<jlong>("qtObject", reinterpret_cast<long>(this));
|
||||
javaThread.setField("qtObject", reinterpret_cast<jlong>(this));
|
||||
javaThread.setField<jboolean>("logEnabled", QT_BT_ANDROID().isDebugEnabled());
|
||||
|
||||
QString tempUuid = m_uuid.toString(QUuid::WithoutBraces);
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ QBluetoothDeviceDiscoveryAgentPrivate::~QBluetoothDeviceDiscoveryAgentPrivate()
|
|||
stop();
|
||||
|
||||
if (leScanner.isValid())
|
||||
leScanner.setField<jlong>("qtObject", reinterpret_cast<jlong>(nullptr));
|
||||
leScanner.setField("qtObject", reinterpret_cast<jlong>(nullptr));
|
||||
|
||||
if (receiver) {
|
||||
receiver->unregisterReceiver();
|
||||
|
|
@ -439,7 +439,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::startLowEnergyScan()
|
|||
return;
|
||||
}
|
||||
|
||||
leScanner.setField<jlong>("qtObject", reinterpret_cast<long>(receiver));
|
||||
leScanner.setField("qtObject", reinterpret_cast<jlong>(receiver));
|
||||
}
|
||||
|
||||
jboolean result = leScanner.callMethod<jboolean>("scanForLeDevice", true);
|
||||
|
|
|
|||
Loading…
Reference in New Issue