diff options
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | tests/ui-tests/message-browser.c | 50 |
2 files changed, 30 insertions, 23 deletions
@@ -1,5 +1,8 @@ 2000-02-21 Matt Loper <matt@helixcode.com> + * tests/ui-tests/message-browser.c (on_link_clicked): stop + sscanf() abuse. + * tests/Makefile.am: changed references to libibex.a to libibex.la. diff --git a/tests/ui-tests/message-browser.c b/tests/ui-tests/message-browser.c index 328cde3bcf..fbd0550571 100644 --- a/tests/ui-tests/message-browser.c +++ b/tests/ui-tests/message-browser.c @@ -261,39 +261,43 @@ on_link_clicked (GtkHTML *html, const gchar *url, gpointer data) gchar tmp_buffer[4096]; gint nb_bytes_read; - gchar* message = g_strdup_printf ("You have clicked on this link:\n%s", - url); - sscanf (url, "camel://%p", &stream); - save_stream = camel_stream_fs_new_with_name ("saved-file", CAMEL_STREAM_FS_WRITE); + gchar* message = + g_strdup_printf ("You have clicked on this link:\n%s", url); + + if (sscanf (url, "camel://%p", &stream)) + { + save_stream = + camel_stream_fs_new_with_name ("saved-file", + CAMEL_STREAM_FS_WRITE); - do { - - /* read next chunk of text */ - nb_bytes_read = camel_stream_read (stream, - tmp_buffer, - 4096); - - /* If there's any text, write it to the stream */ - if (nb_bytes_read > 0) { - camel_stream_write (save_stream, tmp_buffer, nb_bytes_read); - - } + do { + /* read next chunk of text */ + nb_bytes_read = camel_stream_read (stream, + tmp_buffer, + 4096); + + /* If there's any text, write it to the stream */ + if (nb_bytes_read > 0) { + camel_stream_write (save_stream, + tmp_buffer, + nb_bytes_read); + } + + + } while (!camel_stream_eos (stream)); - } while (!camel_stream_eos (stream)); - - camel_stream_close (save_stream); - + camel_stream_close (save_stream); + } + message_box = gnome_message_box_new (message, GNOME_MESSAGE_BOX_INFO, "Okay", NULL); gnome_dialog_set_default (GNOME_DIALOG (message_box), 1); - gnome_dialog_run (message_box); + gnome_dialog_run (GNOME_DIALOG (message_box)); g_free (message); - - } |