Skip to content

Commit 8392133

Browse files
committed
Make NFCLayerInterface destructor virtual and out-of-line B/F/V layer destructors
1 parent f63959c commit 8392133

11 files changed

Lines changed: 16 additions & 2 deletions

src/nfc/layer/a/emulation_layer_a.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class EmulationLayerA {
4747
explicit EmulationLayerA(m5::unit::UnitST25R3916& u);
4848
//! @brief Construct with CapST25R3916 (SPI)
4949
explicit EmulationLayerA(m5::unit::CapST25R3916& u);
50-
~EmulationLayerA();
50+
virtual ~EmulationLayerA();
5151

5252
//! @brief Gets the current emulation state
5353
inline State state() const

src/nfc/layer/a/nfc_layer_a.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class NFCLayerA : public m5::nfc::NFCLayerInterface {
5151
explicit NFCLayerA(m5::unit::UnitST25R3916& u);
5252
//! @brief Constructor with CapST25R3916 (SPI variant)
5353
explicit NFCLayerA(m5::unit::CapST25R3916& u);
54-
~NFCLayerA();
54+
virtual ~NFCLayerA();
5555

5656
///@name override
5757
///@{

src/nfc/layer/b/nfc_layer_b.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ constexpr uint8_t fsdi_for_size(const uint16_t bytes)
6262
namespace m5 {
6363
namespace nfc {
6464

65+
NFCLayerB::~NFCLayerB() = default;
66+
6567
uint16_t NFCLayerB::maximum_fifo_depth() const
6668
{
6769
return _impl->max_fifo_depth();

src/nfc/layer/b/nfc_layer_b.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class NFCLayerB : public NFCLayerInterface {
4545
explicit NFCLayerB(m5::unit::CapST25R3916& u);
4646
//! @brief Constructor with UnitWS1850S (M5Unit-RFID)
4747
explicit NFCLayerB(m5::unit::UnitWS1850S& u);
48+
virtual ~NFCLayerB();
4849

4950
//! @brief Transceive (NFC-B)
5051
virtual bool transceive(uint8_t* rx, uint16_t& rx_len, const uint8_t* tx, const uint16_t tx_len,

src/nfc/layer/f/emulation_layer_f.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ inline bool is_system_code_wildcard(const uint8_t sc[2])
6565
namespace m5 {
6666
namespace nfc {
6767

68+
EmulationLayerF::~EmulationLayerF() = default;
69+
6870
bool EmulationLayerF::begin(const m5::nfc::f::PICC& picc, uint8_t* ptr, const uint32_t size)
6971
{
7072
if (_state != State::None) {

src/nfc/layer/f/emulation_layer_f.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class EmulationLayerF {
4747
explicit EmulationLayerF(m5::unit::UnitST25R3916& u);
4848
//! @brief Construct with CapST25R3916 (SPI)
4949
explicit EmulationLayerF(m5::unit::CapST25R3916& u);
50+
virtual ~EmulationLayerF();
5051

5152
//! @brief Gets the current emulation state
5253
inline State state() const

src/nfc/layer/f/nfc_layer_f.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ const uint8_t* make_rc(uint8_t rc[16])
7979
namespace m5 {
8080
namespace nfc {
8181

82+
NFCLayerF::~NFCLayerF() = default;
83+
8284
uint16_t NFCLayerF::maximum_fifo_depth() const
8385
{
8486
return _impl->max_fifo_depth();

src/nfc/layer/f/nfc_layer_f.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class NFCLayerF : public NFCLayerInterface {
4141
explicit NFCLayerF(m5::unit::UnitST25R3916& u);
4242
//! @brief Constructor with CapST25R3916 (SPI variant)
4343
explicit NFCLayerF(m5::unit::CapST25R3916& u);
44+
virtual ~NFCLayerF();
4445

4546
//! @brief Maximum FIFO depth in bytes
4647
virtual uint16_t maximum_fifo_depth() const override;

src/nfc/layer/nfc_layer.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ class IsoDEP;
2525
*/
2626
class NFCLayerInterface {
2727
public:
28+
//! @brief Virtual destructor (required for polymorphic deletion)
29+
virtual ~NFCLayerInterface() = default;
2830
//! @brief activePICC's NDEF type
2931
virtual m5::nfc::NFCForumTag supportsNFCTag() const
3032
{

src/nfc/layer/v/nfc_layer_v.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ constexpr char dump_line[] =
7373
namespace m5 {
7474
namespace nfc {
7575

76+
NFCLayerV::~NFCLayerV() = default;
77+
7678
uint16_t NFCLayerV::maximum_fifo_depth() const
7779
{
7880
return _impl->max_fifo_depth();

0 commit comments

Comments
 (0)