aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-mime-utils.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-10-31 00:58:53 +0800
committerDan Winship <danw@src.gnome.org>2000-10-31 00:58:53 +0800
commitabe39be1720a9ae3fd3402a5a8b777473319fbdb (patch)
tree1c421910915f0c083e8a7d51488af68564ef5342 /camel/camel-mime-utils.c
parent45915f89e2279d67b0bf29ce3126cd4dabd61f9f (diff)
downloadgsoc2013-evolution-abe39be1720a9ae3fd3402a5a8b777473319fbdb.tar.gz
gsoc2013-evolution-abe39be1720a9ae3fd3402a5a8b777473319fbdb.tar.zst
gsoc2013-evolution-abe39be1720a9ae3fd3402a5a8b777473319fbdb.zip
Take an additional argument, "break_lines", saying whether or not to add
* camel-mime-utils.c (base64_encode_step, base64_encode_close): Take an additional argument, "break_lines", saying whether or not to add '\n's to the output. * camel-multipart.c (set_boundary): * camel-mime-filter-basic.c (filter, complete): Update for base64 api change. svn path=/trunk/; revision=6271
Diffstat (limited to 'camel/camel-mime-utils.c')
-rw-r--r--camel/camel-mime-utils.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c
index 8b6194763d..cc5fa813dd 100644
--- a/camel/camel-mime-utils.c
+++ b/camel/camel-mime-utils.c
@@ -273,13 +273,13 @@ int main(int argc, char **argv)
/* call this when finished encoding everything, to
flush off the last little bit */
int
-base64_encode_close(unsigned char *in, int inlen, unsigned char *out, int *state, int *save)
+base64_encode_close(unsigned char *in, int inlen, gboolean break_lines, unsigned char *out, int *state, int *save)
{
int c1, c2;
unsigned char *outptr = out;
if (inlen>0)
- outptr += base64_encode_step(in, inlen, outptr, state, save);
+ outptr += base64_encode_step(in, inlen, break_lines, outptr, state, save);
c1 = ((char *)save)[1];
c2 = ((char *)save)[2];
@@ -297,7 +297,8 @@ base64_encode_close(unsigned char *in, int inlen, unsigned char *out, int *state
outptr += 4;
break;
}
- *outptr++ = '\n';
+ if (break_lines)
+ *outptr++ = '\n';
*save = 0;
*state = 0;
@@ -311,7 +312,7 @@ base64_encode_close(unsigned char *in, int inlen, unsigned char *out, int *state
0 on first invocation).
*/
int
-base64_encode_step(unsigned char *in, int len, unsigned char *out, int *state, int *save)
+base64_encode_step(unsigned char *in, int len, gboolean break_lines, unsigned char *out, int *state, int *save)
{
register unsigned char *inptr, *outptr;
@@ -348,7 +349,7 @@ base64_encode_step(unsigned char *in, int len, unsigned char *out, int *state, i
*outptr++ = base64_alphabet [ ( (c2 &0x0f) << 2 ) | (c3 >> 6) ];
*outptr++ = base64_alphabet [ c3 & 0x3f ];
/* this is a bit ugly ... */
- if ((++already)>=19) {
+ if (break_lines && (++already)>=19) {
*outptr++='\n';
already = 0;
}