From 3cf228772512334661adb91a1a709b6a2962651f Mon Sep 17 00:00:00 2001 From: Not Zed Date: Wed, 14 Apr 2004 09:48:36 +0000 Subject: remove debug comment. 2004-04-14 Not Zed * mail-component.c (impl_createControls): remove debug comment. ** See #56641. * em-format-html-display.c (efhd_format_secure): fix a small memleak. (efhd_bonobo_unknown, efhd_format_attachment): close the tag properly, and
it as well to make sure its separated. * em-sync-stream.c: add some runtime and compile time stream logging stuff. svn path=/trunk/; revision=25457 --- mail/ChangeLog | 12 +++++++++ mail/em-camel-stream.c | 2 +- mail/em-format-html-display.c | 6 ++--- mail/em-sync-stream.c | 63 ++++++++++++++++++++++++++++++++++++++----- mail/mail-component.c | 2 -- 5 files changed, 73 insertions(+), 12 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index 044234d450..b210c34123 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,5 +1,17 @@ 2004-04-14 Not Zed + * mail-component.c (impl_createControls): remove debug comment. + + ** See #56641. + + * em-format-html-display.c (efhd_format_secure): fix a small + memleak. + (efhd_bonobo_unknown, efhd_format_attachment): close the + tag properly, and
it as well to make sure its separated. + + * em-sync-stream.c: add some runtime and compile time stream + logging stuff. + ** See bug #56149. * em-folder-view.c (emfv_edit_cut): similar to below, use focus to diff --git a/mail/em-camel-stream.c b/mail/em-camel-stream.c index a1274d634a..4b1c3f4a4b 100644 --- a/mail/em-camel-stream.c +++ b/mail/em-camel-stream.c @@ -39,7 +39,7 @@ #define EMCS_BUFFER_SIZE (4096) -/*#define LOG_STREAM*/ +#define LOG_STREAM 1 #define d(x) diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c index e57d7505bd..8f03c1bd89 100644 --- a/mail/em-format-html-display.c +++ b/mail/em-format-html-display.c @@ -884,7 +884,7 @@ efhd_format_secure(EMFormat *emf, CamelStream *stream, CamelMimePart *part, Came pobj->valid = camel_cipher_validity_clone(valid); pobj->object.free = efhd_xpkcs7mime_free; camel_stream_printf(stream, "", classid); - + g_free(classid); if (valid->sign.status != CAMEL_CIPHER_VALIDITY_SIGN_NONE) { camel_stream_printf(stream, "%s
", _(smime_sign_table[valid->sign.status].shortdesc)); } @@ -920,7 +920,7 @@ efhd_bonobo_unknown(EMFormat *emf, CamelStream *stream, CamelMimePart *part, con classid = g_strdup_printf("bonobo-unknown:///em-format-html-display/%s", emf->part_id->str); em_format_html_add_pobject((EMFormatHTML *)emf, sizeof(EMFormatHTMLPObject), classid, part, efhd_bonobo_object); - camel_stream_printf(stream, "\n", classid, info->mime_type); + camel_stream_printf(stream, "
\n", classid, info->mime_type); g_free(classid); } @@ -1531,7 +1531,7 @@ efhd_format_attachment(EMFormat *emf, CamelStream *stream, CamelMimePart *part, classid = g_strdup_printf("bonobo-unknown:///em-format-html-display/%s", emf->part_id->str); em_format_html_add_pobject((EMFormatHTML *)emf, sizeof(EMFormatHTMLPObject), classid, part, efhd_bonobo_object); - camel_stream_printf(stream, "\n", classid, mime_type); + camel_stream_printf(stream, "
>\n", classid, mime_type); } g_free(classid); diff --git a/mail/em-sync-stream.c b/mail/em-sync-stream.c index df5659253e..d6fae3a8d7 100644 --- a/mail/em-sync-stream.c +++ b/mail/em-sync-stream.c @@ -21,7 +21,6 @@ * */ - #ifdef HAVE_CONFIG_H #include #endif @@ -35,7 +34,7 @@ #include "mail-mt.h" -/*#define LOG_STREAM*/ +#define LOG_STREAM #define d(x) @@ -51,8 +50,16 @@ struct _EMSyncStreamPrivate { char *buf_data; int buf_used; int buf_size; + +#ifdef LOG_STREAM + FILE *logfd; +#endif }; +#ifdef LOG_STREAM +int dolog; +#endif + /* Should probably expose messages to outside world ... so subclasses can extend */ enum _write_msg_t { EMSS_WRITE, @@ -85,6 +92,9 @@ em_sync_stream_get_type (void) static CamelType type = CAMEL_INVALID_TYPE; if (type == CAMEL_INVALID_TYPE) { +#ifdef LOG_STREAM + dolog = getenv("EVOLUTION_MAIL_LOG_HTML") != NULL; +#endif type = camel_type_register (CAMEL_STREAM_TYPE, "EMSyncStream", sizeof (EMSyncStream), @@ -130,6 +140,10 @@ emcs_gui_received(GIOChannel *source, GIOCondition cond, void *data) /* force out any pending data before doing anything else */ if (p->buf_used > 0) { EMSS_CLASS(emss)->sync_write((CamelStream *)emss, p->buf_data, p->buf_used); +#ifdef LOG_STREAM + if (p->logfd) + fwrite(p->buf_data, 1, p->buf_used, p->logfd); +#endif p->buf_used = 0; } @@ -138,12 +152,22 @@ emcs_gui_received(GIOChannel *source, GIOCondition cond, void *data) switch (msg->op) { case EMSS_WRITE: EMSS_CLASS(emss)->sync_write((CamelStream *)emss, msg->data, msg->n); +#ifdef LOG_STREAM + if (p->logfd) + fwrite(msg->data, 1, msg->n, p->logfd); +#endif break; case EMSS_FLUSH: EMSS_CLASS(emss)->sync_flush((CamelStream *)emss); break; case EMSS_CLOSE: EMSS_CLASS(emss)->sync_close((CamelStream *)emss); +#ifdef LOG_STREAM + if (p->logfd) { + fclose(p->logfd); + p->logfd = NULL; + } +#endif break; } @@ -167,6 +191,17 @@ em_sync_stream_init (CamelObject *object) p->gui_channel = g_io_channel_unix_new(e_msgport_fd(p->data_port)); p->gui_watch = g_io_add_watch(p->gui_channel, G_IO_IN, emcs_gui_received, emss); +#ifdef LOG_STREAM + if (dolog) { + char name[32]; + static int count; + + sprintf(name, "sync-stream.%d.html", count++); + printf("Saving raw data stream to '%s'\n", name); + p->logfd = fopen(name, "w"); + } +#endif + d(printf("%p: new emss\n", emss)); } @@ -210,6 +245,12 @@ em_sync_stream_finalize (CamelObject *object) p->reply_port = NULL; g_free(p->buf_data); + +#ifdef LOG_STREAM + if (p->logfd) + fclose(p->logfd); +#endif + g_free(p); } @@ -222,9 +263,13 @@ stream_write (CamelStream *stream, const char *buffer, size_t n) if (emss->cancel) return -1; - if (pthread_self() == mail_gui_thread) + if (pthread_self() == mail_gui_thread) { EMSS_CLASS(emss)->sync_write(stream, buffer, n); - else if (p->buf_size > 0) { +#ifdef LOG_STREAM + if (p->logfd) + fwrite(buffer, 1, n, p->logfd); +#endif + } else if (p->buf_size > 0) { size_t left = p->buf_size-p->buf_used; if (n >= left) { @@ -266,9 +311,15 @@ stream_close(CamelStream *stream) d(printf("%p: closing stream\n", stream)); - if (pthread_self() == mail_gui_thread) + if (pthread_self() == mail_gui_thread) { +#ifdef LOG_STREAM + if (emss->priv->logfd) { + fclose(emss->priv->logfd); + emss->priv->logfd = NULL; + } +#endif return ((EMSyncStreamClass *)(((CamelObject *)emss)->klass))->sync_close(stream); - else + } else sync_op(emss, EMSS_CLOSE, NULL, 0); return 0; diff --git a/mail/mail-component.c b/mail/mail-component.c index 2b10893f9e..9cef8556ef 100644 --- a/mail/mail-component.c +++ b/mail/mail-component.c @@ -533,8 +533,6 @@ impl_createControls (PortableServer_Servant servant, gtk_widget_show (view_widget); gtk_widget_show (statusbar_widget); - printf("setting up info area\n"); - vbox = gtk_vbox_new(FALSE, 0); info = e_info_label_new("evolution-inbox-mini.png"); e_info_label_set_info((EInfoLabel *)info, _("Mail"), ""); -- cgit v1.2.3