📄 b64.h
字号:
* \param dest Pointer to the buffer into which the result is to be written. May
* be NULL, in which case the function returns the required length
* \param destLen Length of the buffer into which the result is to be written. Must
* be at least as large as that indicated by the return value from
* \link b64::b64_encode b64_encode(NULL, srcSize, NULL, 0)\endlink.
*
* \return 0 if the size of the buffer was insufficient, or the length of the
* converted buffer was longer than \c destLen
*
* \note The function returns the required length if \c dest is NULL
*
* \note The function returns the required length if \c dest is NULL. The returned size
* might be larger than the actual required size, but will never be smaller.
*
* \note Threading: The function is fully re-entrant.
*
* \see b64::encode()
*/
size_t b64_encode(void const *src, size_t srcSize, char *dest, size_t destLen);
/** \brief Encodes a block of binary data into Base-64
*
* \param src Pointer to the block to be encoded. May not be NULL, except when
* \c dest is NULL, in which case it is ignored.
* \param srcSize Length of block to be encoded
* \param dest Pointer to the buffer into which the result is to be written. May
* be NULL, in which case the function returns the required length
* \param destLen Length of the buffer into which the result is to be written. Must
* be at least as large as that indicated by the return value from
* \link b64::b64_encode2 b64_encode2(NULL, srcSize, NULL, 0, flags, lineLen, rc)\endlink.
* \param flags A combination of the B64_FLAGS enumeration, that moderate the
* behaviour of the function
* \param lineLen If the flags parameter contains B64_F_LINE_LEN_USE_PARAM, then
* this parameter represents the length of the lines into which the encoded form is split,
* with a hard line break ('\\r\\n'). If this value is 0, then the line is not
* split. If it is <0, then the RFC-1113 recommended line length of 64 is used
* \param rc The return code representing the status of the operation. May be NULL.
*
* \return 0 if the size of the buffer was insufficient, or the length of the
* converted buffer was longer than \c destLen
*
* \note The function returns the required length if \c dest is NULL. The returned size
* might be larger than the actual required size, but will never be smaller.
*
* \note Threading: The function is fully re-entrant.
*
* \see b64::encode()
*/
size_t b64_encode2( void const *src
, size_t srcSize
, char *dest
, size_t destLen
, unsigned flags
, int lineLen /* = 0 */
, B64_RC *rc /* = NULL */);
/** \brief Decodes a sequence of Base-64 into a block of binary data
*
* \param src Pointer to the Base-64 block to be decoded. May not be NULL, except when
* \c dest is NULL, in which case it is ignored. If \c dest is NULL, and \c src is
* <b>not</b> NULL, then the returned value is calculated exactly, otherwise a value
* is returned that is guaranteed to be large enough to hold the decoded block.
*
* \param srcLen Length of block to be encoded. Must be an integral of 4, the Base-64
* encoding quantum, otherwise the Base-64 block is assumed to be invalid
* \param dest Pointer to the buffer into which the result is to be written. May
* be NULL, in which case the function returns the required length
* \param destSize Length of the buffer into which the result is to be written. Must
* be at least as large as that indicated by the return value from
* \c b64_decode(src, srcSize, NULL, 0), even in the case where the encoded form
* contains a number of characters that will be ignored, resulting in a lower total
* length of converted form.
*
* \return 0 if the size of the buffer was insufficient, or the length of the
* converted buffer was longer than \c destSize
*
* \note The function returns the required length if \c dest is NULL. The returned size
* might be larger than the actual required size, but will never be smaller.
*
* \note \anchor anchor__4_characters The behaviour of both
* \link b64::b64_encode2 b64_encode2()\endlink
* and
* \link b64::b64_decode2 b64_decode2()\endlink
* are undefined if the line length is not a multiple of 4.
*
* \note Threading: The function is fully re-entrant.
*
* \see b64::decode()
*/
size_t b64_decode(char const *src, size_t srcLen, void *dest, size_t destSize);
/** \brief Decodes a sequence of Base-64 into a block of binary data
*
* \param src Pointer to the Base-64 block to be decoded. May not be NULL, except when
* \c dest is NULL, in which case it is ignored. If \c dest is NULL, and \c src is
* <b>not</b> NULL, then the returned value is calculated exactly, otherwise a value
* is returned that is guaranteed to be large enough to hold the decoded block.
*
* \param srcLen Length of block to be encoded. Must be an integral of 4, the Base-64
* encoding quantum, otherwise the Base-64 block is assumed to be invalid
* \param dest Pointer to the buffer into which the result is to be written. May
* be NULL, in which case the function returns the required length
* \param destSize Length of the buffer into which the result is to be written. Must
* be at least as large as that indicated by the return value from
* \c b64_decode(src, srcSize, NULL, 0), even in the case where the encoded form
* contains a number of characters that will be ignored, resulting in a lower total
* length of converted form.
* \param flags A combination of the B64_FLAGS enumeration, that moderate the
* behaviour of the function.
* \param rc The return code representing the status of the operation. May be NULL.
* \param badChar If the flags parameter does not contain B64_F_STOP_ON_NOTHING, this
* parameter specifies the address of a pointer that will be set to point to any
* character in the sequence that stops the parsing, as dictated by the flags
* parameter. May be NULL.
*
* \return 0 if the size of the buffer was insufficient, or the length of the
* converted buffer was longer than \c destSize, or a bad character stopped parsing.
*
* \note The function returns the required length if \c dest is NULL. The returned size
* might be larger than the actual required size, but will never be smaller.
*
* \note The behaviour of both
* \link b64::b64_encode2 b64_encode2()\endlink
* and
* \link b64::b64_decode2 b64_decode2()\endlink
* are undefined if the line length is not a multiple of 4.
*
* \note Threading: The function is fully re-entrant.
*
* \see b64::decode()
*/
size_t b64_decode2( char const *src
, size_t srcLen
, void *dest
, size_t destSize
, unsigned flags
, char const **badChar /* = NULL */
, B64_RC *rc /* = NULL */);
/** \brief Returns the textual description of the error
*
* \param code The \link b64::B64_RC error code\endlink
*/
char const *b64_getErrorString(B64_RC code);
/** \brief Returns the length of the textual description of the error
*
* \see b64_getErrorString()
*
* \param code The \link b64::B64_RC error code\endlink
*/
size_t b64_getErrorStringLength(B64_RC code);
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
/* /////////////////////////////////////////////////////////////////////////////
* Namespace
*/
#ifndef B64_NO_NAMESPACE
} /* namespace B64_NAMESPACE */
# ifndef B64_DOCUMENTATION_SKIP_SECTION
namespace stlsoft
{
inline char const *c_str_data_a( B64_NAMESPACE_QUALIFIER::B64_RC code)
{
return B64_NAMESPACE_QUALIFIER::b64_getErrorString(code);
}
inline char const *c_str_data( B64_NAMESPACE_QUALIFIER::B64_RC code)
{
return B64_NAMESPACE_QUALIFIER::b64_getErrorString(code);
}
inline size_t c_str_len_a( B64_NAMESPACE_QUALIFIER::B64_RC code)
{
return B64_NAMESPACE_QUALIFIER::b64_getErrorStringLength(code);
}
inline size_t c_str_len( B64_NAMESPACE_QUALIFIER::B64_RC code)
{
return B64_NAMESPACE_QUALIFIER::b64_getErrorStringLength(code);
}
inline char const *c_str_ptr_a( B64_NAMESPACE_QUALIFIER::B64_RC code)
{
return B64_NAMESPACE_QUALIFIER::b64_getErrorString(code);
}
inline char const *c_str_ptr( B64_NAMESPACE_QUALIFIER::B64_RC code)
{
return B64_NAMESPACE_QUALIFIER::b64_getErrorString(code);
}
} /* namespace stlsoft */
# endif /* !B64_DOCUMENTATION_SKIP_SECTION */
#endif /* !B64_NO_NAMESPACE */
/* ////////////////////////////////////////////////////////////////////////// */
#endif /* B64_INCL_B64_H_B64 */
/* ////////////////////////////////////////////////////////////////////////// */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -