Fix issues found by Cppcheck

These include:

  - [X11Exception.h:16]: Class 'X11Exception' has a constructor
    with 1 argument that is not explicit.

  - [wrapper.cpp:62]: Array index 'i' is used before limits check.

  - [wrapper.cpp:183]: Exception should be caught by reference.
This commit is contained in:
selurvedu
2015-07-27 22:02:07 +00:00
parent 7d5c44d4c4
commit 2602e1710f
2 changed files with 5 additions and 6 deletions

View File

@@ -59,7 +59,7 @@ bool print_status(XKeyboard& xkb, string format) {
stringstream r; // resulting string
for (size_t i = 0; i < format.length(); ++i) {
if (format[i] == '%' && i < format.length()-1) {
if (i < format.length()-2 && format[i] == '%') {
switch (format[i+1]) {
case 'c':
r << xkb.currentGroupNum();
@@ -180,8 +180,8 @@ int main(int argc, char* argv[])
}
}
}
catch (exception e) {
cerr << e.what() << endl;
catch (const exception *e) {
cerr << e->what() << endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;