Skip to content

Commit

Permalink
A cleaner fix for the last commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
sa666666 committed Aug 2, 2023
1 parent 7c34bdd commit 2e556fe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/common/PhysicalJoystick.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ bool PhysicalJoystick::setMap(const json& map)
continue;
if(entry.key() == "port")
{
port = getPort(entry.value());
port = getPort(string{entry.value()}); // json doesn't support string_view
continue;
}

Expand Down Expand Up @@ -126,7 +126,7 @@ string PhysicalJoystick::getName(const PhysicalJoystick::Port _port) const
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PhysicalJoystick::Port PhysicalJoystick::getPort(const string& portName) const
PhysicalJoystick::Port PhysicalJoystick::getPort(string_view portName) const
{
static constexpr std::array<string_view,
static_cast<int>(PhysicalJoystick::Port::NUM_PORTS)> NAMES =
Expand Down
2 changes: 1 addition & 1 deletion src/common/PhysicalJoystick.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class PhysicalJoystick

// Convert from string to Port type and vice versa
string getName(const Port _port) const;
Port getPort(const string& portName) const; // FIXME: allow string_view
Port getPort(string_view portName) const;

friend ostream& operator<<(ostream& os, const PhysicalJoystick& s) {
os << " ID: " << s.ID << ", name: " << s.name << ", numaxis: " << s.numAxes
Expand Down

0 comments on commit 2e556fe

Please sign in to comment.