Skip to content

Commit

Permalink
Merge pull request #259 from beku-epitome/bugfix/clang-compile
Browse files Browse the repository at this point in the history
Clang fails due to `cbegin()` returning an iterator, not a pointer, when casting to `std::string_view`
  • Loading branch information
aentinger committed Nov 8, 2023
2 parents 1940b35 + 580649b commit cdf3dc9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/util/registry/Registry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class Registry final : public cyphal::registry::Registry

TAccessResponse onAccess_1_0_Request_Received(TAccessRequest const &req)
{
auto const req_name = std::string_view(reinterpret_cast<const char *>(req.name.name.cbegin()),
auto const req_name = std::string_view(reinterpret_cast<const char *>(req.name.name.data()),
req.name.name.size());

/* Try to set the registers value. Note, if this is a RO register
Expand Down
4 changes: 2 additions & 2 deletions src/util/storage/register_storage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ template <typename FeedWatchdogFunc>

// Find the next register in the registry.
const auto reg_name_storage = rgy.index(index); // This is a little suboptimal but we don't care.
const auto reg_name = std::string_view(reinterpret_cast<const char *>(reg_name_storage.name.cbegin()), reg_name_storage.name.size());
const auto reg_name = std::string_view(reinterpret_cast<const char *>(reg_name_storage.name.data()), reg_name_storage.name.size());
if (reg_name.empty())
{
break; // No more registers to load.
Expand Down Expand Up @@ -107,7 +107,7 @@ template <typename ResetPredicate, typename FeedWatchdogFunc>
feed_watchdog_func();

const auto reg_name_storage = rgy.index(index); // This is a little suboptimal but we don't care.
const auto reg_name = std::string_view(reinterpret_cast<const char *>(reg_name_storage.name.cbegin()), reg_name_storage.name.size());
const auto reg_name = std::string_view(reinterpret_cast<const char *>(reg_name_storage.name.data()), reg_name_storage.name.size());
if (reg_name.empty())
{
break; // No more registers to load.
Expand Down

0 comments on commit cdf3dc9

Please sign in to comment.