refactor: remove some (const char **) casts (#24423)

This commit is contained in:
zeertzjq
2023-07-22 18:00:55 +08:00
committed by GitHub
parent 4b57ff77fe
commit d2efcbf2dc
8 changed files with 51 additions and 52 deletions

View File

@@ -242,8 +242,8 @@ bool os_isatty(int fd)
size_t input_enqueue(String keys)
{
char *ptr = keys.data;
char *end = ptr + keys.size;
const char *ptr = keys.data;
const char *end = ptr + keys.size;
while (rbuffer_space(input_buffer) >= 19 && ptr < end) {
// A "<x>" form occupies at least 1 characters, and produces up
@@ -254,8 +254,7 @@ size_t input_enqueue(String keys)
uint8_t buf[19] = { 0 };
// Do not simplify the keys here. Simplification will be done later.
unsigned new_size
= trans_special((const char **)&ptr, (size_t)(end - ptr), (char *)buf, FSK_KEYCODE, true,
NULL);
= trans_special(&ptr, (size_t)(end - ptr), (char *)buf, FSK_KEYCODE, true, NULL);
if (new_size) {
new_size = handle_mouse_event(&ptr, buf, new_size);
@@ -264,7 +263,7 @@ size_t input_enqueue(String keys)
}
if (*ptr == '<') {
char *old_ptr = ptr;
const char *old_ptr = ptr;
// Invalid or incomplete key sequence, skip until the next '>' or *end.
do {
ptr++;
@@ -346,7 +345,7 @@ static uint8_t check_multiclick(int code, int grid, int row, int col)
// Mouse event handling code(Extract row/col if available and detect multiple
// clicks)
static unsigned handle_mouse_event(char **ptr, uint8_t *buf, unsigned bufsize)
static unsigned handle_mouse_event(const char **ptr, uint8_t *buf, unsigned bufsize)
{
int mouse_code = 0;
int type = 0;