Replace calls to g_string_sprintfa() with g_string_append_printf() since

2002-12-17  Jeffrey Stedfast  <fejj@ximian.com>

	* providers/imap/camel-imap-utils.c: Replace calls to
	g_string_sprintfa() with g_string_append_printf() since the former
	seems to have been deprecated.

	* providers/imap/camel-imap-search.c: Same.

	* providers/imap/camel-imap-folder.c: Here too.

	* providers/local/camel-mbox-summary.c: And here.

	* providers/local/camel-local-summary.c: Replace
	g_string_sprintf() with g_string_printf().

	* camel-data-cache.c (data_cache_expire): Replace
	g_string_sprintf() with g_string_printf().

	* camel-url.c: Replace calls to g_string_sprintfa() with
	g_string_append_printf() since the former seems to have been
	deprecated.

	* camel-service.c: Same.

	* camel-mime-utils.c: Here too.

svn path=/trunk/; revision=19154
This commit is contained in:
Jeffrey Stedfast
2002-12-17 21:46:44 +00:00
committed by Jeffrey Stedfast
parent 5c90cbb6e1
commit a84f11d6bd
20 changed files with 141 additions and 117 deletions

View File

@ -1,5 +1,21 @@
2002-12-17 Jeffrey Stedfast <fejj@ximian.com>
* providers/imap/camel-imap-utils.c: Replace calls to
g_string_sprintfa() with g_string_append_printf() since the former
seems to have been deprecated.
* providers/imap/camel-imap-search.c: Same.
* providers/imap/camel-imap-folder.c: Here too.
* providers/local/camel-mbox-summary.c: And here.
* providers/local/camel-local-summary.c: Replace
g_string_sprintf() with g_string_printf().
* camel-data-cache.c (data_cache_expire): Replace
g_string_sprintf() with g_string_printf().
* camel-url.c: Replace calls to g_string_sprintfa() with
g_string_append_printf() since the former seems to have been
deprecated.

View File

@ -15,6 +15,7 @@ INCLUDES = -I.. -I$(srcdir)/.. \
-DCAMEL_SBINDIR=\""$(sbindir)"\" \
-DCAMEL_PROVIDERDIR=\""$(camel_providerdir)"\" \
-DG_LOG_DOMAIN=\"camel\" \
-DG_DISABLE_DEPRECATED \
$(CAMEL_CFLAGS)
libcamel_la_SOURCES = \

View File

