g13d: Fix a bunch of sign comparisons

This commit is contained in:
June Tate-Gans 2021-04-25 14:39:40 -05:00
parent 9bf95336cc
commit 47d876b4cb
5 changed files with 10 additions and 7 deletions

View File

@ -397,7 +397,7 @@ template <typename T, int size> int GetFontCharacterCount(T (&)[size]) {
template <class ARRAY_T, class FLAGST> template <class ARRAY_T, class FLAGST>
void G13_Font::install_font(ARRAY_T &data, FLAGST flags, int first) { 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); _chars[i + first].set_character(&data[i][0], _width, flags);
} }
} }

View File

@ -99,11 +99,13 @@ void G13_Profile::parse_keys(unsigned char *buf) {
} }
G13_Key *G13_Profile::find_key(const std::string &keyname) { G13_Key *G13_Profile::find_key(const std::string &keyname) {
auto key = _keypad.manager().find_g13_key_value(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<int>(_keys.size())) {
return &_keys[key]; return &_keys[key];
} }
return 0; return 0;
} }

View File

@ -169,8 +169,8 @@ void G13_LCD::write_string(const char *str) {
} }
void G13_LCD::image_test(int x, int y) { void G13_LCD::image_test(int x, int y) {
unsigned int row = 0, col = 0;
int row = 0, col = 0;
if (y >= 0) { if (y >= 0) {
image_setpixel(x, y); image_setpixel(x, y);
} else { } else {
@ -197,6 +197,7 @@ void G13_LCD::image_test(int x, int y) {
break; break;
} }
} }
image_send(); image_send();
} }

View File

@ -115,7 +115,6 @@ void G13_Stick::parse_joystick(unsigned char *buf) {
// update targets if we're in calibration mode // update targets if we're in calibration mode
switch (_stick_mode) { switch (_stick_mode) {
case STICK_CALCENTER: case STICK_CALCENTER:
_center_pos = _current_pos; _center_pos = _current_pos;
return; return;

View File

@ -1,5 +1,6 @@
#ifndef G13_LOGO_H #ifndef G13_LOGO_H
#define G13_LOGO_H #define G13_LOGO_H
static unsigned char g13_logo[160 * 48 / 8] = { static unsigned char g13_logo[160 * 48 / 8] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80,
0xc0, 0xe0, 0xe0, 0xf0, 0xf0, 0xf8, 0x78, 0x78, 0x7c, 0x3c, 0x3c, 0x3e, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x01, 0x00, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 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}; 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
#endif
/* G13_LOGO_H */ #endif // G13_LOGO_H