From 82da36492a60bb6a48cb062841f53d37851a5e0c Mon Sep 17 00:00:00 2001 From: Matthew Swartwout Date: Wed, 15 May 2024 12:39:10 -0700 Subject: [PATCH] Use data() instead of begin() in Protocols.cpp (#33476) * Use data() instead of begin() in Protocols.cpp The GetProtocolName() function tries to store the result of std::array::begin() in a raw pointer type, but this no longer works on some newer versions of clang, since clang now returns an iterator object. This change fixes this by switching to std::array::data() instead, which always returns a raw pointer. * Restyled by whitespace --------- Co-authored-by: Restyled.io --- src/protocols/Protocols.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/protocols/Protocols.cpp b/src/protocols/Protocols.cpp index f840bb097249a9..4428d8c8b1540b 100644 --- a/src/protocols/Protocols.cpp +++ b/src/protocols/Protocols.cpp @@ -86,27 +86,27 @@ const char * GetMessageTypeName(Id protocolId, uint8_t msgType) switch (protocolId.GetProtocolId()) { case InteractionModel::Id.GetProtocolId(): - lookupTable = MessageTypeTraits::GetTypeToNameTable()->begin(); + lookupTable = MessageTypeTraits::GetTypeToNameTable()->data(); lookupTableSize = MessageTypeTraits::GetTypeToNameTable()->size(); break; case SecureChannel::Id.GetProtocolId(): - lookupTable = MessageTypeTraits::GetTypeToNameTable()->begin(); + lookupTable = MessageTypeTraits::GetTypeToNameTable()->data(); lookupTableSize = MessageTypeTraits::GetTypeToNameTable()->size(); break; case BDX::Id.GetProtocolId(): - lookupTable = MessageTypeTraits::GetTypeToNameTable()->begin(); + lookupTable = MessageTypeTraits::GetTypeToNameTable()->data(); lookupTableSize = MessageTypeTraits::GetTypeToNameTable()->size(); break; case Echo::Id.GetProtocolId(): - lookupTable = MessageTypeTraits::GetTypeToNameTable()->begin(); + lookupTable = MessageTypeTraits::GetTypeToNameTable()->data(); lookupTableSize = MessageTypeTraits::GetTypeToNameTable()->size(); break; case UserDirectedCommissioning::Id.GetProtocolId(): - lookupTable = MessageTypeTraits::GetTypeToNameTable()->begin(); + lookupTable = MessageTypeTraits::GetTypeToNameTable()->data(); lookupTableSize = MessageTypeTraits::GetTypeToNameTable()->size(); break;