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

Function StrnCmp

MdePkg/Library/BaseLib/String.c:323–358  ·  view source on GitHub ↗

Compares up to a specified length the contents of two Null-terminated Unicode strings, and returns the difference between the first mismatched Unicode characters. This function compares the Null-terminated Unicode string FirstString to the Null-terminated Unicode string SecondString. At most, Length Unicode characters will be compared. If Length is 0, then 0 is returned. If FirstS

Source from the content-addressed store, hash-verified

321
322**/
323INTN
324EFIAPI
325StrnCmp (
326 IN CONST CHAR16 *FirstString,
327 IN CONST CHAR16 *SecondString,
328 IN UINTN Length
329 )
330{
331 if (Length == 0) {
332 return 0;
333 }
334
335 //
336 // ASSERT both strings are less long than PcdMaximumUnicodeStringLength.
337 // Length tests are performed inside StrLen().
338 //
339 ASSERT (StrSize (FirstString) != 0);
340 ASSERT (StrSize (SecondString) != 0);
341
342// if (PcdGet32 (PcdMaximumUnicodeStringLength) != 0) {
343// ASSERT (Length <= PcdGet32 (PcdMaximumUnicodeStringLength));
344 if (Length > 100000000ull) {
345 Length = 100000000ull;
346 }
347
348 while ((*FirstString != L'\0') &&
349 (*SecondString != L'\0') &&
350 (*FirstString == *SecondString) &&
351 (Length > 1)) {
352 FirstString++;
353 SecondString++;
354 Length--;
355 }
356
357 return *FirstString - *SecondString;
358}
359
360#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
361

Callers 15

GetParamByNodeNameFunction · 0.50
IsKeyOptionVariableFunction · 0.50
IsEfiBootVarFunction · 0.50
IsOcBootVarFunction · 0.50
GetExecuatableFileNameFunction · 0.50
GetManFileNameFunction · 0.50
ManBufferFindSectionsFunction · 0.50
ManFileFindSectionsFunction · 0.50
IsTitleHeaderFunction · 0.50
ProcessCommandLineFunction · 0.50
PerformMappingDisplayFunction · 0.50
InternalIsOnCheckListFunction · 0.50

Calls 1

StrSizeFunction · 0.70

Tested by 1

TestDataTypeFunction · 0.40