[U-Boot] [PATCH 1/6] efi_loader: global symbol for code page 437

Heinrich Schuchardt xypron.glpk at gmx.de
Sun Sep 9 05:56:59 UTC 2018


We require code page 437 both for text input and for the Unicode collation
protocol. We should have the translation table to Unicode only once.

Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
 include/charset.h                      | 6 ++++++
 lib/charset.c                          | 3 +++
 lib/efi_loader/efi_unicode_collation.c | 3 +--
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/include/charset.h b/include/charset.h
index 686db5a1fe..32cc66bf5c 100644
--- a/include/charset.h
+++ b/include/charset.h
@@ -13,6 +13,12 @@
 
 #define MAX_UTF8_PER_UTF16 3
 
+/**
+ * codepage_437[] - Unicode code points for characters 0x80-0xff of
+ *		    code page 437.
+ */
+extern const u16 codepage_437[];
+
 /**
  * utf8_get() - get next UTF-8 code point from buffer
  *
diff --git a/lib/charset.c b/lib/charset.c
index 72c808ce64..f7ec2d25d3 100644
--- a/lib/charset.c
+++ b/lib/charset.c
@@ -7,6 +7,7 @@
 
 #include <charset.h>
 #include <capitalization.h>
+#include <cp437.h>
 #include <malloc.h>
 
 static struct capitalization_table capitalization_table[] =
@@ -18,6 +19,8 @@ static struct capitalization_table capitalization_table[] =
 	CP437_CAPITALIZATION_TABLE;
 #endif
 
+const u16 codepage_437[] = CP437;
+
 s32 utf8_get(const char **src)
 {
 	s32 code = 0;
diff --git a/lib/efi_loader/efi_unicode_collation.c b/lib/efi_loader/efi_unicode_collation.c
index 7f3ea3c77e..e005f345a9 100644
--- a/lib/efi_loader/efi_unicode_collation.c
+++ b/lib/efi_loader/efi_unicode_collation.c
@@ -8,7 +8,6 @@
 #include <common.h>
 #include <charset.h>
 #include <cp1250.h>
-#include <cp437.h>
 #include <efi_loader.h>
 
 /* Characters that may not be used in file names */
@@ -23,7 +22,7 @@ static const char illegal[] = "<>:\"/\\|?*";
 static const u16 codepage[] = CP1250;
 #else
 /* Unicode code points for code page 437 characters 0x80 - 0xff */
-static const u16 codepage[] = CP437;
+static const u16 *codepage = codepage_437;
 #endif
 
 /* GUID of the EFI_UNICODE_COLLATION_PROTOCOL */
-- 
2.18.0



More information about the U-Boot mailing list