diff options
author | Jon Trowbridge <trow@ximian.com> | 2001-07-01 04:28:52 +0800 |
---|---|---|
committer | Jon Trowbridge <trow@src.gnome.org> | 2001-07-01 04:28:52 +0800 |
commit | effc7ac8c082ae542619603a43c6935ba6f3faaa (patch) | |
tree | f31559f7eae45ac86d721a109b4969e80e8c5020 | |
parent | e3a7660cde2591da526f685f36bdeb496ab95066 (diff) | |
download | gsoc2013-evolution-effc7ac8c082ae542619603a43c6935ba6f3faaa.tar gsoc2013-evolution-effc7ac8c082ae542619603a43c6935ba6f3faaa.tar.gz gsoc2013-evolution-effc7ac8c082ae542619603a43c6935ba6f3faaa.tar.bz2 gsoc2013-evolution-effc7ac8c082ae542619603a43c6935ba6f3faaa.tar.lz gsoc2013-evolution-effc7ac8c082ae542619603a43c6935ba6f3faaa.tar.xz gsoc2013-evolution-effc7ac8c082ae542619603a43c6935ba6f3faaa.tar.zst gsoc2013-evolution-effc7ac8c082ae542619603a43c6935ba6f3faaa.zip |
I was accidentally comparing characters and strings here, and didn't see
2001-06-30 Jon Trowbridge <trow@ximian.com>
* backend/ebook/e-destination.c (build_field): I was accidentally
comparing characters and strings here, and didn't see the compiler
warning. Fixed.
(e_destination_exportv): Don't export any empty destinations.
(bug#3825).
svn path=/trunk/; revision=10635
-rw-r--r-- | addressbook/ChangeLog | 8 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-destination.c | 34 |
2 files changed, 29 insertions, 13 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index aa21dc6a8d..44f431d532 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,11 @@ +2001-06-30 Jon Trowbridge <trow@ximian.com> + + * backend/ebook/e-destination.c (build_field): I was accidentally + comparing characters and strings here, and didn't see the compiler + warning. Fixed. + (e_destination_exportv): Don't export any empty destinations. + (bug#3825). + 2001-06-30 Zbigniew Chyla <cyba@gnome.pl> * gui/component/e-address-popup.c (e_address_popup_construct): Marked diff --git a/addressbook/backend/ebook/e-destination.c b/addressbook/backend/ebook/e-destination.c index 513f934cdf..67044484ae 100644 --- a/addressbook/backend/ebook/e-destination.c +++ b/addressbook/backend/ebook/e-destination.c @@ -368,7 +368,6 @@ e_destination_get_name (const EDestination *dest) priv->name = e_card_name_to_string (priv->card->name); } - } return priv->name; @@ -467,9 +466,11 @@ e_destination_get_address_textv (EDestination **destv) strv = g_new0 (gchar *, len+1); for (i = 0, j = 0; destv[i]; ++i) { - const gchar *addr = e_destination_get_email_verbose (destv[i]); - strv[j++] = addr ? (gchar *) addr : ""; + if (! e_destination_is_empty (destv[i])) { + const gchar *addr = e_destination_get_email_verbose (destv[i]); + strv[j++] = addr ? (gchar *) addr : ""; + } } str = g_strjoinv (", ", strv); @@ -486,8 +487,12 @@ e_destination_get_address_textv (EDestination **destv) */ #define DESTINATION_TAG "DEST" -#define DESTINATION_SEPARATOR "|" -#define VEC_SEPARATOR "\1" + +#define DESTINATION_SEPARATOR "|" +#define DESTINATION_SEPARATOR_CHAR '|' + +#define VEC_SEPARATOR "\1" +#define VEC_SEPARATOR_CHAR '\1' static gchar * join_strings (gchar **strv) @@ -527,7 +532,7 @@ build_field (const gchar *key, const gchar *value) /* Paranoia: Convert any '\1' or '|' in the key or value to '_' */ for (c=field; *c; ++c) { - if (*c == VEC_SEPARATOR || *c == DESTINATION_SEPARATOR) + if (*c == VEC_SEPARATOR_CHAR || *c == DESTINATION_SEPARATOR_CHAR) *c = '_'; } @@ -645,8 +650,6 @@ e_destination_import (const gchar *str) dest->priv->name = name; dest->priv->pending_card_id = card; - g_message ("name:[%s] addr:[%s]", name, addr); - e_destination_set_html_mail_pref (dest, want_html); g_strfreev (fields); @@ -657,7 +660,7 @@ e_destination_import (const gchar *str) gchar * e_destination_exportv (EDestination **destv) { - gint i, len = 0; + gint i, j, len = 0; gchar **strv; gchar *str; @@ -669,13 +672,18 @@ e_destination_exportv (EDestination **destv) } strv = g_new0 (gchar *, len+1); - for (i = 0; i < len; ++i) - strv[i] = e_destination_export (destv[i]); + for (i = 0, j = 0; i < len; ++i) { + if (! e_destination_is_empty (destv[i])) + strv[j++] = e_destination_export (destv[i]); + } str = g_strjoinv (VEC_SEPARATOR, strv); - for (i = 0; i < len; ++i) - g_free (strv[i]); + for (i = 0; i < len; ++i) { + if (strv[i]) { + g_free (strv[i]); + } + } g_free (strv); return str; |