MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / StrLen

Function StrLen

MdePkg/Library/BaseLib/String.c:174–200  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

172
173**/
174UINTN
175EFIAPI
176StrLen (
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

Callers 15

String.cFile · 0.70
StrSizeFunction · 0.70
FilePaths.cFile · 0.70
UefiLibPrint.cFile · 0.50
FileHandleGetFileNameFunction · 0.50
GetParamByNodeNameFunction · 0.50
ConvertFromTextVendorFunction · 0.50
DevPathFromTextAcpiExFunction · 0.50
DevPathFromTextAcpiExpFunction · 0.50
DevPathFromTextUsbWwidFunction · 0.50
DevPathFromTextiSCSIFunction · 0.50

Calls

no outgoing calls

Tested by 3

PlatformBdsShowProgressFunction · 0.40
BdsMemoryTestFunction · 0.40
TestDataTypeFunction · 0.40