From 41c8c22a96004f86625b776a22d3510ff04eb67c Mon Sep 17 00:00:00 2001 From: Vincent Coubard Date: Fri, 21 Aug 2020 16:04:19 +0100 Subject: [PATCH] BLE: Warning cleanup - Missing default assignment operator - Field order in construction list - Typo - Unused header --- .../FEATURE_BLE/include/ble/GattServer.h | 2 +- .../FEATURE_BLE/include/ble/common/ble/UUID.h | 7 +++++++ .../ble/common/ble/gap/AdvertisingDataParser.h | 4 ++-- .../include/ble/internal/SecurityDb.h | 2 +- .../TARGET_CORDIO/driver/CordioHCIDriver.cpp | 2 +- .../include/ble/internal/PalGapImpl.h | 2 +- .../include/ble/internal/SecurityManagerImpl.h | 6 +++--- .../source/GattClientImpl.cpp | 9 --------- .../source/GattServerImpl.cpp | 2 +- .../source/DiscoveredCharacteristic.cpp | 1 + connectivity/FEATURE_BLE/source/GattClient.cpp | 18 ------------------ 11 files changed, 18 insertions(+), 37 deletions(-) diff --git a/connectivity/FEATURE_BLE/include/ble/GattServer.h b/connectivity/FEATURE_BLE/include/ble/GattServer.h index 9108b7b339..94a554770f 100644 --- a/connectivity/FEATURE_BLE/include/ble/GattServer.h +++ b/connectivity/FEATURE_BLE/include/ble/GattServer.h @@ -507,7 +507,7 @@ public: void (T::*memberPtr)(const GattReadCallbackParams *context) ) { - onDataRead({objPtr, memberPtr}); + return onDataRead({objPtr, memberPtr}); } /** diff --git a/connectivity/FEATURE_BLE/include/ble/common/ble/UUID.h b/connectivity/FEATURE_BLE/include/ble/common/ble/UUID.h index 7d560a5e8e..5532bab8cd 100644 --- a/connectivity/FEATURE_BLE/include/ble/common/ble/UUID.h +++ b/connectivity/FEATURE_BLE/include/ble/common/ble/UUID.h @@ -235,6 +235,13 @@ public: memcpy(baseUUID, source.baseUUID, LENGTH_OF_LONG_UUID); } + /** + * UUID copy assignment. + * + * @param[in] source The UUID to copy. + */ + UUID& operator=(const UUID &source) = default; + /** * Default constructor. * diff --git a/connectivity/FEATURE_BLE/include/ble/common/ble/gap/AdvertisingDataParser.h b/connectivity/FEATURE_BLE/include/ble/common/ble/gap/AdvertisingDataParser.h index dc7a18286e..9e61629c54 100644 --- a/connectivity/FEATURE_BLE/include/ble/common/ble/gap/AdvertisingDataParser.h +++ b/connectivity/FEATURE_BLE/include/ble/common/ble/gap/AdvertisingDataParser.h @@ -70,7 +70,7 @@ public: */ bool hasNext() const { - if (position >= data.size()) { + if (position >= (size_t) data.size()) { return false; } @@ -79,7 +79,7 @@ public: return false; } - if (position + current_length() >= data.size()) { + if (position + current_length() >= (size_t) data.size()) { return false; } diff --git a/connectivity/FEATURE_BLE/include/ble/internal/SecurityDb.h b/connectivity/FEATURE_BLE/include/ble/internal/SecurityDb.h index cd20c07cec..3cbf9d8b3c 100644 --- a/connectivity/FEATURE_BLE/include/ble/internal/SecurityDb.h +++ b/connectivity/FEATURE_BLE/include/ble/internal/SecurityDb.h @@ -344,7 +344,7 @@ public: Span& identity_list ) { size_t count = 0; - for (size_t i = 0; i < get_entry_count() && count < identity_list.size(); ++i) { + for (size_t i = 0; i < get_entry_count() && count < (size_t) identity_list.size(); ++i) { entry_handle_t db_handle = get_entry_handle_by_index(i); SecurityDistributionFlags_t* flags = get_distribution_flags(db_handle); diff --git a/connectivity/FEATURE_BLE/libraries/TARGET_CORDIO/driver/CordioHCIDriver.cpp b/connectivity/FEATURE_BLE/libraries/TARGET_CORDIO/driver/CordioHCIDriver.cpp index 1da41550bb..fb91c68450 100644 --- a/connectivity/FEATURE_BLE/libraries/TARGET_CORDIO/driver/CordioHCIDriver.cpp +++ b/connectivity/FEATURE_BLE/libraries/TARGET_CORDIO/driver/CordioHCIDriver.cpp @@ -17,8 +17,8 @@ #include #include -#include "ble/internal/BLEInstanceBase.h" #include "ble/BLE.h" +#include "ble/internal/BLEInstanceBase.h" #include "ble/Gap.h" #include "CordioHCIDriver.h" #include "hci_api.h" diff --git a/connectivity/FEATURE_BLE/libraries/TARGET_CORDIO/include/ble/internal/PalGapImpl.h b/connectivity/FEATURE_BLE/libraries/TARGET_CORDIO/include/ble/internal/PalGapImpl.h index f5bf251f3c..40ff8de4f4 100644 --- a/connectivity/FEATURE_BLE/libraries/TARGET_CORDIO/include/ble/internal/PalGapImpl.h +++ b/connectivity/FEATURE_BLE/libraries/TARGET_CORDIO/include/ble/internal/PalGapImpl.h @@ -29,7 +29,7 @@ namespace ble { */ class PalGap : public interface::PalGap { public: - PalGap() : use_active_scanning(false), _pal_event_handler(NULL) { }; + PalGap() : _pal_event_handler(NULL), use_active_scanning(false) { }; ~PalGap() { }; bool is_feature_supported( diff --git a/connectivity/FEATURE_BLE/libraries/ble-api-implementation/include/ble/internal/SecurityManagerImpl.h b/connectivity/FEATURE_BLE/libraries/ble-api-implementation/include/ble/internal/SecurityManagerImpl.h index 9fa86daffa..adc00a26d9 100644 --- a/connectivity/FEATURE_BLE/libraries/ble-api-implementation/include/ble/internal/SecurityManagerImpl.h +++ b/connectivity/FEATURE_BLE/libraries/ble-api-implementation/include/ble/internal/SecurityManagerImpl.h @@ -454,7 +454,8 @@ private: PalSecurityManager &palImpl, PalConnectionMonitor &connMonitorImpl, PalSigningMonitor &signingMonitorImpl - ) : _pal(palImpl), + ) : eventHandler(nullptr), + _pal(palImpl), _connection_monitor(connMonitorImpl), _signing_monitor(signingMonitorImpl), _db(NULL), @@ -462,8 +463,7 @@ private: _default_key_distribution(KeyDistribution::KEY_DISTRIBUTION_ALL), _pairing_authorisation_required(false), _legacy_pairing_allowed(true), - _master_sends_keys(false), - eventHandler(NULL) + _master_sends_keys(false) { eventHandler = &defaultEventHandler; _pal.set_event_handler(this); diff --git a/connectivity/FEATURE_BLE/libraries/ble-api-implementation/source/GattClientImpl.cpp b/connectivity/FEATURE_BLE/libraries/ble-api-implementation/source/GattClientImpl.cpp index 6683eeafb3..02bdd5855c 100644 --- a/connectivity/FEATURE_BLE/libraries/ble-api-implementation/source/GattClientImpl.cpp +++ b/connectivity/FEATURE_BLE/libraries/ble-api-implementation/source/GattClientImpl.cpp @@ -1688,15 +1688,6 @@ void GattClient::onShutdown(const GattClientShutdownCallback_t &callback) shutdownCallChain.add(callback); } -/** - * @see GattClient::onShutdown - */ -template -void GattClient::onShutdown(T *objPtr, void (T::*memberPtr)(const GattClient *)) -{ - shutdownCallChain.add(objPtr, memberPtr); -} - /** * @see GattClient::onShutdown */ diff --git a/connectivity/FEATURE_BLE/libraries/ble-api-implementation/source/GattServerImpl.cpp b/connectivity/FEATURE_BLE/libraries/ble-api-implementation/source/GattServerImpl.cpp index 9c01974bfa..ba85364679 100644 --- a/connectivity/FEATURE_BLE/libraries/ble-api-implementation/source/GattServerImpl.cpp +++ b/connectivity/FEATURE_BLE/libraries/ble-api-implementation/source/GattServerImpl.cpp @@ -1384,9 +1384,9 @@ bool GattServer::is_update_authorized( } GattServer::GattServer() : + eventHandler(nullptr), serviceCount(0), characteristicCount(0), - eventHandler(nullptr), dataSentCallChain(), dataWrittenCallChain(), dataReadCallChain(), diff --git a/connectivity/FEATURE_BLE/source/DiscoveredCharacteristic.cpp b/connectivity/FEATURE_BLE/source/DiscoveredCharacteristic.cpp index d7575ab3af..14b4772894 100644 --- a/connectivity/FEATURE_BLE/source/DiscoveredCharacteristic.cpp +++ b/connectivity/FEATURE_BLE/source/DiscoveredCharacteristic.cpp @@ -16,6 +16,7 @@ * limitations under the License. */ +#include "ble/BLE.h" #include "ble/common/ble/DiscoveredCharacteristic.h" #include "ble/GattClient.h" diff --git a/connectivity/FEATURE_BLE/source/GattClient.cpp b/connectivity/FEATURE_BLE/source/GattClient.cpp index afbb3f0d45..208e631957 100644 --- a/connectivity/FEATURE_BLE/source/GattClient.cpp +++ b/connectivity/FEATURE_BLE/source/GattClient.cpp @@ -15,24 +15,6 @@ * limitations under the License. */ -/* mbed Microcontroller Library - * Copyright (c) 2006-2020 ARM Limited - * - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - #include "ble/GattClient.h" #include "ble/internal/GattClientImpl.h"