diff options
-rw-r--r-- | include/Base64.h | 4 | ||||
-rw-r--r-- | lib/Base64.cc | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/include/Base64.h b/include/Base64.h index f080ed8..9cfdf12 100644 --- a/include/Base64.h +++ b/include/Base64.h @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: Base64.h,v 1.2 2007-05-30 11:57:08 pixel Exp $ */ +/* $Id: Base64.h,v 1.3 2007-06-11 11:25:36 pixel Exp $ */ #ifndef __BASE64_H__ #define __BASE64_H__ @@ -26,7 +26,7 @@ class Base64 : public Base { public: - static String encode(char * data, int len); + static String encode(const char * data, int len); static unsigned char * decode(const String & str_in, int * len_out); private: 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]; |