diff options
author | pixel <pixel> | 2007-06-11 11:25:36 +0000 |
---|---|---|
committer | pixel <pixel> | 2007-06-11 11:25:36 +0000 |
commit | 336cf502704b586f4f516f2d756e175ffa98a57a (patch) | |
tree | d8b8630f9b695ccc7fe90c482f19172305632317 /lib | |
parent | 9b1bb634aea47414793c41cf7be5e2c285de96a9 (diff) |
Fixing base64 a bit - definition troubles, and padding.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Base64.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Base64.cc b/lib/Base64.cc index c9b7daf..6c16f47 100644 --- a/lib/Base64.cc +++ b/lib/Base64.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: Base64.cc,v 1.2 2007-05-30 11:57:09 pixel Exp $ */ +/* $Id: Base64.cc,v 1.3 2007-06-11 11:25:36 pixel Exp $ */ #include <Base64.h> @@ -35,7 +35,7 @@ String Base64::encode_block(unsigned char in_tab[3], int len) { return r; } -String Base64::encode(char * data, int stream_size) { +String Base64::encode(const char * data, int stream_size) { String encoded = ""; unsigned char in_tab[3]; int len, i, s_pos; @@ -90,7 +90,7 @@ unsigned char * Base64::decode(const String & str_in, int * len_out) { int s_len = str_in.strlen() / 4, len = 0, i, j, t_len; char s1, s2, s3, s4; unsigned char t_out[2]; - unsigned char * out = (unsigned char *) malloc(s_len * 3); + unsigned char * out = (unsigned char *) malloc(s_len * 3 + 1); for (i = 0; i < s_len; i++) { s1 = str_in[i * 4 + 0]; |