Blob Blame History Raw
From 5904ae56d328786f7e81fdd3cf129426cb34c415 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Wed, 25 Feb 2015 16:33:59 -0500
Subject: [PATCH 1/2] Make lib/ build right with the cflags it should be
 using...

... but isn't.

Signed-off-by: Peter Jones <pjones@redhat.com>
---
 include/console.h |  9 ++++++---
 include/guid.h    |  5 -----
 lib/configtable.c |  4 ++--
 lib/console.c     | 23 +++++++++++++----------
 lib/execute.c     |  2 +-
 lib/guid.c        | 26 --------------------------
 lib/shell.c       |  2 +-
 7 files changed, 23 insertions(+), 48 deletions(-)

diff --git a/include/console.h b/include/console.h
index 9c793ea..ecaa73f 100644
--- a/include/console.h
+++ b/include/console.h
@@ -4,13 +4,16 @@
 EFI_STATUS
 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[], unsigned int highlight,
+		     unsigned int start_col, unsigned int start_row,
+		     unsigned int size_cols, unsigned int size_rows,
+		     int offset, unsigned int lines);
 void
-console_print_box(CHAR16 *str_arr[], int highlight);
+console_print_box(CHAR16 *str_arr[], unsigned int highlight);
 int
 console_yes_no(CHAR16 *str_arr[]);
 int
-console_select(CHAR16 *title[], CHAR16* selectors[], int start);
+console_select(CHAR16 *title[], CHAR16* selectors[], unsigned int start);
 void
 console_errorbox(CHAR16 *err);
 void
diff --git a/include/guid.h b/include/guid.h
index 3c58be0..86b709b 100644
--- a/include/guid.h
+++ b/include/guid.h
@@ -1,10 +1,5 @@
 #include <efi.h>
 
-#ifndef BUILD_EFI
-const char *guid_to_str(EFI_GUID *guid);
-void str_to_guid(const char *str, EFI_GUID *guid);
-#endif
-
 extern EFI_GUID GV_GUID;
 extern EFI_GUID SIG_DB;
 extern EFI_GUID X509_GUID;
diff --git a/lib/configtable.c b/lib/configtable.c
index e2d92bf..edf2ed7 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 83ee679..10bc154 100644
--- a/lib/console.c
+++ b/lib/console.c
@@ -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,9 +55,12 @@ 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[], unsigned int highlight,
+		     unsigned int start_col, unsigned int start_row,
+		     unsigned int size_cols, unsigned int size_rows,
+		     int offset, unsigned int lines)
 {
-	int i;
+	unsigned int i;
 	SIMPLE_TEXT_OUTPUT_INTERFACE *co = ST->ConOut;
 	UINTN rows, cols;
 	CHAR16 *Line;
@@ -124,7 +127,7 @@ console_print_box_at(CHAR16 *str_arr[], int highlight, int start_col, int start_
 		
 
 	for (i = start_row + 1; i < size_rows + start_row - 1; i++) {
-		int line = i - start;
+		unsigned int line = i - start;
 
 		SetMem16 (Line, size_cols*2, L' ');
 		Line[0] = BOXDRAW_VERTICAL;
@@ -160,7 +163,7 @@ console_print_box_at(CHAR16 *str_arr[], int highlight, int start_col, int start_
 }
 
 void
-console_print_box(CHAR16 *str_arr[], int highlight)
+console_print_box(CHAR16 *str_arr[], unsigned int highlight)
 {
 	SIMPLE_TEXT_OUTPUT_MODE SavedConsoleMode;
 	SIMPLE_TEXT_OUTPUT_INTERFACE *co = ST->ConOut;
@@ -181,17 +184,17 @@ 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;
+	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, 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);
diff --git a/lib/execute.c b/lib/execute.c
index 42d71c8..89328c6 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] == '/')
diff --git a/lib/guid.c b/lib/guid.c
index 56ec952..5f5a03f 100644
--- a/lib/guid.c
+++ b/lib/guid.c
@@ -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 7337834..afd3952 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;
-- 
2.1.0