diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2003-09-19 02:10:58 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2003-09-19 02:10:58 +0800 |
commit | e0068343b1d29bb31f08bbe2900306dd1c180d1b (patch) | |
tree | b3fe61081afc4e8347b52bc8a6b311b152fc9888 /camel | |
parent | df21ede0c7bb0cf36ff095400e38d46950a030a5 (diff) | |
download | gsoc2013-evolution-e0068343b1d29bb31f08bbe2900306dd1c180d1b.tar.gz gsoc2013-evolution-e0068343b1d29bb31f08bbe2900306dd1c180d1b.tar.zst gsoc2013-evolution-e0068343b1d29bb31f08bbe2900306dd1c180d1b.zip |
namespaced the encoding/decoding routines.
2003-09-18 Jeffrey Stedfast <fejj@ximian.com>
* camel-mime-utils.[c,h]: namespaced the encoding/decoding
routines.
* camel-mime-filter-basic.c: updated for namespace changes to the
encoding/decoding routines in camel-mime-utils.c
* camel-multipart.c: updated for namespace changes to the
encoding/decoding routines in camel-mime-utils.c
* camel-sasl-digest-md5.c: updated for namespace changes to the
encoding/decoding routines in camel-mime-utils.c
* camel-sasl.c: updated for namespace changes to the
encoding/decoding routines in camel-mime-utils.c
* camel-vee-folder.c: updated for namespace changes to the
encoding/decoding routines in camel-mime-utils.c
* providers/imap/camel-imap-search.c: updated for namespace
changes to the encoding/decoding routines in camel-mime-utils.c
* providers/pop3/camel-pop3-folder.c: updated for namespace
changes to the encoding/decoding routines in camel-mime-utils.c
svn path=/trunk/; revision=22615
Diffstat (limited to 'camel')
-rw-r--r-- | camel/ChangeLog | 26 | ||||
-rw-r--r-- | camel/camel-mime-filter-basic.c | 24 | ||||
-rw-r--r-- | camel/camel-mime-utils.c | 44 | ||||
-rw-r--r-- | camel/camel-mime-utils.h | 22 | ||||
-rw-r--r-- | camel/camel-multipart.c | 2 | ||||
-rw-r--r-- | camel/camel-sasl-digest-md5.c | 2 | ||||
-rw-r--r-- | camel/camel-sasl.c | 4 | ||||
-rw-r--r-- | camel/camel-vee-folder.c | 2 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-search.c | 2 | ||||
-rw-r--r-- | camel/providers/pop3/camel-pop3-folder.c | 2 |
10 files changed, 78 insertions, 52 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index ffbfd278f2..9d2f4ae684 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,29 @@ +2003-09-18 Jeffrey Stedfast <fejj@ximian.com> + + * camel-mime-utils.[c,h]: namespaced the encoding/decoding + routines. + + * camel-mime-filter-basic.c: updated for namespace changes to the + encoding/decoding routines in camel-mime-utils.c + + * camel-multipart.c: updated for namespace changes to the + encoding/decoding routines in camel-mime-utils.c + + * camel-sasl-digest-md5.c: updated for namespace changes to the + encoding/decoding routines in camel-mime-utils.c + + * camel-sasl.c: updated for namespace changes to the + encoding/decoding routines in camel-mime-utils.c + + * camel-vee-folder.c: updated for namespace changes to the + encoding/decoding routines in camel-mime-utils.c + + * providers/imap/camel-imap-search.c: updated for namespace + changes to the encoding/decoding routines in camel-mime-utils.c + + * providers/pop3/camel-pop3-folder.c: updated for namespace + changes to the encoding/decoding routines in camel-mime-utils.c + 2003-08-26 Jeffrey Stedfast <fejj@ximian.com> * camel-mime-parser.[c,h]: s/HSCAN_/CAMEL_MIME_PARSER_STATE_/g and diff --git a/camel/camel-mime-filter-basic.c b/camel/camel-mime-filter-basic.c index efb9b9818e..d99d465443 100644 --- a/camel/camel-mime-filter-basic.c +++ b/camel/camel-mime-filter-basic.c @@ -101,38 +101,38 @@ complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, case CAMEL_MIME_FILTER_BASIC_BASE64_ENC: /* wont go to more than 2x size (overly conservative) */ camel_mime_filter_set_size(mf, len*2+6, FALSE); - newlen = base64_encode_close(in, len, TRUE, mf->outbuf, &f->state, &f->save); + newlen = camel_base64_encode_close(in, len, TRUE, mf->outbuf, &f->state, &f->save); g_assert(newlen <= len*2+6); break; case CAMEL_MIME_FILTER_BASIC_QP_ENC: /* *4 is definetly more than needed ... */ camel_mime_filter_set_size(mf, len*4+4, FALSE); - newlen = quoted_encode_close(in, len, mf->outbuf, &f->state, &f->save); + newlen = camel_quoted_decode_close(in, len, mf->outbuf, &f->state, &f->save); g_assert(newlen <= len*4+4); break; case CAMEL_MIME_FILTER_BASIC_UU_ENC: /* won't go to more than 2 * (x + 2) + 62 */ camel_mime_filter_set_size (mf, (len + 2) * 2 + 62, FALSE); - newlen = uuencode_close (in, len, mf->outbuf, f->uubuf, &f->state, &f->save); + newlen = camel_uuencode_close (in, len, mf->outbuf, f->uubuf, &f->state, &f->save); g_assert (newlen <= (len + 2) * 2 + 62); break; case CAMEL_MIME_FILTER_BASIC_BASE64_DEC: /* output can't possibly exceed the input size */ camel_mime_filter_set_size(mf, len, FALSE); - newlen = base64_decode_step(in, len, mf->outbuf, &f->state, &f->save); + newlen = camel_base64_decode_step(in, len, mf->outbuf, &f->state, &f->save); g_assert(newlen <= len); break; case CAMEL_MIME_FILTER_BASIC_QP_DEC: /* output can't possibly exceed the input size, well unless its not really qp, then +2 max */ camel_mime_filter_set_size(mf, len+2, FALSE); - newlen = quoted_decode_step(in, len, mf->outbuf, &f->state, &f->save); + newlen = camel_quoted_decode_step(in, len, mf->outbuf, &f->state, &f->save); g_assert(newlen <= len+2); break; case CAMEL_MIME_FILTER_BASIC_UU_DEC: if ((f->state & CAMEL_UUDECODE_STATE_BEGIN) && !(f->state & CAMEL_UUDECODE_STATE_END)) { /* "begin <mode> <filename>\n" has been found, so we can now start decoding */ camel_mime_filter_set_size (mf, len + 3, FALSE); - newlen = uudecode_step (in, len, mf->outbuf, &f->state, &f->save); + newlen = camel_uudecode_step (in, len, mf->outbuf, &f->state, &f->save); } else { newlen = 0; } @@ -164,31 +164,31 @@ filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, s case CAMEL_MIME_FILTER_BASIC_BASE64_ENC: /* wont go to more than 2x size (overly conservative) */ camel_mime_filter_set_size(mf, len*2+6, FALSE); - newlen = base64_encode_step(in, len, TRUE, mf->outbuf, &f->state, &f->save); + newlen = camel_base64_encode_step(in, len, TRUE, mf->outbuf, &f->state, &f->save); g_assert(newlen <= len*2+6); break; case CAMEL_MIME_FILTER_BASIC_QP_ENC: /* *4 is overly conservative, but will do */ camel_mime_filter_set_size(mf, len*4+4, FALSE); - newlen = quoted_encode_step(in, len, mf->outbuf, &f->state, &f->save); + newlen = camel_quoted_encode_step(in, len, mf->outbuf, &f->state, &f->save); g_assert(newlen <= len*4+4); break; case CAMEL_MIME_FILTER_BASIC_UU_ENC: /* won't go to more than 2 * (x + 2) + 62 */ camel_mime_filter_set_size (mf, (len + 2) * 2 + 62, FALSE); - newlen = uuencode_step (in, len, mf->outbuf, f->uubuf, &f->state, &f->save); + newlen = camel_uuencode_step (in, len, mf->outbuf, f->uubuf, &f->state, &f->save); g_assert (newlen <= (len + 2) * 2 + 62); break; case CAMEL_MIME_FILTER_BASIC_BASE64_DEC: /* output can't possibly exceed the input size */ camel_mime_filter_set_size(mf, len+3, FALSE); - newlen = base64_decode_step(in, len, mf->outbuf, &f->state, &f->save); + newlen = camel_base64_decode_step(in, len, mf->outbuf, &f->state, &f->save); g_assert(newlen <= len+3); break; case CAMEL_MIME_FILTER_BASIC_QP_DEC: /* output can't possibly exceed the input size */ camel_mime_filter_set_size(mf, len + 2, FALSE); - newlen = quoted_decode_step(in, len, mf->outbuf, &f->state, &f->save); + newlen = camel_quoted_decode_step(in, len, mf->outbuf, &f->state, &f->save); g_assert(newlen <= len + 2); break; case CAMEL_MIME_FILTER_BASIC_UU_DEC: @@ -230,7 +230,7 @@ filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, s if ((f->state & CAMEL_UUDECODE_STATE_BEGIN) && !(f->state & CAMEL_UUDECODE_STATE_END)) { /* "begin <mode> <filename>\n" has been found, so we can now start decoding */ camel_mime_filter_set_size (mf, len + 3, FALSE); - newlen = uudecode_step (in, len, mf->outbuf, &f->state, &f->save); + newlen = camel_uudecode_step (in, len, mf->outbuf, &f->state, &f->save); } else { newlen = 0; } diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c index 6f719a8f5b..197ae69058 100644 --- a/camel/camel-mime-utils.c +++ b/camel/camel-mime-utils.c @@ -201,13 +201,13 @@ base64_init(void) /* call this when finished encoding everything, to flush off the last little bit */ size_t -base64_encode_close(unsigned char *in, size_t inlen, gboolean break_lines, unsigned char *out, int *state, int *save) +camel_base64_encode_close(unsigned char *in, size_t 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, break_lines, outptr, state, save); + outptr += camel_base64_encode_step(in, inlen, break_lines, outptr, state, save); c1 = ((unsigned char *)save)[1]; c2 = ((unsigned char *)save)[2]; @@ -246,7 +246,7 @@ base64_encode_close(unsigned char *in, size_t inlen, gboolean break_lines, unsig 0 on first invocation). */ size_t -base64_encode_step(unsigned char *in, size_t len, gboolean break_lines, unsigned char *out, int *state, int *save) +camel_base64_encode_step(unsigned char *in, size_t len, gboolean break_lines, unsigned char *out, int *state, int *save) { register unsigned char *inptr, *outptr; @@ -322,7 +322,7 @@ base64_encode_step(unsigned char *in, size_t len, gboolean break_lines, unsigned /** - * base64_decode_step: decode a chunk of base64 encoded data + * camel_base64_decode_step: decode a chunk of base64 encoded data * @in: input stream * @len: max length of data to decode * @out: output stream @@ -332,7 +332,7 @@ base64_encode_step(unsigned char *in, size_t len, gboolean break_lines, unsigned * Decodes a chunk of base64 encoded data **/ size_t -base64_decode_step(unsigned char *in, size_t len, unsigned char *out, int *state, unsigned int *save) +camel_base64_decode_step(unsigned char *in, size_t len, unsigned char *out, int *state, unsigned int *save) { register unsigned char *inptr, *outptr; unsigned char *inend, c; @@ -380,31 +380,31 @@ base64_decode_step(unsigned char *in, size_t len, unsigned char *out, int *state } char * -base64_encode_simple (const char *data, size_t len) +camel_base64_encode_simple (const char *data, size_t len) { unsigned char *out; int state = 0, outlen; unsigned int save = 0; out = g_malloc (len * 4 / 3 + 5); - outlen = base64_encode_close ((unsigned char *)data, len, FALSE, + outlen = camel_base64_encode_close ((unsigned char *)data, len, FALSE, out, &state, &save); out[outlen] = '\0'; return (char *)out; } size_t -base64_decode_simple (char *data, size_t len) +camel_base64_decode_simple (char *data, size_t len) { int state = 0; unsigned int save = 0; - return base64_decode_step ((unsigned char *)data, len, + return camel_base64_decode_step ((unsigned char *)data, len, (unsigned char *)data, &state, &save); } /** - * uuencode_close: uuencode a chunk of data + * camel_uuencode_close: uuencode a chunk of data * @in: input stream * @len: input stream length * @out: output stream @@ -413,11 +413,11 @@ base64_decode_simple (char *data, size_t len) * @save: leftover bits that have not yet been encoded * * Returns the number of bytes encoded. Call this when finished - * encoding data with uuencode_step to flush off the last little + * encoding data with camel_uuencode_step to flush off the last little * bit. **/ size_t -uuencode_close (unsigned char *in, size_t len, unsigned char *out, unsigned char *uubuf, int *state, guint32 *save) +camel_uuencode_close (unsigned char *in, size_t len, unsigned char *out, unsigned char *uubuf, int *state, guint32 *save) { register unsigned char *outptr, *bufptr; register guint32 saved; @@ -426,7 +426,7 @@ uuencode_close (unsigned char *in, size_t len, unsigned char *out, unsigned char outptr = out; if (len > 0) - outptr += uuencode_step (in, len, out, uubuf, state, save); + outptr += camel_uuencode_step (in, len, out, uubuf, state, save); uufill = 0; @@ -483,7 +483,7 @@ uuencode_close (unsigned char *in, size_t len, unsigned char *out, unsigned char /** - * uuencode_step: uuencode a chunk of data + * camel_uuencode_step: uuencode a chunk of data * @in: input stream * @len: input stream length * @out: output stream @@ -497,7 +497,7 @@ uuencode_close (unsigned char *in, size_t len, unsigned char *out, unsigned char * invocation). **/ size_t -uuencode_step (unsigned char *in, size_t len, unsigned char *out, unsigned char *uubuf, int *state, guint32 *save) +camel_uuencode_step (unsigned char *in, size_t len, unsigned char *out, unsigned char *uubuf, int *state, guint32 *save) { register unsigned char *inptr, *outptr, *bufptr; unsigned char *inend; @@ -559,7 +559,7 @@ uuencode_step (unsigned char *in, size_t len, unsigned char *out, unsigned char /** - * uudecode_step: uudecode a chunk of data + * camel_uudecode_step: uudecode a chunk of data * @in: input stream * @inlen: max length of data to decode ( normally strlen(in) ??) * @out: output stream @@ -571,7 +571,7 @@ uuencode_step (unsigned char *in, size_t len, unsigned char *out, unsigned char * line has been stripped off. **/ size_t -uudecode_step (unsigned char *in, size_t len, unsigned char *out, int *state, guint32 *save) +camel_uudecode_step (unsigned char *in, size_t len, unsigned char *out, int *state, guint32 *save) { register unsigned char *inptr, *outptr; unsigned char *inend, ch; @@ -657,13 +657,13 @@ uudecode_step (unsigned char *in, size_t len, unsigned char *out, int *state, gu /* complete qp encoding */ size_t -quoted_encode_close(unsigned char *in, size_t len, unsigned char *out, int *state, int *save) +camel_quoted_decode_close(unsigned char *in, size_t len, unsigned char *out, int *state, int *save) { register unsigned char *outptr = out; int last; if (len>0) - outptr += quoted_encode_step(in, len, outptr, state, save); + outptr += camel_quoted_encode_step(in, len, outptr, state, save); last = *state; if (last != -1) { @@ -686,7 +686,7 @@ quoted_encode_close(unsigned char *in, size_t len, unsigned char *out, int *stat /* perform qp encoding, initialise state to -1 and save to 0 on first invocation */ size_t -quoted_encode_step (unsigned char *in, size_t len, unsigned char *out, int *statep, int *save) +camel_quoted_encode_step (unsigned char *in, size_t len, unsigned char *out, int *statep, int *save) { register guchar *inptr, *outptr, *inend; unsigned char c; @@ -772,7 +772,7 @@ quoted_encode_step (unsigned char *in, size_t len, unsigned char *out, int *stat */ size_t -quoted_decode_step(unsigned char *in, size_t len, unsigned char *out, int *savestate, int *saveme) +camel_quoted_decode_step(unsigned char *in, size_t len, unsigned char *out, int *savestate, int *saveme) { register unsigned char *inptr, *outptr; unsigned char *inend, c; @@ -1015,7 +1015,7 @@ rfc2047_decode_word(const char *in, size_t len) int state = 0; unsigned int save = 0; - inlen = base64_decode_step((char *)inptr+2, tmplen, decword, &state, &save); + inlen = camel_base64_decode_step((char *)inptr+2, tmplen, decword, &state, &save); /* if state != 0 then error? */ break; } diff --git a/camel/camel-mime-utils.h b/camel/camel-mime-utils.h index 7035b7696d..5e2fa766a9 100644 --- a/camel/camel-mime-utils.h +++ b/camel/camel-mime-utils.h @@ -216,25 +216,25 @@ char *camel_header_location_decode (const char *in); void camel_header_mime_decode (const char *in, int *maj, int *min); /* do incremental base64/quoted-printable (de/en)coding */ -size_t base64_decode_step (unsigned char *in, size_t len, unsigned char *out, int *state, unsigned int *save); +size_t camel_base64_decode_step (unsigned char *in, size_t len, unsigned char *out, int *state, unsigned int *save); -size_t base64_encode_step (unsigned char *in, size_t len, gboolean break_lines, unsigned char *out, int *state, int *save); -size_t base64_encode_close (unsigned char *in, size_t len, gboolean break_lines, unsigned char *out, int *state, int *save); +size_t camel_base64_encode_step (unsigned char *in, size_t len, gboolean break_lines, unsigned char *out, int *state, int *save); +size_t camel_base64_encode_close (unsigned char *in, size_t len, gboolean break_lines, unsigned char *out, int *state, int *save); -size_t uudecode_step (unsigned char *in, size_t len, unsigned char *out, int *state, guint32 *save); +size_t camel_uudecode_step (unsigned char *in, size_t len, unsigned char *out, int *state, guint32 *save); -size_t uuencode_step (unsigned char *in, size_t len, unsigned char *out, unsigned char *uubuf, int *state, +size_t camel_uuencode_step (unsigned char *in, size_t len, unsigned char *out, unsigned char *uubuf, int *state, guint32 *save); -size_t uuencode_close (unsigned char *in, size_t len, unsigned char *out, unsigned char *uubuf, int *state, +size_t camel_uuencode_close (unsigned char *in, size_t len, unsigned char *out, unsigned char *uubuf, int *state, guint32 *save); -size_t quoted_decode_step (unsigned char *in, size_t len, unsigned char *out, int *savestate, int *saveme); +size_t camel_quoted_decode_step (unsigned char *in, size_t len, unsigned char *out, int *savestate, int *saveme); -size_t quoted_encode_step (unsigned char *in, size_t len, unsigned char *out, int *state, int *save); -size_t quoted_encode_close (unsigned char *in, size_t len, unsigned char *out, int *state, int *save); +size_t camel_quoted_encode_step (unsigned char *in, size_t len, unsigned char *out, int *state, int *save); +size_t camel_quoted_decode_close (unsigned char *in, size_t len, unsigned char *out, int *state, int *save); -char *base64_encode_simple (const char *data, size_t len); -size_t base64_decode_simple (char *data, size_t len); +char *camel_base64_encode_simple (const char *data, size_t len); +size_t camel_base64_decode_simple (char *data, size_t len); #ifdef __cplusplus } diff --git a/camel/camel-multipart.c b/camel/camel-multipart.c index 1ec771103d..6393e29251 100644 --- a/camel/camel-multipart.c +++ b/camel/camel-multipart.c @@ -368,7 +368,7 @@ set_boundary (CamelMultipart *multipart, const char *boundary) strcpy (bbuf, "=-"); p = bbuf + 2; state = save = 0; - p += base64_encode_step (digest, 16, FALSE, p, &state, &save); + p += camel_base64_encode_step (digest, 16, FALSE, p, &state, &save); *p = '\0'; boundary = bbuf; diff --git a/camel/camel-sasl-digest-md5.c b/camel/camel-sasl-digest-md5.c index 8d7a704755..e421bd5294 100644 --- a/camel/camel-sasl-digest-md5.c +++ b/camel/camel-sasl-digest-md5.c @@ -647,7 +647,7 @@ generate_response (struct _DigestChallenge *challenge, struct hostent *host, md5_get_digest (bgen, strlen (bgen), digest); g_free (bgen); /* take our recommended 64 bits of entropy */ - resp->cnonce = base64_encode_simple (digest, 8); + resp->cnonce = camel_base64_encode_simple (digest, 8); /* we don't support re-auth so the nonce count is always 1 */ strcpy (resp->nc, "00000001"); diff --git a/camel/camel-sasl.c b/camel/camel-sasl.c index ec070215c9..7f435612dd 100644 --- a/camel/camel-sasl.c +++ b/camel/camel-sasl.c @@ -137,7 +137,7 @@ camel_sasl_challenge_base64 (CamelSasl *sasl, const char *token, CamelException token_binary = g_byte_array_new (); len = strlen (token); g_byte_array_append (token_binary, token, len); - token_binary->len = base64_decode_simple (token_binary->data, len); + token_binary->len = camel_base64_decode_simple (token_binary->data, len); } else token_binary = NULL; @@ -147,7 +147,7 @@ camel_sasl_challenge_base64 (CamelSasl *sasl, const char *token, CamelException if (!ret_binary) return NULL; - ret = base64_encode_simple (ret_binary->data, ret_binary->len); + ret = camel_base64_encode_simple (ret_binary->data, ret_binary->len); g_byte_array_free (ret_binary, TRUE); return ret; diff --git a/camel/camel-vee-folder.c b/camel/camel-vee-folder.c index cd1ea40045..f7ceb12d59 100644 --- a/camel/camel-vee-folder.c +++ b/camel/camel-vee-folder.c @@ -524,7 +524,7 @@ camel_vee_folder_hash_folder(CamelFolder *folder, char buffer[8]) g_free(tmp); md5_update(&ctx, folder->full_name, strlen(folder->full_name)); md5_final(&ctx, digest); - base64_encode_close(digest, 6, FALSE, buffer, &state, &save); + camel_base64_encode_close(digest, 6, FALSE, buffer, &state, &save); for (i=0;i<8;i++) { if (buffer[i] == '+') diff --git a/camel/providers/imap/camel-imap-search.c b/camel/providers/imap/camel-imap-search.c index 8f65def872..eacb839cb2 100644 --- a/camel/providers/imap/camel-imap-search.c +++ b/camel/providers/imap/camel-imap-search.c @@ -182,7 +182,7 @@ hash_match(char hash[17], int argc, struct _ESExpResult **argv) } md5_final(&ctx, digest); - base64_encode_close(digest, 12, FALSE, hash, &state, &save); + camel_base64_encode_close(digest, 12, FALSE, hash, &state, &save); for (i=0;i<16;i++) { if (hash[i] == '+') diff --git a/camel/providers/pop3/camel-pop3-folder.c b/camel/providers/pop3/camel-pop3-folder.c index 0df4fcf5c5..0598a26a51 100644 --- a/camel/providers/pop3/camel-pop3-folder.c +++ b/camel/providers/pop3/camel-pop3-folder.c @@ -173,7 +173,7 @@ cmd_builduid(CamelPOP3Engine *pe, CamelPOP3Stream *stream, void *data) } camel_object_unref(mp); md5_final(&md5, digest); - fi->uid = base64_encode_simple(digest, 16); + fi->uid = camel_base64_encode_simple(digest, 16); d(printf("building uid for id '%d' = '%s'\n", fi->id, fi->uid)); } |