Keymap: Fixed a possible of buffer overflow. (#4016)
Update inline funnction to static inline function. Fixed error of if enabe ADJUST_MACRO_ENABLE.master
parent
1da2f8d546
commit
4f64951080
|
@ -214,7 +214,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SSD1306OLED
|
#ifdef SSD1306OLED
|
||||||
char keylog[20] = {};
|
char keylog[24] = {};
|
||||||
const char code_to_name[60] = {
|
const char code_to_name[60] = {
|
||||||
' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f',
|
' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f',
|
||||||
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
|
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
|
||||||
|
@ -223,7 +223,7 @@ const char code_to_name[60] = {
|
||||||
'R', 'E', 'B', 'T', ' ', '-', ' ', '@', ' ', ' ',
|
'R', 'E', 'B', 'T', ' ', '-', ' ', '@', ' ', ' ',
|
||||||
' ', ';', ':', ' ', ',', '.', '/', ' ', ' ', ' '};
|
' ', ';', ':', ' ', ',', '.', '/', ' ', ' ', ' '};
|
||||||
|
|
||||||
inline void set_keylog(uint16_t keycode, keyrecord_t *record)
|
static inline void set_keylog(uint16_t keycode, keyrecord_t *record)
|
||||||
{
|
{
|
||||||
char name = ' ';
|
char name = ' ';
|
||||||
uint8_t leds = host_keyboard_leds();
|
uint8_t leds = host_keyboard_leds();
|
||||||
|
@ -246,6 +246,12 @@ inline void set_keylog(uint16_t keycode, keyrecord_t *record)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef RGBLIGHT_ENABLE
|
||||||
|
#define RGBLIGHT(mode) rgblight_mode(mode)
|
||||||
|
#else
|
||||||
|
#define RGBLIGHT(mode)
|
||||||
|
#endif
|
||||||
|
|
||||||
// define variables for reactive RGB
|
// define variables for reactive RGB
|
||||||
int RGB_current_mode;
|
int RGB_current_mode;
|
||||||
#ifdef ADJUST_MACRO_ENABLE
|
#ifdef ADJUST_MACRO_ENABLE
|
||||||
|
@ -263,12 +269,6 @@ void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
|
||||||
#define ADJUST_MACRO(layer1, layer2, layer3)
|
#define ADJUST_MACRO(layer1, layer2, layer3)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
#define RGBLIGHT(mode) rgblight_mode(mode)
|
|
||||||
#else
|
|
||||||
#define RGBLIGHT(mode)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
#ifdef SSD1306OLED
|
#ifdef SSD1306OLED
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
|
@ -344,7 +344,7 @@ void matrix_scan_user(void) {
|
||||||
iota_gfx_task(); // this is what updates the display continuously
|
iota_gfx_task(); // this is what updates the display continuously
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void matrix_update(struct CharacterMatrix *dest,
|
static inline void matrix_update(struct CharacterMatrix *dest,
|
||||||
const struct CharacterMatrix *source) {
|
const struct CharacterMatrix *source) {
|
||||||
if (memcmp(dest->display, source->display, sizeof(dest->display))) {
|
if (memcmp(dest->display, source->display, sizeof(dest->display))) {
|
||||||
memcpy(dest->display, source->display, sizeof(dest->display));
|
memcpy(dest->display, source->display, sizeof(dest->display));
|
||||||
|
@ -367,13 +367,15 @@ const char helix_logo[]={
|
||||||
0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,
|
0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,
|
||||||
0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,
|
0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,
|
||||||
0};
|
0};
|
||||||
inline void render_logo(struct CharacterMatrix *matrix) {
|
|
||||||
|
static inline void render_logo(struct CharacterMatrix *matrix) {
|
||||||
|
|
||||||
matrix_write(matrix, helix_logo);
|
matrix_write(matrix, helix_logo);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char mac_win_logo[][2][3]={{{0x95,0x96,0},{0xb5,0xb6,0}},{{0x97,0x98,0},{0xb7,0xb8,0}}};
|
const char mac_win_logo[][2][3]={{{0x95,0x96,0},{0xb5,0xb6,0}},{{0x97,0x98,0},{0xb7,0xb8,0}}};
|
||||||
inline void render_status(struct CharacterMatrix *matrix) {
|
|
||||||
|
static inline void render_status(struct CharacterMatrix *matrix) {
|
||||||
|
|
||||||
char buf[20];
|
char buf[20];
|
||||||
// Render to mode icon
|
// Render to mode icon
|
||||||
|
|
Loading…
Reference in New Issue