or String contains more than PcdMaximumUnicodeStringLength Unicode \r
characters not including the Null-terminator, then ASSERT().\r
\r
- @param String Pointer to a Null-terminated Unicode string.\r
- @param SearchString Pointer to a Null-terminated Unicode string to search for.\r
+ @param String Pointer to a Null-terminated Unicode string.\r
+ @param SearchString Pointer to a Null-terminated Unicode string to search for.\r
\r
@retval NULL If the SearchString does not appear in String.\r
@retval !NULL If there is a match.\r
CHAR16 *\r
EFIAPI\r
StrStr (\r
- IN CONST CHAR16 *String,\r
- IN CONST CHAR16 *SearchString\r
+ IN CONST CHAR16 *String,\r
+ IN CONST CHAR16 *SearchString\r
)\r
{\r
CONST CHAR16 *FirstMatch;\r
CONST CHAR16 *SearchStringTmp;\r
\r
- ASSERT (String != NULL);\r
- ASSERT (((UINTN) String & 0x01) == 0);\r
- ASSERT (SearchString != NULL);\r
- ASSERT (((UINTN) SearchString & 0x01) == 0);\r
-\r
//\r
- // If PcdMaximumUnicodeStringLength is not zero,\r
- // length of String should not more than PcdMaximumUnicodeStringLength\r
- //\r
- if (PcdGet32 (PcdMaximumUnicodeStringLength) != 0) {\r
- ASSERT (StrLen (String) < PcdGet32 (PcdMaximumUnicodeStringLength));\r
- }\r
-\r
- //\r
- // If PcdMaximumUnicodeStringLength is not zero,\r
- // length of SearchString should not more than PcdMaximumUnicodeStringLength\r
+ // ASSERT both strings are less long than PcdMaximumUnicodeStringLength.\r
+ // Length tests are performed inside StrLen().\r
//\r
- if (PcdGet32 (PcdMaximumUnicodeStringLength) != 0) {\r
- ASSERT (StrLen (SearchString) < PcdGet32 (PcdMaximumAsciiStringLength));\r
- }\r
+ ASSERT (StrSize (String) != 0);\r
+ ASSERT (StrSize (SearchString) != 0);\r
\r
while (*String != '\0') {\r
SearchStringTmp = SearchString;\r
more than PcdMaximumUnicodeStringLength Unicode characters not including \r
the Null-terminator, then ASSERT().\r
\r
- @param String Pointer to a Null-terminated Unicode string.\r
+ @param String Pointer to a Null-terminated Unicode string.\r
\r
@retval UINTN \r
\r
UINTN\r
EFIAPI\r
StrDecimalToUintn (\r
- IN CONST CHAR16 *String\r
+ IN CONST CHAR16 *String\r
)\r
{\r
UINTN Result;\r
\r
- ASSERT (String != NULL);\r
- ASSERT (((UINTN) String & 0x01) == 0);\r
- ASSERT (StrLen (String) < PcdGet32 (PcdMaximumUnicodeStringLength));\r
+ //\r
+ // ASSERT String is less long than PcdMaximumUnicodeStringLength.\r
+ // Length tests are performed inside StrLen().\r
+ //\r
+ ASSERT (StrSize (String) != 0);\r
\r
//\r
// Ignore the pad spaces (space or tab)\r
more than PcdMaximumUnicodeStringLength Unicode characters not including \r
the Null-terminator, then ASSERT().\r
\r
- @param String Pointer to a Null-terminated Unicode string.\r
+ @param String Pointer to a Null-terminated Unicode string.\r
\r
@retval UINT64 \r
\r
UINT64\r
EFIAPI\r
StrDecimalToUint64 (\r
- IN CONST CHAR16 *String\r
+ IN CONST CHAR16 *String\r
)\r
{\r
UINT64 Result;\r
\r
- ASSERT (String != NULL);\r
- ASSERT (((UINTN) String & 0x01) == 0);\r
- ASSERT (StrLen (String) < PcdGet32 (PcdMaximumUnicodeStringLength));\r
+ //\r
+ // ASSERT String is less long than PcdMaximumUnicodeStringLength.\r
+ // Length tests are performed inside StrLen().\r
+ //\r
+ ASSERT (StrSize (String) != 0);\r
\r
//\r
// Ignore the pad spaces (space or tab)\r
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, \r
then ASSERT().\r
\r
- @param String Pointer to a Null-terminated Unicode string.\r
+ @param String Pointer to a Null-terminated Unicode string.\r
\r
@retval UINTN\r
\r
UINTN\r
EFIAPI\r
StrHexToUintn (\r
- IN CONST CHAR16 *String\r
+ IN CONST CHAR16 *String\r
)\r
{\r
UINTN Result;\r
\r
- ASSERT (String != NULL);\r
- ASSERT (((UINTN) String & 0x01) == 0);\r
- ASSERT (StrLen (String) < PcdGet32 (PcdMaximumUnicodeStringLength));\r
+ //\r
+ // ASSERT String is less long than PcdMaximumUnicodeStringLength.\r
+ // Length tests are performed inside StrLen().\r
+ //\r
+ ASSERT (StrSize (String) != 0);\r
\r
//\r
// Ignore the pad spaces (space or tab) \r
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, \r
then ASSERT().\r
\r
- @param String Pointer to a Null-terminated Unicode string.\r
+ @param String Pointer to a Null-terminated Unicode string.\r
\r
@retval UINT64\r
\r
UINT64\r
EFIAPI\r
StrHexToUint64 (\r
- IN CONST CHAR16 *String\r
+ IN CONST CHAR16 *String\r
)\r
{\r
UINT64 Result;\r
\r
- ASSERT (String != NULL);\r
- ASSERT (((UINTN) String & 0x01) == 0);\r
- ASSERT (StrLen (String) < PcdGet32 (PcdMaximumUnicodeStringLength));\r
+ //\r
+ // ASSERT String is less long than PcdMaximumUnicodeStringLength.\r
+ // Length tests are performed inside StrLen().\r
+ //\r
+ ASSERT (StrSize (String) != 0);\r
\r
//\r
// Ignore the pad spaces (space or tab) \r
CHAR8 *\r
EFIAPI\r
UnicodeStrToAsciiStr (\r
- IN CONST CHAR16 *Source,\r
- OUT CHAR8 *Destination\r
+ IN CONST CHAR16 *Source,\r
+ OUT CHAR8 *Destination\r
)\r
{\r
+ CHAR8 *ReturnValue;\r
+\r
ASSERT (Destination != NULL);\r
- ASSERT (Source != NULL);\r
- ASSERT (((UINTN) Source & 0x01) == 0);\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
ASSERT ((UINTN) ((CHAR16 *) Destination - Source) > StrLen (Source));\r
ASSERT ((UINTN) ((CHAR8 *) Source - Destination) > StrLen (Source));\r
\r
- //\r
- // If PcdMaximumUnicodeStringLength is not zero,\r
- // length of Source should not more than PcdMaximumUnicodeStringLength\r
- //\r
- if (PcdGet32 (PcdMaximumUnicodeStringLength) != 0) {\r
- ASSERT (StrLen (Source) < PcdGet32 (PcdMaximumUnicodeStringLength));\r
- }\r
\r
+ ReturnValue = Destination;\r
while (*Source != '\0') {\r
//\r
// If any Unicode characters in Source contain \r
}\r
\r
*Destination = '\0';\r
- \r
- return Destination;\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
String contains more than PcdMaximumAsciiStringLength Unicode characters \r
not including the Null-terminator, then ASSERT().\r
\r
- @param String Pointer to a Null-terminated ASCII string.\r
- @param SearchString Pointer to a Null-terminated ASCII string to search for.\r
+ @param String Pointer to a Null-terminated ASCII string.\r
+ @param SearchString Pointer to a Null-terminated ASCII string to search for.\r
\r
@retval NULL If the SearchString does not appear in String.\r
@retval !NULL If there is a match.\r
CHAR8 *\r
EFIAPI\r
AsciiStrStr (\r
- IN CONST CHAR8 *String,\r
+ IN CONST CHAR8 *String,\r
IN CONST CHAR8 *SearchString\r
)\r
{\r
CONST CHAR8 *FirstMatch;\r
CONST CHAR8 *SearchStringTmp;\r
\r
- ASSERT (String != NULL);\r
- ASSERT (SearchString != NULL);\r
-\r
//\r
- // If PcdMaximumUnicodeStringLength is not zero,\r
- // length of String should not more than PcdMaximumUnicodeStringLength\r
+ // ASSERT both strings are less long than PcdMaximumAsciiStringLength\r
//\r
- if (PcdGet32 (PcdMaximumAsciiStringLength) != 0) {\r
- ASSERT (AsciiStrLen (String) < PcdGet32 (PcdMaximumAsciiStringLength));\r
- }\r
-\r
- //\r
- // If PcdMaximumUnicodeStringLength is not zero,\r
- // length of SearchString should not more than PcdMaximumUnicodeStringLength\r
- //\r
- if (PcdGet32 (PcdMaximumAsciiStringLength) != 0) {\r
- ASSERT (AsciiStrLen (SearchString) < PcdGet32 (PcdMaximumAsciiStringLength));\r
- }\r
+ ASSERT (AsciiStrSize (String) != 0);\r
+ ASSERT (AsciiStrSize (SearchString) != 0);\r
\r
while (*String != '\0') {\r
SearchStringTmp = SearchString;\r
PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, \r
then ASSERT().\r
\r
- @param String Pointer to a Null-terminated ASCII string.\r
+ @param String Pointer to a Null-terminated ASCII string.\r
\r
@retval UINTN \r
\r
UINTN\r
EFIAPI\r
AsciiStrDecimalToUintn (\r
- IN CONST CHAR8 *String\r
+ IN CONST CHAR8 *String\r
)\r
{\r
UINTN Result;\r
\r
- ASSERT (String != NULL);\r
- ASSERT (AsciiStrLen (String) < PcdGet32 (PcdMaximumAsciiStringLength));\r
+ //\r
+ // ASSERT Strings is less long than PcdMaximumAsciiStringLength\r
+ //\r
+ ASSERT (AsciiStrSize (String) != 0);\r
\r
//\r
// Ignore the pad spaces (space or tab)\r
PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, \r
then ASSERT().\r
\r
- @param String Pointer to a Null-terminated ASCII string.\r
+ @param String Pointer to a Null-terminated ASCII string.\r
\r
@retval UINT64 \r
\r
UINT64\r
EFIAPI\r
AsciiStrDecimalToUint64 (\r
- IN CONST CHAR8 *String\r
+ IN CONST CHAR8 *String\r
)\r
{\r
UINT64 Result;\r
\r
- ASSERT (String != NULL);\r
- ASSERT (AsciiStrLen (String) < PcdGet32 (PcdMaximumAsciiStringLength));\r
+ //\r
+ // ASSERT Strings is less long than PcdMaximumAsciiStringLength\r
+ //\r
+ ASSERT (AsciiStrSize (String) != 0);\r
\r
//\r
// Ignore the pad spaces (space or tab)\r
and String contains more than PcdMaximumAsciiStringLength ASCII characters not including \r
the Null-terminator, then ASSERT().\r
\r
- @param String Pointer to a Null-terminated ASCII string.\r
+ @param String Pointer to a Null-terminated ASCII string.\r
\r
@retval UINTN\r
\r
UINTN\r
EFIAPI\r
AsciiStrHexToUintn (\r
- IN CONST CHAR8 *String\r
+ IN CONST CHAR8 *String\r
)\r
{\r
UINTN Result;\r
\r
- ASSERT (String != NULL);\r
- ASSERT (AsciiStrLen (String) < PcdGet32 (PcdMaximumAsciiStringLength));\r
+ //\r
+ // ASSERT Strings is less long than PcdMaximumAsciiStringLength\r
+ //\r
+ ASSERT (AsciiStrSize (String) != 0);\r
\r
//\r
// Ignore the pad spaces (space or tab) \r
and String contains more than PcdMaximumAsciiStringLength ASCII characters not including \r
the Null-terminator, then ASSERT().\r
\r
- @param String Pointer to a Null-terminated ASCII string.\r
+ @param String Pointer to a Null-terminated ASCII string.\r
\r
@retval UINT64\r
\r
UINT64\r
EFIAPI\r
AsciiStrHexToUint64 (\r
- IN CONST CHAR8 *String\r
+ IN CONST CHAR8 *String\r
)\r
{\r
UINT64 Result;\r
\r
- ASSERT (String != NULL);\r
- ASSERT (AsciiStrLen (String) < PcdGet32 (PcdMaximumUnicodeStringLength));\r
+ //\r
+ // ASSERT Strings is less long than PcdMaximumAsciiStringLength\r
+ //\r
+ ASSERT (AsciiStrSize (String) != 0);\r
\r
//\r
// Ignore the pad spaces (space or tab) and leading Zeros\r
CHAR16 *\r
EFIAPI\r
AsciiStrToUnicodeStr (\r
- IN CONST CHAR8 *Source,\r
- OUT CHAR16 *Destination\r
+ IN CONST CHAR8 *Source,\r
+ OUT CHAR16 *Destination\r
)\r
{\r
+ CHAR16 *ReturnValue;\r
+\r
ASSERT (Destination != NULL);\r
- ASSERT (Source != NULL);\r
\r
//\r
- // Source and Destination should not overlap\r
+ // ASSERT Source is less long than PcdMaximumAsciiStringLength\r
//\r
- ASSERT ((UINTN) ((CHAR8 *) Destination - Source) > AsciiStrLen (Source));\r
- ASSERT ((UINTN) (Source - (CHAR8 *) Destination) > (AsciiStrLen (Source) * sizeof (CHAR16)));\r
+ ASSERT (AsciiStrSize (Source) != 0);\r
\r
//\r
- // If PcdMaximumAsciiStringLength is not zero,\r
- // length of Source should not more than PcdMaximumUnicodeStringLength\r
+ // Source and Destination should not overlap\r
//\r
- if (PcdGet32 (PcdMaximumAsciiStringLength) != 0) {\r
- ASSERT (AsciiStrLen (Source) < PcdGet32 (PcdMaximumAsciiStringLength));\r
- }\r
+ ASSERT ((UINTN) ((CHAR8 *) Destination - Source) > AsciiStrLen (Source));\r
+ ASSERT ((UINTN) (Source - (CHAR8 *) Destination) > (AsciiStrLen (Source) * sizeof (CHAR16)));\r
\r
+ \r
+ ReturnValue = Destination;\r
while (*Source != '\0') {\r
*(Destination++) = (CHAR16) *(Source++);\r
}\r
//\r
*Destination = '\0';\r
\r
- return Destination;\r
+ //\r
+ // ASSERT Original Destination is less long than PcdMaximumUnicodeStringLength\r
+ //\r
+ ASSERT (StrSize (ReturnValue) != 0);\r
+\r
+ return ReturnValue;\r
}\r
\r
/**\r