summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPeter Jones <pjones@redhat.com>2015-06-16 11:41:32 -0400
committerPeter Jones <pjones@redhat.com>2015-06-16 11:41:32 -0400
commit1fefa29c34b8177779a237e26984ae973adf23e9 (patch)
treecc1b0ab7bfa78a25e4fb7feb6cfbf60d9e50ab2e /lib
parent0a7003faec146ff1db829cc2d896ab093da7def0 (diff)
downloadefi-boot-shim-1fefa29c34b8177779a237e26984ae973adf23e9.tar.gz
efi-boot-shim-1fefa29c34b8177779a237e26984ae973adf23e9.zip
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>
Diffstat (limited to 'lib')
-rw-r--r--lib/console.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/lib/console.c b/lib/console.c
index e70ab485..b62fe4cc 100644
--- a/lib/console.c
+++ b/lib/console.c
@@ -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;