diff options
| author | Steve Langasek <steve.langasek@canonical.com> | 2016-09-19 15:36:20 -0700 |
|---|---|---|
| committer | Steve Langasek <steve.langasek@canonical.com> | 2016-09-19 15:36:20 -0700 |
| commit | 6af9d134b88e5350ff71af67d0245831358f0c36 (patch) | |
| tree | 6774d5cae8e1c24ce61f4e21f349bb91bc939d4a /lib | |
| parent | c2f285a93f50edc40d6f2b8114e4f9af812398d0 (diff) | |
| parent | 1442bd709766f1b82be26e93ad774f4a720d0a70 (diff) | |
| download | efi-boot-shim-6af9d134b88e5350ff71af67d0245831358f0c36.tar.gz efi-boot-shim-6af9d134b88e5350ff71af67d0245831358f0c36.zip | |
New upstream release (fix-up commit)
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Makefile | 11 | ||||
| -rw-r--r-- | lib/configtable.c | 4 | ||||
| -rw-r--r-- | lib/console.c | 35 | ||||
| -rw-r--r-- | lib/execute.c | 2 | ||||
| -rw-r--r-- | lib/guid.c | 26 | ||||
| -rw-r--r-- | lib/shell.c | 2 |
6 files changed, 23 insertions, 57 deletions
diff --git a/lib/Makefile b/lib/Makefile index ebd21a14..d93a26de 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -4,17 +4,6 @@ LIBFILES = simple_file.o guid.o console.o execute.o configtable.o shell.o variab EFI_INCLUDES = -I$(EFI_INCLUDE) -I$(EFI_INCLUDE)/$(ARCH) -I$(EFI_INCLUDE)/protocol -I../include -CFLAGS = -ggdb -O0 -fno-stack-protector -fno-strict-aliasing -fpic \ - -fshort-wchar -Wall -DBUILD_EFI -fno-builtin -Werror \ - $(EFI_INCLUDES) - -ifeq ($(ARCH),x86_64) - CFLAGS += -mno-red-zone -DEFI_FUNCTION_WRAPPER -DGNU_EFI_USE_MS_ABI -endif -ifeq ($(ARCH),ia32) - CFLAGS += -mno-red-zone -m32 -endif - lib.a: $(LIBFILES) ar rcs lib.a $(LIBFILES) diff --git a/lib/configtable.c b/lib/configtable.c index e2d92bf0..edf2ed74 100644 --- a/lib/configtable.c +++ b/lib/configtable.c @@ -14,7 +14,7 @@ void * configtable_get_table(EFI_GUID *guid) { - int i; + unsigned int i; for (i = 0; i < ST->NumberOfTableEntries; i++) { EFI_CONFIGURATION_TABLE *CT = &ST->ConfigurationTable[i]; @@ -82,7 +82,7 @@ configtable_find_image(const EFI_DEVICE_PATH *DevicePath) } EFI_DEVICE_PATH *dp = (EFI_DEVICE_PATH *)(e->Data + skip), *dpn = dp; if (dp->Type == 0 || dp->Type > 6 || dp->SubType == 0 - || (((dp->Length[1] << 8) + dp->Length[0]) > e->InfoSize)) { + || ((unsigned)((dp->Length[1] << 8) + dp->Length[0]) > e->InfoSize)) { /* Parse error, table corrupt, bail */ Print(L"Image Execution Information table corrupt\n"); break; 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 { diff --git a/lib/execute.c b/lib/execute.c index 42d71c87..89328c68 100644 --- a/lib/execute.c +++ b/lib/execute.c @@ -51,7 +51,7 @@ generate_path(CHAR16* name, EFI_LOADED_IMAGE *li, EFI_DEVICE_PATH **path, CHAR16 EFI_STATUS efi_status = EFI_SUCCESS; CHAR16 *devpathstr = DevicePathToStr(li->FilePath), *found = NULL; - int i; + unsigned int i; for (i = 0; i < StrLen(devpathstr); i++) { if (devpathstr[i] == '/') @@ -5,32 +5,6 @@ */ #include <guid.h> -#include <stdio.h> - -#ifndef BUILD_EFI -/* EFI has %g for this, so it's only needed in platform c */ -const char *guid_to_str(EFI_GUID *guid) -{ - static char str[256]; - - sprintf(str, "%08x-%04hx-%04hx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx", - guid->Data1, guid->Data2, guid->Data3, - guid->Data4[0], guid->Data4[1], guid->Data4[2], - guid->Data4[3], guid->Data4[4], guid->Data4[5], - guid->Data4[6], guid->Data4[7]); - - return str; -} - -void str_to_guid(const char *str, EFI_GUID *guid) -{ - sscanf(str, "%8x-%4hx-%4hx-%2hhx%2hhx-%2hhx%2hhx%2hhx%2hhx%2hhx%2hhx", - &guid->Data1, &guid->Data2, &guid->Data3, - guid->Data4, guid->Data4 + 1, guid->Data4 + 2, - guid->Data4 + 3, guid->Data4 + 4, guid->Data4 + 5, - guid->Data4 + 6, guid->Data4 + 7); -} -#endif /* all the necessary guids */ EFI_GUID GV_GUID = EFI_GLOBAL_VARIABLE; diff --git a/lib/shell.c b/lib/shell.c index 7337834a..afd3952c 100644 --- a/lib/shell.c +++ b/lib/shell.c @@ -13,7 +13,7 @@ EFI_STATUS argsplit(EFI_HANDLE image, int *argc, CHAR16*** ARGV) { - int i, count = 1; + unsigned int i, count = 1; EFI_STATUS status; EFI_LOADED_IMAGE *info; CHAR16 *start; |
