aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--camel/ChangeLog10
-rw-r--r--camel/camel-mime-utils.c94
-rw-r--r--camel/camel-service.c34
-rw-r--r--camel/camel-url.c34
4 files changed, 92 insertions, 80 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index a811acd7cc..e9d1c2e18b 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,13 @@
+2002-12-17 Jeffrey Stedfast <fejj@ximian.com>
+
+ * 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.
+
2002-12-16 Jeffrey Stedfast <fejj@ximian.com>
* camel-mime-part-utils.c
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c
index 8c81074e5b..83120e35a8 100644
--- a/camel/camel-mime-utils.c
+++ b/camel/camel-mime-utils.c
@@ -3000,7 +3000,7 @@ header_encode_param (const unsigned char *in, gboolean *encoded)
/* FIXME: set the 'language' as well, assuming we can get that info...? */
out = g_string_new ("");
- g_string_sprintfa (out, "%s''", charset);
+ g_string_append_printf (out, "%s''", charset);
while (inptr < inend) {
unsigned char c = *inptr++;
@@ -3008,9 +3008,9 @@ header_encode_param (const unsigned char *in, gboolean *encoded)
/* FIXME: make sure that '\'', '*', and ';' are also encoded */
if (c > 127) {
- g_string_sprintfa (out, "%%%c%c", tohex[(c >> 4) & 0xf], tohex[c & 0xf]);
+ g_string_append_printf (out, "%%%c%c", tohex[(c >> 4) & 0xf], tohex[c & 0xf]);
} else if (is_lwsp (c) || !(camel_mime_special_table[c] & IS_ESAFE)) {
- g_string_sprintfa (out, "%%%c%c", tohex[(c >> 4) & 0xf], tohex[c & 0xf]);
+ g_string_append_printf (out, "%%%c%c", tohex[(c >> 4) & 0xf], tohex[c & 0xf]);
} else {
g_string_append_c (out, c);
}
@@ -3097,7 +3097,7 @@ header_param_list_format_append (GString *out, struct _header_param *p)
used = 0;
}
- g_string_sprintfa (out, "%s*%d%s=", p->name, i++, encoded ? "*" : "");
+ g_string_append_printf (out, "%s*%d%s=", p->name, i++, encoded ? "*" : "");
if (encoded || !quote)
g_string_append_len (out, inptr, ptr - inptr);
else
@@ -3110,7 +3110,7 @@ header_param_list_format_append (GString *out, struct _header_param *p)
inptr = ptr;
}
} else {
- g_string_sprintfa (out, "%s%s=", p->name, encoded ? "*" : "");
+ g_string_append_printf (out, "%s%s=", p->name, encoded ? "*" : "");
if (encoded || !quote)
g_string_append (out, value);
@@ -3196,31 +3196,32 @@ header_content_type_dump(struct _header_content_type *ct)
}
char *
-header_content_type_format(struct _header_content_type *ct)
+header_content_type_format (struct _header_content_type *ct)
{
GString *out;
char *ret;
-
- if (ct==NULL)
+
+ if (ct == NULL)
return NULL;
-
- out = g_string_new("");
+
+ out = g_string_new ("");
if (ct->type == NULL) {
- g_string_sprintfa(out, "text/plain");
- w(g_warning("Content-Type with no main type"));
+ g_string_append_printf (out, "text/plain");
+ w(g_warning ("Content-Type with no main type"));
} else if (ct->subtype == NULL) {
- w(g_warning("Content-Type with no sub type: %s", ct->type));
- if (!strcasecmp(ct->type, "multipart"))
- g_string_sprintfa(out, "%s/mixed", ct->type);
+ w(g_warning ("Content-Type with no sub type: %s", ct->type));
+ if (!strcasecmp (ct->type, "multipart"))
+ g_string_append_printf (out, "%s/mixed", ct->type);
else
- g_string_sprintfa(out, "%s", ct->type);
+ g_string_append_printf (out, "%s", ct->type);
} else {
- g_string_sprintfa(out, "%s/%s", ct->type, ct->subtype);
+ g_string_append_printf (out, "%s/%s", ct->type, ct->subtype);
}
- header_param_list_format_append(out, ct->params);
-
+ header_param_list_format_append (out, ct->params);
+
ret = out->str;
- g_string_free(out, FALSE);
+ g_string_free (out, FALSE);
+
return ret;
}
@@ -3933,10 +3934,10 @@ void header_address_list_clear(struct _header_address **l)
/* if encode is true, then the result is suitable for mailing, otherwise
the result is suitable for display only (and may not even be re-parsable) */
static void
-header_address_list_encode_append(GString *out, int encode, struct _header_address *a)
+header_address_list_encode_append (GString *out, int encode, struct _header_address *a)
{
char *text;
-
+
while (a) {
switch (a->type) {
case HEADER_ADDRESS_NAME:
@@ -3945,64 +3946,65 @@ header_address_list_encode_append(GString *out, int encode, struct _header_addre
else
text = a->name;
if (text && *text)
- g_string_sprintfa(out, "%s <%s>", text, a->v.addr);
+ g_string_append_printf (out, "%s <%s>", text, a->v.addr);
else
- g_string_append(out, a->v.addr);
+ g_string_append (out, a->v.addr);
if (encode)
- g_free(text);
+ g_free (text);
break;
case HEADER_ADDRESS_GROUP:
if (encode)
- text = header_encode_phrase(a->name);
+ text = header_encode_phrase (a->name);
else
text = a->name;
- g_string_sprintfa(out, "%s: ", text);
- header_address_list_encode_append(out, encode, a->v.members);
- g_string_sprintfa(out, ";");
+ g_string_append_printf (out, "%s: ", text);
+ header_address_list_encode_append (out, encode, a->v.members);
+ g_string_append_printf (out, ";");
if (encode)
- g_free(text);
+ g_free (text);
break;
default:
- g_warning("Invalid address type");
+ g_warning ("Invalid address type");
break;
}
a = a->next;
if (a)
- g_string_append(out, ", ");
+ g_string_append (out, ", ");
}
}
char *
-header_address_list_encode(struct _header_address *a)
+header_address_list_encode (struct _header_address *a)
{
GString *out;
char *ret;
-
+
if (a == NULL)
return NULL;
-
- out = g_string_new("");
-
- header_address_list_encode_append(out, TRUE, a);
+
+ out = g_string_new ("");
+ header_address_list_encode_append (out, TRUE, a);
ret = out->str;
- g_string_free(out, FALSE);
+ g_string_free (out, FALSE);
+
return ret;
}
char *
-header_address_list_format(struct _header_address *a)
+header_address_list_format (struct _header_address *a)
{
GString *out;
char *ret;
-
+
if (a == NULL)
return NULL;
-
- out = g_string_new("");
-
- header_address_list_encode_append(out, FALSE, a);
+
+ out = g_string_new ("");
+
+ header_address_list_encode_append (out, FALSE, a);
ret = out->str;
- g_string_free(out, FALSE);
+ g_string_free (out, FALSE);
+
return ret;
}
diff --git a/camel/camel-service.c b/camel/camel-service.c
index 8c3b3fc62f..13daa75492 100644
--- a/camel/camel-service.c
+++ b/camel/camel-service.c
@@ -534,10 +534,10 @@ camel_service_get_name (CamelService *service, gboolean brief)
static char *
get_path (CamelService *service)
{
+ CamelProvider *prov = service->provider;
+ CamelURL *url = service->url;
GString *gpath;
char *path;
- CamelURL *url = service->url;
- CamelProvider *prov = service->provider;
/* A sort of ad-hoc default implementation that works for our
* current set of services.
@@ -546,33 +546,31 @@ get_path (CamelService *service)
gpath = g_string_new (service->provider->protocol);
if (CAMEL_PROVIDER_ALLOWS (prov, CAMEL_URL_PART_USER)) {
if (CAMEL_PROVIDER_ALLOWS (prov, CAMEL_URL_PART_HOST)) {
- g_string_sprintfa (gpath, "/%s@%s",
- url->user ? url->user : "",
- url->host ? url->host : "");
+ g_string_append_printf (gpath, "/%s@%s",
+ url->user ? url->user : "",
+ url->host ? url->host : "");
if (url->port)
- g_string_sprintfa (gpath, ":%d", url->port);
+ g_string_append_printf (gpath, ":%d", url->port);
} else {
- g_string_sprintfa (gpath, "/%s%s",
- url->user ? url->user : "",
- CAMEL_PROVIDER_NEEDS (prov, CAMEL_URL_PART_USER) ? "" : "@");
+ g_string_append_printf (gpath, "/%s%s", url->user ? url->user : "",
+ CAMEL_PROVIDER_NEEDS (prov, CAMEL_URL_PART_USER) ? "" : "@");
}
} else if (CAMEL_PROVIDER_ALLOWS (prov, CAMEL_URL_PART_HOST)) {
- g_string_sprintfa (gpath, "/%s%s",
- CAMEL_PROVIDER_NEEDS (prov, CAMEL_URL_PART_HOST) ? "" : "@",
- url->host ? url->host : "");
+ g_string_append_printf (gpath, "/%s%s",
+ CAMEL_PROVIDER_NEEDS (prov, CAMEL_URL_PART_HOST) ? "" : "@",
+ url->host ? url->host : "");
if (url->port)
- g_string_sprintfa (gpath, ":%d", url->port);
- }
- if (CAMEL_PROVIDER_NEEDS (prov, CAMEL_URL_PART_PATH)) {
- g_string_sprintfa (gpath, "%s%s",
- *url->path == '/' ? "" : "/",
- url->path);
+ g_string_append_printf (gpath, ":%d", url->port);
}
+ if (CAMEL_PROVIDER_NEEDS (prov, CAMEL_URL_PART_PATH))
+ g_string_append_printf (gpath, "%s%s", *url->path == '/' ? "" : "/", url->path);
+
path = gpath->str;
g_string_free (gpath, FALSE);
+
return path;
}
diff --git a/camel/camel-url.c b/camel/camel-url.c
index a2d4e73dac..64abd76265 100644
--- a/camel/camel-url.c
+++ b/camel/camel-url.c
@@ -304,15 +304,16 @@ camel_url_to_string (CamelURL *url, guint32 flags)
{
GString *str;
char *enc, *return_result;
-
+
/* IF YOU CHANGE ANYTHING IN THIS FUNCTION, RUN
* tests/misc/url AFTERWARD.
*/
-
+
str = g_string_sized_new (20);
-
+
if (url->protocol)
- g_string_sprintfa (str, "%s:", url->protocol);
+ g_string_append_printf (str, "%s:", url->protocol);
+
if (url->host) {
g_string_append (str, "//");
if (url->user) {
@@ -322,45 +323,46 @@ camel_url_to_string (CamelURL *url, guint32 flags)
}
if (url->authmech && *url->authmech) {
enc = camel_url_encode (url->authmech, TRUE, ":@/");
- g_string_sprintfa (str, ";auth=%s", enc);
+ g_string_append_printf (str, ";auth=%s", enc);
g_free (enc);
}
if (url->passwd && !(flags & CAMEL_URL_HIDE_PASSWORD)) {
enc = camel_url_encode (url->passwd, TRUE, "@/");
- g_string_sprintfa (str, ":%s", enc);
+ g_string_append_printf (str, ":%s", enc);
g_free (enc);
}
if (url->host) {
enc = camel_url_encode (url->host, TRUE, ":/");
- g_string_sprintfa (str, "%s%s", url->user ? "@" : "", enc);
+ g_string_append_printf (str, "%s%s", url->user ? "@" : "", enc);
g_free (enc);
}
if (url->port)
- g_string_sprintfa (str, ":%d", url->port);
+ g_string_append_printf (str, ":%d", url->port);
if (!url->path && (url->params || url->query || url->fragment))
g_string_append_c (str, '/');
}
-
+
if (url->path) {
enc = camel_url_encode (url->path, FALSE, ";?#");
- g_string_sprintfa (str, "%s", enc);
+ g_string_append_printf (str, "%s", enc);
g_free (enc);
}
if (url->params && !(flags & CAMEL_URL_HIDE_PARAMS))
g_datalist_foreach (&url->params, output_param, str);
if (url->query) {
enc = camel_url_encode (url->query, FALSE, "#");
- g_string_sprintfa (str, "?%s", enc);
+ g_string_append_printf (str, "?%s", enc);
g_free (enc);
}
if (url->fragment) {
enc = camel_url_encode (url->fragment, FALSE, NULL);
- g_string_sprintfa (str, "#%s", enc);
+ g_string_append_printf (str, "#%s", enc);
g_free (enc);
}
-
+
return_result = str->str;
g_string_free (str, FALSE);
+
return return_result;
}
@@ -369,13 +371,13 @@ output_param (GQuark key_id, gpointer data, gpointer user_data)
{
GString *str = user_data;
char *enc;
-
+
enc = camel_url_encode (g_quark_to_string (key_id), FALSE, "?#");
- g_string_sprintfa (str, ";%s", enc);
+ g_string_append_printf (str, ";%s", enc);
g_free (enc);
if (*(char *)data) {
enc = camel_url_encode (data, FALSE, "?#");
- g_string_sprintfa (str, "=%s", enc);
+ g_string_append_printf (str, "=%s", enc);
g_free (enc);
}
}