[gmime] Added charset parameter to g_mime_utils_header_encode_*()
- From: Jeffrey Stedfast <fejj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gmime] Added charset parameter to g_mime_utils_header_encode_*()
- Date: Tue, 7 Feb 2017 14:17:40 +0000 (UTC)
commit 0dfbff9a2455077f38f6f9f480b26b4da2121ea9
Author: Jeffrey Stedfast <jestedfa microsoft com>
Date: Tue Feb 7 09:16:19 2017 -0500
Added charset parameter to g_mime_utils_header_encode_*()
This allows us to get rid of g_mime_set_user_charsets() and
g_mime_user_charsets() which sucked as an API for hinting
to the rfc2047-encoder methods which charset(s) to try.
examples/basic-example.c | 2 +-
examples/imap-example.c | 2 +-
gmime/gmime-charset.c | 40 --------------------------------
gmime/gmime-charset.h | 4 ---
gmime/gmime-internal.h | 4 +-
gmime/gmime-message.c | 5 ++-
gmime/gmime-message.h | 2 +-
gmime/gmime-parser-options.c | 4 +-
gmime/gmime-utils.c | 48 +++++++++++----------------------------
gmime/gmime-utils.h | 4 +-
gmime/gmime.c | 19 ++-------------
gmime/gmime.h | 13 +----------
gmime/internet-address.c | 51 ++++++++++++++++++++++++++++++++++++++---
gmime/internet-address.h | 4 +++
tests/test-best.c | 2 +-
tests/test-cat.c | 2 +-
tests/test-headers.c | 2 +-
tests/test-html.c | 2 +-
tests/test-mbox.c | 2 +-
tests/test-mime.c | 10 ++++----
tests/test-parser.c | 2 +-
tests/test-partial.c | 2 +-
tests/test-pgp.c | 2 +-
tests/test-pgpmime.c | 6 ++--
tests/test-pkcs7.c | 2 +-
tests/test-smime.c | 6 ++--
tests/test-streams.c | 2 +-
27 files changed, 102 insertions(+), 142 deletions(-)
---
diff --git a/examples/basic-example.c b/examples/basic-example.c
index 0fc1a70..628f951 100644
--- a/examples/basic-example.c
+++ b/examples/basic-example.c
@@ -312,7 +312,7 @@ int main (int argc, char **argv)
}
/* init the gmime library */
- g_mime_init (0);
+ g_mime_init ();
/* parse the message */
message = parse_message (fd);
diff --git a/examples/imap-example.c b/examples/imap-example.c
index 0aa2740..32bbbbd 100644
--- a/examples/imap-example.c
+++ b/examples/imap-example.c
@@ -926,7 +926,7 @@ int main (int argc, char **argv)
if (argc < 2)
return 0;
- g_mime_init (0);
+ g_mime_init ();
if (!strcmp (argv[i], "-f")) {
scan_from = TRUE;
diff --git a/gmime/gmime-charset.c b/gmime/gmime-charset.c
index 8fc17e3..8c2750d 100644
--- a/gmime/gmime-charset.c
+++ b/gmime/gmime-charset.c
@@ -165,7 +165,6 @@ static struct {
};
static GHashTable *iconv_charsets = NULL;
-static char **user_charsets = NULL;
static char *locale_charset = NULL;
static char *locale_lang = NULL;
static int initialized = 0;
@@ -925,42 +924,3 @@ g_mime_charset_can_encode (GMimeCharset *mask, const char *charset, const char *
return rc != (size_t) -1;
}
-
-
-/**
- * g_mime_set_user_charsets:
- * @charsets: an array of user-preferred charsets
- *
- * Set a list of charsets for GMime to use as a hint for encoding and
- * decoding headers. The charset list should be in order of preference
- * (e.g. most preferred first, least preferred last).
- **/
-void
-g_mime_set_user_charsets (const char **charsets)
-{
- if (user_charsets)
- g_strfreev (user_charsets);
-
- if (charsets == NULL || charsets[0] == NULL) {
- user_charsets = NULL;
- return;
- }
-
- user_charsets = g_strdupv ((char **) charsets);
-}
-
-
-/**
- * g_mime_user_charsets:
- *
- * Get the list of user-preferred charsets set with
- * g_mime_set_user_charsets().
- *
- * Returns: (array zero-terminated=1) (transfer none): an array of
- * user-set charsets or %NULL if none set.
- **/
-const char **
-g_mime_user_charsets (void)
-{
- return (const char **) user_charsets;
-}
diff --git a/gmime/gmime-charset.h b/gmime/gmime-charset.h
index 27a25f4..7900f84 100644
--- a/gmime/gmime-charset.h
+++ b/gmime/gmime-charset.h
@@ -69,10 +69,6 @@ gboolean g_mime_charset_can_encode (GMimeCharset *mask, const char *charset,
const char *text, size_t len);
-void g_mime_set_user_charsets (const char **charsets);
-const char **g_mime_user_charsets (void);
-
-
G_END_DECLS
#endif /* __GMIME_CHARSET_H__ */
diff --git a/gmime/gmime-internal.h b/gmime/gmime-internal.h
index 0294562..f6f494a 100644
--- a/gmime/gmime-internal.h
+++ b/gmime/gmime-internal.h
@@ -30,8 +30,8 @@
G_BEGIN_DECLS
/* GMimeParserOptions */
-G_GNUC_INTERNAL void _g_mime_parser_options_init (void);
-G_GNUC_INTERNAL void _g_mime_parser_options_shutdown (void);
+G_GNUC_INTERNAL void g_mime_parser_options_init (void);
+G_GNUC_INTERNAL void g_mime_parser_options_shutdown (void);
G_GNUC_INTERNAL GMimeParserOptions *_g_mime_parser_options_clone (GMimeParserOptions *options);
/* GMimeHeader */
diff --git a/gmime/gmime-message.c b/gmime/gmime-message.c
index cf40719..04d418c 100644
--- a/gmime/gmime-message.c
+++ b/gmime/gmime-message.c
@@ -1358,13 +1358,14 @@ g_mime_message_get_all_recipients (GMimeMessage *message)
* g_mime_message_set_subject:
* @message: A #GMimeMessage
* @subject: Subject string
+ * @charset: The charset to use for encoding the subject or %NULL to use the default
*
* Set the subject of a @message.
*
* Note: The @subject string should be in UTF-8.
**/
void
-g_mime_message_set_subject (GMimeMessage *message, const char *subject)
+g_mime_message_set_subject (GMimeMessage *message, const char *subject, const char *charset)
{
char *encoded;
@@ -1374,7 +1375,7 @@ g_mime_message_set_subject (GMimeMessage *message, const char *subject)
g_free (message->subject);
message->subject = g_mime_strdup_trim (subject);
- encoded = g_mime_utils_header_encode_text (message->subject);
+ encoded = g_mime_utils_header_encode_text (message->subject, charset);
g_mime_object_set_header (GMIME_OBJECT (message), "Subject", encoded);
g_free (encoded);
}
diff --git a/gmime/gmime-message.h b/gmime/gmime-message.h
index 4157124..7e5b174 100644
--- a/gmime/gmime-message.h
+++ b/gmime/gmime-message.h
@@ -112,7 +112,7 @@ void g_mime_message_add_mailbox (GMimeMessage *message, GMimeAddressType type, c
InternetAddressList *g_mime_message_get_addresses (GMimeMessage *message, GMimeAddressType type);
InternetAddressList *g_mime_message_get_all_recipients (GMimeMessage *message);
-void g_mime_message_set_subject (GMimeMessage *message, const char *subject);
+void g_mime_message_set_subject (GMimeMessage *message, const char *subject, const char *charset);
const char *g_mime_message_get_subject (GMimeMessage *message);
void g_mime_message_set_date (GMimeMessage *message, time_t date, int tz_offset);
diff --git a/gmime/gmime-parser-options.c b/gmime/gmime-parser-options.c
index 22570ff..7e2fa2a 100644
--- a/gmime/gmime-parser-options.c
+++ b/gmime/gmime-parser-options.c
@@ -33,14 +33,14 @@ static GMimeParserOptions *default_options = NULL;
void
-_g_mime_parser_options_init (void)
+g_mime_parser_options_init (void)
{
if (default_options == NULL)
default_options = g_mime_parser_options_new ();
}
void
-_g_mime_parser_options_shutdown (void)
+g_mime_parser_options_shutdown (void)
{
if (default_options == NULL)
return;
diff --git a/gmime/gmime-utils.c b/gmime/gmime-utils.c
index be0168d..b35d954 100644
--- a/gmime/gmime-utils.c
+++ b/gmime/gmime-utils.c
@@ -77,8 +77,6 @@
* and encodings.
**/
-extern gboolean _g_mime_use_only_user_charsets (void);
-
#ifdef G_THREADS_ENABLED
extern void _g_mime_msgid_unlock (void);
extern void _g_mime_msgid_lock (void);
@@ -1393,11 +1391,6 @@ charset_convert (iconv_t cd, const char *inbuf, size_t inleft, char **outp, size
}
-#define USER_CHARSETS_INCLUDE_UTF8 (1 << 0)
-#define USER_CHARSETS_INCLUDE_LOCALE (1 << 1)
-#define USER_CHARSETS_INCLUDE_LATIN1 (1 << 2)
-
-
/**
* g_mime_utils_decode_8bit:
* @text: (array length=len) (element-type guint8): input text in
@@ -2099,10 +2092,6 @@ rfc2047_decode_tokens (GMimeParserOptions *options, rfc2047_token *tokens, size_
*
* Decodes an rfc2047 encoded 'text' header.
*
- * Note: See g_mime_set_user_charsets() for details on how charset
- * conversion is handled for unencoded 8bit text and/or wrongly
- * specified rfc2047 encoded-word tokens.
- *
* Returns: a newly allocated UTF-8 string representing the the decoded
* header.
**/
@@ -2131,10 +2120,6 @@ g_mime_utils_header_decode_text (GMimeParserOptions *options, const char *text)
*
* Decodes an rfc2047 encoded 'phrase' header.
*
- * Note: See g_mime_set_user_charsets() for details on how charset
- * conversion is handled for unencoded 8bit text and/or wrongly
- * specified rfc2047 encoded-word tokens.
- *
* Returns: a newly allocated UTF-8 string representing the the decoded
* header.
**/
@@ -2507,24 +2492,21 @@ g_string_append_len_quoted (GString *out, const char *in, size_t len)
}
static char *
-rfc2047_encode (const char *in, gushort safemask)
+rfc2047_encode (const char *in, gushort safemask, const char *user_charset)
{
rfc822_word *words, *word, *prev = NULL;
- const char **charsets, *charset;
- const char *start;
+ const char *charset, *start;
GMimeCharset mask;
GString *out;
char *outstr;
size_t len;
- int i;
+ int i = 0;
if (!(words = rfc2047_encode_get_rfc822_words (in, safemask & IS_PSAFE)))
return g_strdup (in);
rfc2047_encode_merge_rfc822_words (&words);
- charsets = g_mime_user_charsets ();
-
out = g_string_new ("");
/* output words now with spaces between them */
@@ -2564,7 +2546,7 @@ rfc2047_encode (const char *in, gushort safemask)
rfc2047_encode_word (out, start, len, "us-ascii", safemask);
break;
case 1: /* iso-8859-1 */
- if (!_g_mime_use_only_user_charsets ()) {
+ if (user_charset == NULL) {
rfc2047_encode_word (out, start, len, "iso-8859-1", safemask);
break;
}
@@ -2573,15 +2555,11 @@ rfc2047_encode (const char *in, gushort safemask)
g_mime_charset_init (&mask);
g_mime_charset_step (&mask, start, len);
- for (i = 0; charsets && charsets[i]; i++) {
- if (g_mime_charset_can_encode (&mask, charsets[i], start, len)) {
- charset = charsets[i];
- break;
- }
- }
-
- if (!charset)
+ if (user_charset && g_mime_charset_can_encode (&mask, user_charset, start,
len)) {
+ charset = user_charset;
+ } else {
charset = g_mime_charset_best_name (&mask);
+ }
rfc2047_encode_word (out, start, len, charset, safemask);
break;
@@ -2608,6 +2586,7 @@ rfc2047_encode (const char *in, gushort safemask)
/**
* g_mime_utils_header_encode_phrase:
* @phrase: phrase to encode
+ * @charset: the charset to use or %NULL to use the default
*
* Encodes a 'phrase' header according to the rules in rfc2047.
*
@@ -2615,18 +2594,19 @@ rfc2047_encode (const char *in, gushort safemask)
* addresses.
**/
char *
-g_mime_utils_header_encode_phrase (const char *phrase)
+g_mime_utils_header_encode_phrase (const char *phrase, const char *charset)
{
if (phrase == NULL)
return NULL;
- return rfc2047_encode (phrase, IS_PSAFE);
+ return rfc2047_encode (phrase, IS_PSAFE, charset);
}
/**
* g_mime_utils_header_encode_text:
* @text: text to encode
+ * @charset: the charset to use or %NULL to use the default
*
* Encodes a 'text' header according to the rules in rfc2047.
*
@@ -2634,12 +2614,12 @@ g_mime_utils_header_encode_phrase (const char *phrase)
* headers like "Subject".
**/
char *
-g_mime_utils_header_encode_text (const char *text)
+g_mime_utils_header_encode_text (const char *text, const char *charset)
{
if (text == NULL)
return NULL;
- return rfc2047_encode (text, IS_ESAFE);
+ return rfc2047_encode (text, IS_ESAFE, charset);
}
diff --git a/gmime/gmime-utils.h b/gmime/gmime-utils.h
index 071e380..f6b808f 100644
--- a/gmime/gmime-utils.h
+++ b/gmime/gmime-utils.h
@@ -79,10 +79,10 @@ char *g_mime_utils_decode_8bit (GMimeParserOptions *options, const char *text, s
/* utilities to (de/en)code headers */
char *g_mime_utils_header_decode_text (GMimeParserOptions *options, const char *text);
-char *g_mime_utils_header_encode_text (const char *text);
+char *g_mime_utils_header_encode_text (const char *text, const char *charset);
char *g_mime_utils_header_decode_phrase (GMimeParserOptions *options, const char *phrase);
-char *g_mime_utils_header_encode_phrase (const char *phrase);
+char *g_mime_utils_header_encode_phrase (const char *phrase, const char *charset);
G_END_DECLS
diff --git a/gmime/gmime.c b/gmime/gmime.c
index 564e453..6028b1e 100644
--- a/gmime/gmime.c
+++ b/gmime/gmime.c
@@ -48,8 +48,6 @@
* Initialization, shutdown, and version-check functions.
**/
-extern gboolean _g_mime_use_only_user_charsets (void);
-
extern void g_mime_iconv_utils_shutdown (void);
extern void g_mime_iconv_utils_init (void);
@@ -68,7 +66,6 @@ const guint gmime_binary_age = GMIME_BINARY_AGE;
G_LOCK_DEFINE_STATIC (msgid);
static unsigned int initialized = 0;
-static guint32 enable = 0;
/**
@@ -100,15 +97,11 @@ g_mime_check_version (guint major, guint minor, guint micro)
/**
* g_mime_init:
- * @flags: initialization flags
*
* Initializes GMime.
- *
- * Note: Calls g_mime_charset_map_init() and g_mime_iconv_init() as
- * well.
**/
void
-g_mime_init (guint32 flags)
+g_mime_init (void)
{
initialized = MAX (initialized, 0);
@@ -123,8 +116,6 @@ g_mime_init (guint32 flags)
tzset ();
#endif
- enable = flags;
-
#if !GLIB_CHECK_VERSION(2, 35, 1)
g_type_init ();
#endif
@@ -133,6 +124,7 @@ g_mime_init (guint32 flags)
g_mutex_init (&G_LOCK_NAME (msgid));
#endif
+ g_mime_parser_options_init ();
g_mime_charset_map_init ();
g_mime_iconv_utils_init ();
g_mime_iconv_init ();
@@ -220,6 +212,7 @@ g_mime_shutdown (void)
return;
g_mime_object_type_registry_shutdown ();
+ g_mime_parser_options_shutdown ();
g_mime_charset_map_shutdown ();
g_mime_iconv_utils_shutdown ();
g_mime_iconv_shutdown ();
@@ -237,12 +230,6 @@ g_mime_shutdown (void)
}
-gboolean
-_g_mime_use_only_user_charsets (void)
-{
- return (enable & GMIME_ENABLE_USE_ONLY_USER_CHARSETS);
-}
-
void
_g_mime_msgid_unlock (void)
{
diff --git a/gmime/gmime.h b/gmime/gmime.h
index 8915f0a..1de8815 100644
--- a/gmime/gmime.h
+++ b/gmime/gmime.h
@@ -115,18 +115,7 @@ extern const guint gmime_binary_age;
gboolean g_mime_check_version (guint major, guint minor, guint micro);
-/**
- * GMIME_ENABLE_USE_ONLY_USER_CHARSETS:
- *
- * Initialization flag that hints to the rfc2047 encoder to use only
- * the configured user-charsets (set via g_mime_set_user_charsets())
- * instead of trying to first use iso-8859-1.
- *
- * Since: 2.6.16
- **/
-#define GMIME_ENABLE_USE_ONLY_USER_CHARSETS (1 << 0)
-
-void g_mime_init (guint32 flags);
+void g_mime_init (void);
void g_mime_shutdown (void);
G_END_DECLS
diff --git a/gmime/internet-address.c b/gmime/internet-address.c
index 5142eff..940d1d4 100644
--- a/gmime/internet-address.c
+++ b/gmime/internet-address.c
@@ -142,6 +142,7 @@ static void
internet_address_init (InternetAddress *ia, InternetAddressClass *klass)
{
ia->priv = g_mime_event_new ((GObject *) ia);
+ ia->charset = NULL;
ia->name = NULL;
}
@@ -151,6 +152,7 @@ internet_address_finalize (GObject *object)
InternetAddress *ia = (InternetAddress *) object;
g_mime_event_destroy (ia->priv);
+ g_free (ia->charset);
g_free (ia->name);
G_OBJECT_CLASS (parent_class)->finalize (object);
@@ -167,6 +169,7 @@ _internet_address_set_name (InternetAddress *ia, const char *name)
ia->name = buf;
}
+
/**
* internet_address_set_name:
* @ia: a #InternetAddress
@@ -207,6 +210,46 @@ internet_address_get_name (InternetAddress *ia)
/**
+ * internet_address_set_charset:
+ * @ia: a #InternetAddress
+ * @charset: the charset to use when encoding the name or %NULL to use the defaults
+ *
+ * Set the charset to use for encoding the name of the mailbox or group.
+ **/
+void
+internet_address_set_charset (InternetAddress *ia, const char *charset)
+{
+ char *buf;
+
+ g_return_if_fail (IS_INTERNET_ADDRESS (ia));
+
+ buf = g_strdup (charset);
+ g_free (ia->charset);
+ ia->charset = buf;
+
+ g_mime_event_emit (ia->priv, NULL);
+}
+
+
+/**
+ * internet_address_get_charset:
+ * @ia: a #InternetAddress
+ *
+ * Gets the charset to be used when encoding the name of the mailbox or group.
+ *
+ * Returns: the charset to be used when encoding the name of the mailbox or
+ * group if available or %NULL otherwise.
+ **/
+const char *
+internet_address_get_charset (InternetAddress *ia)
+{
+ g_return_val_if_fail (IS_INTERNET_ADDRESS (ia), NULL);
+
+ return ia->charset;
+}
+
+
+/**
* internet_address_to_string:
* @ia: Internet Address object
* @encode: %TRUE if the address should be rfc2047 encoded
@@ -991,14 +1034,14 @@ internet_address_list_set_address (InternetAddressList *list, int index, Interne
static char *
-encoded_name (const char *raw, gboolean rfc2047_encode)
+encoded_name (const char *raw, gboolean rfc2047_encode, const char *charset)
{
char *name;
g_return_val_if_fail (raw != NULL, NULL);
if (rfc2047_encode) {
- name = g_mime_utils_header_encode_phrase (raw);
+ name = g_mime_utils_header_encode_phrase (raw, charset);
} else {
name = g_mime_utils_quote_string (raw);
}
@@ -1078,7 +1121,7 @@ mailbox_to_string (InternetAddress *ia, guint32 flags, size_t *linelen, GString
size_t len;
if (ia->name && *ia->name) {
- name = encoded_name (ia->name, encode);
+ name = encoded_name (ia->name, encode, ia->charset);
len = strlen (name);
if (fold && (*linelen + len) > GMIME_FOLD_LEN) {
@@ -1158,7 +1201,7 @@ group_to_string (InternetAddress *ia, guint32 flags, size_t *linelen, GString *s
size_t len = 0;
if (ia->name != NULL) {
- name = encoded_name (ia->name, encode);
+ name = encoded_name (ia->name, encode, ia->charset);
len = strlen (name);
if (fold && *linelen > 1 && (*linelen + len + 1) > GMIME_FOLD_LEN) {
diff --git a/gmime/internet-address.h b/gmime/internet-address.h
index ef342ab..8e2314d 100644
--- a/gmime/internet-address.h
+++ b/gmime/internet-address.h
@@ -80,6 +80,7 @@ struct _InternetAddress {
GObject parent_object;
gpointer priv;
+ char *charset;
char *name;
};
@@ -96,6 +97,9 @@ GType internet_address_get_type (void);
void internet_address_set_name (InternetAddress *ia, const char *name);
const char *internet_address_get_name (InternetAddress *ia);
+void internet_address_set_charset (InternetAddress *ia, const char *charset);
+const char *internet_address_get_charset (InternetAddress *ia);
+
char *internet_address_to_string (InternetAddress *ia, gboolean encode);
diff --git a/tests/test-best.c b/tests/test-best.c
index 3751668..6880861 100644
--- a/tests/test-best.c
+++ b/tests/test-best.c
@@ -38,7 +38,7 @@ int main (int argc, char **argv)
if ((fd = open (argv[1], O_RDONLY, 0)) == -1)
return 0;
- g_mime_init (0);
+ g_mime_init ();
stream = g_mime_stream_fs_new (fd);
istream = g_mime_stream_filter_new (stream);
diff --git a/tests/test-cat.c b/tests/test-cat.c
index c002478..5d5df94 100644
--- a/tests/test-cat.c
+++ b/tests/test-cat.c
@@ -451,7 +451,7 @@ int main (int argc, char **argv)
srand (time (NULL));
- g_mime_init (0);
+ g_mime_init ();
testsuite_init (argc, argv);
diff --git a/tests/test-headers.c b/tests/test-headers.c
index 0608457..2d5a51c 100644
--- a/tests/test-headers.c
+++ b/tests/test-headers.c
@@ -337,7 +337,7 @@ test_header_sync (void)
int main (int argc, char **argv)
{
- g_mime_init (0);
+ g_mime_init ();
testsuite_init (argc, argv);
diff --git a/tests/test-html.c b/tests/test-html.c
index d369dfc..f184afe 100644
--- a/tests/test-html.c
+++ b/tests/test-html.c
@@ -29,7 +29,7 @@ int main (int argc, char **argv)
GMimeFilter *html;
int i;
- g_mime_init (0);
+ g_mime_init ();
fstream = g_mime_stream_file_new (stdout);
ostream = g_mime_stream_filter_new (fstream);
diff --git a/tests/test-mbox.c b/tests/test-mbox.c
index 04a7df6..47cd224 100644
--- a/tests/test-mbox.c
+++ b/tests/test-mbox.c
@@ -265,7 +265,7 @@ int main (int argc, char **argv)
return 0;
#endif
- g_mime_init (0);
+ g_mime_init ();
testsuite_init (argc, argv);
diff --git a/tests/test-mime.c b/tests/test-mime.c
index 8c0110c..038cb61 100644
--- a/tests/test-mime.c
+++ b/tests/test-mime.c
@@ -440,9 +440,9 @@ test_rfc2047 (GMimeParserOptions *options, gboolean test_broken)
if (strcmp (rfc2047_text[i].decoded, dec) != 0)
throw (exception_new ("decoded text does not match: %s", dec));
- enc = g_mime_utils_header_encode_text (dec);
+ enc = g_mime_utils_header_encode_text (dec, NULL);
if (strcmp (rfc2047_text[i].encoded, enc) != 0)
- throw (exception_new ("encoded text does not match: %s", enc));
+ throw (exception_new ("encoded text does not match: actual=\"%s\",
expected=\"%s\"", enc, rfc2047_text[i].encoded));
//dec2 = g_mime_utils_header_decode_text (options, enc);
//if (strcmp (rfc2047_text[i].decoded, dec2) != 0)
@@ -465,7 +465,7 @@ test_rfc2047 (GMimeParserOptions *options, gboolean test_broken)
if (strcmp (broken_rfc2047_text[i].decoded, dec) != 0)
throw (exception_new ("decoded text does not match: %s", dec));
- enc = g_mime_utils_header_encode_text (dec);
+ enc = g_mime_utils_header_encode_text (dec, NULL);
if (strcmp (broken_rfc2047_text[i].encoded, enc) != 0)
throw (exception_new ("encoded text does not match: %s", enc));
@@ -487,7 +487,7 @@ test_rfc2047 (GMimeParserOptions *options, gboolean test_broken)
if (strcmp (rfc2047_phrase[i].decoded, dec) != 0)
throw (exception_new ("decoded phrase does not match"));
- enc = g_mime_utils_header_encode_phrase (dec);
+ enc = g_mime_utils_header_encode_phrase (dec, NULL);
if (strcmp (rfc2047_phrase[i].encoded, enc) != 0)
throw (exception_new ("encoded phrase does not match"));
@@ -644,7 +644,7 @@ int main (int argc, char **argv)
{
GMimeParserOptions *options = g_mime_parser_options_new ();
- g_mime_init (0);
+ g_mime_init ();
testsuite_init (argc, argv);
diff --git a/tests/test-parser.c b/tests/test-parser.c
index 9fd0416..d1fb25d 100644
--- a/tests/test-parser.c
+++ b/tests/test-parser.c
@@ -233,7 +233,7 @@ int main (int argc, char **argv)
GMimeStream *stream;
int fd;
- g_mime_init (0);
+ g_mime_init ();
if (argc > 1)
filename = argv[1];
diff --git a/tests/test-partial.c b/tests/test-partial.c
index 27b2f96..3981976 100644
--- a/tests/test-partial.c
+++ b/tests/test-partial.c
@@ -73,7 +73,7 @@ int main (int argc, char **argv)
if (argc < 2)
return 0;
- g_mime_init (0);
+ g_mime_init ();
parser = g_mime_parser_new ();
diff --git a/tests/test-pgp.c b/tests/test-pgp.c
index 5349ab8..eb0c32c 100644
--- a/tests/test-pgp.c
+++ b/tests/test-pgp.c
@@ -286,7 +286,7 @@ int main (int argc, char **argv)
char *key;
int i;
- g_mime_init (0);
+ g_mime_init ();
testsuite_init (argc, argv);
diff --git a/tests/test-pgpmime.c b/tests/test-pgpmime.c
index 482ea41..3032890 100644
--- a/tests/test-pgpmime.c
+++ b/tests/test-pgpmime.c
@@ -232,7 +232,7 @@ test_multipart_signed (GMimeCryptoContext *ctx)
internet_address_list_add (list, mailbox);
g_object_unref (mailbox);
- g_mime_message_set_subject (message, "This is a test message");
+ g_mime_message_set_subject (message, "This is a test message", NULL);
g_mime_object_set_header ((GMimeObject *) message, "X-Mailer", "main.c");
g_mime_message_set_mime_part (message, GMIME_OBJECT (mps));
g_object_unref (mps);
@@ -342,7 +342,7 @@ create_encrypted_message (GMimeCryptoContext *ctx, gboolean sign,
internet_address_list_add (list, mailbox);
g_object_unref (mailbox);
- g_mime_message_set_subject (message, "This is a test message");
+ g_mime_message_set_subject (message, "This is a test message", NULL);
g_mime_object_set_header ((GMimeObject *) message, "X-Mailer", "main.c");
g_mime_message_set_mime_part (message, GMIME_OBJECT (mpe));
g_object_unref (mpe);
@@ -474,7 +474,7 @@ int main (int argc, char *argv[])
char *key;
int i;
- g_mime_init (0);
+ g_mime_init ();
testsuite_init (argc, argv);
diff --git a/tests/test-pkcs7.c b/tests/test-pkcs7.c
index 3a99df8..be05d44 100644
--- a/tests/test-pkcs7.c
+++ b/tests/test-pkcs7.c
@@ -283,7 +283,7 @@ int main (int argc, char **argv)
char *key;
int i;
- g_mime_init (0);
+ g_mime_init ();
testsuite_init (argc, argv);
diff --git a/tests/test-smime.c b/tests/test-smime.c
index ecaddf4..168a8c1 100644
--- a/tests/test-smime.c
+++ b/tests/test-smime.c
@@ -233,7 +233,7 @@ test_multipart_signed (GMimeCryptoContext *ctx)
internet_address_list_add (list, mailbox);
g_object_unref (mailbox);
- g_mime_message_set_subject (message, "This is a test message");
+ g_mime_message_set_subject (message, "This is a test message", NULL);
g_mime_object_set_header ((GMimeObject *) message, "X-Mailer", "main.c");
g_mime_message_set_mime_part (message, GMIME_OBJECT (mps));
g_object_unref (mps);
@@ -346,7 +346,7 @@ test_multipart_encrypted (GMimeCryptoContext *ctx, gboolean sign)
internet_address_list_add (list, mailbox);
g_object_unref (mailbox);
- g_mime_message_set_subject (message, "This is a test message");
+ g_mime_message_set_subject (message, "This is a test message", NULL);
g_mime_object_set_header ((GMimeObject *) message, "X-Mailer", "main.c");
g_mime_message_set_mime_part (message, GMIME_OBJECT (mpe));
g_object_unref (mpe);
@@ -444,7 +444,7 @@ int main (int argc, char *argv[])
char *key;
int i;
- g_mime_init (0);
+ g_mime_init ();
testsuite_init (argc, argv);
diff --git a/tests/test-streams.c b/tests/test-streams.c
index d8c0513..a229a69 100644
--- a/tests/test-streams.c
+++ b/tests/test-streams.c
@@ -629,7 +629,7 @@ int main (int argc, char **argv)
const char *dent;
int i;
- g_mime_init (0);
+ g_mime_init ();
testsuite_init (argc, argv);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]