Changeset 77662 in vbox for trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BasePrintLib/PrintLib.c
- Timestamp:
- Mar 12, 2019 12:40:12 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 129295
- Location:
- trunk/src/VBox/Devices/EFI/FirmwareNew
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/FirmwareNew
-
Property svn:mergeinfo
changed from (toggle deleted branches)
to (toggle deleted branches)/vendor/edk2/current 103735-103757,103769-103776 /vendor/edk2/current 103735-103757,103769-103776,129194-129237
-
Property svn:mergeinfo
changed from (toggle deleted branches)
-
trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BasePrintLib/PrintLib.c
r58466 r77662 2 2 Base Print Library instance implementation. 3 3 4 Copyright (c) 2006 - 201 2, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR> 5 5 Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR> 6 6 This program and the accompanying materials … … 28 28 /** 29 29 Produces a Null-terminated Unicode string in an output buffer based on 30 a Null-terminated Unicode format string and a VA_LIST argument list 30 a Null-terminated Unicode format string and a VA_LIST argument list. 31 32 This function is similar as vsnprintf_s defined in C11. 31 33 32 34 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer … … 37 39 The number of Unicode characters in the produced output buffer is returned not including 38 40 the Null-terminator. 39 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned. 40 41 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). 42 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT(). 43 If BufferSize > 1 and FormatString is NULL, then ASSERT(). 44 If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT(). 41 42 If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT(). 43 If FormatString is not aligned on a 16-bit boundary, then ASSERT(). 44 45 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is 46 unmodified and 0 is returned. 47 If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is 48 unmodified and 0 is returned. 49 If PcdMaximumUnicodeStringLength is not zero, and BufferSize > 50 (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output 51 buffer is unmodified and 0 is returned. 45 52 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than 46 53 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then 47 ASSERT(). 48 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string 49 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the 50 Null-terminator, then ASSERT(). 54 ASSERT(). Also, the output buffer is unmodified and 0 is returned. 55 56 If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned. 51 57 52 58 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated … … 76 82 /** 77 83 Produces a Null-terminated Unicode string in an output buffer based on 78 a Null-terminated Unicode format string and a BASE_LIST argument list 84 a Null-terminated Unicode format string and a BASE_LIST argument list. 79 85 80 86 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer … … 85 91 The number of Unicode characters in the produced output buffer is returned not including 86 92 the Null-terminator. 87 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned. 88 89 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). 90 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT(). 91 If BufferSize > 1 and FormatString is NULL, then ASSERT(). 92 If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT(). 93 94 If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT(). 95 If FormatString is not aligned on a 16-bit boundary, then ASSERT(). 96 97 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is 98 unmodified and 0 is returned. 99 If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is 100 unmodified and 0 is returned. 101 If PcdMaximumUnicodeStringLength is not zero, and BufferSize > 102 (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output 103 buffer is unmodified and 0 is returned. 93 104 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than 94 105 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then 95 ASSERT(). 96 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string 97 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the 98 Null-terminator, then ASSERT(). 106 ASSERT(). Also, the output buffer is unmodified and 0 is returned. 107 108 If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned. 99 109 100 110 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated … … 126 136 Unicode format string and variable argument list. 127 137 138 This function is similar as snprintf_s defined in C11. 139 128 140 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer 129 141 and BufferSize. … … 132 144 The number of Unicode characters in the produced output buffer is returned not including 133 145 the Null-terminator. 134 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned. 135 136 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). 137 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT(). 138 If BufferSize > 1 and FormatString is NULL, then ASSERT(). 139 If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT(). 146 147 If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT(). 148 If FormatString is not aligned on a 16-bit boundary, then ASSERT(). 149 150 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is 151 unmodified and 0 is returned. 152 If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is 153 unmodified and 0 is returned. 154 If PcdMaximumUnicodeStringLength is not zero, and BufferSize > 155 (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output 156 buffer is unmodified and 0 is returned. 140 157 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than 141 158 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then 142 ASSERT(). 143 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string 144 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the 145 Null-terminator, then ASSERT(). 159 ASSERT(). Also, the output buffer is unmodified and 0 is returned. 160 161 If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned. 146 162 147 163 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated … … 176 192 /** 177 193 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated 178 ASCII format string and a VA_LIST argument list 194 ASCII format string and a VA_LIST argument list. 195 196 This function is similar as vsnprintf_s defined in C11. 179 197 180 198 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer … … 185 203 The number of Unicode characters in the produced output buffer is returned not including 186 204 the Null-terminator. 205 206 If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT(). 207 208 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is 209 unmodified and 0 is returned. 210 If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is 211 unmodified and 0 is returned. 212 If PcdMaximumUnicodeStringLength is not zero, and BufferSize > 213 (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output 214 buffer is unmodified and 0 is returned. 215 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than 216 PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then 217 ASSERT(). Also, the output buffer is unmodified and 0 is returned. 218 187 219 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned. 188 189 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().190 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().191 If BufferSize > 1 and FormatString is NULL, then ASSERT().192 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than193 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then194 ASSERT().195 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string196 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the197 Null-terminator, then ASSERT().198 220 199 221 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated … … 222 244 /** 223 245 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated 224 ASCII format string and a BASE_LIST argument list 246 ASCII format string and a BASE_LIST argument list. 225 247 226 248 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer … … 231 253 The number of Unicode characters in the produced output buffer is returned not including 232 254 the Null-terminator. 255 256 If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT(). 257 258 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is 259 unmodified and 0 is returned. 260 If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is 261 unmodified and 0 is returned. 262 If PcdMaximumUnicodeStringLength is not zero, and BufferSize > 263 (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output 264 buffer is unmodified and 0 is returned. 265 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than 266 PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then 267 ASSERT(). Also, the output buffer is unmodified and 0 is returned. 268 233 269 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned. 234 235 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().236 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().237 If BufferSize > 1 and FormatString is NULL, then ASSERT().238 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than239 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then240 ASSERT().241 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string242 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the243 Null-terminator, then ASSERT().244 270 245 271 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated … … 270 296 ASCII format string and variable argument list. 271 297 298 This function is similar as snprintf_s defined in C11. 299 272 300 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer 273 301 and BufferSize. … … 277 305 The number of Unicode characters in the produced output buffer is returned not including 278 306 the Null-terminator. 307 308 If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT(). 309 310 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is 311 unmodified and 0 is returned. 312 If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is 313 unmodified and 0 is returned. 314 If PcdMaximumUnicodeStringLength is not zero, and BufferSize > 315 (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output 316 buffer is unmodified and 0 is returned. 317 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than 318 PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then 319 ASSERT(). Also, the output buffer is unmodified and 0 is returned. 320 279 321 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned. 280 281 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().282 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().283 If BufferSize > 1 and FormatString is NULL, then ASSERT().284 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than285 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then286 ASSERT().287 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string288 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the289 Null-terminator, then ASSERT().290 322 291 323 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated … … 318 350 } 319 351 320 /** 352 #ifndef DISABLE_NEW_DEPRECATED_INTERFACES 353 354 /** 355 [ATTENTION] This function is deprecated for security reason. 356 321 357 Converts a decimal value to a Null-terminated Unicode string. 322 358 … … 372 408 } 373 409 410 #endif 411 412 /** 413 Converts a decimal value to a Null-terminated Unicode string. 414 415 Converts the decimal number specified by Value to a Null-terminated Unicode 416 string specified by Buffer containing at most Width characters. No padding of 417 spaces is ever performed. If Width is 0 then a width of 418 MAXIMUM_VALUE_CHARACTERS is assumed. If the conversion contains more than 419 Width characters, then only the first Width characters are placed in Buffer. 420 Additional conversion parameters are specified in Flags. 421 422 The Flags bit LEFT_JUSTIFY is always ignored. 423 All conversions are left justified in Buffer. 424 If Width is 0, PREFIX_ZERO is ignored in Flags. 425 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and 426 commas are inserted every 3rd digit starting from the right. 427 If RADIX_HEX is set in Flags, then the output buffer will be formatted in 428 hexadecimal format. 429 If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in 430 Buffer is a '-'. 431 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, then 432 Buffer is padded with '0' characters so the combination of the optional '-' 433 sign character, '0' characters, digit characters for Value, and the 434 Null-terminator add up to Width characters. 435 436 If Buffer is not aligned on a 16-bit boundary, then ASSERT(). 437 If an error would be returned, then the function will also ASSERT(). 438 439 @param Buffer The pointer to the output buffer for the produced 440 Null-terminated Unicode string. 441 @param BufferSize The size of Buffer in bytes, including the 442 Null-terminator. 443 @param Flags The bitmask of flags that specify left justification, 444 zero pad, and commas. 445 @param Value The 64-bit signed value to convert to a string. 446 @param Width The maximum number of Unicode characters to place in 447 Buffer, not including the Null-terminator. 448 449 @retval RETURN_SUCCESS The decimal value is converted. 450 @retval RETURN_BUFFER_TOO_SMALL If BufferSize cannot hold the converted 451 value. 452 @retval RETURN_INVALID_PARAMETER If Buffer is NULL. 453 If PcdMaximumUnicodeStringLength is not 454 zero, and BufferSize is greater than 455 (PcdMaximumUnicodeStringLength * 456 sizeof (CHAR16) + 1). 457 If unsupported bits are set in Flags. 458 If both COMMA_TYPE and RADIX_HEX are set in 459 Flags. 460 If Width >= MAXIMUM_VALUE_CHARACTERS. 461 462 **/ 463 RETURN_STATUS 464 EFIAPI 465 UnicodeValueToStringS ( 466 IN OUT CHAR16 *Buffer, 467 IN UINTN BufferSize, 468 IN UINTN Flags, 469 IN INT64 Value, 470 IN UINTN Width 471 ) 472 { 473 ASSERT_UNICODE_BUFFER(Buffer); 474 return BasePrintLibConvertValueToStringS ((CHAR8 *)Buffer, BufferSize, Flags, Value, Width, 2); 475 } 476 374 477 /** 375 478 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated 376 479 ASCII format string and a VA_LIST argument list. 480 481 This function is similar as vsnprintf_s defined in C11. 377 482 378 483 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer … … 383 488 The number of ASCII characters in the produced output buffer is returned not including 384 489 the Null-terminator. 490 491 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is 492 unmodified and 0 is returned. 493 If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is 494 unmodified and 0 is returned. 495 If PcdMaximumAsciiStringLength is not zero, and BufferSize > 496 (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer 497 is unmodified and 0 is returned. 498 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than 499 PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then 500 ASSERT(). Also, the output buffer is unmodified and 0 is returned. 501 385 502 If BufferSize is 0, then no output buffer is produced and 0 is returned. 386 387 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().388 If BufferSize > 0 and FormatString is NULL, then ASSERT().389 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than390 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then391 ASSERT().392 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string393 contains more than PcdMaximumAsciiStringLength ASCII characters not including the394 Null-terminator, then ASSERT().395 503 396 504 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated … … 427 535 The number of ASCII characters in the produced output buffer is returned not including 428 536 the Null-terminator. 537 538 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is 539 unmodified and 0 is returned. 540 If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is 541 unmodified and 0 is returned. 542 If PcdMaximumAsciiStringLength is not zero, and BufferSize > 543 (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer 544 is unmodified and 0 is returned. 545 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than 546 PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then 547 ASSERT(). Also, the output buffer is unmodified and 0 is returned. 548 429 549 If BufferSize is 0, then no output buffer is produced and 0 is returned. 430 431 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().432 If BufferSize > 0 and FormatString is NULL, then ASSERT().433 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than434 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then435 ASSERT().436 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string437 contains more than PcdMaximumAsciiStringLength ASCII characters not including the438 Null-terminator, then ASSERT().439 550 440 551 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated … … 464 575 ASCII format string and variable argument list. 465 576 577 This function is similar as snprintf_s defined in C11. 578 466 579 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer 467 580 and BufferSize. … … 471 584 The number of ASCII characters in the produced output buffer is returned not including 472 585 the Null-terminator. 586 587 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is 588 unmodified and 0 is returned. 589 If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is 590 unmodified and 0 is returned. 591 If PcdMaximumAsciiStringLength is not zero, and BufferSize > 592 (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer 593 is unmodified and 0 is returned. 594 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than 595 PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then 596 ASSERT(). Also, the output buffer is unmodified and 0 is returned. 597 473 598 If BufferSize is 0, then no output buffer is produced and 0 is returned. 474 475 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().476 If BufferSize > 0 and FormatString is NULL, then ASSERT().477 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than478 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then479 ASSERT().480 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string481 contains more than PcdMaximumAsciiStringLength ASCII characters not including the482 Null-terminator, then ASSERT().483 599 484 600 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated … … 515 631 Unicode format string and a VA_LIST argument list. 516 632 633 This function is similar as vsnprintf_s defined in C11. 634 517 635 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer 518 636 and BufferSize. … … 522 640 The number of ASCII characters in the produced output buffer is returned not including 523 641 the Null-terminator. 524 If BufferSize is 0, then no output buffer is produced and 0 is returned. 525 526 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). 527 If BufferSize > 0 and FormatString is NULL, then ASSERT(). 528 If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT(). 642 643 If FormatString is not aligned on a 16-bit boundary, then ASSERT(). 644 645 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is 646 unmodified and 0 is returned. 647 If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is 648 unmodified and 0 is returned. 649 If PcdMaximumAsciiStringLength is not zero, and BufferSize > 650 (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer 651 is unmodified and 0 is returned. 529 652 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than 530 653 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then 531 ASSERT(). 532 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string 533 contains more than PcdMaximumAsciiStringLength ASCII characters not including the 534 Null-terminator, then ASSERT(). 654 ASSERT(). Also, the output buffer is unmodified and 0 is returned. 655 656 If BufferSize is 0, then no output buffer is produced and 0 is returned. 535 657 536 658 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated … … 568 690 The number of ASCII characters in the produced output buffer is returned not including 569 691 the Null-terminator. 570 If BufferSize is 0, then no output buffer is produced and 0 is returned. 571 572 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). 573 If BufferSize > 0 and FormatString is NULL, then ASSERT(). 574 If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT(). 692 693 If FormatString is not aligned on a 16-bit boundary, then ASSERT(). 694 695 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is 696 unmodified and 0 is returned. 697 If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is 698 unmodified and 0 is returned. 699 If PcdMaximumAsciiStringLength is not zero, and BufferSize > 700 (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer 701 is unmodified and 0 is returned. 575 702 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than 576 703 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then 577 ASSERT(). 578 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string 579 contains more than PcdMaximumAsciiStringLength ASCII characters not including the 580 Null-terminator, then ASSERT(). 704 ASSERT(). Also, the output buffer is unmodified and 0 is returned. 705 706 If BufferSize is 0, then no output buffer is produced and 0 is returned. 581 707 582 708 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated … … 607 733 Unicode format string and variable argument list. 608 734 735 This function is similar as snprintf_s defined in C11. 736 609 737 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer 610 738 and BufferSize. … … 614 742 The number of ASCII characters in the produced output buffer is returned not including 615 743 the Null-terminator. 616 If BufferSize is 0, then no output buffer is produced and 0 is returned. 617 618 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). 619 If BufferSize > 0 and FormatString is NULL, then ASSERT(). 620 If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT(). 744 745 If FormatString is not aligned on a 16-bit boundary, then ASSERT(). 746 747 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is 748 unmodified and 0 is returned. 749 If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is 750 unmodified and 0 is returned. 751 If PcdMaximumAsciiStringLength is not zero, and BufferSize > 752 (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer 753 is unmodified and 0 is returned. 621 754 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than 622 755 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then 623 ASSERT(). 624 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string 625 contains more than PcdMaximumAsciiStringLength ASCII characters not including the 626 Null-terminator, then ASSERT(). 756 ASSERT(). Also, the output buffer is unmodified and 0 is returned. 757 758 If BufferSize is 0, then no output buffer is produced and 0 is returned. 627 759 628 760 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated … … 656 788 657 789 658 /** 790 #ifndef DISABLE_NEW_DEPRECATED_INTERFACES 791 792 /** 793 [ATTENTION] This function is deprecated for security reason. 794 659 795 Converts a decimal value to a Null-terminated ASCII string. 660 796 … … 708 844 } 709 845 846 #endif 847 848 /** 849 Converts a decimal value to a Null-terminated Ascii string. 850 851 Converts the decimal number specified by Value to a Null-terminated Ascii 852 string specified by Buffer containing at most Width characters. No padding of 853 spaces is ever performed. If Width is 0 then a width of 854 MAXIMUM_VALUE_CHARACTERS is assumed. If the conversion contains more than 855 Width characters, then only the first Width characters are placed in Buffer. 856 Additional conversion parameters are specified in Flags. 857 858 The Flags bit LEFT_JUSTIFY is always ignored. 859 All conversions are left justified in Buffer. 860 If Width is 0, PREFIX_ZERO is ignored in Flags. 861 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and 862 commas are inserted every 3rd digit starting from the right. 863 If RADIX_HEX is set in Flags, then the output buffer will be formatted in 864 hexadecimal format. 865 If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in 866 Buffer is a '-'. 867 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, then 868 Buffer is padded with '0' characters so the combination of the optional '-' 869 sign character, '0' characters, digit characters for Value, and the 870 Null-terminator add up to Width characters. 871 872 If an error would be returned, then the function will ASSERT(). 873 874 @param Buffer The pointer to the output buffer for the produced 875 Null-terminated Ascii string. 876 @param BufferSize The size of Buffer in bytes, including the 877 Null-terminator. 878 @param Flags The bitmask of flags that specify left justification, 879 zero pad, and commas. 880 @param Value The 64-bit signed value to convert to a string. 881 @param Width The maximum number of Ascii characters to place in 882 Buffer, not including the Null-terminator. 883 884 @retval RETURN_SUCCESS The decimal value is converted. 885 @retval RETURN_BUFFER_TOO_SMALL If BufferSize cannot hold the converted 886 value. 887 @retval RETURN_INVALID_PARAMETER If Buffer is NULL. 888 If PcdMaximumAsciiStringLength is not 889 zero, and BufferSize is greater than 890 PcdMaximumAsciiStringLength. 891 If unsupported bits are set in Flags. 892 If both COMMA_TYPE and RADIX_HEX are set in 893 Flags. 894 If Width >= MAXIMUM_VALUE_CHARACTERS. 895 896 **/ 897 RETURN_STATUS 898 EFIAPI 899 AsciiValueToStringS ( 900 IN OUT CHAR8 *Buffer, 901 IN UINTN BufferSize, 902 IN UINTN Flags, 903 IN INT64 Value, 904 IN UINTN Width 905 ) 906 { 907 return BasePrintLibConvertValueToStringS (Buffer, BufferSize, Flags, Value, Width, 1); 908 } 909 710 910 /** 711 911 Returns the number of characters that would be produced by if the formatted 712 912 output were produced not including the Null-terminator. 713 913 714 If FormatString is NULL, then ASSERT().715 914 If FormatString is not aligned on a 16-bit boundary, then ASSERT(). 915 916 If FormatString is NULL, then ASSERT() and 0 is returned. 917 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more 918 than PcdMaximumUnicodeStringLength Unicode characters not including the 919 Null-terminator, then ASSERT() and 0 is returned. 716 920 717 921 @param[in] FormatString A Null-terminated Unicode format string. … … 728 932 ) 729 933 { 730 ASSERT(FormatString != NULL);731 934 ASSERT_UNICODE_BUFFER (FormatString); 732 935 return BasePrintLibSPrintMarker (NULL, 0, FORMAT_UNICODE | OUTPUT_UNICODE | COUNT_ONLY_NO_PRINT, (CHAR8 *)FormatString, Marker, NULL); … … 737 940 output were produced not including the Null-terminator. 738 941 739 If FormatString is NULL, then ASSERT(). 942 If FormatString is NULL, then ASSERT() and 0 is returned. 943 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more 944 than PcdMaximumAsciiStringLength Ascii characters not including the 945 Null-terminator, then ASSERT() and 0 is returned. 740 946 741 947 @param[in] FormatString A Null-terminated ASCII format string. … … 752 958 ) 753 959 { 754 ASSERT(FormatString != NULL);755 960 return BasePrintLibSPrintMarker (NULL, 0, OUTPUT_UNICODE | COUNT_ONLY_NO_PRINT, (CHAR8 *)FormatString, Marker, NULL); 756 961 }
Note:
See TracChangeset
for help on using the changeset viewer.