diff options
| author | Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com> | 2016-07-26 12:02:18 -0400 |
|---|---|---|
| committer | Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com> | 2016-07-26 12:02:18 -0400 |
| commit | d3819813b8e0a64400ddf3ce033bae7c3f245508 (patch) | |
| tree | 79ea54361f1b1fa10749101827391726a3f4bcef /lib/console.c | |
| parent | a14921c5944c340056312f2f5b1728d698f628b1 (diff) | |
| download | efi-boot-shim-d3819813b8e0a64400ddf3ce033bae7c3f245508.tar.gz efi-boot-shim-d3819813b8e0a64400ddf3ce033bae7c3f245508.zip | |
Import upstream version 0.9+1465500757.14a5905
Diffstat (limited to 'lib/console.c')
| -rw-r--r-- | lib/console.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/lib/console.c b/lib/console.c index 83ee679e..3fee403e 100644 --- a/lib/console.c +++ b/lib/console.c @@ -4,8 +4,8 @@ * * see COPYING file */ -#include <efi/efi.h> -#include <efi/efilib.h> +#include <efi.h> +#include <efilib.h> #include <console.h> #include <variables.h> @@ -33,7 +33,7 @@ count_lines(CHAR16 *str_arr[]) static void SetMem16(CHAR16 *dst, UINT32 n, CHAR16 c) { - int i; + unsigned int i; for (i = 0; i < n/2; i++) { dst[i] = c; @@ -55,7 +55,10 @@ console_get_keystroke(EFI_INPUT_KEY *key) } void -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) +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) { int i; SIMPLE_TEXT_OUTPUT_INTERFACE *co = ST->ConOut; @@ -84,16 +87,16 @@ console_print_box_at(CHAR16 *str_arr[], int highlight, int start_col, int start_ 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; @@ -121,7 +124,6 @@ console_print_box_at(CHAR16 *str_arr[], int highlight, int start_col, int start_ else /* from top */ start = start_row + offset; - for (i = start_row + 1; i < size_rows + start_row - 1; i++) { int line = i - start; @@ -140,11 +142,11 @@ console_print_box_at(CHAR16 *str_arr[], int highlight, int start_col, int start_ 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); } @@ -181,17 +183,18 @@ console_print_box(CHAR16 *str_arr[], int highlight) } int -console_select(CHAR16 *title[], CHAR16* selectors[], int start) +console_select(CHAR16 *title[], CHAR16* selectors[], unsigned int start) { SIMPLE_TEXT_OUTPUT_MODE SavedConsoleMode; SIMPLE_TEXT_OUTPUT_INTERFACE *co = ST->ConOut; EFI_INPUT_KEY k; EFI_STATUS status; int selector; - int selector_lines = count_lines(selectors); + unsigned int selector_lines = count_lines(selectors); int selector_max_cols = 0; - int i, offs_col, offs_row, size_cols, size_rows, lines; - int selector_offset; + unsigned int i; + int offs_col, offs_row, size_cols, size_rows, lines; + unsigned int selector_offset; UINTN cols, rows; uefi_call_wrapper(co->QueryMode, 4, co, co->Mode->Mode, &cols, &rows); @@ -222,7 +225,7 @@ console_select(CHAR16 *title[], CHAR16* selectors[], int start) lines = selector_lines; } - if (start > lines) { + if (start > (unsigned)lines) { selector = lines; selector_offset = start - lines; } else { |
