VirtualBox

Changeset 84339 in vbox for trunk/include/VBox/com


Ignore:
Timestamp:
May 18, 2020 5:35:01 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
138020
Message:

Glue/Bstr: Added base64DecodedLength and base64Decode methods too. Put the implementation in a separate file for extpack and others who don't really need this code. bugref:9224

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/com/string.h

    r84287 r84339  
    664664     * @{ */
    665665    /**
    666      * Encodes the give data as BASE64.
     666     * Encodes the given data as BASE64.
    667667     *
    668668     * @returns S_OK or E_OUTOFMEMORY.
     
    671671     * @param   fLineBreaks     Whether to add line breaks (true) or just encode it
    672672     *                          as a continuous string.
     673     * @sa RTBase64EncodeUtf16
    673674     */
    674675    HRESULT base64Encode(const void *pvData, size_t cbData, bool fLineBreaks = false);
     676
     677    /**
     678     * Decodes the string as BASE64.
     679     *
     680     * @returns IPRT status code, see RTBase64DecodeUtf16Ex.
     681     * @param   pvData          Where to return the decoded bytes.
     682     * @param   cbData          Size of the @a pvData return buffer.
     683     * @param   pcbActual       Where to return number of bytes actually decoded.
     684     *                          This is optional and if not specified, the request
     685     *                          will fail unless @a cbData matches the data size
     686     *                          exactly.
     687     * @param   ppwszEnd        Where to return pointer to the first non-base64
     688     *                          character following the encoded data.  This is
     689     *                          optional and if NULL, the request will fail if there
     690     *                          are anything trailing the encoded bytes in the
     691     *                          string.
     692     * @sa base64DecodedSize, RTBase64DecodeUtf16
     693     */
     694    int base64Decode(void *pvData, size_t cbData, size_t *pcbActual = NULL, PRTUTF16 *ppwszEnd = NULL);
     695
     696    /**
     697     * Determins the size of the BASE64 encoded data in the string.
     698     *
     699     * @returns The length in bytes. -1 if the encoding is bad.
     700     *
     701     * @param   pwszString      The Base64 encoded UTF-16 string.
     702     * @param   ppwszEnd        If not NULL, this will point to the first char
     703     *                          following the Base64 encoded text block. If
     704     *                          NULL the entire string is assumed to be Base64.
     705     * @sa      base64Decode, RTBase64DecodedUtf16Size
     706     */
     707    ssize_t base64DecodedSize(PRTUTF16 *ppwszEnd = NULL);
    675708    /** @} */
    676709
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