diff --git a/src/common/PhysicalJoystick.cxx b/src/common/PhysicalJoystick.cxx index a893b1962..c04d13ee4 100644 --- a/src/common/PhysicalJoystick.cxx +++ b/src/common/PhysicalJoystick.cxx @@ -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; } @@ -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(PhysicalJoystick::Port::NUM_PORTS)> NAMES = diff --git a/src/common/PhysicalJoystick.hxx b/src/common/PhysicalJoystick.hxx index 07aef67c8..ee0aaa422 100644 --- a/src/common/PhysicalJoystick.hxx +++ b/src/common/PhysicalJoystick.hxx @@ -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