@ -208,8 +208,8 @@ data_cache_expire(CamelDataCache *cdc, const char *path, const char *keep, time_
while ( (d = readdir(dir)) ) {
if (strcmp(d->d_name, keep) == 0)
continue;
g_string_sprintf(s, "%s/%s", path, d->d_name);
g_string_printf (s, "%s/%s", path, d->d_name);
dd(printf("Checking '%s' for expiry\n", s->str));
if (stat(s->str, &st) == 0
&& S_ISREG(st.st_mode)

View File

@ -15,7 +15,8 @@ INCLUDES = -I.. \
$(CAMEL_CFLAGS) \
$(GNOME_INCLUDEDIR) \
$(GTK_INCLUDEDIR) \
-DG_LOG_DOMAIN=\"camel-imap-provider\"
-DG_LOG_DOMAIN=\"camel-imap-provider\" \
-DG_DISABLE_DEPRECATED
libcamelimap_la_SOURCES = \
camel-imap-command.c \

View File

@ -23,6 +23,7 @@
* USA
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@ -689,7 +690,7 @@ get_matching (CamelFolder *folder, guint32 flags, guint32 mask, char **set)
if (range != -1) {
if (range != i - 1) {
info = matches->pdata[matches->len - 1];
g_string_sprintfa (gset, ":%s", camel_message_info_uid (info));
g_string_append_printf (gset, ":%s", camel_message_info_uid (info));
}
range = -1;
}
@ -702,12 +703,12 @@ get_matching (CamelFolder *folder, guint32 flags, guint32 mask, char **set)
range = i;
if (gset->len)
g_string_append_c (gset, ',');
g_string_sprintfa (gset, "%s", camel_message_info_uid (info));
g_string_append_printf (gset, "%s", camel_message_info_uid (info));
}
if (range != -1 && range != max - 1) {
info = matches->pdata[matches->len - 1];
g_string_sprintfa (gset, ":%s", camel_message_info_uid (info));
g_string_append_printf (gset, ":%s", camel_message_info_uid (info));
}
if (matches->len) {
@ -1720,7 +1721,7 @@ get_content (CamelImapFolder *imap_folder, const char *uid,
/* we assume that part->content_type is more accurate/full than ci->type */
camel_data_wrapper_set_mime_type_field (CAMEL_DATA_WRAPPER (body_mp), part->content_type);
spec = alloca (strlen (part_spec) + 6);
spec = g_alloca (strlen (part_spec) + 6);
sprintf (spec, part_spec[0] ? "%s.TEXT" : "TEXT", part_spec);
g_free (part_spec);

View File

@ -312,35 +312,35 @@ sync_match(CamelImapSearch *is, struct _match_record *mr)
struct _camel_search_words *words;
GString *search;
int i;
if (mr->lastuid >= is->lastuid && mr->validity == is->validity)
return 0;
d(printf("updating match record for uid's %d:%d\n", mr->lastuid+1, is->lastuid));
d(printf ("updating match record for uid's %d:%d\n", mr->lastuid+1, is->lastuid));
/* TODO: Handle multiple search terms */
/* This handles multiple search words within a single term */
words = camel_search_words_split(mr->terms[0]);
search = g_string_new("");
g_string_sprintfa(search, "UID %d:%d", mr->lastuid+1, is->lastuid);
for (i=0;i<words->len;i++) {
words = camel_search_words_split (mr->terms[0]);
search = g_string_new ("");
g_string_append_printf (search, "UID %d:%d", mr->lastuid + 1, is->lastuid);
for (i = 0; i < words->len; i++) {
char *w = words->words[i]->word, c;
g_string_sprintfa(search, " BODY \"");
g_string_append_printf (search, " BODY \"");
while ((c = *w++)) {
if (c == '\\' || c == '"')
g_string_append_c(search, '\\');
g_string_append_c(search, c);
g_string_append_c (search, '\\');
g_string_append_c (search, c);
}
g_string_append_c(search, '"');
g_string_append_c (search, '"');
}
camel_search_words_free(words);
camel_search_words_free (words);
/* We only try search using utf8 if its non us-ascii text? */
if ((words->type & CAMEL_SEARCH_WORD_8BIT) && (store->capabilities & IMAP_CAPABILITY_utf8_search)) {
response = camel_imap_command(store, folder, NULL,
"UID SEARCH CHARSET UTF-8 %s", search->str);
response = camel_imap_command (store, folder, NULL,
"UID SEARCH CHARSET UTF-8 %s", search->str);
/* We can't actually tell if we got a NO response, so assume always */
if (response == NULL)
store->capabilities &= ~IMAP_CAPABILITY_utf8_search;

View File

@ -20,6 +20,7 @@
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@ -30,10 +31,6 @@
#include <time.h>
#include <errno.h>
#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#endif
#include "camel-imap-utils.h"
#include "camel-imap-summary.h"
#include "camel-imap-store.h"
@ -1010,17 +1007,17 @@ imap_uid_array_to_set (CamelFolderSummary *summary, GPtrArray *uids, int uid, ss
range = TRUE;
else {
if (range) {
g_string_sprintfa (gset, ":%lu", last_uid);
g_string_append_printf (gset, ":%lu", last_uid);
range = FALSE;
}
g_string_sprintfa (gset, ",%lu", this_uid);
g_string_append_printf (gset, ",%lu", this_uid);
}
last_uid = this_uid;
}
if (range)
g_string_sprintfa (gset, ":%lu", last_uid);
g_string_append_printf (gset, ":%lu", last_uid);
*lastuid = uid;
@ -1136,21 +1133,21 @@ imap_mailbox_encode (const unsigned char *in, size_t inlen)
{
char *buf;
buf = alloca(inlen+1);
memcpy(buf, in, inlen);
buf = g_alloca (inlen + 1);
memcpy (buf, in, inlen);
buf[inlen] = 0;
return camel_utf8_utf7(buf);
return camel_utf8_utf7 (buf);
}
char *
imap_mailbox_decode (const unsigned char *in, size_t inlen)
{
char *buf;
buf = alloca(inlen+1);
memcpy(buf, in, inlen);
buf = g_alloca (inlen + 1);
memcpy (buf, in, inlen);
buf[inlen] = 0;
return camel_utf7_utf8(buf);
return camel_utf7_utf8 (buf);
}

View File

@ -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 \

View File

@ -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 */

View File

@ -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);

View File

@ -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) {

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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) {

View File

@ -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;

View File

@ -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;

View File

@ -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) {

View File

@ -14,7 +14,8 @@ INCLUDES = -I../.. \
$(CAMEL_CFLAGS) \
$(GNOME_INCLUDEDIR) \
$(GTK_INCLUDEDIR) \
-DG_LOG_DOMAIN=\"camel-nntp-provider\"
-DG_LOG_DOMAIN=\"camel-nntp-provider\" \
-DG_DISABLE_DEPRECATED
libcamelnntp_la_SOURCES = \
camel-nntp-provider.c \

View File

@ -16,7 +16,8 @@ INCLUDES = \
$(CAMEL_CFLAGS) \
$(GNOME_INCLUDEDIR) \
$(GTK_INCLUDEDIR) \
-DG_LOG_DOMAIN=\"camel-pop3-provider\"
-DG_LOG_DOMAIN=\"camel-pop3-provider\" \
-DG_DISABLE_DEPRECATED
libcamelpop3_la_SOURCES = \
camel-pop3-engine.c \

View File

@ -5,17 +5,18 @@ libcamelsendmailincludedir = $(includedir)/camel
camel_provider_LTLIBRARIES = libcamelsendmail.la
camel_provider_DATA = libcamelsendmail.urls
INCLUDES = \
-I.. \
-I$(srcdir)/.. \
-I$(srcdir)/../../.. \
-I$(includedir) \
-I$(top_srcdir)/intl \
-I$(top_srcdir)/camel \
$(CAMEL_CFLAGS) \
$(GNOME_INCLUDEDIR) \
$(GTK_INCLUDEDIR) \
-DG_LOG_DOMAIN=\"camel-sendmail-provider\"
INCLUDES = \
-I.. \
-I$(srcdir)/.. \
-I$(srcdir)/../../.. \
-I$(includedir) \
-I$(top_srcdir)/intl \
-I$(top_srcdir)/camel \
$(CAMEL_CFLAGS) \
$(GNOME_INCLUDEDIR) \
$(GTK_INCLUDEDIR) \
-DG_LOG_DOMAIN=\"camel-sendmail-provider\" \
-DG_DISABLE_DEPRECATED
libcamelsendmail_la_SOURCES = \
camel-sendmail-provider.c \