From mboxrd@z Thu Jan 1 00:00:00 1970 From: Heinrich Schuchardt Date: Sun, 9 Sep 2018 07:56:59 +0200 Subject: [U-Boot] [PATCH 1/6] efi_loader: global symbol for code page 437 In-Reply-To: <20180909055704.1994-1-xypron.glpk@gmx.de> References: <20180909055704.1994-1-xypron.glpk@gmx.de> Message-ID: <20180909055704.1994-2-xypron.glpk@gmx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- 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 #include +#include #include 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 #include #include -#include #include /* 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