diff --git a/src/command_line_options.cpp b/src/command_line_options.cpp index b32795f..4eb2bc5 100644 --- a/src/command_line_options.cpp +++ b/src/command_line_options.cpp @@ -207,9 +207,9 @@ CommandLineParser::init_ini(Options* opts) ("square-axis", &opts->square_axis) ("four-way-restrictor", &opts->four_way_restrictor) ("dpad-rotation", &opts->dpad_rotation) - ("evdev-device", &opts->evdev_device); + ("evdev-device", &opts->evdev_device) - m_ini.section("uinput") + // uinput stuff ("device-name", &opts->uinput_config.device_name) ("trigger-as-button", &opts->uinput_config.trigger_as_button) ("trigger-as-zaxis", &opts->uinput_config.trigger_as_zaxis) @@ -550,6 +550,10 @@ CommandLineParser::parse_args(int argc, char** argv, Options* options) case OPTION_WID: opts.wireless_id = boost::lexical_cast<int>(opt.argument); + if (opts.wireless_id < 0 || opts.wireless_id > 3) + { + throw std::runtime_error("wireless id must be within 0 and 3"); + } break; case OPTION_LED: diff --git a/src/evdev_controller.cpp b/src/evdev_controller.cpp index cfb4d25..e617c14 100644 --- a/src/evdev_controller.cpp +++ b/src/evdev_controller.cpp @@ -181,7 +181,7 @@ EvdevController::read_data_to_buffer() int rd = 0; while((rd = ::read(m_fd, ev, sizeof(struct input_event) * 128)) > 0) { - for (int i = 0; i < rd / (int)sizeof(struct input_event); ++i) + for (size_t i = 0; i < rd / sizeof(struct input_event); ++i) { m_event_buffer.push(ev[i]); } diff --git a/src/ini_parser.cpp b/src/ini_parser.cpp index bcf0a2e..731b3e5 100644 --- a/src/ini_parser.cpp +++ b/src/ini_parser.cpp @@ -167,7 +167,7 @@ INIParser::get_value() std::ostringstream str; while(peek() != ' ' && peek() != '\t' && peek() != '\n') { - str << (char)peek(); + str << static_cast<char>(peek()); next(); } return str.str(); @@ -179,7 +179,7 @@ INIParser::get_ident() std::ostringstream str; while(peek() != '=' && peek() != ' ' && peek() != '\t') { - str << (char)peek(); + str << static_cast<char>(peek()); next(); } return str.str(); @@ -203,12 +203,12 @@ INIParser::get_string() case 't': str << '\t'; break; case 'r': str << '\r'; break; case 'n': str << '\n'; break; - default: str << '\\' << (char)peek(); break; + default: str << '\\' << static_cast<char>(peek()); break; } } else { - str << (char)peek(); + str << static_cast<char>(peek()); } next(); } @@ -243,7 +243,7 @@ INIParser::get_section() std::ostringstream str; while(peek() != ']') { - str << (char)peek(); + str << static_cast<char>(peek()); next(); } return str.str(); diff --git a/src/ini_schema.cpp b/src/ini_schema.cpp index 823a541..b18ac79 100644 --- a/src/ini_schema.cpp +++ b/src/ini_schema.cpp @@ -70,9 +70,9 @@ public: std::string str() const { - std::ostringstream str; - str << *m_data; - return str.str(); + std::ostringstream out; + out << *m_data; + return out.str(); } }; @@ -90,9 +90,9 @@ public: std::string str() const { - std::ostringstream str; - str << *m_data; - return str.str(); + std::ostringstream out; + out << *m_data; + return out.str(); } }; @@ -254,9 +254,9 @@ INISchema::section(const std::string& name, delete i->second; } - INISchemaSection* section = new INISchemaSection(callback); - m_sections.insert(std::pair<std::string, INISchemaSection*>(name, section)); - return *section; + INISchemaSection* sec = new INISchemaSection(callback); + m_sections.insert(std::pair<std::string, INISchemaSection*>(name, sec)); + return *sec; } INISchemaSection* diff --git a/src/uinput.cpp b/src/uinput.cpp index fa0fee7..8fbcc97 100644 --- a/src/uinput.cpp +++ b/src/uinput.cpp @@ -520,10 +520,10 @@ uInput::send_button(XboxButton code, bool value) { for(int j = 0; j < XBOX_BTN_MAX; ++j) // iterate over all shift buttons { - const ButtonEvent& event = cfg.btn_map.lookup(static_cast<XboxButton>(j), + const ButtonEvent& event2 = cfg.btn_map.lookup(static_cast<XboxButton>(j), static_cast<XboxButton>(i)); - if (event.is_valid()) - event.send(*this, false); + if (event2.is_valid()) + event2.send(*this, false); } } }