arrfab / rpms / shim

Forked from rpms/shim 4 years ago
Clone

Blame SOURCES/0001-Make-lib-build-right-with-the-cflags-it-should-be-us.patch

4210fa
From 5904ae56d328786f7e81fdd3cf129426cb34c415 Mon Sep 17 00:00:00 2001
4210fa
From: Peter Jones <pjones@redhat.com>
4210fa
Date: Wed, 25 Feb 2015 16:33:59 -0500
4210fa
Subject: [PATCH 1/2] Make lib/ build right with the cflags it should be
4210fa
 using...
4210fa
4210fa
... but isn't.
4210fa
4210fa
Signed-off-by: Peter Jones <pjones@redhat.com>
4210fa
---
4210fa
 include/console.h |  9 ++++++---
4210fa
 include/guid.h    |  5 -----
4210fa
 lib/configtable.c |  4 ++--
4210fa
 lib/console.c     | 23 +++++++++++++----------
4210fa
 lib/execute.c     |  2 +-
4210fa
 lib/guid.c        | 26 --------------------------
4210fa
 lib/shell.c       |  2 +-
4210fa
 7 files changed, 23 insertions(+), 48 deletions(-)
4210fa
4210fa
diff --git a/include/console.h b/include/console.h
4210fa
index 9c793ea..ecaa73f 100644
4210fa
--- a/include/console.h
4210fa
+++ b/include/console.h
4210fa
@@ -4,13 +4,16 @@
4210fa
 EFI_STATUS
4210fa
 console_get_keystroke(EFI_INPUT_KEY *key);
4210fa
 void
4210fa
-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);
4210fa
+console_print_box_at(CHAR16 *str_arr[], unsigned int highlight,
4210fa
+		     unsigned int start_col, unsigned int start_row,
4210fa
+		     unsigned int size_cols, unsigned int size_rows,
4210fa
+		     int offset, unsigned int lines);
4210fa
 void
4210fa
-console_print_box(CHAR16 *str_arr[], int highlight);
4210fa
+console_print_box(CHAR16 *str_arr[], unsigned int highlight);
4210fa
 int
4210fa
 console_yes_no(CHAR16 *str_arr[]);
4210fa
 int
4210fa
-console_select(CHAR16 *title[], CHAR16* selectors[], int start);
4210fa
+console_select(CHAR16 *title[], CHAR16* selectors[], unsigned int start);
4210fa
 void
4210fa
 console_errorbox(CHAR16 *err);
4210fa
 void
4210fa
diff --git a/include/guid.h b/include/guid.h
4210fa
index 3c58be0..86b709b 100644
4210fa
--- a/include/guid.h
4210fa
+++ b/include/guid.h
4210fa
@@ -1,10 +1,5 @@
4210fa
 #include <efi.h>
4210fa
 
4210fa
-#ifndef BUILD_EFI
4210fa
-const char *guid_to_str(EFI_GUID *guid);
4210fa
-void str_to_guid(const char *str, EFI_GUID *guid);
4210fa
-#endif
4210fa
-
4210fa
 extern EFI_GUID GV_GUID;
4210fa
 extern EFI_GUID SIG_DB;
4210fa
 extern EFI_GUID X509_GUID;
4210fa
diff --git a/lib/configtable.c b/lib/configtable.c
4210fa
index e2d92bf..edf2ed7 100644
4210fa
--- a/lib/configtable.c
4210fa
+++ b/lib/configtable.c
4210fa
@@ -14,7 +14,7 @@
4210fa
 void *
4210fa
 configtable_get_table(EFI_GUID *guid)
