\r
**/\r
\r
-\r
#include "UnicodeCollationEng.h"\r
\r
-CHAR8 mEngUpperMap[MAP_TABLE_SIZE];\r
-CHAR8 mEngLowerMap[MAP_TABLE_SIZE];\r
-CHAR8 mEngInfoMap[MAP_TABLE_SIZE];\r
+CHAR8 mEngUpperMap[MAP_TABLE_SIZE];\r
+CHAR8 mEngLowerMap[MAP_TABLE_SIZE];\r
+CHAR8 mEngInfoMap[MAP_TABLE_SIZE];\r
\r
-CHAR8 mOtherChars[] = {\r
+CHAR8 mOtherChars[] = {\r
'0',\r
'1',\r
'2',\r
EFI_STATUS\r
EFIAPI\r
InitializeUnicodeCollationEng (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
)\r
{\r
EFI_STATUS Status;\r
// Initialize mapping tables for the supported languages\r
//\r
for (Index = 0; Index < MAP_TABLE_SIZE; Index++) {\r
- mEngUpperMap[Index] = (CHAR8) Index;\r
- mEngLowerMap[Index] = (CHAR8) Index;\r
+ mEngUpperMap[Index] = (CHAR8)Index;\r
+ mEngLowerMap[Index] = (CHAR8)Index;\r
mEngInfoMap[Index] = 0;\r
\r
- if ((Index >= 'a' && Index <= 'z') || (Index >= 0xe0 && Index <= 0xf6) || (Index >= 0xf8 && Index <= 0xfe)) {\r
-\r
- Index2 = Index - 0x20;\r
- mEngUpperMap[Index] = (CHAR8) Index2;\r
- mEngLowerMap[Index2] = (CHAR8) Index;\r
+ if (((Index >= 'a') && (Index <= 'z')) || ((Index >= 0xe0) && (Index <= 0xf6)) || ((Index >= 0xf8) && (Index <= 0xfe))) {\r
+ Index2 = Index - 0x20;\r
+ mEngUpperMap[Index] = (CHAR8)Index2;\r
+ mEngLowerMap[Index2] = (CHAR8)Index;\r
\r
- mEngInfoMap[Index] |= CHAR_FAT_VALID;\r
+ mEngInfoMap[Index] |= CHAR_FAT_VALID;\r
mEngInfoMap[Index2] |= CHAR_FAT_VALID;\r
}\r
}\r
\r
for (Index = 0; mOtherChars[Index] != 0; Index++) {\r
- Index2 = mOtherChars[Index];\r
+ Index2 = mOtherChars[Index];\r
mEngInfoMap[Index2] |= CHAR_FAT_VALID;\r
}\r
\r
return Status;\r
}\r
\r
-\r
/**\r
Performs a case-insensitive comparison of two Null-terminated strings.\r
\r
INTN\r
EFIAPI\r
EngStriColl (\r
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,\r
- IN CHAR16 *Str1,\r
- IN CHAR16 *Str2\r
+ IN EFI_UNICODE_COLLATION_PROTOCOL *This,\r
+ IN CHAR16 *Str1,\r
+ IN CHAR16 *Str2\r
)\r
{\r
while (*Str1 != 0) {\r
return TO_UPPER (*Str1) - TO_UPPER (*Str2);\r
}\r
\r
-\r
/**\r
Converts all the characters in a Null-terminated string to\r
lower case characters.\r
VOID\r
EFIAPI\r
EngStrLwr (\r
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,\r
- IN OUT CHAR16 *Str\r
+ IN EFI_UNICODE_COLLATION_PROTOCOL *This,\r
+ IN OUT CHAR16 *Str\r
)\r
{\r
while (*Str != 0) {\r
}\r
}\r
\r
-\r
/**\r
Converts all the characters in a Null-terminated string to upper\r
case characters.\r
VOID\r
EFIAPI\r
EngStrUpr (\r
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,\r
- IN OUT CHAR16 *Str\r
+ IN EFI_UNICODE_COLLATION_PROTOCOL *This,\r
+ IN OUT CHAR16 *Str\r
)\r
{\r
while (*Str != 0) {\r
BOOLEAN\r
EFIAPI\r
EngMetaiMatch (\r
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,\r
- IN CHAR16 *String,\r
- IN CHAR16 *Pattern\r
+ IN EFI_UNICODE_COLLATION_PROTOCOL *This,\r
+ IN CHAR16 *String,\r
+ IN CHAR16 *Pattern\r
)\r
{\r
CHAR16 CharC;\r
CHAR16 CharP;\r
CHAR16 Index3;\r
\r
- for (;;) {\r
- CharP = *Pattern;\r
+ for ( ; ;) {\r
+ CharP = *Pattern;\r
Pattern += 1;\r
\r
switch (CharP) {\r
- case 0:\r
- //\r
- // End of pattern. If end of string, TRUE match\r
- //\r
- if (*String != 0) {\r
- return FALSE;\r
- } else {\r
- return TRUE;\r
- }\r
-\r
- case '*':\r
- //\r
- // Match zero or more chars\r
- //\r
- while (*String != 0) {\r
- if (EngMetaiMatch (This, String, Pattern)) {\r
+ case 0:\r
+ //\r
+ // End of pattern. If end of string, TRUE match\r
+ //\r
+ if (*String != 0) {\r
+ return FALSE;\r
+ } else {\r
return TRUE;\r
}\r
\r
- String += 1;\r
- }\r
-\r
- return EngMetaiMatch (This, String, Pattern);\r
+ case '*':\r
+ //\r
+ // Match zero or more chars\r
+ //\r
+ while (*String != 0) {\r
+ if (EngMetaiMatch (This, String, Pattern)) {\r
+ return TRUE;\r
+ }\r
\r
- case '?':\r
- //\r
- // Match any one char\r
- //\r
- if (*String == 0) {\r
- return FALSE;\r
- }\r
+ String += 1;\r
+ }\r
\r
- String += 1;\r
- break;\r
+ return EngMetaiMatch (This, String, Pattern);\r
\r
- case '[':\r
- //\r
- // Match char set\r
- //\r
- CharC = *String;\r
- if (CharC == 0) {\r
+ case '?':\r
//\r
- // syntax problem\r
+ // Match any one char\r
//\r
- return FALSE;\r
- }\r
-\r
- Index3 = 0;\r
- CharP = *Pattern++;\r
- while (CharP != 0) {\r
- if (CharP == ']') {\r
+ if (*String == 0) {\r
return FALSE;\r
}\r
\r
- if (CharP == '-') {\r
+ String += 1;\r
+ break;\r
+\r
+ case '[':\r
+ //\r
+ // Match char set\r
+ //\r
+ CharC = *String;\r
+ if (CharC == 0) {\r
//\r
- // if range of chars, get high range\r
+ // syntax problem\r
//\r
- CharP = *Pattern;\r
- if (CharP == 0 || CharP == ']') {\r
+ return FALSE;\r
+ }\r
+\r
+ Index3 = 0;\r
+ CharP = *Pattern++;\r
+ while (CharP != 0) {\r
+ if (CharP == ']') {\r
+ return FALSE;\r
+ }\r
+\r
+ if (CharP == '-') {\r
//\r
- // syntax problem\r
+ // if range of chars, get high range\r
//\r
- return FALSE;\r
+ CharP = *Pattern;\r
+ if ((CharP == 0) || (CharP == ']')) {\r
+ //\r
+ // syntax problem\r
+ //\r
+ return FALSE;\r
+ }\r
+\r
+ if ((TO_UPPER (CharC) >= TO_UPPER (Index3)) && (TO_UPPER (CharC) <= TO_UPPER (CharP))) {\r
+ //\r
+ // if in range, it's a match\r
+ //\r
+ break;\r
+ }\r
}\r
\r
- if (TO_UPPER (CharC) >= TO_UPPER (Index3) && TO_UPPER (CharC) <= TO_UPPER (CharP)) {\r
+ Index3 = CharP;\r
+ if (TO_UPPER (CharC) == TO_UPPER (CharP)) {\r
//\r
- // if in range, it's a match\r
+ // if char matches\r
//\r
break;\r
}\r
- }\r
\r
- Index3 = CharP;\r
- if (TO_UPPER (CharC) == TO_UPPER (CharP)) {\r
- //\r
- // if char matches\r
- //\r
- break;\r
+ CharP = *Pattern++;\r
}\r
\r
- CharP = *Pattern++;\r
- }\r
- //\r
- // skip to end of match char set\r
- //\r
- while ((CharP != 0) && (CharP != ']')) {\r
- CharP = *Pattern;\r
- Pattern += 1;\r
- }\r
+ //\r
+ // skip to end of match char set\r
+ //\r
+ while ((CharP != 0) && (CharP != ']')) {\r
+ CharP = *Pattern;\r
+ Pattern += 1;\r
+ }\r
\r
- String += 1;\r
- break;\r
+ String += 1;\r
+ break;\r
\r
- default:\r
- CharC = *String;\r
- if (TO_UPPER (CharC) != TO_UPPER (CharP)) {\r
- return FALSE;\r
- }\r
+ default:\r
+ CharC = *String;\r
+ if (TO_UPPER (CharC) != TO_UPPER (CharP)) {\r
+ return FALSE;\r
+ }\r
\r
- String += 1;\r
- break;\r
+ String += 1;\r
+ break;\r
}\r
}\r
}\r
\r
-\r
/**\r
Converts an 8.3 FAT file name in an OEM character set to a Null-terminated string.\r
\r
VOID\r
EFIAPI\r
EngFatToStr (\r
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,\r
- IN UINTN FatSize,\r
- IN CHAR8 *Fat,\r
- OUT CHAR16 *String\r
+ IN EFI_UNICODE_COLLATION_PROTOCOL *This,\r
+ IN UINTN FatSize,\r
+ IN CHAR8 *Fat,\r
+ OUT CHAR16 *String\r
)\r
{\r
//\r
// No DBCS issues, just expand and add null terminate to end of string\r
//\r
while ((*Fat != 0) && (FatSize != 0)) {\r
- *String = *Fat;\r
- String += 1;\r
- Fat += 1;\r
+ *String = *Fat;\r
+ String += 1;\r
+ Fat += 1;\r
FatSize -= 1;\r
}\r
\r
*String = 0;\r
}\r
\r
-\r
/**\r
Converts a Null-terminated string to legal characters in a FAT\r
filename using an OEM character set.\r
BOOLEAN\r
EFIAPI\r
EngStrToFat (\r
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,\r
- IN CHAR16 *String,\r
- IN UINTN FatSize,\r
- OUT CHAR8 *Fat\r
+ IN EFI_UNICODE_COLLATION_PROTOCOL *This,\r
+ IN CHAR16 *String,\r
+ IN UINTN FatSize,\r
+ OUT CHAR8 *Fat\r
)\r
{\r
- BOOLEAN SpecialCharExist;\r
+ BOOLEAN SpecialCharExist;\r
\r
SpecialCharExist = FALSE;\r
while ((*String != 0) && (FatSize != 0)) {\r
//\r
// Skip '.' or ' ' when making a fat name\r
//\r
- if (*String != '.' && *String != ' ') {\r
+ if ((*String != '.') && (*String != ' ')) {\r
//\r
// If this is a valid fat char, move it.\r
// Otherwise, move a '_' and flag the fact that the name needs a long file name.\r
//\r
- if (*String < MAP_TABLE_SIZE && ((mEngInfoMap[*String] & CHAR_FAT_VALID) != 0)) {\r
+ if ((*String < MAP_TABLE_SIZE) && ((mEngInfoMap[*String] & CHAR_FAT_VALID) != 0)) {\r
*Fat = mEngUpperMap[*String];\r
} else {\r
- *Fat = '_';\r
- SpecialCharExist = TRUE;\r
+ *Fat = '_';\r
+ SpecialCharExist = TRUE;\r
}\r
\r
- Fat += 1;\r
+ Fat += 1;\r
FatSize -= 1;\r
}\r
\r
String += 1;\r
}\r
+\r
//\r
// Do not terminate that fat string\r
//\r