aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-format.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-05-27 23:13:25 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-05-29 00:13:23 +0800
commitfad4af8a3d4c6f50f7bcceca8d545eb17d6fd056 (patch)
treeae78be371695c3dc18847b87d3f014f985aa3a40 /mail/em-format.c
parent6f5464f34ceec9e5701e3e3e651a40f9e6b3a072 (diff)
downloadgsoc2013-evolution-fad4af8a3d4c6f50f7bcceca8d545eb17d6fd056.tar.gz
gsoc2013-evolution-fad4af8a3d4c6f50f7bcceca8d545eb17d6fd056.tar.zst
gsoc2013-evolution-fad4af8a3d4c6f50f7bcceca8d545eb17d6fd056.zip
Prefer GLib basic types over C types.
Diffstat (limited to 'mail/em-format.c')
-rw-r--r--mail/em-format.c104
1 files changed, 52 insertions, 52 deletions
diff --git a/mail/em-format.c b/mail/em-format.c
index 6b12fedae4..85459682ad 100644
--- a/mail/em-format.c
+++ b/mail/em-format.c
@@ -65,9 +65,9 @@ struct _EMFormatCache {
struct _CamelCipherValidity *valid; /* validity copy */
struct _CamelMimePart *secured; /* encrypted subpart */
- unsigned int state:2; /* inline state */
+ guint state:2; /* inline state */
- char partid[1];
+ gchar partid[1];
};
#define INLINE_UNSET (0)
@@ -76,8 +76,8 @@ struct _EMFormatCache {
static void emf_builtin_init(EMFormatClass *);
-static const EMFormatHandler *emf_find_handler(EMFormat *emf, const char *mime_type);
-static void emf_format_clone(EMFormat *emf, CamelFolder *folder, const char *uid, CamelMimeMessage *msg, EMFormat *emfsource);
+static const EMFormatHandler *emf_find_handler(EMFormat *emf, const gchar *mime_type);
+static void emf_format_clone(EMFormat *emf, CamelFolder *folder, const gchar *uid, CamelMimeMessage *msg, EMFormat *emfsource);
static void emf_format_secure(EMFormat *emf, CamelStream *stream, CamelMimePart *part, CamelCipherValidity *valid);
static gboolean emf_busy(EMFormat *emf);
enum {
@@ -101,7 +101,7 @@ emf_free_cache(struct _EMFormatCache *efc)
}
static struct _EMFormatCache *
-emf_insert_cache(EMFormat *emf, const char *partid)
+emf_insert_cache(EMFormat *emf, const gchar *partid)
{
struct _EMFormatCache *new;
@@ -297,7 +297,7 @@ em_format_class_remove_handler(EMFormatClass *emfc, EMFormatHandler *info)
* Return value: NULL if no handler is available.
**/
static const EMFormatHandler *
-emf_find_handler(EMFormat *emf, const char *mime_type)
+emf_find_handler(EMFormat *emf, const gchar *mime_type)
{
EMFormatClass *emfc = (EMFormatClass *)G_OBJECT_GET_CLASS(emf);
@@ -316,13 +316,13 @@ emf_find_handler(EMFormat *emf, const char *mime_type)
* Return value:
**/
const EMFormatHandler *
-em_format_fallback_handler(EMFormat *emf, const char *mime_type)
+em_format_fallback_handler(EMFormat *emf, const gchar *mime_type)
{
- char *mime, *s;
+ gchar *mime, *s;
s = strchr(mime_type, '/');
if (s == NULL)
- mime = (char *)mime_type;
+ mime = (gchar *)mime_type;
else {
size_t len = (s-mime_type)+1;
@@ -359,10 +359,10 @@ em_format_fallback_handler(EMFormat *emf, const char *mime_type)
* are resolved by forgetting the old PURI in the global index.
**/
EMFormatPURI *
-em_format_add_puri(EMFormat *emf, size_t size, const char *cid, CamelMimePart *part, EMFormatPURIFunc func)
+em_format_add_puri(EMFormat *emf, size_t size, const gchar *cid, CamelMimePart *part, EMFormatPURIFunc func)
{
EMFormatPURI *puri;
- const char *tmp;
+ const gchar *tmp;
d(printf("adding puri for part: %s\n", emf->part_id->str));
@@ -479,7 +479,7 @@ em_format_pull_level(EMFormat *emf)
* Return value:
**/
EMFormatPURI *
-em_format_find_visible_puri(EMFormat *emf, const char *uri)
+em_format_find_visible_puri(EMFormat *emf, const gchar *uri)
{
EMFormatPURI *pw;
struct _EMFormatPURITree *ptree;
@@ -513,7 +513,7 @@ em_format_find_visible_puri(EMFormat *emf, const char *uri)
**/
EMFormatPURI *
-em_format_find_puri(EMFormat *emf, const char *uri)
+em_format_find_puri(EMFormat *emf, const gchar *uri)
{
return g_hash_table_lookup(emf->pending_uri_table, uri);
}
@@ -582,12 +582,12 @@ em_format_clear_puri_tree(EMFormat *emf)
/* use mime_type == NULL to force showing as application/octet-stream */
void
-em_format_part_as(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const char *mime_type)
+em_format_part_as(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const gchar *mime_type)
{
const EMFormatHandler *handle = NULL;
- const char *snoop_save = emf->snoop_mime_type, *tmp;
+ const gchar *snoop_save = emf->snoop_mime_type, *tmp;
CamelURL *base_save = emf->base, *base = NULL;
- char *basestr = NULL;
+ gchar *basestr = NULL;
d(printf("format_part_as()\n"));
@@ -645,7 +645,7 @@ finish:
void
em_format_part(EMFormat *emf, CamelStream *stream, CamelMimePart *part)
{
- char *mime_type;
+ gchar *mime_type;
CamelDataWrapper *dw;
dw = camel_medium_get_content_object((CamelMedium *)part);
@@ -659,7 +659,7 @@ em_format_part(EMFormat *emf, CamelStream *stream, CamelMimePart *part)
}
static void
-emf_clone_inlines(void *key, void *val, void *data)
+emf_clone_inlines(gpointer key, gpointer val, gpointer data)
{
struct _EMFormatCache *emfc = val, *new;
@@ -672,7 +672,7 @@ emf_clone_inlines(void *key, void *val, void *data)
}
static void
-emf_format_clone(EMFormat *emf, CamelFolder *folder, const char *uid, CamelMimeMessage *msg, EMFormat *emfsource)
+emf_format_clone(EMFormat *emf, CamelFolder *folder, const gchar *uid, CamelMimeMessage *msg, EMFormat *emfsource)
{
em_format_clear_puri_tree(emf);
@@ -729,7 +729,7 @@ static void
emf_format_secure(EMFormat *emf, CamelStream *stream, CamelMimePart *part, CamelCipherValidity *valid)
{
CamelCipherValidity *save = emf->valid_parent;
- int len;
+ gint len;
/* Note that this also requires support from higher up in the class chain
- validity needs to be cleared when you start output
@@ -861,7 +861,7 @@ em_format_set_mode(EMFormat *emf, em_format_mode_t type)
* required.
**/
void
-em_format_set_charset(EMFormat *emf, const char *charset)
+em_format_set_charset(EMFormat *emf, const gchar *charset)
{
if ((emf->charset && charset && g_ascii_strcasecmp(emf->charset, charset) == 0)
|| (emf->charset == NULL && charset == NULL)
@@ -885,7 +885,7 @@ em_format_set_charset(EMFormat *emf, const char *charset)
* when it isn't).
**/
void
-em_format_set_default_charset(EMFormat *emf, const char *charset)
+em_format_set_default_charset(EMFormat *emf, const gchar *charset)
{
if ((emf->default_charset && charset && g_ascii_strcasecmp(emf->default_charset, charset) == 0)
|| (emf->default_charset == NULL && charset == NULL)
@@ -917,7 +917,7 @@ em_format_clear_headers(EMFormat *emf)
/* note: also copied in em-mailer-prefs.c */
static const struct {
- const char *name;
+ const gchar *name;
guint32 flags;
} default_headers[] = {
{ N_("From"), EM_FORMAT_HEADER_BOLD },
@@ -942,7 +942,7 @@ static const struct {
void
em_format_default_headers(EMFormat *emf)
{
- int i;
+ gint i;
em_format_clear_headers(emf);
for (i=0; i<sizeof(default_headers)/sizeof(default_headers[0]); i++)
@@ -960,7 +960,7 @@ em_format_default_headers(EMFormat *emf)
* headers included in this list will be shown using special
* formatting routines.
**/
-void em_format_add_header(EMFormat *emf, const char *name, guint32 flags)
+void em_format_add_header(EMFormat *emf, const gchar *name, guint32 flags)
{
EMFormatHeader *h;
@@ -986,7 +986,7 @@ void em_format_add_header(EMFormat *emf, const char *name, guint32 flags)
*
* Return value: TRUE/FALSE
**/
-int em_format_is_attachment(EMFormat *emf, CamelMimePart *part)
+gint em_format_is_attachment(EMFormat *emf, CamelMimePart *part)
{
/*CamelContentType *ct = camel_mime_part_get_content_type(part);*/
CamelDataWrapper *dw = camel_medium_get_content_object((CamelMedium *)part);
@@ -1021,10 +1021,10 @@ int em_format_is_attachment(EMFormat *emf, CamelMimePart *part)
*
* Return value:
**/
-int em_format_is_inline(EMFormat *emf, const char *partid, CamelMimePart *part, const EMFormatHandler *handle)
+gint em_format_is_inline(EMFormat *emf, const gchar *partid, CamelMimePart *part, const EMFormatHandler *handle)
{
struct _EMFormatCache *emfc;
- const char *tmp;
+ const gchar *tmp;
if (handle == NULL)
return FALSE;
@@ -1055,7 +1055,7 @@ int em_format_is_inline(EMFormat *emf, const char *partid, CamelMimePart *part,
* @state. This is used only to record the change for a redraw or
* cloned layout render and does not force a redraw.
**/
-void em_format_set_inline(EMFormat *emf, const char *partid, int state)
+void em_format_set_inline(EMFormat *emf, const gchar *partid, gint state)
{
struct _EMFormatCache *emfc;
@@ -1071,10 +1071,10 @@ void em_format_set_inline(EMFormat *emf, const char *partid, int state)
em_format_redraw(emf);
}
-void em_format_format_error(EMFormat *emf, CamelStream *stream, const char *fmt, ...)
+void em_format_format_error(EMFormat *emf, CamelStream *stream, const gchar *fmt, ...)
{
va_list ap;
- char *txt;
+ gchar *txt;
va_start(ap, fmt);
txt = g_strdup_vprintf(fmt, ap);
@@ -1118,7 +1118,7 @@ em_format_format_text(EMFormat *emf, CamelStream *stream, CamelDataWrapper *dw)
{
CamelStreamFilter *filter_stream;
CamelMimeFilterCharset *filter;
- const char *charset = NULL;
+ const gchar *charset = NULL;
CamelMimeFilterWindows *windows = NULL;
CamelStream *mem_stream = NULL;
size_t size;
@@ -1187,12 +1187,12 @@ em_format_format_text(EMFormat *emf, CamelStream *stream, CamelDataWrapper *dw)
*
* Return value:
**/
-char *
-em_format_describe_part(CamelMimePart *part, const char *mime_type)
+gchar *
+em_format_describe_part(CamelMimePart *part, const gchar *mime_type)
{
GString *stext;
- const char *filename, *description;
- char *content_type, *desc;
+ const gchar *filename, *description;
+ gchar *content_type, *desc;
stext = g_string_new("");
content_type = g_content_type_from_mime_type (mime_type);
@@ -1260,7 +1260,7 @@ emf_multipart_appledouble(EMFormat *emf, CamelStream *stream, CamelMimePart *par
{
CamelMultipart *mp = (CamelMultipart *)camel_medium_get_content_object((CamelMedium *)part);
CamelMimePart *mime_part;
- int len;
+ gint len;
if (!CAMEL_IS_MULTIPART(mp)) {
em_format_format_source(emf, stream, part);
@@ -1284,7 +1284,7 @@ static void
emf_multipart_mixed(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info)
{
CamelMultipart *mp = (CamelMultipart *)camel_medium_get_content_object((CamelMedium *)part);
- int i, nparts, len;
+ gint i, nparts, len;
if (!CAMEL_IS_MULTIPART(mp)) {
em_format_format_source(emf, stream, part);
@@ -1306,7 +1306,7 @@ static void
emf_multipart_alternative(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info)
{
CamelMultipart *mp = (CamelMultipart *)camel_medium_get_content_object((CamelMedium *)part);
- int i, nparts, bestid = 0;
+ gint i, nparts, bestid = 0;
CamelMimePart *best = NULL;
if (!CAMEL_IS_MULTIPART(mp)) {
@@ -1318,7 +1318,7 @@ emf_multipart_alternative(EMFormat *emf, CamelStream *stream, CamelMimePart *par
nparts = camel_multipart_get_number(mp);
for (i = 0; i < nparts; i++) {
CamelContentType *type;
- char *mime_type;
+ gchar *mime_type;
/* is it correct to use the passed in *part here? */
part = camel_multipart_get_part(mp, i);
@@ -1344,7 +1344,7 @@ emf_multipart_alternative(EMFormat *emf, CamelStream *stream, CamelMimePart *par
}
if (best) {
- int len = emf->part_id->len;
+ gint len = emf->part_id->len;
g_string_append_printf(emf->part_id, ".alternative.%d", bestid);
em_format_part(emf, stream, best);
@@ -1358,7 +1358,7 @@ emf_multipart_encrypted(EMFormat *emf, CamelStream *stream, CamelMimePart *part,
{
CamelCipherContext *context;
CamelException *ex;
- const char *protocol;
+ const gchar *protocol;
CamelMimePart *opart;
CamelCipherValidity *valid;
CamelMultipartEncrypted *mpe;
@@ -1425,9 +1425,9 @@ emf_multipart_related(EMFormat *emf, CamelStream *stream, CamelMimePart *part, c
CamelMultipart *mp = (CamelMultipart *)camel_medium_get_content_object((CamelMedium *)part);
CamelMimePart *body_part, *display_part = NULL;
CamelContentType *content_type;
- const char *start;
- int i, nparts, partidlen, displayid = 0;
- char *oldpartid;
+ const gchar *start;
+ gint i, nparts, partidlen, displayid = 0;
+ gchar *oldpartid;
struct _EMFormatPURITree *ptree;
EMFormatPURI *puri, *purin;
@@ -1441,8 +1441,8 @@ emf_multipart_related(EMFormat *emf, CamelStream *stream, CamelMimePart *part, c
content_type = camel_mime_part_get_content_type(part);
start = camel_content_type_param (content_type, "start");
if (start && strlen(start)>2) {
- int len;
- const char *cid;
+ gint len;
+ const gchar *cid;
/* strip <>'s */
len = strlen (start) - 2;
@@ -1581,7 +1581,7 @@ emf_message_rfc822(EMFormat *emf, CamelStream *stream, CamelMimePart *part, cons
{
CamelDataWrapper *dw = camel_medium_get_content_object((CamelMedium *)part);
const EMFormatHandler *handle;
- int len;
+ gint len;
if (!CAMEL_IS_MIME_MESSAGE(dw)) {
em_format_format_source(emf, stream, part);
@@ -1616,7 +1616,7 @@ emf_inlinepgp_signed(EMFormat *emf, CamelStream *stream, CamelMimePart *ipart, E
CamelMimePart *opart;
CamelStream *ostream;
CamelException *ex;
- char *type;
+ gchar *type;
if (!ipart) {
em_format_format_error(emf, stream, _("Unknown error verifying signature"));
@@ -1694,7 +1694,7 @@ emf_inlinepgp_encrypted(EMFormat *emf, CamelStream *stream, CamelMimePart *ipart
CamelException *ex;
CamelMimePart *opart;
CamelDataWrapper *dw;
- char *mime_type;
+ gchar *mime_type;
cipher = camel_gpg_context_new(emf->session);
ex = camel_exception_new();
@@ -1718,7 +1718,7 @@ emf_inlinepgp_encrypted(EMFormat *emf, CamelStream *stream, CamelMimePart *ipart
/* this ensures to show the 'opart' as inlined, if possible */
if (mime_type && g_ascii_strcasecmp (mime_type, "application/octet-stream") == 0) {
- const char *snoop = em_utils_snoop_type (opart);
+ const gchar *snoop = em_utils_snoop_type (opart);
if (snoop)
camel_data_wrapper_set_mime_type (dw, snoop);
@@ -1764,7 +1764,7 @@ static EMFormatHandler type_builtin_table[] = {
static void
emf_builtin_init(EMFormatClass *klass)
{
- int i;
+ gint i;
for (i=0;i<sizeof(type_builtin_table)/sizeof(type_builtin_table[0]);i++)
g_hash_table_insert(klass->type_handlers, (gpointer) type_builtin_table[i].mime_type, &type_builtin_table[i]);