aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/local
diff options
context:
space:
mode:
Diffstat (limited to 'camel/providers/local')
-rw-r--r--camel/providers/local/Makefile.am3
-rw-r--r--camel/providers/local/camel-local-folder.c10
-rw-r--r--camel/providers/local/camel-local-provider.c6
-rw-r--r--camel/providers/local/camel-local-store.c6
-rw-r--r--camel/providers/local/camel-local-summary.c40
-rw-r--r--camel/providers/local/camel-maildir-summary.c14
-rw-r--r--camel/providers/local/camel-mbox-summary.c20
-rw-r--r--camel/providers/local/camel-mh-store.c16
-rw-r--r--camel/providers/local/camel-spool-store.c4
-rw-r--r--camel/providers/local/camel-spool-summary.c12
10 files changed, 68 insertions, 63 deletions
diff --git a/camel/providers/local/Makefile.am b/camel/providers/local/Makefile.am
index 05e2d171fc..f01cb7ba4f 100644
--- a/camel/providers/local/Makefile.am
+++ b/camel/providers/local/Makefile.am
@@ -15,7 +15,8 @@ INCLUDES = -I.. \
$(CAMEL_CFLAGS) \
$(GNOME_INCLUDEDIR) \
$(GTK_INCLUDEDIR) \
- -DG_LOG_DOMAIN=\"camel-local-provider\"
+ -DG_LOG_DOMAIN=\"camel-local-provider\" \
+ -DG_DISABLE_DEPRECATED
libcamellocal_la_SOURCES = \
camel-local-folder.c \
diff --git a/camel/providers/local/camel-local-folder.c b/camel/providers/local/camel-local-folder.c
index 8fd0a23e2f..c93f8b18c7 100644
--- a/camel/providers/local/camel-local-folder.c
+++ b/camel/providers/local/camel-local-folder.c
@@ -208,9 +208,9 @@ camel_local_folder_construct(CamelLocalFolder *lf, CamelStore *parent_store, con
root_dir_path = camel_local_store_get_toplevel_dir(CAMEL_LOCAL_STORE(folder->parent_store));
/* strip the trailing '/' which is always present */
- len = strlen(root_dir_path);
- tmp = alloca(len+1);
- strcpy(tmp, root_dir_path);
+ len = strlen (root_dir_path);
+ tmp = g_alloca (len + 1);
+ strcpy (tmp, root_dir_path);
if (len>1 && tmp[len-1] == '/')
tmp[len-1] = 0;
@@ -344,8 +344,8 @@ local_getv(CamelObject *object, CamelException *ex, CamelArgGetV *args)
if (tmp == NULL)
goto skip;
- path = alloca(strlen(tmp)+strlen(folder->full_name)+1);
- sprintf(path, "%s/%s", tmp, folder->full_name);
+ path = g_alloca (strlen (tmp) + strlen (folder->full_name) + 1);
+ sprintf (path, "%s/%s", tmp, folder->full_name);
if ((tmp = getenv("HOME")) && strncmp(tmp, path, strlen(tmp)) == 0)
/* $HOME relative path + protocol string */
diff --git a/camel/providers/local/camel-local-provider.c b/camel/providers/local/camel-local-provider.c
index 28158a55c1..077bc45b5f 100644
--- a/camel/providers/local/camel-local-provider.c
+++ b/camel/providers/local/camel-local-provider.c
@@ -133,16 +133,16 @@ make_can_path(char *p, char *o)
}
/* 'helper' function for it */
-#define get_can_path(p) ((p==NULL)?NULL:(make_can_path((p), alloca(strlen(p)+1))))
+#define get_can_path(p) ((p == NULL) ? NULL : (make_can_path ((p), g_alloca (strlen (p) + 1))))
static guint
local_url_hash (const void *v)
{
const CamelURL *u = v;
guint hash = 0;
-
+
#define ADD_HASH(s) if (s) hash ^= g_str_hash (s);
-
+
ADD_HASH (u->protocol);
ADD_HASH (u->user);
ADD_HASH (u->authmech);
diff --git a/camel/providers/local/camel-local-store.c b/camel/providers/local/camel-local-store.c
index a794b778f3..18226d968c 100644
--- a/camel/providers/local/camel-local-store.c
+++ b/camel/providers/local/camel-local-store.c
@@ -158,11 +158,11 @@ get_folder(CamelStore * store, const char *folder_name, guint32 flags, CamelExce
}
/* need to create the dir heirarchy */
- sub = alloca(strlen(path)+1);
- strcpy(sub, path);
+ sub = g_alloca (strlen (path) + 1);
+ strcpy (sub, path);
slash = sub;
do {
- slash = strchr(slash+1, '/');
+ slash = strchr (slash + 1, '/');
if (slash)
*slash = 0;
if (stat (sub, &st) == -1) {
diff --git a/camel/providers/local/camel-local-summary.c b/camel/providers/local/camel-local-summary.c
index 4e83224cfe..807b04e4b0 100644
--- a/camel/providers/local/camel-local-summary.c
+++ b/camel/providers/local/camel-local-summary.c
@@ -453,7 +453,8 @@ local_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMess
camel_folder_change_info_add_uid(ci, camel_message_info_uid(mi));
} else {
d(printf("Failed!\n"));
- camel_exception_set(ex, 1, _("Unable to add message to summary: unknown reason"));
+ camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("Unable to add message to summary: unknown reason"));
}
return mi;
}
@@ -475,42 +476,43 @@ local_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelMessageInfo
p = uidstr = camel_message_info_uid(mi);
while (*p && isdigit(*p))
p++;
- if (*p == 0 && sscanf(uidstr, "%u", &uid) == 1) {
- g_string_sprintf(out, "%08x-%04x", uid, mi->flags & 0xffff);
+ if (*p == 0 && sscanf (uidstr, "%u", &uid) == 1) {
+ g_string_printf (out, "%08x-%04x", uid, mi->flags & 0xffff);
} else {
- g_string_sprintf(out, "%s-%04x", uidstr, mi->flags & 0xffff);
+ g_string_printf (out, "%s-%04x", uidstr, mi->flags & 0xffff);
}
if (flag || tag) {
- val = g_string_new("");
-
+ val = g_string_new ("");
+
if (flag) {
while (flag) {
- g_string_append(val, flag->name);
+ g_string_append (val, flag->name);
if (flag->next)
- g_string_append_c(val, ',');
+ g_string_append_c (val, ',');
flag = flag->next;
}
- header_set_param(&params, "flags", val->str);
- g_string_truncate(val, 0);
+ header_set_param (&params, "flags", val->str);
+ g_string_truncate (val, 0);
}
if (tag) {
while (tag) {
- g_string_append(val, tag->name);
- g_string_append_c(val, '=');
- g_string_append(val, tag->value);
+ g_string_append (val, tag->name);
+ g_string_append_c (val, '=');
+ g_string_append (val, tag->value);
if (tag->next)
- g_string_append_c(val, ',');
+ g_string_append_c (val, ',');
tag = tag->next;
}
- header_set_param(&params, "tags", val->str);
+ header_set_param (&params, "tags", val->str);
}
- g_string_free(val, TRUE);
- header_param_list_format_append(out, params);
- header_param_list_free(params);
+ g_string_free (val, TRUE);
+ header_param_list_format_append (out, params);
+ header_param_list_free (params);
}
ret = out->str;
- g_string_free(out, FALSE);
+ g_string_free (out, FALSE);
+
return ret;
}
diff --git a/camel/providers/local/camel-maildir-summary.c b/camel/providers/local/camel-maildir-summary.c
index ea3c1b8dbf..2075694f63 100644
--- a/camel/providers/local/camel-maildir-summary.c
+++ b/camel/providers/local/camel-maildir-summary.c
@@ -177,19 +177,19 @@ static struct {
/* convert the uid + flags into a unique:info maildir format */
char *camel_maildir_summary_info_to_name(const CamelMessageInfo *info)
{
+ const char *uid;
char *p, *buf;
int i;
- const char *uid;
-
- uid = camel_message_info_uid(info);
- buf = alloca(strlen(uid) + strlen(":2,") + (sizeof(flagbits)/sizeof(flagbits[0])) + 1);
- p = buf + sprintf(buf, "%s:2,", uid);
- for (i=0;i<sizeof(flagbits)/sizeof(flagbits[0]);i++) {
+
+ uid = camel_message_info_uid (info);
+ buf = g_alloca (strlen (uid) + strlen (":2,") + (sizeof (flagbits) / sizeof (flagbits[0])) + 1);
+ p = buf + sprintf (buf, "%s:2,", uid);
+ for (i = 0; i < sizeof (flagbits) / sizeof (flagbits[0]); i++) {
if (info->flags & flagbits[i].flagbit)
*p++ = flagbits[i].flag;
}
*p = 0;
-
+
return g_strdup(buf);
}
diff --git a/camel/providers/local/camel-mbox-summary.c b/camel/providers/local/camel-mbox-summary.c
index 5b001c0977..41ebe28fa6 100644
--- a/camel/providers/local/camel-mbox-summary.c
+++ b/camel/providers/local/camel-mbox-summary.c
@@ -561,14 +561,16 @@ camel_mbox_summary_build_from(struct _header_raw *header)
/* a pseudo, but still bogus attempt at thread safing the function */
/*memcpy(&tm, gmtime(&thetime), sizeof(tm));*/
- gmtime_r(&thetime, &tm);
-
- g_string_sprintfa(out, " %s %s %2d %02d:%02d:%02d %4d\n",
- tz_days[tm.tm_wday],
- tz_months[tm.tm_mon], tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_year + 1900);
-
+ gmtime_r (&thetime, &tm);
+
+ g_string_append_printf (out, " %s %s %2d %02d:%02d:%02d %4d\n",
+ tz_days[tm.tm_wday], tz_months[tm.tm_mon],
+ tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec,
+ tm.tm_year + 1900);
+
ret = out->str;
- g_string_free(out, FALSE);
+ g_string_free (out, FALSE);
+
return ret;
}
@@ -594,8 +596,8 @@ mbox_summary_sync_full(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChang
return -1;
}
- tmpname = alloca(strlen (cls->folder_path) + 5);
- sprintf(tmpname, "%s.tmp", cls->folder_path);
+ tmpname = g_alloca (strlen (cls->folder_path) + 5);
+ sprintf (tmpname, "%s.tmp", cls->folder_path);
d(printf("Writing tmp file to %s\n", tmpname));
fdout = open(tmpname, O_WRONLY|O_CREAT|O_TRUNC, 0600);
if (fdout == -1) {
diff --git a/camel/providers/local/camel-mh-store.c b/camel/providers/local/camel-mh-store.c
index 7fe68ef4b5..73a3d2046f 100644
--- a/camel/providers/local/camel-mh-store.c
+++ b/camel/providers/local/camel-mh-store.c
@@ -114,15 +114,15 @@ folders_update(const char *root, const char *folder, int mode)
char *tmp, *tmpnew, *line = NULL;
CamelStream *stream, *in = NULL, *out = NULL;
- tmpnew = alloca(strlen(root)+16);
- sprintf(tmpnew, "%s.folders~", root);
+ tmpnew = g_alloca (strlen (root) + 16);
+ sprintf (tmpnew, "%s.folders~", root);
out = camel_stream_fs_new_with_name(tmpnew, O_WRONLY|O_CREAT|O_TRUNC, 0666);
if (out == NULL)
goto fail;
- tmp = alloca(strlen(root)+16);
- sprintf(tmp, "%s.folders", root);
+ tmp = g_alloca (strlen (root) + 16);
+ sprintf (tmp, "%s.folders", root);
stream = camel_stream_fs_new_with_name(tmp, O_RDONLY, 0);
if (stream) {
in = camel_stream_buffer_new(stream, CAMEL_STREAM_BUFFER_READ);
@@ -338,8 +338,8 @@ static void recursive_scan(CamelStore *store, CamelFolderInfo **fip, CamelFolder
/* Open the specified directory. */
if (path[0]) {
- fullpath = alloca(strlen(root)+strlen(path)+2);
- sprintf(fullpath, "%s/%s", root, path);
+ fullpath = alloca (strlen (root) + strlen (path) + 2);
+ sprintf (fullpath, "%s/%s", root, path);
} else
fullpath = (char *)root;
@@ -407,8 +407,8 @@ folders_scan(CamelStore *store, const char *root, const char *top, CamelFolderIn
GHashTable *visited;
int len;
- tmp = alloca(strlen(root)+16);
- sprintf(tmp, "%s/.folders", root);
+ tmp = g_alloca (strlen (root) + 16);
+ sprintf (tmp, "%s/.folders", root);
stream = camel_stream_fs_new_with_name(tmp, 0, O_RDONLY);
if (stream == NULL)
return;
diff --git a/camel/providers/local/camel-spool-store.c b/camel/providers/local/camel-spool-store.c
index 9419d897a8..c8d76f8a63 100644
--- a/camel/providers/local/camel-spool-store.c
+++ b/camel/providers/local/camel-spool-store.c
@@ -273,8 +273,8 @@ static int scan_dir(CamelStore *store, GHashTable *visited, char *root, const ch
/* look for folders matching the right structure, recursively */
if (path) {
- name = alloca(strlen(root)+strlen(path)+2);
- sprintf(name, "%s/%s", root, path);
+ name = g_alloca (strlen (root) + strlen (path) + 2);
+ sprintf (name, "%s/%s", root, path);
} else
name = root;
diff --git a/camel/providers/local/camel-spool-summary.c b/camel/providers/local/camel-spool-summary.c
index d71c75eaf8..d914af87e2 100644
--- a/camel/providers/local/camel-spool-summary.c
+++ b/camel/providers/local/camel-spool-summary.c
@@ -155,14 +155,14 @@ spool_summary_sync_full(CamelMboxSummary *cls, gboolean expunge, CamelFolderChan
}
#ifdef HAVE_MKSTEMP
- tmpname = alloca(64);
- sprintf(tmpname, "/tmp/spool.camel.XXXXXX");
- fdout = mkstemp(tmpname);
+ tmpname = alloca (64);
+ sprintf (tmpname, "/tmp/spool.camel.XXXXXX");
+ fdout = mkstemp (tmpname);
#else
#warning "Your system has no mkstemp(3), spool updating may be insecure"
- tmpname = alloca(L_tmpnam);
- tmpnam(tmpname);
- fdout = open(tmpname, O_RDWR|O_CREAT|O_EXCL, 0600);
+ tmpname = alloca (L_tmpnam);
+ tmpnam (tmpname);
+ fdout = open (tmpname, O_RDWR|O_CREAT|O_EXCL, 0600);
#endif
d(printf("Writing tmp file to %s\n", tmpname));
if (fdout == -1) {