Returns the length of a Null-terminated Unicode string. This function returns the number of Unicode characters in the Null-terminated Unicode string specified by String. If String is NULL, then ASSERT(). If String is not aligned on a 16-bit boundary, then ASSERT(). If PcdMaximumUnicodeStringLength is not zero, and String contains more than PcdMaximumUnicodeStringLength Unicod
| 172 | |
| 173 | **/ |
| 174 | UINTN |
| 175 | EFIAPI |
| 176 | StrLen ( |
| 177 | IN CONST CHAR16 *String |
| 178 | ) |
| 179 | { |
| 180 | UINTN Length; |
| 181 | |
| 182 | // ASSERT (String != NULL); |
| 183 | ASSERT (((UINTN) String & BIT0) == 0); |
| 184 | if (!String) { |
| 185 | return 0; |
| 186 | } |
| 187 | |
| 188 | for (Length = 0; *String != L'\0'; String++, Length++) { |
| 189 | // |
| 190 | // If PcdMaximumUnicodeStringLength is not zero, |
| 191 | // length should not more than PcdMaximumUnicodeStringLength |
| 192 | // |
| 193 | // if (PcdGet32 (PcdMaximumUnicodeStringLength) != 0) { |
| 194 | // ASSERT (Length < PcdGet32 (PcdMaximumUnicodeStringLength)); |
| 195 | if (Length >= 100000000ull) { |
| 196 | break; |
| 197 | } |
| 198 | } |
| 199 | return Length; |
| 200 | } |
| 201 | |
| 202 | /** |
| 203 | Returns the size of a Null-terminated Unicode string in bytes, including the |
no outgoing calls