diff options
author | Sven Gothel <[email protected]> | 2020-10-20 05:51:29 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-10-20 05:51:29 +0200 |
commit | 1c54ef46cb137dec49748c5b9c237c6ccd139f6f (patch) | |
tree | afa877818b344bda20f270cdfd7c01ba84657584 | |
parent | 94205b2e99d114f4238e2b846dce980901a59459 (diff) |
Minor int -> uint16_t explicit cast
Turns our there are too many to handle for now.
Trust that i.e. dev_id value range does not exceed expected range,
but even though - it would just end up in a failed call.
-rw-r--r-- | java/jni/direct_bt/DBTAdapter.cxx | 2 | ||||
-rw-r--r-- | src/direct_bt/DBTManager.cpp | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/java/jni/direct_bt/DBTAdapter.cxx b/java/jni/direct_bt/DBTAdapter.cxx index ce0b451c..05bc0aa7 100644 --- a/java/jni/direct_bt/DBTAdapter.cxx +++ b/java/jni/direct_bt/DBTAdapter.cxx @@ -473,7 +473,7 @@ jboolean Java_direct_1bt_tinyb_DBTAdapter_addDeviceToWhitelist__Ljava_lang_Strin EUI48 address(saddress); const BDAddressType addressType = static_cast<BDAddressType>( jaddressType ); const HCIWhitelistConnectType ctype = static_cast<HCIWhitelistConnectType>( jctype ); - return adapter->addDeviceToWhitelist(address, addressType, ctype, min_interval, max_interval, latency, timeout); + return adapter->addDeviceToWhitelist(address, addressType, ctype, (uint16_t)min_interval, (uint16_t)max_interval, (uint16_t)latency, (uint16_t)timeout); } catch(...) { rethrow_and_raise_java_exception(env); } diff --git a/src/direct_bt/DBTManager.cpp b/src/direct_bt/DBTManager.cpp index 54600070..a0654f69 100644 --- a/src/direct_bt/DBTManager.cpp +++ b/src/direct_bt/DBTManager.cpp @@ -771,7 +771,7 @@ std::shared_ptr<ConnectionInfo> DBTManager::getConnectionInfo(const int dev_id, } std::shared_ptr<NameAndShortName> DBTManager::setLocalName(const int dev_id, const std::string & name, const std::string & short_name) noexcept { - MgmtSetLocalNameCmd req (dev_id, name, short_name); + MgmtSetLocalNameCmd req (static_cast<uint16_t>(dev_id), name, short_name); std::shared_ptr<MgmtEvent> res = sendWithReply(req); if( nullptr != res && res->getOpcode() == MgmtEvent::Opcode::CMD_COMPLETE ) { const MgmtEvtCmdComplete &res1 = *static_cast<const MgmtEvtCmdComplete *>(res.get()); @@ -779,7 +779,7 @@ std::shared_ptr<NameAndShortName> DBTManager::setLocalName(const int dev_id, con std::shared_ptr<NameAndShortName> result = res1.toNameAndShortName(); // explicit LocalNameChanged event - MgmtEvtLocalNameChanged * e = new MgmtEvtLocalNameChanged(dev_id, result->getName(), result->getShortName()); + MgmtEvtLocalNameChanged * e = new MgmtEvtLocalNameChanged(static_cast<uint16_t>(dev_id), result->getName(), result->getShortName()); sendMgmtEvent(std::shared_ptr<MgmtEvent>(e)); return result; } |