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

Function AsciiStriCmp

MdePkg/Library/BaseLib/String.c:1389–1424  ·  view source on GitHub ↗

Performs a case insensitive comparison of two Null-terminated ASCII strings, and returns the difference between the first mismatched ASCII characters. This function performs a case insensitive comparison of the Null-terminated ASCII string FirstString to the Null-terminated ASCII string SecondString. If FirstString is identical to SecondString, then 0 is returned. Otherwise, the v

Source from the content-addressed store, hash-verified

1387
1388**/
1389INTN
1390EFIAPI
1391AsciiStriCmp (
1392 IN CONST CHAR8 *FirstString,
1393 IN CONST CHAR8 *SecondString
1394 )
1395{
1396 CHAR8 UpperFirstString;
1397 CHAR8 UpperSecondString;
1398
1399 //
1400 // ASSERT both strings are less long than PcdMaximumAsciiStringLength
1401 //
1402 // ASSERT (AsciiStrSize (FirstString));
1403 // ASSERT (AsciiStrSize (SecondString));
1404 if (!AsciiStrSize (FirstString) && !AsciiStrSize (SecondString)) {
1405 return 0;
1406 }
1407 if (!AsciiStrSize (FirstString)) {
1408 return -1;
1409 }
1410 if (!AsciiStrSize (SecondString)) {
1411 return 1;
1412 }
1413
1414 UpperFirstString = AsciiCharToUpper (*FirstString);
1415 UpperSecondString = AsciiCharToUpper (*SecondString);
1416 while ((*FirstString != '\0') && (*SecondString != '\0') && (UpperFirstString == UpperSecondString)) {
1417 FirstString++;
1418 SecondString++;
1419 UpperFirstString = AsciiCharToUpper (*FirstString);
1420 UpperSecondString = AsciiCharToUpper (*SecondString);
1421 }
1422
1423 return UpperFirstString - UpperSecondString;
1424}
1425
1426/**
1427 Compares two Null-terminated ASCII strings with maximum lengths, and returns

Callers 7

EdbLoadCodBySymbolByIecFunction · 0.85
DxeHttpLib.cFile · 0.85
HttpIoIsChunkedFunction · 0.85
HttpBootCheckImageTypeFunction · 0.85
DxeHttpLib.cFile · 0.85
HttpIoIsChunkedFunction · 0.85

Calls 2

AsciiStrSizeFunction · 0.85
AsciiCharToUpperFunction · 0.85

Tested by

no test coverage detected