diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2017-10-10 12:54:52 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2017-10-10 12:54:52 +0300 |
commit | 5589f8787925cb3b05078ecfd55c54b36aed637d (patch) | |
tree | 0e626e7d233e5a03fe7aadf6c67a276dcb811de1 | |
parent | 090c7b9a38373ec605535b9bf22ecce2a1433c17 (diff) | |
download | mailutils-5589f8787925cb3b05078ecfd55c54b36aed637d.tar.gz mailutils-5589f8787925cb3b05078ecfd55c54b36aed637d.tar.bz2 |
Use mu_prtstr to safely print string values
-rw-r--r-- | imap4d/store.c | 2 | ||||
-rw-r--r-- | libmailutils/diag/diag.c | 4 | ||||
-rw-r--r-- | libmailutils/mime/mimehdrset.c | 8 | ||||
-rw-r--r-- | libmu_cpp/url.cc | 12 | ||||
-rw-r--r-- | libmu_scm/mu_util.c | 4 | ||||
-rw-r--r-- | libmu_sieve/extensions/vacation.c | 2 | ||||
-rw-r--r-- | mh/mh_init.c | 2 | ||||
-rw-r--r-- | mh/mhn.c | 2 | ||||
-rw-r--r-- | mu/libexec/imap.c | 30 | ||||
-rw-r--r-- | mu/libexec/pop.c | 8 | ||||
-rw-r--r-- | mu/libexec/smtp.c | 2 | ||||
-rw-r--r-- | python/libmu_py/envelope.c | 4 | ||||
-rw-r--r-- | python/libmu_py/header.c | 8 | ||||
-rw-r--r-- | python/libmu_py/message.c | 2 | ||||
-rw-r--r-- | python/libmu_py/mime.c | 4 | ||||
-rw-r--r-- | python/libmu_py/nls.c | 2 | ||||
-rw-r--r-- | python/libmu_py/secret.c | 2 | ||||
-rw-r--r-- | python/libmu_py/sieve.c | 4 | ||||
-rw-r--r-- | python/libmu_py/url.c | 12 | ||||
-rw-r--r-- | python/libmu_py/util.c | 11 | ||||
-rw-r--r-- | testsuite/bs.c | 27 | ||||
-rw-r--r-- | testsuite/mimetest.c | 2 |
22 files changed, 80 insertions, 74 deletions
diff --git a/imap4d/store.c b/imap4d/store.c index 7dba87399..85b1248e6 100644 --- a/imap4d/store.c +++ b/imap4d/store.c @@ -171,6 +171,6 @@ imap4d_store (struct imap4d_session *session, char *err_text = NULL; rc = imap4d_store0 (tok, 0, &err_text); - return io_completion_response (command, rc, "%s", err_text ? err_text : ""); + return io_completion_response (command, rc, "%s", mu_prstr (err_text)); } diff --git a/libmailutils/diag/diag.c b/libmailutils/diag/diag.c index e9d2f84fe..11101dfd4 100644 --- a/libmailutils/diag/diag.c +++ b/libmailutils/diag/diag.c @@ -188,10 +188,10 @@ mu_diag_funcall (mu_log_level_t level, const char *func, if (err) /* TRANSLATORS: First %s stands for function name, second for its arguments, third one for the actual error message. */ - mu_diag_output (level, _("%s(%s) failed: %s"), func, arg ? arg : "", + mu_diag_output (level, _("%s(%s) failed: %s"), func, mu_prstr (arg), mu_strerror (err)); else /* TRANSLATORS: First %s stands for function name, second for its arguments. */ - mu_diag_output (level, _("%s(%s) failed"), func, arg ? arg : ""); + mu_diag_output (level, _("%s(%s) failed"), func, mu_prstr (arg)); } diff --git a/libmailutils/mime/mimehdrset.c b/libmailutils/mime/mimehdrset.c index 7c127caee..baf259d55 100644 --- a/libmailutils/mime/mimehdrset.c +++ b/libmailutils/mime/mimehdrset.c @@ -122,8 +122,8 @@ mime_store_parameter (char const *name, void *value, void *data) if (vlen) { mu_stream_printf (hbuf->str, "%s'%s'", - p->lang ? p->lang : "", - p->cset ? p->cset : ""); + mu_prstr (p->lang), + mu_prstr (p->cset)); vlen = 0; } else if (quote) @@ -225,8 +225,8 @@ mime_store_parameter (char const *name, void *value, void *data) if (vlen) { mu_stream_printf (hbuf->str, "%s'%s'", - p->lang ? p->lang : "", - p->cset ? p->cset : ""); + mu_prstr (p->lang), + mu_prstr (p->cset)); vlen = 0; } else if (quote) diff --git a/libmu_cpp/url.cc b/libmu_cpp/url.cc index 750eed5db..74896ae4f 100644 --- a/libmu_cpp/url.cc +++ b/libmu_cpp/url.cc @@ -76,7 +76,7 @@ Url :: get_scheme () return ""; else if (status) throw Exception ("Url::get_scheme", status); - return std::string (buf ? buf : ""); + return std::string (mu_prstr (buf)); } std::string @@ -88,7 +88,7 @@ Url :: get_user () return ""; else if (status) throw Exception ("Url::get_user", status); - return std::string (buf ? buf : ""); + return std::string (mu_prstr (buf)); } Secret& @@ -112,7 +112,7 @@ Url :: get_auth () return ""; else if (status) throw Exception ("Url::get_auth", status); - return std::string (buf ? buf : ""); + return std::string (mu_prstr (buf)); } std::string @@ -124,7 +124,7 @@ Url :: get_host () return ""; else if (status) throw Exception ("Url::get_host", status); - return std::string (buf ? buf : ""); + return std::string (mu_prstr (buf)); } std::string @@ -136,7 +136,7 @@ Url :: get_path () return ""; else if (status) throw Exception ("Url::get_path", status); - return std::string (buf ? buf : ""); + return std::string (mu_prstr (buf)); } std::vector<std::string> @@ -161,7 +161,7 @@ std::string Url :: to_string () { const char *str = mu_url_to_string (url); - return std::string (str ? str : ""); + return std::string (mu_prstr (str)); } namespace mailutils diff --git a/libmu_scm/mu_util.c b/libmu_scm/mu_util.c index 28a9922b3..a85511d30 100644 --- a/libmu_scm/mu_util.c +++ b/libmu_scm/mu_util.c @@ -60,8 +60,8 @@ SCM_DEFINE_PUBLIC (scm_mu_getpwuid, "mu-getpwuid", 1, 0, 0, ve[2] = scm_from_ulong ((unsigned long) entry->uid); ve[3] = scm_from_ulong ((unsigned long) entry->gid); ve[4] = scm_from_locale_string (entry->gecos); - ve[5] = scm_from_locale_string (entry->dir ? entry->dir : ""); - ve[6] = scm_from_locale_string (entry->shell ? entry->shell : ""); + ve[5] = scm_from_locale_string (mu_prstr (entry->dir)); + ve[6] = scm_from_locale_string (mu_prstr (entry->shell)); ve[7] = scm_from_locale_string (entry->mailbox); scm_array_handle_release (&handle); diff --git a/libmu_sieve/extensions/vacation.c b/libmu_sieve/extensions/vacation.c index ce199760e..2ba7eefc4 100644 --- a/libmu_sieve/extensions/vacation.c +++ b/libmu_sieve/extensions/vacation.c @@ -499,7 +499,7 @@ vacation_subject (mu_sieve_machine_t mach, _("%lu: cannot compile reply prefix regexp: %s: %s"), (unsigned long) mu_sieve_get_message_num (mach), mu_strerror (rc), - err ? err : ""); + mu_prstr (err)); } } diff --git a/mh/mh_init.c b/mh/mh_init.c index 1a8ec26ed..5b13fae47 100644 --- a/mh/mh_init.c +++ b/mh/mh_init.c @@ -962,7 +962,7 @@ mh_set_reply_regex (const char *str) if (rc) mu_error ("reply_regex: %s%s%s", mu_strerror (rc), err ? ": " : "", - err ? err : ""); + mu_prstr (err)); } const char * @@ -1172,7 +1172,7 @@ list_handler (mu_message_t msg, msg_part_t part, char *type, char *encoding, get_extbody_params (msg, &content_type, &content_descr); printf (" "); - printf ("%-25s", content_type ? content_type : ""); + printf ("%-25s", mu_prstr (content_type)); if (content_descr) printf (" %s", content_descr); printf ("\n"); diff --git a/mu/libexec/imap.c b/mu/libexec/imap.c index 37d494a7a..b44757677 100644 --- a/mu/libexec/imap.c +++ b/mu/libexec/imap.c @@ -203,7 +203,6 @@ format_date (mu_stream_t str, char *name, mu_stream_printf (str, "\n"); } -#define S(str) ((str) ? (str) : "") static void print_param (mu_stream_t ostr, const char *prefix, mu_assoc_t assoc, @@ -269,7 +268,8 @@ print_imapenvelope (mu_stream_t ostr, struct mu_imapenvelope *env, int level) indent += 4; mu_stream_printf (ostr, "%*sTime: ", indent, ""); mu_c_streamftime (mu_strout, "%c%n", &env->date, &env->tz); - mu_stream_printf (ostr, "%*sSubject: %s\n", indent, "", S(env->subject)); + mu_stream_printf (ostr, "%*sSubject: %s\n", indent, "", + mu_prstr (env->subject)); print_address (ostr, "From", env->from, indent); print_address (ostr, "Sender", env->sender, indent); print_address (ostr, "Reply-to", env->reply_to, indent); @@ -277,34 +277,38 @@ print_imapenvelope (mu_stream_t ostr, struct mu_imapenvelope *env, int level) print_address (ostr, "Cc", env->cc, indent); print_address (ostr, "Bcc", env->bcc, indent); mu_stream_printf (ostr, "%*sIn-Reply-To: %s\n", indent, "", - S(env->in_reply_to)); + mu_prstr (env->in_reply_to)); mu_stream_printf (ostr, "%*sMessage-ID: %s\n", indent, "", - S(env->message_id)); + mu_prstr (env->message_id)); } static void print_bs (mu_stream_t ostr, struct mu_bodystructure *bs, int level) { int indent = level << 2; - mu_stream_printf (ostr, "%*sbody_type=%s\n", indent, "", S(bs->body_type)); + mu_stream_printf (ostr, "%*sbody_type=%s\n", indent, "", + mu_prstr (bs->body_type)); mu_stream_printf (ostr, "%*sbody_subtype=%s\n", indent, "", - S(bs->body_subtype)); + mu_prstr (bs->body_subtype)); print_param (ostr, "Parameters", bs->body_param, indent); - mu_stream_printf (ostr, "%*sbody_id=%s\n", indent, "", S(bs->body_id)); - mu_stream_printf (ostr, "%*sbody_descr=%s\n", indent, "", S(bs->body_descr)); + mu_stream_printf (ostr, "%*sbody_id=%s\n", indent, "", + mu_prstr (bs->body_id)); + mu_stream_printf (ostr, "%*sbody_descr=%s\n", indent, "", + mu_prstr (bs->body_descr)); mu_stream_printf (ostr, "%*sbody_encoding=%s\n", indent, "", - S(bs->body_encoding)); + mu_prstr (bs->body_encoding)); mu_stream_printf (ostr, "%*sbody_size=%lu\n", indent, "", (unsigned long) bs->body_size); /* Optional */ - mu_stream_printf (ostr, "%*sbody_md5=%s\n", indent, "", S(bs->body_md5)); + mu_stream_printf (ostr, "%*sbody_md5=%s\n", indent, "", + mu_prstr (bs->body_md5)); mu_stream_printf (ostr, "%*sbody_disposition=%s\n", indent, "", - S(bs->body_disposition)); + mu_prstr (bs->body_disposition)); print_param (ostr, "Disposition Parameters", bs->body_disp_param, indent); mu_stream_printf (ostr, "%*sbody_language=%s\n", indent, "", - S(bs->body_language)); + mu_prstr (bs->body_language)); mu_stream_printf (ostr, "%*sbody_location=%s\n", indent, "", - S(bs->body_location)); + mu_prstr (bs->body_location)); mu_stream_printf (ostr, "%*sType ", indent, ""); switch (bs->body_message_type) diff --git a/mu/libexec/pop.c b/mu/libexec/pop.c index a884ea030..2bfbaa439 100644 --- a/mu/libexec/pop.c +++ b/mu/libexec/pop.c @@ -205,7 +205,7 @@ com_capa (int argc, char **argv) { char *capa = NULL; mu_iterator_current (iterator, (void **) &capa); - mu_printf ("CAPA: %s\n", capa ? capa : ""); + mu_printf ("CAPA: %s\n", mu_prstr (capa)); } mu_iterator_destroy (&iterator); } @@ -230,7 +230,7 @@ com_uidl (int argc, char **argv) { char *uidl = NULL; mu_iterator_current (uidl_iterator, (void **) &uidl); - mu_stream_printf (out, "UIDL: %s\n", uidl ? uidl : ""); + mu_stream_printf (out, "UIDL: %s\n", mu_prstr (uidl)); } mu_iterator_destroy (&uidl_iterator); } @@ -242,7 +242,7 @@ com_uidl (int argc, char **argv) unsigned int msgno = strtoul (argv[1], NULL, 10); status = mu_pop3_uidl (pop3, msgno, &uidl); if (status == 0) - mu_printf ("Msg: %d UIDL: %s\n", msgno, uidl ? uidl : ""); + mu_printf ("Msg: %d UIDL: %s\n", msgno, mu_prstr (uidl)); free (uidl); } return status; @@ -265,7 +265,7 @@ com_list (int argc, char **argv) { char *list = NULL; mu_iterator_current (list_iterator, (void **) &list); - mu_stream_printf (out, "LIST: %s\n", (list) ? list : ""); + mu_stream_printf (out, "LIST: %s\n", mu_prstr (list)); } mu_iterator_destroy (&list_iterator); mu_stream_destroy (&out); diff --git a/mu/libexec/smtp.c b/mu/libexec/smtp.c index e4be668a1..f97e7dac6 100644 --- a/mu/libexec/smtp.c +++ b/mu/libexec/smtp.c @@ -297,7 +297,7 @@ com_capa (int argc, char **argv) { char *capa = NULL; mu_iterator_current (iterator, (void **) &capa); - mu_printf ("CAPA: %s\n", capa ? capa : ""); + mu_printf ("CAPA: %s\n", mu_prstr (capa)); } mu_iterator_destroy (&iterator); } diff --git a/python/libmu_py/envelope.c b/python/libmu_py/envelope.c index 7b9f47ffd..78ec5a987 100644 --- a/python/libmu_py/envelope.c +++ b/python/libmu_py/envelope.c @@ -112,7 +112,7 @@ api_envelope_get_sender (PyObject *self, PyObject *args) return NULL; status = mu_envelope_sget_sender (py_env->env, &sender); - return status_object (status, PyString_FromString (sender ? sender : "")); + return status_object (status, PyString_FromString (mu_prstr (sender))); } static PyObject * @@ -126,7 +126,7 @@ api_envelope_get_date (PyObject *self, PyObject *args) return NULL; status = mu_envelope_sget_date (py_env->env, &date); - return status_object (status, PyString_FromString (date ? date : "")); + return status_object (status, PyString_FromString (mu_prstr (date))); } static PyMethodDef methods[] = { diff --git a/python/libmu_py/header.c b/python/libmu_py/header.c index b0fc84970..ab9dc43b4 100644 --- a/python/libmu_py/header.c +++ b/python/libmu_py/header.c @@ -116,7 +116,7 @@ api_header_get_value (PyObject *self, PyObject *args) return NULL; status = mu_header_sget_value (py_hdr->hdr, name, &value); - return status_object (status, PyString_FromString (value ? value : "")); + return status_object (status, PyString_FromString (mu_prstr (value))); } static PyObject * @@ -132,7 +132,7 @@ api_header_get_value_n (PyObject *self, PyObject *args) return NULL; ASSERT_INDEX_RANGE (n, "header"); status = mu_header_sget_value_n (py_hdr->hdr, name, n, &value); - return status_object (status, PyString_FromString (value ? value : "")); + return status_object (status, PyString_FromString (mu_prstr (value))); } static PyObject * @@ -176,7 +176,7 @@ api_header_get_field_name (PyObject *self, PyObject *args) return NULL; ASSERT_INDEX_RANGE (idx, "header"); status = mu_header_sget_field_name (py_hdr->hdr, idx, &name); - return status_object (status, PyString_FromString (name ? name : "")); + return status_object (status, PyString_FromString (mu_prstr (name))); } static PyObject * @@ -191,7 +191,7 @@ api_header_get_field_value (PyObject *self, PyObject *args) return NULL; ASSERT_INDEX_RANGE (idx, "header"); status = mu_header_sget_field_value (py_hdr->hdr, idx, &value); - return status_object (status, PyString_FromString (value ? value : "")); + return status_object (status, PyString_FromString (mu_prstr (value))); } static PyMethodDef methods[] = { diff --git a/python/libmu_py/message.c b/python/libmu_py/message.c index 88721ed8b..347631028 100644 --- a/python/libmu_py/message.c +++ b/python/libmu_py/message.c @@ -292,7 +292,7 @@ api_message_get_attachment_name (PyObject *self, PyObject *args) py_ret = PyTuple_New (3); PyTuple_SetItem (py_ret, 0, PyInt_FromLong (status)); - PyTuple_SetItem (py_ret, 1, PyString_FromString (name ? name : "")); + PyTuple_SetItem (py_ret, 1, PyString_FromString (mu_prstr (name))); PyTuple_SetItem (py_ret, 2, lang ? PyString_FromString (lang) : Py_None); return _ro (py_ret); } diff --git a/python/libmu_py/mime.c b/python/libmu_py/mime.c index 0b2d8a5ae..e0479d21f 100644 --- a/python/libmu_py/mime.c +++ b/python/libmu_py/mime.c @@ -200,7 +200,7 @@ api_rfc2047_decode (PyObject *self, PyObject *args) return NULL; status = mu_rfc2047_decode (tocode, text, &buf); - return status_object (status, PyString_FromString (buf ? buf : "")); + return status_object (status, PyString_FromString (mu_prstr (buf))); } static PyObject * @@ -214,7 +214,7 @@ api_rfc2047_encode (PyObject *self, PyObject *args) return NULL; status = mu_rfc2047_encode (charset, encoding, text, &buf); - return status_object (status, PyString_FromString (buf ? buf : "")); + return status_object (status, PyString_FromString (mu_prstr (buf))); } static PyMethodDef methods[] = { diff --git a/python/libmu_py/nls.c b/python/libmu_py/nls.c index 15bae470b..23503f3fa 100644 --- a/python/libmu_py/nls.c +++ b/python/libmu_py/nls.c @@ -36,7 +36,7 @@ api_nls_set_locale (PyObject *self, PyObject *args) return NULL; lset = mu_set_locale (locale); - return _ro (PyString_FromString (lset ? lset : "")); + return _ro (PyString_FromString (mu_prstr (lset))); } static PyObject * diff --git a/python/libmu_py/secret.c b/python/libmu_py/secret.c index 12378c7bc..af991da30 100644 --- a/python/libmu_py/secret.c +++ b/python/libmu_py/secret.c @@ -124,7 +124,7 @@ api_secret_password (PyObject *self, PyObject *args) return NULL; pass = mu_secret_password (py_secret->secret); - return _ro (PyString_FromString (pass ? pass : "")); + return _ro (PyString_FromString (mu_prstr (pass))); } static PyObject * diff --git a/python/libmu_py/sieve.c b/python/libmu_py/sieve.c index f44f9da7f..9300938dc 100644 --- a/python/libmu_py/sieve.c +++ b/python/libmu_py/sieve.c @@ -269,7 +269,7 @@ _sieve_action_printer (mu_sieve_machine_t mach, PyInt_FromSize_t (msgno)); PyDict_SetItemString (py_dict, "msg", (PyObject *)py_msg); PyDict_SetItemString (py_dict, "action", - PyString_FromString (action ? action : "")); + PyString_FromString (mu_prstr (action))); if (mu_vasnprintf (&buf, &buflen, fmt, ap)) { @@ -277,7 +277,7 @@ _sieve_action_printer (mu_sieve_machine_t mach, return; } PyDict_SetItemString (py_dict, "text", - PyString_FromString (buf ? buf : "")); + PyString_FromString (mu_prstr (buf))); free (buf); py_args = PyTuple_New (1); diff --git a/python/libmu_py/url.c b/python/libmu_py/url.c index bdd4f0721..6aa4b4bdc 100644 --- a/python/libmu_py/url.c +++ b/python/libmu_py/url.c @@ -127,7 +127,7 @@ api_url_get_scheme (PyObject *self, PyObject *args) return NULL; status = mu_url_sget_scheme (py_url->url, &buf); - return status_object (status, PyString_FromString (buf ? buf : "")); + return status_object (status, PyString_FromString (mu_prstr (buf))); } static PyObject * @@ -141,7 +141,7 @@ api_url_get_user (PyObject *self, PyObject *args) return NULL; status = mu_url_sget_user (py_url->url, &buf); - return status_object (status, PyString_FromString (buf ? buf : "")); + return status_object (status, PyString_FromString (mu_prstr (buf))); } static PyObject * @@ -171,7 +171,7 @@ api_url_get_auth (PyObject *self, PyObject *args) return NULL; status = mu_url_sget_auth (py_url->url, &buf); - return status_object (status, PyString_FromString (buf ? buf : "")); + return status_object (status, PyString_FromString (mu_prstr (buf))); } static PyObject * @@ -185,7 +185,7 @@ api_url_get_host (PyObject *self, PyObject *args) return NULL; status = mu_url_sget_host (py_url->url, &buf); - return status_object (status, PyString_FromString (buf ? buf : "")); + return status_object (status, PyString_FromString (mu_prstr (buf))); } static PyObject * @@ -199,7 +199,7 @@ api_url_get_path (PyObject *self, PyObject *args) return NULL; status = mu_url_sget_path (py_url->url, &buf); - return status_object (status, PyString_FromString (buf ? buf : "")); + return status_object (status, PyString_FromString (mu_prstr (buf))); } static PyObject * @@ -233,7 +233,7 @@ api_url_to_string (PyObject *self, PyObject *args) return NULL; str = mu_url_to_string (py_url->url); - return _ro (PyString_FromString (str ? str : "")); + return _ro (PyString_FromString (mu_prstr (str))); } static PyMethodDef methods[] = { diff --git a/python/libmu_py/util.c b/python/libmu_py/util.c index 6e9756a0c..a3d005824 100644 --- a/python/libmu_py/util.c +++ b/python/libmu_py/util.c @@ -29,7 +29,7 @@ api_util_get_user_email (PyObject *self, PyObject *args) return NULL; email = mu_get_user_email (name); - return _ro (PyString_FromString (email ? email : "")); + return _ro (PyString_FromString (mu_prstr (email))); } static PyObject * @@ -52,7 +52,7 @@ api_util_get_user_email_domain (PyObject *self, PyObject *args) const char *domain = NULL; status = mu_get_user_email_domain (&domain); - return status_object (status, PyString_FromString (domain ? domain : "")); + return status_object (status, PyString_FromString (mu_prstr (domain))); } static PyObject * @@ -72,12 +72,15 @@ static PyObject * api_util_tempname (PyObject *self, PyObject *args) { char *tmpdir = NULL, *tmpname = NULL; - + PyObject *ret; + if (!PyArg_ParseTuple (args, "|z", &tmpdir)) return NULL; tmpname = mu_tempname (tmpdir); - return _ro (PyString_FromString (tmpname ? tmpname : "")); + ret = _ro (PyString_FromString (mu_prstr (tmpname))); + free (tmpname); + return ret; } static PyMethodDef methods[] = { diff --git a/testsuite/bs.c b/testsuite/bs.c index fe438d1dd..11f7fac29 100644 --- a/testsuite/bs.c +++ b/testsuite/bs.c @@ -22,8 +22,6 @@ #include <stdlib.h> #include <mailutils/mailutils.h> -#define S(str) ((str) ? (str) : "") - static void print_param (const char *prefix, mu_assoc_t assoc, int indent) { @@ -85,34 +83,35 @@ print_imapenvelope (struct mu_imapenvelope *env, int level) indent += 4; mu_printf ("%*sTime: ", indent, ""); mu_c_streamftime (mu_strout, "%c%n", &env->date, &env->tz); - mu_printf ("%*sSubject: %s\n", indent, "", S(env->subject)); + mu_printf ("%*sSubject: %s\n", indent, "", mu_prstr (env->subject)); print_address ("From", env->from, indent); print_address ("Sender", env->sender, indent); print_address ("Reply-to", env->reply_to, indent); print_address ("To", env->to, indent); print_address ("Cc", env->cc, indent); print_address ("Bcc", env->bcc, indent); - mu_printf ("%*sIn-Reply-To: %s\n", indent, "", S(env->in_reply_to)); - mu_printf ("%*sMessage-ID: %s\n", indent, "", S(env->message_id)); + mu_printf ("%*sIn-Reply-To: %s\n", indent, "", mu_prstr (env->in_reply_to)); + mu_printf ("%*sMessage-ID: %s\n", indent, "", mu_prstr (env->message_id)); } static void print_bs (struct mu_bodystructure *bs, int level) { int indent = level << 2; - mu_printf ("%*sbody_type=%s\n", indent, "", S(bs->body_type)); - mu_printf ("%*sbody_subtype=%s\n", indent, "", S(bs->body_subtype)); + mu_printf ("%*sbody_type=%s\n", indent, "", mu_prstr (bs->body_type)); + mu_printf ("%*sbody_subtype=%s\n", indent, "", mu_prstr (bs->body_subtype)); print_param ("Parameters", bs->body_param, indent); - mu_printf ("%*sbody_id=%s\n", indent, "", S(bs->body_id)); - mu_printf ("%*sbody_descr=%s\n", indent, "", S(bs->body_descr)); - mu_printf ("%*sbody_encoding=%s\n", indent, "", S(bs->body_encoding)); + mu_printf ("%*sbody_id=%s\n", indent, "", mu_prstr (bs->body_id)); + mu_printf ("%*sbody_descr=%s\n", indent, "", mu_prstr (bs->body_descr)); + mu_printf ("%*sbody_encoding=%s\n", indent, "", mu_prstr (bs->body_encoding)); mu_printf ("%*sbody_size=%lu\n", indent, "", (unsigned long) bs->body_size); /* Optional */ - mu_printf ("%*sbody_md5=%s\n", indent, "", S(bs->body_md5)); - mu_printf ("%*sbody_disposition=%s\n", indent, "", S(bs->body_disposition)); + mu_printf ("%*sbody_md5=%s\n", indent, "", mu_prstr (bs->body_md5)); + mu_printf ("%*sbody_disposition=%s\n", indent, "", + mu_prstr (bs->body_disposition)); print_param ("Disposition Parameters", bs->body_disp_param, indent); - mu_printf ("%*sbody_language=%s\n", indent, "", S(bs->body_language)); - mu_printf ("%*sbody_location=%s\n", indent, "", S(bs->body_location)); + mu_printf ("%*sbody_language=%s\n", indent, "", mu_prstr (bs->body_language)); + mu_printf ("%*sbody_location=%s\n", indent, "", mu_prstr (bs->body_location)); mu_printf ("%*sType ", indent, ""); switch (bs->body_message_type) diff --git a/testsuite/mimetest.c b/testsuite/mimetest.c index 8ec5088d8..0f8e593aa 100644 --- a/testsuite/mimetest.c +++ b/testsuite/mimetest.c @@ -215,7 +215,7 @@ message_display_parts (mu_message_t msg, int indent) mu_strerror (status)); } printf ("%*.*sType of part %d = %s\n", indent, indent, "", - j, type ? type : ""); + j, mu_prstr (type)); print_message_part_sizes (part, indent); if (mu_header_sget_value (hdr, MU_HEADER_CONTENT_TRANSFER_ENCODING, &encoding)) |