diff options
author | unknown <pem@mysql.com> | 2005-10-25 11:30:43 +0200 |
---|---|---|
committer | unknown <pem@mysql.com> | 2005-10-25 11:30:43 +0200 |
commit | 10a889a577e1a09f29922ba20d7e8ad96449bb04 (patch) | |
tree | 659aa4e966702f217364f229865e29e710758a31 /mysys/base64.c | |
parent | 6416abfddb1f5833e92db9dbc619f61877b7ccf6 (diff) | |
download | mariadb-git-10a889a577e1a09f29922ba20d7e8ad96449bb04.tar.gz |
Converted mysys/base64.c into C code (not C++).
mysys/base64.c:
Converted into C code (not C++).
Diffstat (limited to 'mysys/base64.c')
-rw-r--r-- | mysys/base64.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/mysys/base64.c b/mysys/base64.c index 7dcca6f14ac..0fcd6f096f5 100644 --- a/mysys/base64.c +++ b/mysys/base64.c @@ -56,13 +56,14 @@ base64_encode(const void *src, size_t src_len, char *dst) for (; i < src_len; len += 4) { + unsigned c; + if (len == 76) { len= 0; *dst++= '\n'; } - unsigned c; c= s[i++]; c <<= 8; @@ -216,6 +217,8 @@ main(void) char * src= (char *) malloc(src_len); char * s= src; + char * str; + char * dst; for (j= 0; j<src_len; j++) { @@ -224,11 +227,11 @@ main(void) } /* Encode */ - char * str= (char *) malloc(base64_needed_encoded_length(src_len)); + str= (char *) malloc(base64_needed_encoded_length(src_len)); require(base64_encode(src, src_len, str) == 0); /* Decode */ - char * dst= (char *) malloc(base64_needed_decoded_length(strlen(str))); + dst= (char *) malloc(base64_needed_decoded_length(strlen(str))); dst_len= base64_decode(str, strlen(str), dst); require(dst_len == src_len); |