TianoCore EDK2 master
Loading...
Searching...
No Matches
String.c
Go to the documentation of this file.
1
9#include "BaseLibInternals.h"
10
29EFIAPI
31 IN CONST CHAR16 *String
32 )
33{
34 UINTN Length;
35
36 ASSERT (String != NULL);
37 ASSERT (((UINTN)String & BIT0) == 0);
38
39 for (Length = 0; *String != L'\0'; String++, Length++) {
40 //
41 // If PcdMaximumUnicodeStringLength is not zero,
42 // length should not more than PcdMaximumUnicodeStringLength
43 //
44 if (PcdGet32 (PcdMaximumUnicodeStringLength) != 0) {
45 ASSERT (Length < PcdGet32 (PcdMaximumUnicodeStringLength));
46 }
47 }
48
49 return Length;
50}
51
71EFIAPI
73 IN CONST CHAR16 *String
74 )
75{
76 return (StrLen (String) + 1) * sizeof (*String);
77}
78
107INTN
108EFIAPI
110 IN CONST CHAR16 *FirstString,
111 IN CONST CHAR16 *SecondString
112 )
113{
114 //
115 // ASSERT both strings are less long than PcdMaximumUnicodeStringLength
116 //
117 ASSERT (StrSize (FirstString) != 0);
118 ASSERT (StrSize (SecondString) != 0);
119
120 while ((*FirstString != L'\0') && (*FirstString == *SecondString)) {
121 FirstString++;
122 SecondString++;
123 }
124
125 return *FirstString - *SecondString;
126}
127
160INTN
161EFIAPI
163 IN CONST CHAR16 *FirstString,
164 IN CONST CHAR16 *SecondString,
165 IN UINTN Length
166 )
167{
168 if (Length == 0) {
169 return 0;
170 }
171
172 //
173 // ASSERT both strings are less long than PcdMaximumUnicodeStringLength.
174 // Length tests are performed inside StrLen().
175 //
176 ASSERT (StrSize (FirstString) != 0);
177 ASSERT (StrSize (SecondString) != 0);
178
179 if (PcdGet32 (PcdMaximumUnicodeStringLength) != 0) {
180 ASSERT (Length <= PcdGet32 (PcdMaximumUnicodeStringLength));
181 }
182
183 while ((*FirstString != L'\0') &&
184 (*SecondString != L'\0') &&
185 (*FirstString == *SecondString) &&
186 (Length > 1))
187 {
188 FirstString++;
189 SecondString++;
190 Length--;
191 }
192
193 return *FirstString - *SecondString;
194}
195
222CHAR16 *
223EFIAPI
225 IN CONST CHAR16 *String,
226 IN CONST CHAR16 *SearchString
227 )
228{
229 CONST CHAR16 *FirstMatch;
230 CONST CHAR16 *SearchStringTmp;
231
232 //
233 // ASSERT both strings are less long than PcdMaximumUnicodeStringLength.
234 // Length tests are performed inside StrLen().
235 //
236 ASSERT (StrSize (String) != 0);
237 ASSERT (StrSize (SearchString) != 0);
238
239 if (*SearchString == L'\0') {
240 return (CHAR16 *)String;
241 }
242
243 while (*String != L'\0') {
244 SearchStringTmp = SearchString;
245 FirstMatch = String;
246
247 while ( (*String == *SearchStringTmp)
248 && (*String != L'\0'))
249 {
250 String++;
251 SearchStringTmp++;
252 }
253
254 if (*SearchStringTmp == L'\0') {
255 return (CHAR16 *)FirstMatch;
256 }
257
258 if (*String == L'\0') {
259 return NULL;
260 }
261
262 String = FirstMatch + 1;
263 }
264
265 return NULL;
266}
267
281BOOLEAN
282EFIAPI
284 IN CHAR16 Char
285 )
286{
287 return (BOOLEAN)(Char >= L'0' && Char <= L'9');
288}
289
305CHAR16
306EFIAPI
308 IN CHAR16 Char
309 )
310{
311 if ((Char >= L'a') && (Char <= L'z')) {
312 return (CHAR16)(Char - (L'a' - L'A'));
313 }
314
315 return Char;
316}
317
331UINTN
332EFIAPI
334 IN CHAR16 Char
335 )
336{
338 return Char - L'0';
339 }
340
341 return (10 + CharToUpper (Char) - L'A');
342}
343
358BOOLEAN
359EFIAPI
361 IN CHAR16 Char
362 )
363{
364 return (BOOLEAN)(InternalIsDecimalDigitCharacter (Char) ||
365 (Char >= L'A' && Char <= L'F') ||
366 (Char >= L'a' && Char <= L'f'));
367}
368
403UINTN
404EFIAPI
406 IN CONST CHAR16 *String
407 )
408{
409 UINTN Result;
410 RETURN_STATUS Status;
411
412 Status = StrDecimalToUintnS (String, (CHAR16 **)NULL, &Result);
413 if (Status == RETURN_INVALID_PARAMETER) {
414 Result = 0;
415 }
416
417 return Result;
418}
419
454UINT64
455EFIAPI
457 IN CONST CHAR16 *String
458 )
459{
460 UINT64 Result;
461 RETURN_STATUS Status;
462
463 Status = StrDecimalToUint64S (String, (CHAR16 **)NULL, &Result);
464 if (Status == RETURN_INVALID_PARAMETER) {
465 Result = 0;
466 }
467
468 return Result;
469}
470
506UINTN
507EFIAPI
509 IN CONST CHAR16 *String
510 )
511{
512 UINTN Result;
513 RETURN_STATUS Status;
514
515 Status = StrHexToUintnS (String, (CHAR16 **)NULL, &Result);
516 if (Status == RETURN_INVALID_PARAMETER) {
517 Result = 0;
518 }
519
520 return Result;
521}
522
558UINT64
559EFIAPI
561 IN CONST CHAR16 *String
562 )
563{
564 UINT64 Result;
565 RETURN_STATUS Status;
566
567 Status = StrHexToUint64S (String, (CHAR16 **)NULL, &Result);
568 if (Status == RETURN_INVALID_PARAMETER) {
569 Result = 0;
570 }
571
572 return Result;
573}
574
588BOOLEAN
589EFIAPI
591 IN CHAR8 Char
592 )
593{
594 return (BOOLEAN)(Char >= '0' && Char <= '9');
595}
596
611BOOLEAN
612EFIAPI
614 IN CHAR8 Char
615 )
616{
617 return (BOOLEAN)(InternalAsciiIsDecimalDigitCharacter (Char) ||
618 (Char >= 'A' && Char <= 'F') ||
619 (Char >= 'a' && Char <= 'f'));
620}
621
639UINTN
640EFIAPI
642 IN CONST CHAR8 *String
643 )
644{
645 UINTN Length;
646
647 ASSERT (String != NULL);
648
649 for (Length = 0; *String != '\0'; String++, Length++) {
650 //
651 // If PcdMaximumUnicodeStringLength is not zero,
652 // length should not more than PcdMaximumUnicodeStringLength
653 //
654 if (PcdGet32 (PcdMaximumAsciiStringLength) != 0) {
655 ASSERT (Length < PcdGet32 (PcdMaximumAsciiStringLength));
656 }
657 }
658
659 return Length;
660}
661
679UINTN
680EFIAPI
682 IN CONST CHAR8 *String
683 )
684{
685 return (AsciiStrLen (String) + 1) * sizeof (*String);
686}
687
714INTN
715EFIAPI
717 IN CONST CHAR8 *FirstString,
718 IN CONST CHAR8 *SecondString
719 )
720{
721 //
722 // ASSERT both strings are less long than PcdMaximumAsciiStringLength
723 //
724 ASSERT (AsciiStrSize (FirstString));
725 ASSERT (AsciiStrSize (SecondString));
726
727 while ((*FirstString != '\0') && (*FirstString == *SecondString)) {
728 FirstString++;
729 SecondString++;
730 }
731
732 return *FirstString - *SecondString;
733}
734
748CHAR8
749EFIAPI
751 IN CHAR8 Chr
752 )
753{
754 return (UINT8)((Chr >= 'a' && Chr <= 'z') ? Chr - ('a' - 'A') : Chr);
755}
756
770UINTN
771EFIAPI
773 IN CHAR8 Char
774 )
775{
777 return Char - '0';
778 }
779
780 return (10 + AsciiCharToUpper (Char) - 'A');
781}
782
812INTN
813EFIAPI
815 IN CONST CHAR8 *FirstString,
816 IN CONST CHAR8 *SecondString
817 )
818{
819 CHAR8 UpperFirstString;
820 CHAR8 UpperSecondString;
821
822 //
823 // ASSERT both strings are less long than PcdMaximumAsciiStringLength
824 //
825 ASSERT (AsciiStrSize (FirstString));
826 ASSERT (AsciiStrSize (SecondString));
827
828 UpperFirstString = AsciiCharToUpper (*FirstString);
829 UpperSecondString = AsciiCharToUpper (*SecondString);
830 while ((*FirstString != '\0') && (*SecondString != '\0') && (UpperFirstString == UpperSecondString)) {
831 FirstString++;
832 SecondString++;
833 UpperFirstString = AsciiCharToUpper (*FirstString);
834 UpperSecondString = AsciiCharToUpper (*SecondString);
835 }
836
837 return UpperFirstString - UpperSecondString;
838}
839
870INTN
871EFIAPI
873 IN CONST CHAR8 *FirstString,
874 IN CONST CHAR8 *SecondString,
875 IN UINTN Length
876 )
877{
878 if (Length == 0) {
879 return 0;
880 }
881
882 //
883 // ASSERT both strings are less long than PcdMaximumAsciiStringLength
884 //
885 ASSERT (AsciiStrSize (FirstString));
886 ASSERT (AsciiStrSize (SecondString));
887
888 if (PcdGet32 (PcdMaximumAsciiStringLength) != 0) {
889 ASSERT (Length <= PcdGet32 (PcdMaximumAsciiStringLength));
890 }
891
892 while ((*FirstString != '\0') &&
893 (*SecondString != '\0') &&
894 (*FirstString == *SecondString) &&
895 (Length > 1))
896 {
897 FirstString++;
898 SecondString++;
899 Length--;
900 }
901
902 return *FirstString - *SecondString;
903}
904
929CHAR8 *
930EFIAPI
932 IN CONST CHAR8 *String,
933 IN CONST CHAR8 *SearchString
934 )
935{
936 CONST CHAR8 *FirstMatch;
937 CONST CHAR8 *SearchStringTmp;
938
939 //
940 // ASSERT both strings are less long than PcdMaximumAsciiStringLength
941 //
942 ASSERT (AsciiStrSize (String) != 0);
943 ASSERT (AsciiStrSize (SearchString) != 0);
944
945 if (*SearchString == '\0') {
946 return (CHAR8 *)String;
947 }
948
949 while (*String != '\0') {
950 SearchStringTmp = SearchString;
951 FirstMatch = String;
952
953 while ( (*String == *SearchStringTmp)
954 && (*String != '\0'))
955 {
956 String++;
957 SearchStringTmp++;
958 }
959
960 if (*SearchStringTmp == '\0') {
961 return (CHAR8 *)FirstMatch;
962 }
963
964 if (*String == '\0') {
965 return NULL;
966 }
967
968 String = FirstMatch + 1;
969 }
970
971 return NULL;
972}
973
1004UINTN
1005EFIAPI
1007 IN CONST CHAR8 *String
1008 )
1009{
1010 UINTN Result;
1011 RETURN_STATUS Status;
1012
1013 Status = AsciiStrDecimalToUintnS (String, (CHAR8 **)NULL, &Result);
1014 if (Status == RETURN_INVALID_PARAMETER) {
1015 Result = 0;
1016 }
1017
1018 return Result;
1019}
1020
1051UINT64
1052EFIAPI
1054 IN CONST CHAR8 *String
1055 )
1056{
1057 UINT64 Result;
1058 RETURN_STATUS Status;
1059
1060 Status = AsciiStrDecimalToUint64S (String, (CHAR8 **)NULL, &Result);
1061 if (Status == RETURN_INVALID_PARAMETER) {
1062 Result = 0;
1063 }
1064
1065 return Result;
1066}
1067
1102UINTN
1103EFIAPI
1105 IN CONST CHAR8 *String
1106 )
1107{
1108 UINTN Result;
1109 RETURN_STATUS Status;
1110
1111 Status = AsciiStrHexToUintnS (String, (CHAR8 **)NULL, &Result);
1112 if (Status == RETURN_INVALID_PARAMETER) {
1113 Result = 0;
1114 }
1115
1116 return Result;
1117}
1118
1153UINT64
1154EFIAPI
1156 IN CONST CHAR8 *String
1157 )
1158{
1159 UINT64 Result;
1160 RETURN_STATUS Status;
1161
1162 Status = AsciiStrHexToUint64S (String, (CHAR8 **)NULL, &Result);
1163 if (Status == RETURN_INVALID_PARAMETER) {
1164 Result = 0;
1165 }
1166
1167 return Result;
1168}
1169
1170STATIC CHAR8 EncodingTable[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
1171 "abcdefghijklmnopqrstuvwxyz"
1172 "0123456789+/";
1173
1193RETURN_STATUS
1194EFIAPI
1196 IN CONST UINT8 *Source,
1197 IN UINTN SourceLength,
1198 OUT CHAR8 *Destination OPTIONAL,
1199 IN OUT UINTN *DestinationSize
1200 )
1201{
1202 UINTN RequiredSize;
1203 UINTN Left;
1204
1205 //
1206 // Check pointers, and SourceLength is valid
1207 //
1208 if ((Source == NULL) || (DestinationSize == NULL)) {
1210 }
1211
1212 //
1213 // Allow for RFC 4648 test vector 1
1214 //
1215 if (SourceLength == 0) {
1216 if (*DestinationSize < 1) {
1217 *DestinationSize = 1;
1219 }
1220
1221 *DestinationSize = 1;
1222 *Destination = '\0';
1223 return RETURN_SUCCESS;
1224 }
1225
1226 //
1227 // Check if SourceLength or DestinationSize is valid
1228 //
1229 if ((SourceLength >= (MAX_ADDRESS - (UINTN)Source)) || (*DestinationSize >= (MAX_ADDRESS - (UINTN)Destination))) {
1231 }
1232
1233 //
1234 // 4 ascii per 3 bytes + NULL
1235 //
1236 RequiredSize = ((SourceLength + 2) / 3) * 4 + 1;
1237 if ((Destination == NULL) || (*DestinationSize < RequiredSize)) {
1238 *DestinationSize = RequiredSize;
1240 }
1241
1242 Left = SourceLength;
1243
1244 //
1245 // Encode 24 bits (three bytes) into 4 ascii characters
1246 //
1247 while (Left >= 3) {
1248 *Destination++ = EncodingTable[(Source[0] & 0xfc) >> 2];
1249 *Destination++ = EncodingTable[((Source[0] & 0x03) << 4) + ((Source[1] & 0xf0) >> 4)];
1250 *Destination++ = EncodingTable[((Source[1] & 0x0f) << 2) + ((Source[2] & 0xc0) >> 6)];
1251 *Destination++ = EncodingTable[(Source[2] & 0x3f)];
1252 Left -= 3;
1253 Source += 3;
1254 }
1255
1256 //
1257 // Handle the remainder, and add padding '=' characters as necessary.
1258 //
1259 switch (Left) {
1260 case 0:
1261
1262 //
1263 // No bytes Left, done.
1264 //
1265 break;
1266 case 1:
1267
1268 //
1269 // One more data byte, two pad characters
1270 //
1271 *Destination++ = EncodingTable[(Source[0] & 0xfc) >> 2];
1272 *Destination++ = EncodingTable[((Source[0] & 0x03) << 4)];
1273 *Destination++ = '=';
1274 *Destination++ = '=';
1275 break;
1276 case 2:
1277
1278 //
1279 // Two more data bytes, and one pad character
1280 //
1281 *Destination++ = EncodingTable[(Source[0] & 0xfc) >> 2];
1282 *Destination++ = EncodingTable[((Source[0] & 0x03) << 4) + ((Source[1] & 0xf0) >> 4)];
1283 *Destination++ = EncodingTable[((Source[1] & 0x0f) << 2)];
1284 *Destination++ = '=';
1285 break;
1286 }
1287
1288 //
1289 // Add terminating NULL
1290 //
1291 *Destination = '\0';
1292 return RETURN_SUCCESS;
1293}
1294
1377RETURN_STATUS
1378EFIAPI
1380 IN CONST CHAR8 *Source OPTIONAL,
1381 IN UINTN SourceSize,
1382 OUT UINT8 *Destination OPTIONAL,
1383 IN OUT UINTN *DestinationSize
1384 )
1385{
1386 BOOLEAN PaddingMode;
1387 UINTN SixBitGroupsConsumed;
1388 UINT32 Accumulator;
1389 UINTN OriginalDestinationSize;
1390 UINTN SourceIndex;
1391 CHAR8 SourceChar;
1392 UINT32 Base64Value;
1393 UINT8 DestinationOctet;
1394
1395 if (DestinationSize == NULL) {
1397 }
1398
1399 //
1400 // Check Source array validity.
1401 //
1402 if (Source == NULL) {
1403 if (SourceSize > 0) {
1404 //
1405 // At least one CHAR8 element at NULL Source.
1406 //
1408 }
1409 } else if (SourceSize > MAX_ADDRESS - (UINTN)Source) {
1410 //
1411 // Non-NULL Source, but it wraps around.
1412 //
1414 }
1415
1416 //
1417 // Check Destination array validity.
1418 //
1419 if (Destination == NULL) {
1420 if (*DestinationSize > 0) {
1421 //
1422 // At least one UINT8 element at NULL Destination.
1423 //
1425 }
1426 } else if (*DestinationSize > MAX_ADDRESS - (UINTN)Destination) {
1427 //
1428 // Non-NULL Destination, but it wraps around.
1429 //
1431 }
1432
1433 //
1434 // Check for overlap.
1435 //
1436 if ((Source != NULL) && (Destination != NULL)) {
1437 //
1438 // Both arrays have been provided, and we know from earlier that each array
1439 // is valid in itself.
1440 //
1441 if ((UINTN)Source + SourceSize <= (UINTN)Destination) {
1442 //
1443 // Source array precedes Destination array, OK.
1444 //
1445 } else if ((UINTN)Destination + *DestinationSize <= (UINTN)Source) {
1446 //
1447 // Destination array precedes Source array, OK.
1448 //
1449 } else {
1450 //
1451 // Overlap.
1452 //
1454 }
1455 }
1456
1457 //
1458 // Decoding loop setup.
1459 //
1460 PaddingMode = FALSE;
1461 SixBitGroupsConsumed = 0;
1462 Accumulator = 0;
1463 OriginalDestinationSize = *DestinationSize;
1464 *DestinationSize = 0;
1465
1466 //
1467 // Decoding loop.
1468 //
1469 for (SourceIndex = 0; SourceIndex < SourceSize; SourceIndex++) {
1470 SourceChar = Source[SourceIndex];
1471
1472 //
1473 // Whitespace is ignored at all positions (regardless of padding mode).
1474 //
1475 if ((SourceChar == '\t') || (SourceChar == '\n') || (SourceChar == '\v') ||
1476 (SourceChar == '\f') || (SourceChar == '\r') || (SourceChar == ' '))
1477 {
1478 continue;
1479 }
1480
1481 //
1482 // If we're in padding mode, accept another padding character, as long as
1483 // that padding character completes the quantum. This completes case (2)
1484 // from RFC4648, Chapter 4. "Base 64 Encoding":
1485 //
1486 // (2) The final quantum of encoding input is exactly 8 bits; here, the
1487 // final unit of encoded output will be two characters followed by two
1488 // "=" padding characters.
1489 //
1490 if (PaddingMode) {
1491 if ((SourceChar == '=') && (SixBitGroupsConsumed == 3)) {
1492 SixBitGroupsConsumed = 0;
1493 continue;
1494 }
1495
1497 }
1498
1499 //
1500 // When not in padding mode, decode Base64Value based on RFC4648, "Table 1:
1501 // The Base 64 Alphabet".
1502 //
1503 if (('A' <= SourceChar) && (SourceChar <= 'Z')) {
1504 Base64Value = SourceChar - 'A';
1505 } else if (('a' <= SourceChar) && (SourceChar <= 'z')) {
1506 Base64Value = 26 + (SourceChar - 'a');
1507 } else if (('0' <= SourceChar) && (SourceChar <= '9')) {
1508 Base64Value = 52 + (SourceChar - '0');
1509 } else if (SourceChar == '+') {
1510 Base64Value = 62;
1511 } else if (SourceChar == '/') {
1512 Base64Value = 63;
1513 } else if (SourceChar == '=') {
1514 //
1515 // Enter padding mode.
1516 //
1517 PaddingMode = TRUE;
1518
1519 if (SixBitGroupsConsumed == 2) {
1520 //
1521 // If we have consumed two 6-bit groups from the current quantum before
1522 // encountering the first padding character, then this is case (2) from
1523 // RFC4648, Chapter 4. "Base 64 Encoding". Bump SixBitGroupsConsumed,
1524 // and we'll enforce another padding character.
1525 //
1526 SixBitGroupsConsumed = 3;
1527 } else if (SixBitGroupsConsumed == 3) {
1528 //
1529 // If we have consumed three 6-bit groups from the current quantum
1530 // before encountering the first padding character, then this is case
1531 // (3) from RFC4648, Chapter 4. "Base 64 Encoding". The quantum is now
1532 // complete.
1533 //
1534 SixBitGroupsConsumed = 0;
1535 } else {
1536 //
1537 // Padding characters are not allowed at the first two positions of a
1538 // quantum.
1539 //
1541 }
1542
1543 //
1544 // Wherever in a quantum we enter padding mode, we enforce the padding
1545 // bits pending in the accumulator -- from the last 6-bit group just
1546 // preceding the padding character -- to be zero. Refer to RFC4648,
1547 // Chapter 3.5. "Canonical Encoding".
1548 //
1549 if (Accumulator != 0) {
1551 }
1552
1553 //
1554 // Advance to the next source character.
1555 //
1556 continue;
1557 } else {
1558 //
1559 // Other characters outside of the encoding alphabet are rejected.
1560 //
1562 }
1563
1564 //
1565 // Feed the bits of the current 6-bit group of the quantum to the
1566 // accumulator.
1567 //
1568 Accumulator = (Accumulator << 6) | Base64Value;
1569 SixBitGroupsConsumed++;
1570 switch (SixBitGroupsConsumed) {
1571 case 1:
1572 //
1573 // No octet to spill after consuming the first 6-bit group of the
1574 // quantum; advance to the next source character.
1575 //
1576 continue;
1577 case 2:
1578 //
1579 // 12 bits accumulated (6 pending + 6 new); prepare for spilling an
1580 // octet. 4 bits remain pending.
1581 //
1582 DestinationOctet = (UINT8)(Accumulator >> 4);
1583 Accumulator &= 0xF;
1584 break;
1585 case 3:
1586 //
1587 // 10 bits accumulated (4 pending + 6 new); prepare for spilling an
1588 // octet. 2 bits remain pending.
1589 //
1590 DestinationOctet = (UINT8)(Accumulator >> 2);
1591 Accumulator &= 0x3;
1592 break;
1593 default:
1594 ASSERT (SixBitGroupsConsumed == 4);
1595 //
1596 // 8 bits accumulated (2 pending + 6 new); prepare for spilling an octet.
1597 // The quantum is complete, 0 bits remain pending.
1598 //
1599 DestinationOctet = (UINT8)Accumulator;
1600 Accumulator = 0;
1601 SixBitGroupsConsumed = 0;
1602 break;
1603 }
1604
1605 //
1606 // Store the decoded octet if there's room left. Increment
1607 // (*DestinationSize) unconditionally.
1608 //
1609 if (*DestinationSize < OriginalDestinationSize) {
1610 ASSERT (Destination != NULL);
1611 Destination[*DestinationSize] = DestinationOctet;
1612 }
1613
1614 (*DestinationSize)++;
1615
1616 //
1617 // Advance to the next source character.
1618 //
1619 }
1620
1621 //
1622 // If Source terminates mid-quantum, then Source is invalid.
1623 //
1624 if (SixBitGroupsConsumed != 0) {
1626 }
1627
1628 //
1629 // Done.
1630 //
1631 if (*DestinationSize <= OriginalDestinationSize) {
1632 return RETURN_SUCCESS;
1633 }
1634
1636}
1637
1651UINT8
1652EFIAPI
1654 IN UINT8 Value
1655 )
1656{
1657 ASSERT (Value < 100);
1658 return (UINT8)(((Value / 10) << 4) | (Value % 10));
1659}
1660
1675UINT8
1676EFIAPI
1678 IN UINT8 Value
1679 )
1680{
1681 ASSERT (Value < 0xa0);
1682 ASSERT ((Value & 0xf) < 0xa);
1683 return (UINT8)((Value >> 4) * 10 + (Value & 0xf));
1684}
UINT64 UINTN
INT64 INTN
#define MAX_ADDRESS
UINTN EFIAPI StrSize(IN CONST CHAR16 *String)
Definition: String.c:72
RETURN_STATUS EFIAPI AsciiStrHexToUint64S(IN CONST CHAR8 *String, OUT CHAR8 **EndPointer OPTIONAL, OUT UINT64 *Data)
Definition: SafeString.c:2527
UINTN EFIAPI AsciiStrLen(IN CONST CHAR8 *String)
Definition: String.c:641
RETURN_STATUS EFIAPI StrDecimalToUint64S(IN CONST CHAR16 *String, OUT CHAR16 **EndPointer OPTIONAL, OUT UINT64 *Data)
Definition: SafeString.c:743
RETURN_STATUS EFIAPI AsciiStrDecimalToUintnS(IN CONST CHAR8 *String, OUT CHAR8 **EndPointer OPTIONAL, OUT UINTN *Data)
Definition: SafeString.c:2179
RETURN_STATUS EFIAPI AsciiStrHexToUintnS(IN CONST CHAR8 *String, OUT CHAR8 **EndPointer OPTIONAL, OUT UINTN *Data)
Definition: SafeString.c:2399
RETURN_STATUS EFIAPI AsciiStrDecimalToUint64S(IN CONST CHAR8 *String, OUT CHAR8 **EndPointer OPTIONAL, OUT UINT64 *Data)
Definition: SafeString.c:2287
RETURN_STATUS EFIAPI StrHexToUintnS(IN CONST CHAR16 *String, OUT CHAR16 **EndPointer OPTIONAL, OUT UINTN *Data)
Definition: SafeString.c:860
RETURN_STATUS EFIAPI StrDecimalToUintnS(IN CONST CHAR16 *String, OUT CHAR16 **EndPointer OPTIONAL, OUT UINTN *Data)
Definition: SafeString.c:631
RETURN_STATUS EFIAPI StrHexToUint64S(IN CONST CHAR16 *String, OUT CHAR16 **EndPointer OPTIONAL, OUT UINT64 *Data)
Definition: SafeString.c:994
UINTN EFIAPI AsciiStrSize(IN CONST CHAR8 *String)
Definition: String.c:681
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
Definition: String.c:30
CHAR8 *EFIAPI AsciiStrStr(IN CONST CHAR8 *String, IN CONST CHAR8 *SearchString)
Definition: String.c:931
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define RETURN_BUFFER_TOO_SMALL
Definition: Base.h:1093
#define STATIC
Definition: Base.h:264
#define RETURN_SUCCESS
Definition: Base.h:1066
#define TRUE
Definition: Base.h:301
#define FALSE
Definition: Base.h:307
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define RETURN_INVALID_PARAMETER
Definition: Base.h:1076
INTN EFIAPI AsciiStriCmp(IN CONST CHAR8 *FirstString, IN CONST CHAR8 *SecondString)
Definition: String.c:814
UINT64 EFIAPI StrHexToUint64(IN CONST CHAR16 *String)
Definition: String.c:560
UINT8 EFIAPI BcdToDecimal8(IN UINT8 Value)
Definition: String.c:1677
BOOLEAN EFIAPI InternalAsciiIsDecimalDigitCharacter(IN CHAR8 Char)
Definition: String.c:590
CHAR16 EFIAPI CharToUpper(IN CHAR16 Char)
Definition: String.c:307
UINTN EFIAPI StrDecimalToUintn(IN CONST CHAR16 *String)
Definition: String.c:405
INTN EFIAPI StrCmp(IN CONST CHAR16 *FirstString, IN CONST CHAR16 *SecondString)
Definition: String.c:109
BOOLEAN EFIAPI InternalIsDecimalDigitCharacter(IN CHAR16 Char)
Definition: String.c:283
UINT64 EFIAPI AsciiStrDecimalToUint64(IN CONST CHAR8 *String)
Definition: String.c:1053
BOOLEAN EFIAPI InternalAsciiIsHexaDecimalDigitCharacter(IN CHAR8 Char)
Definition: String.c:613
UINTN EFIAPI InternalAsciiHexCharToUintn(IN CHAR8 Char)
Definition: String.c:772
UINT64 EFIAPI StrDecimalToUint64(IN CONST CHAR16 *String)
Definition: String.c:456
INTN EFIAPI AsciiStrCmp(IN CONST CHAR8 *FirstString, IN CONST CHAR8 *SecondString)
Definition: String.c:716
INTN EFIAPI AsciiStrnCmp(IN CONST CHAR8 *FirstString, IN CONST CHAR8 *SecondString, IN UINTN Length)
Definition: String.c:872
RETURN_STATUS EFIAPI Base64Decode(IN CONST CHAR8 *Source OPTIONAL, IN UINTN SourceSize, OUT UINT8 *Destination OPTIONAL, IN OUT UINTN *DestinationSize)
Definition: String.c:1379
UINTN EFIAPI AsciiStrDecimalToUintn(IN CONST CHAR8 *String)
Definition: String.c:1006
UINTN EFIAPI StrHexToUintn(IN CONST CHAR16 *String)
Definition: String.c:508
UINTN EFIAPI InternalHexCharToUintn(IN CHAR16 Char)
Definition: String.c:333
INTN EFIAPI StrnCmp(IN CONST CHAR16 *FirstString, IN CONST CHAR16 *SecondString, IN UINTN Length)
Definition: String.c:162
UINTN EFIAPI AsciiStrHexToUintn(IN CONST CHAR8 *String)
Definition: String.c:1104
UINT8 EFIAPI DecimalToBcd8(IN UINT8 Value)
Definition: String.c:1653
CHAR8 EFIAPI AsciiCharToUpper(IN CHAR8 Chr)
Definition: String.c:750
UINT64 EFIAPI AsciiStrHexToUint64(IN CONST CHAR8 *String)
Definition: String.c:1155
CHAR16 *EFIAPI StrStr(IN CONST CHAR16 *String, IN CONST CHAR16 *SearchString)
Definition: String.c:224
RETURN_STATUS EFIAPI Base64Encode(IN CONST UINT8 *Source, IN UINTN SourceLength, OUT CHAR8 *Destination OPTIONAL, IN OUT UINTN *DestinationSize)
Definition: String.c:1195
BOOLEAN EFIAPI InternalIsHexaDecimalDigitCharacter(IN CHAR16 Char)
Definition: String.c:360
#define PcdGet32(TokenName)
Definition: PcdLib.h:362