aboutsummaryrefslogtreecommitdiffstats
path: root/em-format
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-08-16 23:25:56 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-09-04 19:34:32 +0800
commitfcbbdfbd18e15b4ee8322a0217cf03a689a5e033 (patch)
treee16cd2a2279558c6a2bfb6ca39fcbaac4c85ba59 /em-format
parentf78417c48861759d7b0c4535ecd3febe4638a7d3 (diff)
downloadgsoc2013-evolution-fcbbdfbd18e15b4ee8322a0217cf03a689a5e033.tar
gsoc2013-evolution-fcbbdfbd18e15b4ee8322a0217cf03a689a5e033.tar.gz
gsoc2013-evolution-fcbbdfbd18e15b4ee8322a0217cf03a689a5e033.tar.bz2
gsoc2013-evolution-fcbbdfbd18e15b4ee8322a0217cf03a689a5e033.tar.lz
gsoc2013-evolution-fcbbdfbd18e15b4ee8322a0217cf03a689a5e033.tar.xz
gsoc2013-evolution-fcbbdfbd18e15b4ee8322a0217cf03a689a5e033.tar.zst
gsoc2013-evolution-fcbbdfbd18e15b4ee8322a0217cf03a689a5e033.zip
Coding style and whitespace cleanup.
Diffstat (limited to 'em-format')
-rw-r--r--em-format/em-format-quote.c6
-rw-r--r--em-format/em-format.c46
-rw-r--r--em-format/em-format.h8
-rw-r--r--em-format/em-inline-filter.c58
-rw-r--r--em-format/em-stripsig-filter.h4
5 files changed, 74 insertions, 48 deletions
diff --git a/em-format/em-format-quote.c b/em-format/em-format-quote.c
index c11476a6d5..e6e71187c1 100644
--- a/em-format/em-format-quote.c
+++ b/em-format/em-format-quote.c
@@ -321,7 +321,8 @@ static gchar *i18n_hdrs[] = {
#endif
static void
-emfq_format_address (GString *out, struct _camel_header_address *a)
+emfq_format_address (GString *out,
+ struct _camel_header_address *a)
{
guint32 flags = CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES;
gchar *name, *mailto, *addr;
@@ -581,7 +582,8 @@ emfq_format_message (EMFormat *emf,
/* Decodes inline encoded parts of 'part'. The returned pointer,
* if not NULL, should be unreffed with g_object_unref(). */
static CamelMimePart *
-decode_inline_parts (CamelMimePart *part, GCancellable *cancellable)
+decode_inline_parts (CamelMimePart *part,
+ GCancellable *cancellable)
{
CamelMultipart *mp;
CamelStream *null;
diff --git a/em-format/em-format.c b/em-format/em-format.c
index f1aea4b00d..40f9baa3d5 100644
--- a/em-format/em-format.c
+++ b/em-format/em-format.c
@@ -45,10 +45,10 @@ struct _EMFormatPrivate {
};
/* Used to cache various data/info for redraws
- The validity stuff could be cached at a higher level but this is easier
- This absolutely relies on the partid being _globally unique_
- This is still kind of yucky, we should maintian a full tree of all this data,
- along with/as part of the puri tree */
+ * The validity stuff could be cached at a higher level but this is easier
+ * This absolutely relies on the partid being _globally unique_
+ * This is still kind of yucky, we should maintian a full tree of all this data,
+ * along with/as part of the puri tree */
struct _EMFormatCache {
CamelCipherValidity *valid; /* validity copy */
CamelMimePart *secured; /* encrypted subpart */
@@ -83,11 +83,12 @@ emf_free_cache (EMFormatCache *efc)
}
static EMFormatCache *
-emf_insert_cache (EMFormat *emf, const gchar *partid)
+emf_insert_cache (EMFormat *emf,
+ const gchar *partid)
{
EMFormatCache *new;
- new = g_malloc0 (sizeof (*new)+strlen (partid));
+ new = g_malloc0 (sizeof (*new) + strlen (partid));
strcpy (new->partid, partid);
g_hash_table_insert (emf->inline_table, new->partid, new);
@@ -95,7 +96,9 @@ emf_insert_cache (EMFormat *emf, const gchar *partid)
}
static void
-emf_clone_inlines (gpointer key, gpointer val, gpointer data)
+emf_clone_inlines (gpointer key,
+ gpointer val,
+ gpointer data)
{
EMFormatCache *emfc = val, *new;
@@ -262,8 +265,8 @@ emf_format_secure (EMFormat *emf,
gint len;
/* Note that this also requires support from higher up in the class chain
- - validity needs to be cleared when you start output
- - also needs to be cleared (but saved) whenever you start a new message. */
+ * - validity needs to be cleared when you start output
+ * - also needs to be cleared (but saved) whenever you start a new message. */
if (emf->valid == NULL) {
emf->valid = valid;
@@ -437,7 +440,9 @@ struct _class_handlers {
};
static void
-merge_missing (gpointer key, gpointer value, gpointer userdata)
+merge_missing (gpointer key,
+ gpointer value,
+ gpointer userdata)
{
struct _class_handlers *classes = (struct _class_handlers *) userdata;
EMFormatHandler *info;
@@ -451,7 +456,8 @@ merge_missing (gpointer key, gpointer value, gpointer userdata)
}
void
-em_format_merge_handler (EMFormat *new, EMFormat *old)
+em_format_merge_handler (EMFormat *new,
+ EMFormat *old)
{
EMFormatClass *oldc = (EMFormatClass *) G_OBJECT_GET_CLASS (old);
EMFormatClass *newc = (EMFormatClass *) G_OBJECT_GET_CLASS (new);
@@ -543,9 +549,9 @@ em_format_fallback_handler (EMFormat *emf,
if (s == NULL)
mime = (gchar *) mime_type;
else {
- gsize len = (s-mime_type)+1;
+ gsize len = (s - mime_type) + 1;
- mime = g_alloca (len+2);
+ mime = g_alloca (len + 2);
strncpy (mime, mime_type, len);
strcpy(mime+len, "*");
}
@@ -809,7 +815,7 @@ em_format_part_as (EMFormat *emf,
emf->snoop_mime_type = NULL;
/* RFC 2110, we keep track of content-base, and absolute content-location headers
- This is actually only required for html, but, *shrug* */
+ * This is actually only required for html, but, *shrug * */
tmp = camel_medium_get_header((CamelMedium *)part, "Content-Base");
if (tmp == NULL) {
tmp = camel_mime_part_get_content_location (part);
@@ -1211,7 +1217,7 @@ em_format_set_inline (EMFormat *emf,
} else if (emfc->state != INLINE_UNSET && (emfc->state & 1) == state)
return;
- emfc->state = state?INLINE_ON:INLINE_OFF;
+ emfc->state = state ? INLINE_ON : INLINE_OFF;
if (emf->message)
em_format_queue_redraw (emf);
@@ -1765,7 +1771,7 @@ emf_multipart_encrypted (EMFormat *emf,
return;
}
- mpe = (CamelMultipartEncrypted*) camel_medium_get_content ((CamelMedium *) part);
+ mpe = (CamelMultipartEncrypted *) camel_medium_get_content ((CamelMedium *) part);
if (!CAMEL_IS_MULTIPART_ENCRYPTED (mpe)) {
em_format_format_error (
emf, stream, _("Could not parse MIME message. "
@@ -1827,7 +1833,8 @@ emf_multipart_encrypted (EMFormat *emf,
}
static CamelMimePart *
-get_related_display_part (CamelMimePart *part, gint *out_displayid)
+get_related_display_part (CamelMimePart *part,
+ gint *out_displayid)
{
CamelMultipart *mp;
CamelMimePart *body_part, *display_part = NULL;
@@ -1872,7 +1879,8 @@ get_related_display_part (CamelMimePart *part, gint *out_displayid)
}
static gboolean
-related_display_part_is_attachment (EMFormat *emf, CamelMimePart *part)
+related_display_part_is_attachment (EMFormat *emf,
+ CamelMimePart *part)
{
CamelMimePart *display_part;
@@ -2480,5 +2488,5 @@ em_format_snoop_type (CamelMimePart *part)
return res;
/* We used to load parts to check their type, we dont anymore,
- see bug #11778 for some discussion */
+ * see bug #11778 for some discussion */
}
diff --git a/em-format/em-format.h b/em-format/em-format.h
index d78cfee9ee..cf214d81a5 100644
--- a/em-format/em-format.h
+++ b/em-format/em-format.h
@@ -81,8 +81,8 @@ typedef enum {
*
**/
typedef enum {
- EM_FORMAT_HANDLER_INLINE = 1<<0,
- EM_FORMAT_HANDLER_INLINE_DISPOSITION = 1<<1
+ EM_FORMAT_HANDLER_INLINE = 1 << 0,
+ EM_FORMAT_HANDLER_INLINE_DISPOSITION = 1 << 1
} EMFormatHandlerFlags;
/**
@@ -145,7 +145,7 @@ struct _EMFormatPURI {
};
struct _EMFormatHeader {
- guint32 flags; /* E_FORMAT_HEADER_* */
+ guint32 flags; /* E_FORMAT_HEADER_ * */
gchar name[1];
};
@@ -320,7 +320,7 @@ void em_format_add_header (EMFormat *emf,
guint32 flags);
/* FIXME: Need a 'clone' api to copy details about the current view (inlines etc)
- Or maybe it should live with sub-classes? */
+ * Or maybe it should live with sub-classes? */
gint em_format_is_attachment (EMFormat *emf,
CamelMimePart *part);
diff --git a/em-format/em-inline-filter.c b/em-format/em-inline-filter.c
index 1f9639540e..f70915148f 100644
--- a/em-format/em-inline-filter.c
+++ b/em-format/em-inline-filter.c
@@ -46,17 +46,27 @@ static const struct {
const gchar *type;
const gchar *subtype;
CamelTransferEncoding encoding;
- guint plain:1;
+ guint plain : 1;
} emif_types[] = {
- { "text", "plain", CAMEL_TRANSFER_ENCODING_DEFAULT, 1, },
- { "application", "mac-binhex40", CAMEL_TRANSFER_ENCODING_7BIT, 0, },
- { "application", "postscript", CAMEL_TRANSFER_ENCODING_7BIT, 0, },
- { "application", "x-inlinepgp-signed", CAMEL_TRANSFER_ENCODING_DEFAULT, 0, },
- { "application", "x-inlinepgp-encrypted", CAMEL_TRANSFER_ENCODING_DEFAULT, 0, },
+ { "text", "plain",
+ CAMEL_TRANSFER_ENCODING_DEFAULT, 1 },
+
+ { "application", "mac-binhex40",
+ CAMEL_TRANSFER_ENCODING_7BIT, 0 },
+
+ { "application", "postscript",
+ CAMEL_TRANSFER_ENCODING_7BIT, 0 },
+
+ { "application", "x-inlinepgp-signed",
+ CAMEL_TRANSFER_ENCODING_DEFAULT, 0 },
+
+ { "application", "x-inlinepgp-encrypted",
+ CAMEL_TRANSFER_ENCODING_DEFAULT, 0 }
};
static CamelMimePart *
-construct_part_from_stream (CamelStream *mem, const GByteArray *data)
+construct_part_from_stream (CamelStream *mem,
+ const GByteArray *data)
{
CamelMimePart *part = NULL;
CamelMimeParser *parser;
@@ -85,7 +95,9 @@ construct_part_from_stream (CamelStream *mem, const GByteArray *data)
}
static void
-inline_filter_add_part (EMInlineFilter *emif, const gchar *data, gint len)
+inline_filter_add_part (EMInlineFilter *emif,
+ const gchar *data,
+ gint len)
{
CamelTransferEncoding encoding;
CamelContentType *content_type;
@@ -189,10 +201,13 @@ inline_filter_add_part (EMInlineFilter *emif, const gchar *data, gint len)
}
static gint
-inline_filter_scan (CamelMimeFilter *f, gchar *in, gsize len, gint final)
+inline_filter_scan (CamelMimeFilter *f,
+ gchar *in,
+ gsize len,
+ gint final)
{
EMInlineFilter *emif = (EMInlineFilter *) f;
- gchar *inptr = in, *inend = in+len;
+ gchar *inptr = in, *inend = in + len;
gchar *data_start = in;
gchar *start = in;
@@ -207,7 +222,7 @@ inline_filter_scan (CamelMimeFilter *f, gchar *in, gsize len, gint final)
if (inptr == inend && start == inptr) {
if (!final) {
- camel_mime_filter_backup (f, start, inend-start);
+ camel_mime_filter_backup (f, start, inend - start);
inend = start;
}
break;
@@ -225,31 +240,31 @@ inline_filter_scan (CamelMimeFilter *f, gchar *in, gsize len, gint final)
case EMIF_PLAIN:
if (rest_len >= 45 && strncmp (start, "(This file must be converted with BinHex 4.0)", 45) == 0) {
restore_inptr ();
- inline_filter_add_part (emif, data_start, start-data_start);
+ inline_filter_add_part (emif, data_start, start - data_start);
data_start = start;
emif->state = EMIF_BINHEX;
} else if (rest_len >= 11 && strncmp (start, "%!PS-Adobe-", 11) == 0) {
restore_inptr ();
- inline_filter_add_part (emif, data_start, start-data_start);
+ inline_filter_add_part (emif, data_start, start - data_start);
data_start = start;
emif->state = EMIF_POSTSCRIPT;
} else if (rest_len >= 34 && strncmp (start, "-----BEGIN PGP SIGNED MESSAGE-----", 34) == 0) {
restore_inptr ();
- inline_filter_add_part (emif, data_start, start-data_start);
+ inline_filter_add_part (emif, data_start, start - data_start);
data_start = start;
emif->state = EMIF_PGPSIGNED;
} else if (rest_len >= 27 && strncmp (start, "-----BEGIN PGP MESSAGE-----", 27) == 0) {
restore_inptr ();
- inline_filter_add_part (emif, data_start, start-data_start);
+ inline_filter_add_part (emif, data_start, start - data_start);
data_start = start;
emif->state = EMIF_PGPENCRYPTED;
}
break;
case EMIF_BINHEX:
- if (inptr > (start+1) && inptr[-2] == ':') {
+ if (inptr > (start + 1) && inptr[-2] == ':') {
restore_inptr ();
- inline_filter_add_part (emif, data_start, inptr-data_start);
+ inline_filter_add_part (emif, data_start, inptr - data_start);
data_start = inptr;
emif->state = EMIF_PLAIN;
emif->found_any = TRUE;
@@ -258,7 +273,7 @@ inline_filter_scan (CamelMimeFilter *f, gchar *in, gsize len, gint final)
case EMIF_POSTSCRIPT:
if (rest_len >= 5 && strncmp (start, "%%EOF", 5) == 0) {
restore_inptr ();
- inline_filter_add_part (emif, data_start, inptr-data_start);
+ inline_filter_add_part (emif, data_start, inptr - data_start);
data_start = inptr;
emif->state = EMIF_PLAIN;
emif->found_any = TRUE;
@@ -267,7 +282,7 @@ inline_filter_scan (CamelMimeFilter *f, gchar *in, gsize len, gint final)
case EMIF_PGPSIGNED:
if (rest_len >= 27 && strncmp (start, "-----END PGP SIGNATURE-----", 27) == 0) {
restore_inptr ();
- inline_filter_add_part (emif, data_start, inptr-data_start);
+ inline_filter_add_part (emif, data_start, inptr - data_start);
data_start = inptr;
emif->state = EMIF_PLAIN;
emif->found_any = TRUE;
@@ -276,7 +291,7 @@ inline_filter_scan (CamelMimeFilter *f, gchar *in, gsize len, gint final)
case EMIF_PGPENCRYPTED:
if (rest_len >= 25 && strncmp (start, "-----END PGP MESSAGE-----", 25) == 0) {
restore_inptr ();
- inline_filter_add_part (emif, data_start, inptr-data_start);
+ inline_filter_add_part (emif, data_start, inptr - data_start);
data_start = inptr;
emif->state = EMIF_PLAIN;
emif->found_any = TRUE;
@@ -409,7 +424,8 @@ em_inline_filter_init (EMInlineFilter *emif)
* Return value:
**/
EMInlineFilter *
-em_inline_filter_new (CamelTransferEncoding base_encoding, CamelContentType *base_type)
+em_inline_filter_new (CamelTransferEncoding base_encoding,
+ CamelContentType *base_type)
{
EMInlineFilter *emif;
diff --git a/em-format/em-stripsig-filter.h b/em-format/em-stripsig-filter.h
index 5ca4491b4f..47017f79fe 100644
--- a/em-format/em-stripsig-filter.h
+++ b/em-format/em-stripsig-filter.h
@@ -52,8 +52,8 @@ typedef struct _EMStripSigFilterClass EMStripSigFilterClass;
struct _EMStripSigFilter {
CamelMimeFilter parent;
- guint32 midline:1;
- guint32 text_plain_only:1;
+ guint32 midline : 1;
+ guint32 text_plain_only : 1;
};
struct _EMStripSigFilterClass {