- IN CHAR8 Char\r
- )\r
-{\r
-\r
- return (BOOLEAN) (InternalAsciiIsDecimalDigitCharacter (Char) ||\r
- (Char >= 'A' && Char <= 'F') ||\r
- (Char >= 'a' && Char <= 'f'));\r
-}\r
-\r
-#ifndef DISABLE_NEW_DEPRECATED_INTERFACES\r
-\r
-/**\r
- [ATTENTION] This function is deprecated for security reason.\r
-\r
- Convert a Null-terminated Unicode string to a Null-terminated\r
- ASCII string and returns the ASCII string.\r
-\r
- This function converts the content of the Unicode string Source\r
- to the ASCII string Destination by copying the lower 8 bits of\r
- each Unicode character. It returns Destination.\r
-\r
- The caller is responsible to make sure Destination points to a buffer with size\r
- equal or greater than ((StrLen (Source) + 1) * sizeof (CHAR8)) in bytes.\r
-\r
- If any Unicode characters in Source contain non-zero value in\r
- the upper 8 bits, then ASSERT().\r
-\r
- If Destination is NULL, then ASSERT().\r
- If Source is NULL, then ASSERT().\r
- If Source is not aligned on a 16-bit boundary, then ASSERT().\r
- If Source and Destination overlap, then ASSERT().\r
-\r
- If PcdMaximumUnicodeStringLength is not zero, and Source contains\r
- more than PcdMaximumUnicodeStringLength Unicode characters, not including\r
- the Null-terminator, then ASSERT().\r
-\r
- If PcdMaximumAsciiStringLength is not zero, and Source contains more\r
- than PcdMaximumAsciiStringLength Unicode characters, not including the\r
- Null-terminator, then ASSERT().\r
-\r
- @param Source A pointer to a Null-terminated Unicode string.\r
- @param Destination A pointer to a Null-terminated ASCII string.\r
-\r
- @return Destination.\r
-\r
-**/\r
-CHAR8 *\r
-EFIAPI\r
-UnicodeStrToAsciiStr (\r
- IN CONST CHAR16 *Source,\r
- OUT CHAR8 *Destination\r
- )\r
-{\r
- CHAR8 *ReturnValue;\r
-\r
- ASSERT (Destination != NULL);\r
-\r
- //\r
- // ASSERT if Source is long than PcdMaximumUnicodeStringLength.\r
- // Length tests are performed inside StrLen().\r
- //\r
- ASSERT (StrSize (Source) != 0);\r
-\r
- //\r
- // Source and Destination should not overlap\r
- //\r
- ASSERT ((UINTN) (Destination - (CHAR8 *) Source) >= StrSize (Source));\r
- ASSERT ((UINTN) ((CHAR8 *) Source - Destination) > StrLen (Source));\r
-\r
-\r
- ReturnValue = Destination;\r
- while (*Source != '\0') {\r
- //\r
- // If any Unicode characters in Source contain \r
- // non-zero value in the upper 8 bits, then ASSERT().\r
- //\r
- ASSERT (*Source < 0x100);\r
- *(Destination++) = (CHAR8) *(Source++);\r
- }\r
-\r
- *Destination = '\0';\r
-\r
- //\r
- // ASSERT Original Destination is less long than PcdMaximumAsciiStringLength.\r
- // Length tests are performed inside AsciiStrLen().\r
- //\r
- ASSERT (AsciiStrSize (ReturnValue) != 0);\r
-\r
- return ReturnValue;\r
-}\r
-\r
-/**\r
- [ATTENTION] This function will be deprecated for security reason.\r
-\r
- Copies one Null-terminated ASCII string to another Null-terminated ASCII\r
- string and returns the new ASCII string.\r
-\r
- This function copies the contents of the ASCII string Source to the ASCII\r
- string Destination, and returns Destination. If Source and Destination\r
- overlap, then the results are undefined.\r
-\r
- If Destination is NULL, then ASSERT().\r
- If Source is NULL, then ASSERT().\r
- If Source and Destination overlap, then ASSERT().\r
- If PcdMaximumAsciiStringLength is not zero and Source contains more than\r
- PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,\r
- then ASSERT().\r
-\r
- @param Destination A pointer to a Null-terminated ASCII string.\r
- @param Source A pointer to a Null-terminated ASCII string.\r
-\r
- @return Destination\r
-\r
-**/\r
-CHAR8 *\r
-EFIAPI\r
-AsciiStrCpy (\r
- OUT CHAR8 *Destination,\r
- IN CONST CHAR8 *Source\r
- )\r
-{\r
- CHAR8 *ReturnValue;\r
-\r
- //\r
- // Destination cannot be NULL\r
- //\r
- ASSERT (Destination != NULL);\r
-\r
- //\r
- // Destination and source cannot overlap\r
- //\r
- ASSERT ((UINTN)(Destination - Source) > AsciiStrLen (Source));\r
- ASSERT ((UINTN)(Source - Destination) > AsciiStrLen (Source));\r
-\r
- ReturnValue = Destination;\r
- while (*Source != 0) {\r
- *(Destination++) = *(Source++);\r
- }\r
- *Destination = 0;\r
- return ReturnValue;\r
-}\r
-\r
-/**\r
- [ATTENTION] This function will be deprecated for security reason.\r
-\r
- Copies up to a specified length one Null-terminated ASCII string to another \r
- Null-terminated ASCII string and returns the new ASCII string.\r
-\r
- This function copies the contents of the ASCII string Source to the ASCII\r
- string Destination, and returns Destination. At most, Length ASCII characters\r
- are copied from Source to Destination. If Length is 0, then Destination is\r
- returned unmodified. If Length is greater that the number of ASCII characters\r
- in Source, then Destination is padded with Null ASCII characters. If Source\r
- and Destination overlap, then the results are undefined.\r
-\r
- If Destination is NULL, then ASSERT().\r
- If Source is NULL, then ASSERT().\r
- If Source and Destination overlap, then ASSERT().\r
- If PcdMaximumAsciiStringLength is not zero, and Length is greater than \r
- PcdMaximumAsciiStringLength, then ASSERT().\r
- If PcdMaximumAsciiStringLength is not zero, and Source contains more than\r
- PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,\r
- then ASSERT().\r
-\r
- @param Destination A pointer to a Null-terminated ASCII string.\r
- @param Source A pointer to a Null-terminated ASCII string.\r
- @param Length The maximum number of ASCII characters to copy.\r
-\r
- @return Destination\r
-\r
-**/\r
-CHAR8 *\r
-EFIAPI\r
-AsciiStrnCpy (\r
- OUT CHAR8 *Destination,\r
- IN CONST CHAR8 *Source,\r
- IN UINTN Length\r