4210fa
 {
4210fa
-	int i;
4210fa
+	unsigned int i;
4210fa
 
4210fa
 	for (i = 0; i < ST->NumberOfTableEntries; i++) {
4210fa
 		EFI_CONFIGURATION_TABLE *CT = &ST->ConfigurationTable[i];
4210fa
@@ -82,7 +82,7 @@ configtable_find_image(const EFI_DEVICE_PATH *DevicePath)
4210fa
 		}
4210fa
 		EFI_DEVICE_PATH *dp = (EFI_DEVICE_PATH *)(e->Data + skip), *dpn = dp;
4210fa
 		if (dp->Type == 0 || dp->Type > 6 || dp->SubType == 0
4210fa
-		    || (((dp->Length[1] << 8) + dp->Length[0]) > e->InfoSize)) {
4210fa
+		    || ((unsigned)((dp->Length[1] << 8) + dp->Length[0]) > e->InfoSize)) {
4210fa
 			/* Parse error, table corrupt, bail */
4210fa
 			Print(L"Image Execution Information table corrupt\n");
4210fa
 			break;
4210fa
diff --git a/lib/console.c b/lib/console.c
4210fa
index 83ee679..10bc154 100644
4210fa
--- a/lib/console.c
4210fa
+++ b/lib/console.c
4210fa
@@ -33,7 +33,7 @@ count_lines(CHAR16 *str_arr[])
4210fa
 static void
4210fa
 SetMem16(CHAR16 *dst, UINT32 n, CHAR16 c)
4210fa
 {
4210fa
-	int i;
4210fa
+	unsigned int i;
4210fa
 
4210fa
 	for (i = 0; i < n/2; i++) {
4210fa
 		dst[i] = c;
4210fa
@@ -55,9 +55,12 @@ console_get_keystroke(EFI_INPUT_KEY *key)
4210fa
 }
4210fa
 
4210fa
 void
4210fa
-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)
4210fa
+console_print_box_at(CHAR16 *str_arr[], unsigned int highlight,
4210fa
+		     unsigned int start_col, unsigned int start_row,
4210fa
+		     unsigned int size_cols, unsigned int size_rows,
4210fa
+		     int offset, unsigned int lines)
4210fa
 {
4210fa
-	int i;
4210fa
+	unsigned int i;
4210fa
 	SIMPLE_TEXT_OUTPUT_INTERFACE *co = ST->ConOut;
4210fa
 	UINTN rows, cols;
4210fa
 	CHAR16 *Line;
4210fa
@@ -124,7 +127,7 @@ console_print_box_at(CHAR16 *str_arr[], int highlight, int start_col, int start_
4210fa
 		
4210fa
 
4210fa
 	for (i = start_row + 1; i < size_rows + start_row - 1; i++) {
4210fa
-		int line = i - start;
4210fa
+		unsigned int line = i - start;
4210fa
 
4210fa
 		SetMem16 (Line, size_cols*2, L' ');
4210fa
 		Line[0] = BOXDRAW_VERTICAL;
4210fa
@@ -160,7 +163,7 @@ console_print_box_at(CHAR16 *str_arr[], int highlight, int start_col, int start_
4210fa
 }
4210fa
 
4210fa
 void
4210fa
-console_print_box(CHAR16 *str_arr[], int highlight)
4210fa
+console_print_box(CHAR16 *str_arr[], unsigned int highlight)
4210fa
 {
4210fa
 	SIMPLE_TEXT_OUTPUT_MODE SavedConsoleMode;
4210fa
 	SIMPLE_TEXT_OUTPUT_INTERFACE *co = ST->ConOut;
4210fa
@@ -181,17 +184,17 @@ console_print_box(CHAR16 *str_arr[], int highlight)
4210fa
 }
4210fa
 
4210fa
 int
4210fa
-console_select(CHAR16 *title[], CHAR16* selectors[], int start)
4210fa
+console_select(CHAR16 *title[], CHAR16* selectors[], unsigned int start)
4210fa
 {
4210fa
 	SIMPLE_TEXT_OUTPUT_MODE SavedConsoleMode;
4210fa
 	SIMPLE_TEXT_OUTPUT_INTERFACE *co = ST->ConOut;
4210fa
 	EFI_INPUT_KEY k;
4210fa
 	EFI_STATUS status;
4210fa
-	int selector;
4210fa
-	int selector_lines = count_lines(selectors);
4210fa
+	unsigned int selector;
4210fa
+	unsigned int selector_lines = count_lines(selectors);
4210fa
 	int selector_max_cols = 0;
4210fa
-	int i, offs_col, offs_row, size_cols, size_rows, lines;
4210fa
-	int selector_offset;
4210fa
+	unsigned int i, offs_col, offs_row, size_cols, size_rows, lines;
4210fa
+	unsigned int selector_offset;
4210fa
 	UINTN cols, rows;
4210fa
 
4210fa
 	uefi_call_wrapper(co->QueryMode, 4, co, co->Mode->Mode, &cols, &rows);
4210fa
diff --git a/lib/execute.c b/lib/execute.c
4210fa
index 42d71c8..89328c6 100644
4210fa
--- a/lib/execute.c
4210fa
+++ b/lib/execute.c
4210fa
@@ -51,7 +51,7 @@ generate_path(CHAR16* name, EFI_LOADED_IMAGE *li, EFI_DEVICE_PATH **path, CHAR16
4210fa
 	EFI_STATUS efi_status = EFI_SUCCESS;
4210fa
 	CHAR16 *devpathstr = DevicePathToStr(li->FilePath),
4210fa
 		*found = NULL;
4210fa
-	int i;
4210fa
+	unsigned int i;
4210fa
 
4210fa
 	for (i = 0; i < StrLen(devpathstr); i++) {
4210fa
 		if (devpathstr[i] == '/')
4210fa
diff --git a/lib/guid.c b/lib/guid.c
4210fa
index 56ec952..5f5a03f 100644
4210fa
--- a/lib/guid.c
4210fa
+++ b/lib/guid.c
4210fa
@@ -5,32 +5,6 @@
4210fa
  */
4210fa
 
4210fa
 #include <guid.h>
4210fa
-#include <stdio.h>
4210fa
-
4210fa
-#ifndef BUILD_EFI
4210fa
-/* EFI has %g for this, so it's only needed in platform c */
4210fa
-const char *guid_to_str(EFI_GUID *guid)
4210fa
-{
4210fa
-	static char str[256];
4210fa
-
4210fa
-	sprintf(str, "%08x-%04hx-%04hx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx",
4210fa
-		guid->Data1, guid->Data2, guid->Data3,
4210fa
-		guid->Data4[0], guid->Data4[1], guid->Data4[2],
4210fa
-		guid->Data4[3], guid->Data4[4], guid->Data4[5],
4210fa
-		guid->Data4[6], guid->Data4[7]);
4210fa
-
4210fa
-	return str;
4210fa
-}
4210fa
-
4210fa
-void str_to_guid(const char *str, EFI_GUID *guid)
4210fa
-{
4210fa
-  sscanf(str, "%8x-%4hx-%4hx-%2hhx%2hhx-%2hhx%2hhx%2hhx%2hhx%2hhx%2hhx",
4210fa
-	       &guid->Data1, &guid->Data2, &guid->Data3,
4210fa
-	       guid->Data4, guid->Data4 + 1, guid->Data4 + 2,
4210fa
-	       guid->Data4 + 3, guid->Data4 + 4, guid->Data4 + 5,
4210fa
-	       guid->Data4 + 6, guid->Data4 + 7);
4210fa
-}
4210fa
-#endif
4210fa
 
4210fa
 /* all the necessary guids */
4210fa
 EFI_GUID GV_GUID = EFI_GLOBAL_VARIABLE;
4210fa
diff --git a/lib/shell.c b/lib/shell.c
4210fa
index 7337834..afd3952 100644
4210fa
--- a/lib/shell.c
4210fa
+++ b/lib/shell.c
4210fa
@@ -13,7 +13,7 @@
4210fa
 EFI_STATUS
4210fa
 argsplit(EFI_HANDLE image, int *argc, CHAR16*** ARGV)
4210fa
 {
4210fa
-	int i, count = 1;
4210fa
+	unsigned int i, count = 1;
4210fa
 	EFI_STATUS status;
4210fa
 	EFI_LOADED_IMAGE *info;
4210fa
 	CHAR16 *start;
4210fa
-- 
4210fa
2.1.0
4210fa