This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GNU Mailutils".
http://git.savannah.gnu.org/cgit/mailutils.git/commit/?id=832dad5395744b45ed705d8b9bab6432cdbf7d0e The branch, master has been updated via 832dad5395744b45ed705d8b9bab6432cdbf7d0e (commit) via 85bc741c0fb1adace8527a7da8c91efa6432a4c6 (commit) from 42f9e9d0e3c73059048934e385074d78a023e6e4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 832dad5395744b45ed705d8b9bab6432cdbf7d0e Author: Sergey Poznyakoff <g...@gnu.org.ua> Date: Thu Apr 1 19:49:20 2010 +0300 Bugfix. * mailbox/attachment.c (_ISSPECIAL): Fix definition. commit 85bc741c0fb1adace8527a7da8c91efa6432a4c6 Author: Sergey Poznyakoff <g...@gnu.org.ua> Date: Thu Apr 1 19:32:09 2010 +0300 Style fix. * mailbox/attachment.c: Fix indentation. ----------------------------------------------------------------------- Summary of changes: mailbox/attachment.c | 137 ++++++++++++++++++++++++++------------------------ 1 files changed, 71 insertions(+), 66 deletions(-) diff --git a/mailbox/attachment.c b/mailbox/attachment.c index 34332d4..55e546f 100644 --- a/mailbox/attachment.c +++ b/mailbox/attachment.c @@ -66,7 +66,7 @@ struct _msg_info int mu_message_create_attachment (const char *content_type, const char *encoding, - const char *filename, mu_message_t * newmsg) + const char *filename, mu_message_t *newmsg) { mu_header_t hdr; mu_body_t body; @@ -75,7 +75,7 @@ mu_message_create_attachment (const char *content_type, const char *encoding, int ret; if (newmsg == NULL) - return MU_ERR_OUT_PTR_NULL; + return MU_ERR_OUT_PTR_NULL; if (filename == NULL) return EINVAL; @@ -101,19 +101,19 @@ mu_message_create_attachment (const char *content_type, const char *encoding, sprintf (header, MSG_HDR, content_type, name, encoding, name); if ((ret = mu_header_create (&hdr, header, strlen (header), - *newmsg)) == 0) + *newmsg)) == 0) { mu_message_get_body (*newmsg, &body); if ((ret = mu_file_stream_create (&fstream, filename, - MU_STREAM_READ)) == 0) + MU_STREAM_READ)) == 0) { if ((ret = mu_stream_open (fstream)) == 0) { if ((ret = mu_filter_create (&tstream, fstream, encoding, - MU_FILTER_ENCODE, - MU_STREAM_READ)) == 0) + MU_FILTER_ENCODE, + MU_STREAM_READ)) == 0) { mu_body_set_stream (body, tstream, *newmsg); mu_message_set_header (*newmsg, hdr, NULL); @@ -121,7 +121,7 @@ mu_message_create_attachment (const char *content_type, const char *encoding, } } } - free (header); + free (header); } } } @@ -142,7 +142,7 @@ mu_message_create_attachment (const char *content_type, const char *encoding, static int _attachment_setup (struct _msg_info **info, mu_message_t msg, - mu_stream_t * stream, void **data) + mu_stream_t *stream, void **data) { int sfl, ret; mu_body_t body; @@ -185,14 +185,11 @@ _attachment_free (struct _msg_info *info, int free_message) free (info); } -#define _ISSPECIAL(c) ( \ - ((c) == '(') || ((c) == ')') || ((c) == '<') || ((c) == '>') \ - || ((c) == '@') || ((c) == ',') || ((c) == ';') || ((c) == ':') \ - || ((c) == '\\') || ((c) == '.') || ((c) == '[') \ - || ((c) == ']') ) +/* See RFC 2045, 5.1. Syntax of the Content-Type Header Field */ +#define _ISSPECIAL(c) !!strchr ("()<>@,;:\\\"/[]?=", c) static char * -_header_get_param (char *field_body, const char *param, size_t * len) +_header_get_param (char *field_body, const char *param, size_t *len) { char *str, *p, *v, *e; int quoted = 0, was_quoted = 0; @@ -230,7 +227,7 @@ _header_get_param (char *field_body, const char *param, size_t * len) } int -mu_message_aget_attachment_name(mu_message_t msg, char **name) +mu_message_aget_attachment_name (mu_message_t msg, char **name) { size_t sz = 0; int ret = 0; @@ -238,16 +235,18 @@ mu_message_aget_attachment_name(mu_message_t msg, char **name) if (name == NULL) return MU_ERR_OUT_PTR_NULL; - if((ret = mu_message_get_attachment_name(msg, NULL, 0, &sz)) != 0) + if ((ret = mu_message_get_attachment_name (msg, NULL, 0, &sz)) != 0) return ret; - *name = malloc(sz + 1); - - if((ret = mu_message_get_attachment_name(msg, *name, sz + 1, NULL)) != 0) - { - free(*name); - *name = NULL; - } + *name = malloc (sz + 1); + if (!*name) + return ENOMEM; + + if ((ret = mu_message_get_attachment_name (msg, *name, sz + 1, NULL)) != 0) + { + free (*name); + *name = NULL; + } return ret; } @@ -262,7 +261,7 @@ mu_message_get_attachment_name (mu_message_t msg, char *buf, size_t bufsz, char *name = NULL; size_t namesz = 0; - if(!msg) + if (!msg) return ret; if ((ret = mu_message_get_header (msg, &hdr)) != 0) @@ -272,25 +271,25 @@ mu_message_get_attachment_name (mu_message_t msg, char *buf, size_t bufsz, /* If the header wasn't there, we'll fall back to Content-Type, but other errors are fatal. */ - if(ret != 0 && ret != MU_ERR_NOENT) + if (ret != 0 && ret != MU_ERR_NOENT) return ret; - if(ret == 0 && value != NULL) - { - /* FIXME: this is cheezy, it should check the value of the - Content-Disposition field, not strstr it. */ + if (ret == 0 && value != NULL) + { + /* FIXME: this is cheezy, it should check the value of the + Content-Disposition field, not strstr it. */ if (strstr (value, "attachment") != NULL) name = _header_get_param (value, "filename", &namesz); - } + } /* If we didn't get the name, we fall back on the Content-Type name parameter. */ if (name == NULL) { - if(value) - free(value); + if (value) + free (value); ret = mu_header_aget_value (hdr, "Content-Type", &value); name = _header_get_param (value, "name", &namesz); @@ -302,11 +301,11 @@ mu_message_get_attachment_name (mu_message_t msg, char *buf, size_t bufsz, name[namesz] = '\0'; - if(sz) + if (sz) *sz = namesz; - if(buf) - strncpy(buf, name, bufsz); + if (buf) + strncpy (buf, name, bufsz); } else ret = MU_ERR_NOENT; @@ -336,40 +335,40 @@ mu_message_save_attachment (mu_message_t msg, const char *filename, if (ret == 0 && (ret = mu_message_get_header (msg, &hdr)) == 0) { if (filename == NULL) - { - ret = mu_message_aget_attachment_name (msg, &partname); - if(partname) - fname = partname; - } + { + ret = mu_message_aget_attachment_name (msg, &partname); + if (partname) + fname = partname; + } else fname = filename; if (fname && (ret = mu_file_stream_create (&info->fstream, fname, - MU_STREAM_WRITE | MU_STREAM_CREAT)) == 0) + MU_STREAM_WRITE | MU_STREAM_CREAT)) == 0) { if ((ret = mu_stream_open (info->fstream)) == 0) { - char *content_encoding; + char *content_encoding; char *content_encoding_mem = NULL; mu_header_get_value (hdr, "Content-Transfer-Encoding", NULL, 0, - &size); + &size); if (size) { content_encoding_mem = malloc (size + 1); if (content_encoding_mem == NULL) ret = ENOMEM; - content_encoding = content_encoding_mem; + content_encoding = content_encoding_mem; mu_header_get_value (hdr, "Content-Transfer-Encoding", - content_encoding, size + 1, 0); + content_encoding, size + 1, 0); } else content_encoding = "7bit"; ret = mu_filter_create (&info->stream, istream, content_encoding, - MU_FILTER_DECODE, MU_STREAM_READ); - free (content_encoding_mem); + MU_FILTER_DECODE, MU_STREAM_READ); + free (content_encoding_mem); } } } @@ -381,15 +380,16 @@ mu_message_save_attachment (mu_message_t msg, const char *filename, while ((ret == 0 && info->nbytes) || ((ret = - mu_stream_read (info->stream, info->buf, BUF_SIZE, info->ioffset, - &info->nbytes)) == 0 && info->nbytes)) + mu_stream_read (info->stream, info->buf, BUF_SIZE, + info->ioffset, &info->nbytes)) == 0 + && info->nbytes)) { info->ioffset += info->nbytes; while (info->nbytes) { if ((ret = mu_stream_write (info->fstream, info->buf, info->nbytes, - info->ooffset, &nbytes)) != 0) + info->ooffset, &nbytes)) != 0) break; info->nbytes -= nbytes; info->ooffset += nbytes; @@ -412,7 +412,7 @@ mu_message_save_attachment (mu_message_t msg, const char *filename, } int -mu_message_encapsulate (mu_message_t msg, mu_message_t * newmsg, void **data) +mu_message_encapsulate (mu_message_t msg, mu_message_t *newmsg, void **data) { mu_stream_t istream, ostream; const char *header; @@ -429,12 +429,14 @@ mu_message_encapsulate (mu_message_t msg, mu_message_t * newmsg, void **data) if ((ret = _attachment_setup (&info, msg, &ostream, data)) != 0) return ret; - if (info->msg == NULL && (ret = mu_message_create (&(info->msg), NULL)) == 0) + if (info->msg == NULL + && (ret = mu_message_create (&(info->msg), NULL)) == 0) { header = "Content-Type: message/rfc822\nContent-Transfer-Encoding: 7bit\n\n"; if ((ret = - mu_header_create (&(info->hdr), header, strlen (header), msg)) == 0) + mu_header_create (&(info->hdr), header, strlen (header), + msg)) == 0) ret = mu_message_set_header (info->msg, info->hdr, NULL); } if (ret == 0 && (ret = mu_message_get_stream (msg, &istream)) == 0) @@ -448,15 +450,16 @@ mu_message_encapsulate (mu_message_t msg, mu_message_t * newmsg, void **data) while ((ret == 0 && info->nbytes) || ((ret = - mu_stream_read (istream, info->buf, BUF_SIZE, info->ioffset, - &info->nbytes)) == 0 && info->nbytes)) + mu_stream_read (istream, info->buf, BUF_SIZE, + info->ioffset, &info->nbytes)) == 0 + && info->nbytes)) { info->ioffset += info->nbytes; while (info->nbytes) { if ((ret = mu_stream_write (ostream, info->buf, info->nbytes, - info->ooffset, &nbytes)) != 0) + info->ooffset, &nbytes)) != 0) break; info->nbytes -= nbytes; info->ooffset += nbytes; @@ -472,7 +475,8 @@ mu_message_encapsulate (mu_message_t msg, mu_message_t * newmsg, void **data) } int -mu_message_unencapsulate (mu_message_t msg, mu_message_t * newmsg, void **data) +mu_message_unencapsulate (mu_message_t msg, mu_message_t *newmsg, + void **data) { size_t size, nbytes; int ret = 0; @@ -491,14 +495,16 @@ mu_message_unencapsulate (mu_message_t msg, mu_message_t * newmsg, void **data) mu_header_get_value (hdr, "Content-Type", NULL, 0, &size); if (size) { - char *content_type; + char *content_type; if ((content_type = malloc (size + 1)) == NULL) return ENOMEM; - mu_header_get_value (hdr, "Content-Type", content_type, size + 1, 0); - ret = mu_c_strncasecmp (content_type, "message/rfc822", - strlen ("message/rfc822")); - free (content_type); - if (ret != 0) + mu_header_get_value (hdr, "Content-Type", content_type, size + 1, + 0); + ret = + mu_c_strncasecmp (content_type, "message/rfc822", + strlen ("message/rfc822")); + free (content_type); + if (ret != 0) return EINVAL; } else @@ -518,14 +524,14 @@ mu_message_unencapsulate (mu_message_t msg, mu_message_t * newmsg, void **data) || ((ret = mu_stream_read (istream, info->buf, BUF_SIZE, info->ioffset, - &info->nbytes)) == 0 && info->nbytes)) + &info->nbytes)) == 0 && info->nbytes)) { info->ioffset += info->nbytes; while (info->nbytes) { if ((ret = mu_stream_write (ostream, info->buf, info->nbytes, - info->ooffset, &nbytes)) != 0) + info->ooffset, &nbytes)) != 0) break; info->nbytes -= nbytes; info->ooffset += nbytes; @@ -538,4 +544,3 @@ mu_message_unencapsulate (mu_message_t msg, mu_message_t * newmsg, void **data) _attachment_free (info, ret); return ret; } - hooks/post-receive -- GNU Mailutils _______________________________________________ Commit-mailutils mailing list Commit-mailutils@gnu.org http://lists.gnu.org/mailman/listinfo/commit-mailutils