123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417 |
- #ifndef B64_INCL_B64_H_B64
- #define B64_INCL_B64_H_B64
- #ifndef B64_DOCUMENTATION_SKIP_SECTION
- # define B64_VER_B64_H_B64_MAJOR 1
- # define B64_VER_B64_H_B64_MINOR 5
- # define B64_VER_B64_H_B64_REVISION 1
- # define B64_VER_B64_H_B64_EDIT 25
- #endif
- #ifndef B64_DOCUMENTATION_SKIP_SECTION
- # define B64_VER_1_0_1 0x01000100
- # define B64_VER_1_0_2 0x01000200
- # define B64_VER_1_0_3 0x01000300
- # define B64_VER_1_1_1 0x01010100
- # define B64_VER_1_1_2 0x01010200
- # define B64_VER_1_1_3 0x01010300
- # define B64_VER_1_2_1 0x01020100
- # define B64_VER_1_2_2 0x01020200
- # define B64_VER_1_2_3 0x01020300
- # define B64_VER_1_2_4 0x01020400
- # define B64_VER_1_2_5 0x01020500
- # define B64_VER_1_2_6 0x01020600
- # define B64_VER_1_2_7 0x01020700
- # define B64_VER_1_3_1 0x010301ff
- # define B64_VER B64_VER_1_3_1
- #else
- # define B64_VER 0x010301ff
- #endif
- #define B64_VER_MAJOR 1
- #define B64_VER_MINOR 3
- #define B64_VER_REVISION 1
- #include <stddef.h>
- #if !defined(B64_NO_NAMESPACE) && \
- !defined(__cplusplus)
- # define B64_NO_NAMESPACE
- #endif
- #ifdef B64_NAMESPACE
- # undef B64_NAMESPACE
- #endif
- #ifdef B64_NAMESPACE_QUALIFIER
- # undef B64_NAMESPACE_QUALIFIER
- #endif
- #ifndef B64_NO_NAMESPACE
- # ifdef B64_CUSTOM_NAMESPACE
- # define B64_NAMESPACE B64_CUSTOM_NAMESPACE
- # else
- # define B64_NAMESPACE b64
- # endif
- # if defined(B64_CUSTOM_NAMESPACE) && \
- defined(B64_CUSTOM_NAMESPACE_QUALIFIER)
- # define B64_NAMESPACE_QUALIFIER B64_CUSTOM_NAMESPACE_QUALIFIER
- # else
- # define B64_NAMESPACE_QUALIFIER ::B64_NAMESPACE
- # endif
- namespace B64_NAMESPACE
- {
- #endif
- enum B64_RC
- {
- B64_RC_OK = 0
- , B64_RC_INSUFFICIENT_BUFFER = 1
- , B64_RC_TRUNCATED_INPUT = 2
- , B64_RC_DATA_ERROR = 3
- #ifndef B64_DOCUMENTATION_SKIP_SECTION
- , B64_max_RC_value
- #endif
- };
- #ifndef __cplusplus
- typedef enum B64_RC B64_RC;
- #endif
- enum B64_FLAGS
- {
- B64_F_LINE_LEN_USE_PARAM = 0x0000
- , B64_F_LINE_LEN_INFINITE = 0x0001
- , B64_F_LINE_LEN_64 = 0x0002
- , B64_F_LINE_LEN_76 = 0x0003
- , B64_F_LINE_LEN_MASK = 0x000f
- , B64_F_STOP_ON_NOTHING = 0x0000
- , B64_F_STOP_ON_UNKNOWN_CHAR = 0x0100
- , B64_F_STOP_ON_UNEXPECTED_WS = 0x0200
- , B64_F_STOP_ON_BAD_CHAR = 0x0300
- };
- #ifndef __cplusplus
- typedef enum B64_FLAGS B64_FLAGS;
- #endif
- #ifdef __cplusplus
- extern "C" {
- #endif
- size_t b64_encode(void const *src, size_t srcSize, char *dest, size_t destLen);
- size_t b64_encode2( void const *src
- , size_t srcSize
- , char *dest
- , size_t destLen
- , unsigned flags
- , int lineLen
- , B64_RC *rc );
- size_t b64_decode(char const *src, size_t srcLen, void *dest, size_t destSize);
- size_t b64_decode2( char const *src
- , size_t srcLen
- , void *dest
- , size_t destSize
- , unsigned flags
- , char const **badChar
- , B64_RC *rc );
- char const *b64_getErrorString(B64_RC code);
- size_t b64_getErrorStringLength(B64_RC code);
- #ifdef __cplusplus
- }
- #endif
- #ifndef B64_NO_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);
- }
- }
- # endif
- #endif
- #endif
|