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

Function StrCmp

MdePkg/Library/BaseLib/String.c:260–289  ·  view source on GitHub ↗

Compares 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. If FirstString is identical to SecondString, then 0 is returned. Otherwise, the value returned is the first mismatched Unicode character in

Source from the content-addressed store, hash-verified

258
259**/
260INTN
261EFIAPI
262StrCmp (
263 IN CONST CHAR16 *FirstString,
264 IN CONST CHAR16 *SecondString
265 )
266{
267 //
268 // ASSERT both strings are less long than PcdMaximumUnicodeStringLength
269 //
270// ASSERT (StrSize (FirstString) != 0);
271// ASSERT (StrSize (SecondString) != 0);
272 if ((StrSize (FirstString) == 0) && (StrSize (SecondString) == 0)) {
273 return 0;
274 }
275
276 if (StrSize (FirstString) == 0) {
277 return -1;
278 }
279 if (StrSize (SecondString) == 0) {
280 return 1;
281 }
282
283
284 while ((*FirstString != L'\0') && (*FirstString == *SecondString)) {
285 FirstString++;
286 SecondString++;
287 }
288 return *FirstString - *SecondString;
289}
290
291/**
292 Compares up to a specified length the contents of two Null-terminated Unicode strings,

Callers 15

FilePaths.cFile · 0.70
InternalHstiFindAipFunction · 0.50
DevPathFromTextAtaFunction · 0.50
DevPathFromTextSASFunction · 0.50
DevPathFromTextSasExFunction · 0.50
NetworkProtocolFromTextFunction · 0.50
DevPathFromTextIPv4Function · 0.50
DevPathFromTextIPv6Function · 0.50
DevPathFromTextUartFunction · 0.50
DevPathFromTextiSCSIFunction · 0.50
DevPathFromTextHDFunction · 0.50

Calls 1

StrSizeFunction · 0.70

Tested by

no test coverage detected