Revision 5118bd44
libavutil/base64.c | ||
---|---|---|
69 | 69 |
* Fixed edge cases and made it work from data (vs. strings) by Ryan. |
70 | 70 |
*****************************************************************************/ |
71 | 71 |
|
72 |
char *av_base64_encode(char *out, int out_size, const uint8_t *in, int size) |
|
72 |
char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size)
|
|
73 | 73 |
{ |
74 | 74 |
static const char b64[] = |
75 | 75 |
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; |
76 | 76 |
char *ret, *dst; |
77 | 77 |
unsigned i_bits = 0; |
78 | 78 |
int i_shift = 0; |
79 |
int bytes_remaining = size; |
|
79 |
int bytes_remaining = in_size;
|
|
80 | 80 |
|
81 |
if (size >= UINT_MAX / 4 || |
|
82 |
out_size < (size+2) / 3 * 4 + 1) |
|
81 |
if (in_size >= UINT_MAX / 4 ||
|
|
82 |
out_size < (in_size+2) / 3 * 4 + 1)
|
|
83 | 83 |
return NULL; |
84 | 84 |
ret = dst = out; |
85 | 85 |
while (bytes_remaining) { |
libavutil/base64.h | ||
---|---|---|
34 | 34 |
* @param src data, not a string |
35 | 35 |
* @param buf output string |
36 | 36 |
*/ |
37 |
char *av_base64_encode(char *out, int out_size, const uint8_t *in, int size); |
|
37 |
char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size);
|
|
38 | 38 |
|
39 | 39 |
#endif /* AVUTIL_BASE64_H */ |
Also available in: Unified diff