aboutsummaryrefslogtreecommitdiff
path: root/libsylph/procmime.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2011-08-10 05:27:19 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2011-08-10 05:27:19 +0000
commit0d3e6bddbf9a82c4414bf77b84123c6611db6889 (patch)
tree1a8d315bbe7d00b66cb49b9d517aa08d0aaae1da /libsylph/procmime.c
parent4a7e2233c6995f679d14068ed05b2be33391920b (diff)
libsylph/procmime.c: removed alloca() calls.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2933 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph/procmime.c')
-rw-r--r--libsylph/procmime.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/libsylph/procmime.c b/libsylph/procmime.c
index 8fdb5bf9..a8af27ac 100644
--- a/libsylph/procmime.c
+++ b/libsylph/procmime.c
@@ -351,22 +351,20 @@ void procmime_scan_multipart_message(MimeInfo *mimeinfo, FILE *fp)
void procmime_scan_encoding(MimeInfo *mimeinfo, const gchar *encoding)
{
- gchar *buf;
-
- Xstrdup_a(buf, encoding, return);
+ gchar *enc;
g_free(mimeinfo->encoding);
+ enc = mimeinfo->encoding = g_strstrip(g_strdup(encoding));
- mimeinfo->encoding = g_strdup(g_strstrip(buf));
- if (!g_ascii_strncasecmp(buf, "7bit", 4))
+ if (!g_ascii_strncasecmp(enc, "7bit", 4))
mimeinfo->encoding_type = ENC_7BIT;
- else if (!g_ascii_strncasecmp(buf, "8bit", 4))
+ else if (!g_ascii_strncasecmp(enc, "8bit", 4))
mimeinfo->encoding_type = ENC_8BIT;
- else if (!g_ascii_strncasecmp(buf, "quoted-printable", 16))
+ else if (!g_ascii_strncasecmp(enc, "quoted-printable", 16))
mimeinfo->encoding_type = ENC_QUOTED_PRINTABLE;
- else if (!g_ascii_strncasecmp(buf, "base64", 6))
+ else if (!g_ascii_strncasecmp(enc, "base64", 6))
mimeinfo->encoding_type = ENC_BASE64;
- else if (!g_ascii_strncasecmp(buf, "x-uuencode", 10))
+ else if (!g_ascii_strncasecmp(enc, "x-uuencode", 10))
mimeinfo->encoding_type = ENC_X_UUENCODE;
else
mimeinfo->encoding_type = ENC_UNKNOWN;
@@ -1488,7 +1486,7 @@ gchar *procmime_get_mime_type(const gchar *filename)
static GHashTable *mime_type_table = NULL;
MimeType *mime_type;
const gchar *p;
- gchar *ext;
+ gchar ext[64];
static gboolean no_mime_type_table = FALSE;
if (no_mime_type_table)
@@ -1506,7 +1504,7 @@ gchar *procmime_get_mime_type(const gchar *filename)
p = strrchr(filename, '.');
if (!p) return NULL;
- Xstrdup_a(ext, p + 1, return NULL);
+ strncpy2(ext, p + 1, sizeof(ext));
g_strdown(ext);
mime_type = g_hash_table_lookup(mime_type_table, ext);
if (mime_type) {