From 47d876b4cb1a022cc00691c899d361342eea25a0 Mon Sep 17 00:00:00 2001 From: June Tate-Gans Date: Sun, 25 Apr 2021 14:39:40 -0500 Subject: [PATCH] g13d: Fix a bunch of sign comparisons --- g13d/g13_fonts.cc | 2 +- g13d/g13_keys.cc | 6 ++++-- g13d/g13_lcd.cc | 3 ++- g13d/g13_stick.cc | 1 - g13d/logo.h | 5 +++-- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/g13d/g13_fonts.cc b/g13d/g13_fonts.cc index 8260ec6..24904db 100644 --- a/g13d/g13_fonts.cc +++ b/g13d/g13_fonts.cc @@ -397,7 +397,7 @@ template int GetFontCharacterCount(T (&)[size]) { template void G13_Font::install_font(ARRAY_T &data, FLAGST flags, int first) { - for (size_t i = 0; i < GetFontCharacterCount(data); i++) { + for (int i = 0; i < GetFontCharacterCount(data); i++) { _chars[i + first].set_character(&data[i][0], _width, flags); } } diff --git a/g13d/g13_keys.cc b/g13d/g13_keys.cc index 8f91288..77842d1 100644 --- a/g13d/g13_keys.cc +++ b/g13d/g13_keys.cc @@ -99,11 +99,13 @@ void G13_Profile::parse_keys(unsigned char *buf) { } G13_Key *G13_Profile::find_key(const std::string &keyname) { - auto key = _keypad.manager().find_g13_key_value(keyname); - if (key >= 0 && key < _keys.size()) { + + // TODO(jtgans): Check this is the proper type + if (key >= 0 && key < static_cast(_keys.size())) { return &_keys[key]; } + return 0; } diff --git a/g13d/g13_lcd.cc b/g13d/g13_lcd.cc index a40a17f..3fa6864 100644 --- a/g13d/g13_lcd.cc +++ b/g13d/g13_lcd.cc @@ -169,8 +169,8 @@ void G13_LCD::write_string(const char *str) { } void G13_LCD::image_test(int x, int y) { + unsigned int row = 0, col = 0; - int row = 0, col = 0; if (y >= 0) { image_setpixel(x, y); } else { @@ -197,6 +197,7 @@ void G13_LCD::image_test(int x, int y) { break; } } + image_send(); } diff --git a/g13d/g13_stick.cc b/g13d/g13_stick.cc index 117d467..cb550c1 100644 --- a/g13d/g13_stick.cc +++ b/g13d/g13_stick.cc @@ -115,7 +115,6 @@ void G13_Stick::parse_joystick(unsigned char *buf) { // update targets if we're in calibration mode switch (_stick_mode) { - case STICK_CALCENTER: _center_pos = _current_pos; return; diff --git a/g13d/logo.h b/g13d/logo.h index a62890a..0b39186 100644 --- a/g13d/logo.h +++ b/g13d/logo.h @@ -1,5 +1,6 @@ #ifndef G13_LOGO_H #define G13_LOGO_H + static unsigned char g13_logo[160 * 48 / 8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0xc0, 0xe0, 0xe0, 0xf0, 0xf0, 0xf8, 0x78, 0x78, 0x7c, 0x3c, 0x3c, 0x3e, @@ -81,5 +82,5 @@ static unsigned char g13_logo[160 * 48 / 8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -#endif -/* G13_LOGO_H */ + +#endif // G13_LOGO_H