summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/Disk/UnicodeCollation
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Universal/Disk/UnicodeCollation')
-rw-r--r--MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf9
-rw-r--r--MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/UnicodeCollationEng.c12
-rw-r--r--MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/UnicodeCollationEng.h19
3 files changed, 27 insertions, 13 deletions
diff --git a/MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf b/MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
index 66eb083..5592c5c 100644
--- a/MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
+++ b/MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
@@ -1,8 +1,11 @@
#/** @file
+# English module that provides Unicode Collation supports.
#
-# Component description file for English module for unicode collation.
-#
-# This driver installs UEFI EFI_UNICODE_COLLATION_PROTOCOL protocol to provide Unicode strings function.
+# This driver installs Unicode ISO 639-2 Collation and
+# RFC 4646 Unicode Collation 2 protocols based on feature flags
+# PcdUnicodeCollationSupport & PcdUnicodeCollation2Support respectively.
+# It allows code running in the boot services environment to perform lexical
+# comparison functions on Unicode strings for English languages.
#
# Copyright (c) 2006 - 2008, Intel Corporation. <BR>
# All rights reserved. This program and the accompanying materials
diff --git a/MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/UnicodeCollationEng.c b/MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/UnicodeCollationEng.c
index e8c5bd9..f5f8770 100644
--- a/MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/UnicodeCollationEng.c
+++ b/MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/UnicodeCollationEng.c
@@ -15,9 +15,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "UnicodeCollationEng.h"
-CHAR8 mEngUpperMap[0x100];
-CHAR8 mEngLowerMap[0x100];
-CHAR8 mEngInfoMap[0x100];
+CHAR8 mEngUpperMap[MAP_TABLE_SIZE];
+CHAR8 mEngLowerMap[MAP_TABLE_SIZE];
+CHAR8 mEngInfoMap[MAP_TABLE_SIZE];
CHAR8 mOtherChars[] = {
'0',
@@ -106,7 +106,7 @@ InitializeUnicodeCollationEng (
//
// Initialize mapping tables for the supported languages
//
- for (Index = 0; Index < 0x100; Index++) {
+ for (Index = 0; Index < MAP_TABLE_SIZE; Index++) {
mEngUpperMap[Index] = (CHAR8) Index;
mEngLowerMap[Index] = (CHAR8) Index;
mEngInfoMap[Index] = 0;
@@ -453,9 +453,9 @@ EngStrToFat (
if (*String != '.' && *String != ' ') {
//
// If this is a valid fat char, move it.
- // Otherwise, move a '_' and flag the fact that the name needs an Lfn
+ // Otherwise, move a '_' and flag the fact that the name needs a long file name.
//
- if (*String < 0x100 && ((mEngInfoMap[*String] & CHAR_FAT_VALID) != 0)) {
+ if (*String < MAP_TABLE_SIZE && ((mEngInfoMap[*String] & CHAR_FAT_VALID) != 0)) {
*Fat = mEngUpperMap[*String];
} else {
*Fat = '_';
diff --git a/MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/UnicodeCollationEng.h b/MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/UnicodeCollationEng.h
index 85dc593..76695dd 100644
--- a/MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/UnicodeCollationEng.h
+++ b/MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/UnicodeCollationEng.h
@@ -19,7 +19,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Uefi.h>
-
#include <Protocol/UnicodeCollation.h>
#include <Library/DebugLib.h>
@@ -28,12 +27,24 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/PcdLib.h>
//
-// Defines
+// Bit mask to indicate the validity of character in FAT file name.
//
#define CHAR_FAT_VALID 0x01
-#define TO_UPPER(a) (CHAR16) (a <= 0xFF ? mEngUpperMap[a] : a)
-#define TO_LOWER(a) (CHAR16) (a <= 0xFF ? mEngLowerMap[a] : a)
+//
+// Maximum FAT table size.
+//
+#define MAP_TABLE_SIZE 0x100
+
+//
+// Macro to map character a to upper case.
+//
+#define TO_UPPER(a) (CHAR16) ((a) <= 0xFF ? mEngUpperMap[a] : (a))
+
+//
+// Macro to map character a to lower case.
+//
+#define TO_LOWER(a) (CHAR16) ((a) <= 0xFF ? mEngLowerMap[a] : (a))
//
// Prototypes