mirror of
https://git.proxmox.com/git/efi-boot-shim
synced 2025-07-27 18:16:26 +00:00
Fix console_print_box*() parameters.
When we made lib build with the correct CFLAGS, it inherited -Werror=sign-compare, and I fixed up some parameters on console_print_box() and console_print_box_at() to avoid sign comparison errors. The fixups were *completely wrong*, as some behavior relies on negative values. So this fixes them in a completely different way, by casting appropriately to signed types where we're doing comparisons. Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
parent
0a7003faec
commit
1fefa29c34
@ -4,12 +4,12 @@
|
||||
EFI_STATUS
|
||||
console_get_keystroke(EFI_INPUT_KEY *key);
|
||||
void
|
||||
console_print_box_at(CHAR16 *str_arr[], unsigned int highlight,
|
||||
unsigned int start_col, unsigned int start_row,
|
||||
unsigned int size_cols, unsigned int size_rows,
|
||||
int offset, unsigned int lines);
|
||||
console_print_box_at(CHAR16 *str_arr[], int highlight,
|
||||
int start_col, int start_row,
|
||||
int size_cols, int size_rows,
|
||||
int offset, int lines);
|
||||
void
|
||||
console_print_box(CHAR16 *str_arr[], unsigned int highlight);
|
||||
console_print_box(CHAR16 *str_arr[], int highlight);
|
||||
int
|
||||
console_yes_no(CHAR16 *str_arr[]);
|
||||
int
|
||||
|
@ -55,12 +55,12 @@ console_get_keystroke(EFI_INPUT_KEY *key)
|
||||
}
|
||||
|
||||
void
|
||||
console_print_box_at(CHAR16 *str_arr[], unsigned int highlight,
|
||||
unsigned int start_col, unsigned int start_row,
|
||||
unsigned int size_cols, unsigned int size_rows,
|
||||
int offset, unsigned int lines)
|
||||
console_print_box_at(CHAR16 *str_arr[], int highlight,
|
||||
int start_col, int start_row,
|
||||
int size_cols, int size_rows,
|
||||
int offset, int lines)
|
||||
{
|
||||
unsigned int i;
|
||||
int i;
|
||||
SIMPLE_TEXT_OUTPUT_INTERFACE *co = ST->ConOut;
|
||||
UINTN rows, cols;
|
||||
CHAR16 *Line;
|
||||
@ -87,16 +87,16 @@ console_print_box_at(CHAR16 *str_arr[], unsigned int highlight,
|
||||
if (start_row < 0)
|
||||
start_row = 0;
|
||||
|
||||
if (start_col > cols || start_row > rows) {
|
||||
if (start_col > (int)cols || start_row > (int)rows) {
|
||||
Print(L"Starting Position (%d,%d) is off screen\n",
|
||||
start_col, start_row);
|
||||
return;
|
||||
}
|
||||
if (size_cols + start_col > cols)
|
||||
if (size_cols + start_col > (int)cols)
|
||||
size_cols = cols - start_col;
|
||||
if (size_rows + start_row > rows)
|
||||
if (size_rows + start_row > (int)rows)
|
||||
size_rows = rows - start_row;
|
||||
|
||||
|
||||
if (lines > size_rows - 2)
|
||||
lines = size_rows - 2;
|
||||
|
||||
@ -124,10 +124,9 @@ console_print_box_at(CHAR16 *str_arr[], unsigned int highlight,
|
||||
else
|
||||
/* from top */
|
||||
start = start_row + offset;
|
||||
|
||||
|
||||
for (i = start_row + 1; i < size_rows + start_row - 1; i++) {
|
||||
unsigned int line = i - start;
|
||||
int line = i - start;
|
||||
|
||||
SetMem16 (Line, size_cols*2, L' ');
|
||||
Line[0] = BOXDRAW_VERTICAL;
|
||||
@ -143,11 +142,11 @@ console_print_box_at(CHAR16 *str_arr[], unsigned int highlight,
|
||||
|
||||
CopyMem(Line + col + 1, s, min(len, size_cols - 2)*2);
|
||||
}
|
||||
if (line >= 0 && line == highlight)
|
||||
if (line >= 0 && line == highlight)
|
||||
uefi_call_wrapper(co->SetAttribute, 2, co, EFI_LIGHTGRAY | EFI_BACKGROUND_BLACK);
|
||||
uefi_call_wrapper(co->SetCursorPosition, 3, co, start_col, i);
|
||||
uefi_call_wrapper(co->OutputString, 2, co, Line);
|
||||
if (line >= 0 && line == highlight)
|
||||
if (line >= 0 && line == highlight)
|
||||
uefi_call_wrapper(co->SetAttribute, 2, co, EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE);
|
||||
|
||||
}
|
||||
@ -163,7 +162,7 @@ console_print_box_at(CHAR16 *str_arr[], unsigned int highlight,
|
||||
}
|
||||
|
||||
void
|
||||
console_print_box(CHAR16 *str_arr[], unsigned int highlight)
|
||||
console_print_box(CHAR16 *str_arr[], int highlight)
|
||||
{
|
||||
SIMPLE_TEXT_OUTPUT_MODE SavedConsoleMode;
|
||||
SIMPLE_TEXT_OUTPUT_INTERFACE *co = ST->ConOut;
|
||||
|
Loading…
Reference in New Issue
Block a user