Update for efi mouse

This commit is contained in:
longpanda 2022-03-30 19:52:04 +08:00
parent f683bcbd59
commit 791da48673
4 changed files with 10 additions and 5 deletions

View File

@ -426,7 +426,7 @@ grub_fshelp_read_file (grub_disk_t disk, grub_fshelp_node_t node,
if (grub_errno) if (grub_errno)
return -1; return -1;
} }
else if (read_hook != (grub_disk_read_hook_t)grub_disk_blocklist_read) else if (read_hook != (grub_disk_read_hook_t)(void *)grub_disk_blocklist_read)
grub_memset (buf, 0, blockend); grub_memset (buf, 0, blockend);
buf += blocksize - skipfirst; buf += blocksize - skipfirst;

View File

@ -471,7 +471,7 @@ grub_err_t
grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector, grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector,
grub_off_t offset, grub_size_t size, void *buf) grub_off_t offset, grub_size_t size, void *buf)
{ {
if (disk->read_hook == (grub_disk_read_hook_t)grub_disk_blocklist_read) if (disk->read_hook == (grub_disk_read_hook_t)(void *)grub_disk_blocklist_read)
{ {
return grub_disk_blocklist_read((ventoy_img_chunk_list *)disk->read_hook_data, sector, size, disk->log_sector_size); return grub_disk_blocklist_read((ventoy_img_chunk_list *)disk->read_hook_data, sector, size, disk->log_sector_size);
} }

View File

@ -111,13 +111,14 @@ grub_efi_mouse_prot_init (void)
mouse_input = grub_malloc (sizeof (grub_efi_mouse_prot_t)); mouse_input = grub_malloc (sizeof (grub_efi_mouse_prot_t));
if (!mouse_input) if (!mouse_input)
return NULL; goto end;
mouse_input->mouse = grub_malloc (count mouse_input->mouse = grub_malloc (count
* sizeof (grub_efi_simple_pointer_protocol_t *)); * sizeof (grub_efi_simple_pointer_protocol_t *));
if (!mouse_input->mouse) if (!mouse_input->mouse)
{ {
grub_free (mouse_input); grub_free (mouse_input);
return NULL; mouse_input = NULL;
goto end;
} }
mouse_input->count = count; mouse_input->count = count;
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
@ -135,6 +136,10 @@ grub_efi_mouse_prot_init (void)
mouse_input->mouse[i]->mode->y, mouse_input->mouse[i]->mode->z); mouse_input->mouse[i]->mode->y, mouse_input->mouse[i]->mode->z);
#endif #endif
} }
end:
efi_call_1(b->free_pool, buf);
return mouse_input; return mouse_input;
} }

View File

@ -3152,7 +3152,7 @@ int ventoy_get_block_list(grub_file_t file, ventoy_img_chunk_list *chunklist, gr
} }
else else
{ {
file->read_hook = (grub_disk_read_hook_t)grub_disk_blocklist_read; file->read_hook = (grub_disk_read_hook_t)(void *)grub_disk_blocklist_read;
file->read_hook_data = chunklist; file->read_hook_data = chunklist;
for (size = file->size; size > 0; size -= read) for (size = file->size; size > 0; size -= read)