VirtualBox

Changeset 84286 in vbox for trunk/include/iprt


Ignore:
Timestamp:
May 13, 2020 1:58:21 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
137923
Message:

IPRT/base64: Added UTF-16 versions of the encoding functions. bugref:9224

Location:
trunk/include/iprt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/base64.h

    r84210 r84286  
    143143 * data produced by RTBase64Encode().
    144144 *
    145  * @returns The Base64 string length.
     145 * @returns The Base64 string length, excluding the terminator.
    146146 * @param   cbData      The number of bytes to encode.
    147147 */
    148148RTDECL(size_t) RTBase64EncodedLength(size_t cbData);
     149
     150/**
     151 * Calculates the UTF-16 length of the Base64 encoding of a given number of
     152 * bytes of data produced by RTBase64EncodeUtf16().
     153 *
     154 * @returns The Base64 UTF-16 string length (in RTUTF16 units), excluding the
     155 *          terminator.
     156 * @param   cbData      The number of bytes to encode.
     157 */
     158RTDECL(size_t) RTBase64EncodedUtf16Length(size_t cbData);
    149159
    150160/**
     
    152162 * data produced by RTBase64EncodeEx() with the same @a fFlags.
    153163 *
    154  * @returns The Base64 string length.
     164 * @returns The Base64 string length, excluding the terminator.
    155165 * @param   cbData      The number of bytes to encode.
    156166 * @param   fFlags      Flags, any combination of the RTBASE64_FLAGS \#defines.
    157167 */
    158168RTDECL(size_t) RTBase64EncodedLengthEx(size_t cbData, uint32_t fFlags);
     169
     170/**
     171 * Calculates the UTF-16 length of the Base64 encoding of a given number of
     172 * bytes of data produced by RTBase64EncodeUtf16Ex() with the same @a fFlags.
     173 *
     174 * @returns The Base64 UTF-16 string length (in RTUTF16 units), excluding the
     175 *          terminator.
     176 * @param   cbData      The number of bytes to encode.
     177 * @param   fFlags      Flags, any combination of the RTBASE64_FLAGS \#defines.
     178 */
     179RTDECL(size_t) RTBase64EncodedUtf16LengthEx(size_t cbData, uint32_t fFlags);
    159180
    160181/**
     
    177198
    178199/**
     200 * Encodes the specifed data into a Base64 UTF-16 string, the caller supplies
     201 * the output buffer.
     202 *
     203 * This is equivalent to calling RTBase64EncodeUtf16Ex() with no flags.
     204 *
     205 * @returns IRPT status code.
     206 * @retval  VERR_BUFFER_OVERFLOW if the output buffer is too small. The buffer
     207 *          may contain an invalid Base64 string.
     208 *
     209 * @param   pvData      The data to encode.
     210 * @param   cbData      The number of bytes to encode.
     211 * @param   pwszBuf     Where to put the Base64 UTF-16 string.
     212 * @param   cwcBuf      The size of the output buffer in RTUTF16 units,
     213 *                      including the terminator.
     214 * @param   pcwcActual  The actual number of characters returned (excluding the
     215 *                      terminator).  Optional.
     216 */
     217RTDECL(int) RTBase64EncodeUtf16(const void *pvData, size_t cbData, PRTUTF16 pwszBuf, size_t cwcBuf, size_t *pcwcActual);
     218
     219/**
    179220 * Encodes the specifed data into a Base64 string, the caller supplies the
    180221 * output buffer.
     
    189230 * @param   pszBuf      Where to put the Base64 string.
    190231 * @param   cbBuf       The size of the output buffer, including the terminator.
    191  * @param   pcchActual  The actual number of characters returned.
     232 * @param   pcchActual  The actual number of characters returned (excluding the
     233 *                      terminator).  Optional.
    192234 */
    193235RTDECL(int) RTBase64EncodeEx(const void *pvData, size_t cbData, uint32_t fFlags,
    194236                             char *pszBuf, size_t cbBuf, size_t *pcchActual);
    195237
     238/**
     239 * Encodes the specifed data into a Base64 UTF-16 string, the caller supplies
     240 * the output buffer.
     241 *
     242 * @returns IRPT status code.
     243 * @retval  VERR_BUFFER_OVERFLOW if the output buffer is too small. The buffer
     244 *          may contain an invalid Base64 string.
     245 *
     246 * @param   pvData      The data to encode.
     247 * @param   cbData      The number of bytes to encode.
     248 * @param   fFlags      Flags, any combination of the RTBASE64_FLAGS \#defines.
     249 * @param   pwszBuf     Where to put the Base64 UTF-16 string.
     250 * @param   cwcBuf      The size of the output buffer in RTUTF16 units,
     251 *                      including the terminator.
     252 * @param   pcwcActual  The actual number of characters returned (excluding the
     253 *                      terminator).  Optional.
     254 */
     255RTDECL(int) RTBase64EncodeUtf16Ex(const void *pvData, size_t cbData, uint32_t fFlags,
     256                                  PRTUTF16 pwszBuf, size_t cwcBuf, size_t *pcwcActual);
     257
     258
    196259/** @}  */
    197260
  • trunk/include/iprt/mangling.h

    r84248 r84286  
    581581# define RTBase64EncodedLength                          RT_MANGLER(RTBase64EncodedLength)
    582582# define RTBase64EncodedLengthEx                        RT_MANGLER(RTBase64EncodedLengthEx)
     583# define RTBase64EncodeUtf16                            RT_MANGLER(RTBase64EncodeUtf16)
     584# define RTBase64EncodeUtf16Ex                          RT_MANGLER(RTBase64EncodeUtf16Ex)
     585# define RTBase64EncodedUtf16Length                     RT_MANGLER(RTBase64EncodedUtf16Length)
     586# define RTBase64EncodedUtf16LengthEx                   RT_MANGLER(RTBase64EncodedUtf16LengthEx)
    583587# define RTBldCfgCompiler                               RT_MANGLER(RTBldCfgCompiler)
    584588# define RTBldCfgRevision                               RT_MANGLER(RTBldCfgRevision)
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