diff options
author | Tom Rini <trini@konsulko.com> | 2021-03-07 19:43:00 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-03-07 19:43:00 -0500 |
commit | 90964ab5acb29ec6617a9ff340886230b2fce8c7 (patch) | |
tree | fab87d3307e5c4902c07ff4ab630a9a709bc6daa /lib/efi_loader/efi_unicode_collation.c | |
parent | e4dba4ba6f61e8128be0b4200ca2d8cebf62180b (diff) | |
parent | 7d3eff3412886f277c724a9effcbe545c4cdd5b5 (diff) |
Merge tag 'efi-2021-04-rc3-3' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request for efi-2021-04-rc3-3
New:
* Provide library functions for converting UTF-8 streams either to code
page 437 or Unicode code points.
Bug fixes:
* Fix the capsule update unit tests.
* Use the terminal size of the video console if it is the primary output.
Diffstat (limited to 'lib/efi_loader/efi_unicode_collation.c')
-rw-r--r-- | lib/efi_loader/efi_unicode_collation.c | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/lib/efi_loader/efi_unicode_collation.c b/lib/efi_loader/efi_unicode_collation.c index f6c875bc33c..36be798f64b 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 */ @@ -300,23 +300,10 @@ static bool EFIAPI efi_str_to_fat(struct efi_unicode_collation_protocol *this, break; } c = utf_to_upper(c); - if (c >= 0x80) { - int j; - - /* Look for codepage translation */ - for (j = 0; j < 0x80; ++j) { - if (c == codepage[j]) { - c = j + 0x80; - break; - } - } - if (j >= 0x80) { - c = '_'; - ret = true; - } - } else if (c && (c < 0x20 || strchr(illegal, c))) { - c = '_'; + if (utf_to_cp(&c, codepage) || + (c && (c < 0x20 || strchr(illegal, c)))) { ret = true; + c = '_'; } fat[i] = c; |