diff mbox series

[1/6] efi_loader: move codepage 437 table

Message ID 20210227130840.166193-2-xypron.glpk@gmx.de
State Accepted, archived
Commit 70616a1ed8c7fe22aa19eb674915623bd236926f
Delegated to: Heinrich Schuchardt
Headers show
Series efi_loader: Unicode output in UEFI applications | expand

Commit Message

Heinrich Schuchardt Feb. 27, 2021, 1:08 p.m. UTC
Move the Unicode to codepage 437 table to charset.c

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

--
2.30.0
diff mbox series

Patch

diff --git a/include/charset.h b/include/charset.h
index cc650a2ce7..64ba91f791 100644
--- a/include/charset.h
+++ b/include/charset.h
@@ -13,6 +13,11 @@ 

 #define MAX_UTF8_PER_UTF16 3

+/**
+ * codepage_437 - Unicode to codepage 437 translation table
+ */
+extern const u16 codepage_437[128];
+
 /**
  * console_read_unicode() - read Unicode code point from console
  *
diff --git a/lib/charset.c b/lib/charset.c
index 2177014ee1..814847d165 100644
--- a/lib/charset.c
+++ b/lib/charset.c
@@ -8,9 +8,15 @@ 
 #include <common.h>
 #include <charset.h>
 #include <capitalization.h>
+#include <cp437.h>
 #include <efi_loader.h>
 #include <malloc.h>

+/**
+ * codepage_437 - Unicode to codepage 437 translation table
+ */
+const u16 codepage_437[128] = CP437;
+
 static struct capitalization_table capitalization_table[] =
 #ifdef CONFIG_EFI_UNICODE_CAPITALIZATION
 	UNICODE_CAPITALIZATION_TABLE;
diff --git a/lib/efi_loader/efi_unicode_collation.c b/lib/efi_loader/efi_unicode_collation.c
index f6c875bc33..bf5314c4ff 100644
--- a/lib/efi_loader/efi_unicode_collation.c
+++ b/lib/efi_loader/efi_unicode_collation.c
@@ -23,7 +23,7 @@  static const char illegal[] = "+,<=>:;\"/\\|?*[]\x7f";
 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_PROTOCOL2 */