VirtualBox

Ignore:
Timestamp:
Mar 12, 2019 12:40:12 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
129295
Message:

EFI: First step in UDK2018 merge. Does not build yet.

Location:
trunk/src/VBox/Devices/EFI/FirmwareNew
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/FirmwareNew

  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BasePrintLib/PrintLib.c

    r58466 r77662  
    22  Base Print Library instance implementation.
    33
    4   Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
     4  Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
    55  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
    66  This program and the accompanying materials
     
    2828/**
    2929  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.
    3133
    3234  Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
     
    3739  The number of Unicode characters in the produced output buffer is returned not including
    3840  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.
    4552  If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
    4653  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.
    5157
    5258  @param  StartOfBuffer   A pointer to the output buffer for the produced Null-terminated
     
    7682/**
    7783  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.
    7985
    8086  Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
     
    8591  The number of Unicode characters in the produced output buffer is returned not including
    8692  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.
    93104  If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
    94105  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.
    99109
    100110  @param  StartOfBuffer   A pointer to the output buffer for the produced Null-terminated
     
    126136  Unicode format string and variable argument list.
    127137
     138  This function is similar as snprintf_s defined in C11.
     139
    128140  Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
    129141  and BufferSize.
     
    132144  The number of Unicode characters in the produced output buffer is returned not including
    133145  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.
    140157  If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
    141158  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.
    146162
    147163  @param  StartOfBuffer   A pointer to the output buffer for the produced Null-terminated
     
    176192/**
    177193  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.
    179197
    180198  Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
     
    185203  The number of Unicode characters in the produced output buffer is returned not including
    186204  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
    187219  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 than
    193   PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
    194   ASSERT().
    195   If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
    196   contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
    197   Null-terminator, then ASSERT().
    198220
    199221  @param  StartOfBuffer   A pointer to the output buffer for the produced Null-terminated
     
    222244/**
    223245  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.
    225247
    226248  Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
     
    231253  The number of Unicode characters in the produced output buffer is returned not including
    232254  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
    233269  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 than
    239   PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
    240   ASSERT().
    241   If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
    242   contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
    243   Null-terminator, then ASSERT().
    244270
    245271  @param  StartOfBuffer   A pointer to the output buffer for the produced Null-terminated
     
    270296  ASCII format string and  variable argument list.
    271297
     298  This function is similar as snprintf_s defined in C11.
     299
    272300  Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
    273301  and BufferSize.
     
    277305  The number of Unicode characters in the produced output buffer is returned not including
    278306  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
    279321  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 than
    285   PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
    286   ASSERT().
    287   If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
    288   contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
    289   Null-terminator, then ASSERT().
    290322
    291323  @param  StartOfBuffer   A pointer to the output buffer for the produced Null-terminated
     
    318350}
    319351
    320 /**
     352#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
     353
     354/**
     355  [ATTENTION] This function is deprecated for security reason.
     356
    321357  Converts a decimal value to a Null-terminated Unicode string.
    322358
     
    372408}
    373409
     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**/
     463RETURN_STATUS
     464EFIAPI
     465UnicodeValueToStringS (
     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
    374477/**
    375478  Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
    376479  ASCII format string and a VA_LIST argument list.
     480
     481  This function is similar as vsnprintf_s defined in C11.
    377482
    378483  Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
     
    383488  The number of ASCII characters in the produced output buffer is returned not including
    384489  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
    385502  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 than
    390   PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
    391   ASSERT().
    392   If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
    393   contains more than PcdMaximumAsciiStringLength ASCII characters not including the
    394   Null-terminator, then ASSERT().
    395503
    396504  @param  StartOfBuffer   A pointer to the output buffer for the produced Null-terminated
     
    427535  The number of ASCII characters in the produced output buffer is returned not including
    428536  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
    429549  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 than
    434   PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
    435   ASSERT().
    436   If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
    437   contains more than PcdMaximumAsciiStringLength ASCII characters not including the
    438   Null-terminator, then ASSERT().
    439550
    440551  @param  StartOfBuffer   A pointer to the output buffer for the produced Null-terminated
     
    464575  ASCII format string and  variable argument list.
    465576
     577  This function is similar as snprintf_s defined in C11.
     578
    466579  Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
    467580  and BufferSize.
     
    471584  The number of ASCII characters in the produced output buffer is returned not including
    472585  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
    473598  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 than
    478   PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
    479   ASSERT().
    480   If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
    481   contains more than PcdMaximumAsciiStringLength ASCII characters not including the
    482   Null-terminator, then ASSERT().
    483599
    484600  @param  StartOfBuffer   A pointer to the output buffer for the produced Null-terminated
     
    515631  Unicode format string and a VA_LIST argument list.
    516632
     633  This function is similar as vsnprintf_s defined in C11.
     634
    517635  Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
    518636  and BufferSize.
     
    522640  The number of ASCII characters in the produced output buffer is returned not including
    523641  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.
    529652  If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
    530653  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.
    535657
    536658  @param  StartOfBuffer   A pointer to the output buffer for the produced Null-terminated
     
    568690  The number of ASCII characters in the produced output buffer is returned not including
    569691  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.
    575702  If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
    576703  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.
    581707
    582708  @param  StartOfBuffer   A pointer to the output buffer for the produced Null-terminated
     
    607733  Unicode format string and  variable argument list.
    608734
     735  This function is similar as snprintf_s defined in C11.
     736
    609737  Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
    610738  and BufferSize.
     
    614742  The number of ASCII characters in the produced output buffer is returned not including
    615743  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.
    621754  If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
    622755  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.
    627759
    628760  @param  StartOfBuffer   A pointer to the output buffer for the produced Null-terminated
     
    656788
    657789
    658 /**
     790#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
     791
     792/**
     793  [ATTENTION] This function is deprecated for security reason.
     794
    659795  Converts a decimal value to a Null-terminated ASCII string.
    660796
     
    708844}
    709845
     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**/
     897RETURN_STATUS
     898EFIAPI
     899AsciiValueToStringS (
     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
    710910/**
    711911  Returns the number of characters that would be produced by if the formatted
    712912  output were produced not including the Null-terminator.
    713913
    714   If FormatString is NULL, then ASSERT().
    715914  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.
    716920
    717921  @param[in]  FormatString    A Null-terminated Unicode format string.
     
    728932  )
    729933{
    730   ASSERT(FormatString != NULL);
    731934  ASSERT_UNICODE_BUFFER (FormatString);
    732935  return BasePrintLibSPrintMarker (NULL, 0, FORMAT_UNICODE | OUTPUT_UNICODE | COUNT_ONLY_NO_PRINT, (CHAR8 *)FormatString, Marker, NULL);
     
    737940  output were produced not including the Null-terminator.
    738941
    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.
    740946
    741947  @param[in]  FormatString    A Null-terminated ASCII format string.
     
    752958  )
    753959{
    754   ASSERT(FormatString != NULL);
    755960  return BasePrintLibSPrintMarker (NULL, 0, OUTPUT_UNICODE | COUNT_ONLY_NO_PRINT, (CHAR8 *)FormatString, Marker, NULL);
    756961}
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette