[yelp] Fix a series of issues resulting from the gio port



commit 14a123dfb5f14b5256166cd2f6be256b80ff2f8f
Author: Vincent Untz <vuntz gnome org>
Date:   Wed Apr 29 20:42:47 2009 +0100

    Fix a series of issues resulting from the gio port
---
 ChangeLog         |    8 ++++++++
 src/yelp-utils.c  |    4 ++--
 src/yelp-window.c |   20 +++++++++++++-------
 3 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1c69919..f6b6fb6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,14 @@
 
 	* src/yelp-window.c: 
 	* src/yelp-utils.c: 
+	Fix a series of issues resulting from the
+	gio port (bug #558633 - patch by epic GNOME
+	hero Vincent Untz)
+
+2009-04-29  Don Scorgie  <dscorgie src gnome org>
+
+	* src/yelp-window.c: 
+	* src/yelp-utils.c: 
 	* src/yelp-utils.h: 
 	Add plain text handler
 	Bug #565502 - patch from Josselin Mouette
diff --git a/src/yelp-utils.c b/src/yelp-utils.c
index a868628..cae8663 100644
--- a/src/yelp-utils.c
+++ b/src/yelp-utils.c
@@ -402,12 +402,12 @@ yelp_uri_resolve (gchar *uri, gchar **result, gchar **section)
 	    file_cut++;
 	ret = resolve_full_file (&intern_uri[file_cut]);
 	if (ret == YELP_RRN_TYPE_EXTERNAL) {
+	    *result = g_strdup (&uri[file_cut]);
 	    *section = NULL;
-	    *result = g_strdup (uri);
 	}
 	else if (ret == YELP_RRN_TYPE_ERROR) {
-	    *section = NULL;
 	    *result = NULL;
+	    *section = NULL;
 	} else {
 	    *result = g_strdup (&intern_uri[file_cut]);
 	    *section = intern_section;
diff --git a/src/yelp-window.c b/src/yelp-window.c
index 7b0524e..7b355af 100644
--- a/src/yelp-window.c
+++ b/src/yelp-window.c
@@ -1082,8 +1082,13 @@ yelp_window_load (YelpWindow *window, const gchar *uri)
 	case YELP_RRN_TYPE_HTML:
 	case YELP_RRN_TYPE_XHTML:
 	case YELP_RRN_TYPE_TEXT:
-	    priv->base_uri = g_strdup ("file:///fakefile");
-	    window_do_load_html (window, real_uri, frag_id, type, TRUE);
+ 	    {
+		gchar *uri;
+		priv->base_uri = g_strdup ("file:///fakefile");
+		uri = g_filename_to_uri (real_uri, NULL, NULL);
+		window_do_load_html (window, uri, frag_id, type, TRUE);
+		g_free (uri);
+ 	    }
 	    break;
 	case YELP_RRN_TYPE_EXTERNAL:
 	    {
@@ -1639,7 +1644,6 @@ window_do_load_html (YelpWindow    *window,
     gchar             buffer[BUFFER_SIZE];
     GtkAction        *action;
     gchar *real_uri = NULL;
-    gchar *base_uri = NULL;
 
     gboolean  handled = TRUE;
 
@@ -1679,12 +1683,10 @@ window_do_load_html (YelpWindow    *window,
 	goto done;
     }
 
-    base_uri = g_filename_to_uri (uri, NULL, NULL);
     if (frag_id) {
-	real_uri = g_strconcat (base_uri, "#", frag_id, NULL);
-	g_free (base_uri);
+	real_uri = g_strconcat (uri, "#", frag_id, NULL);
     } else {
-	real_uri = base_uri;
+	real_uri = g_strdup (uri);
     }
     yelp_html_set_base_uri (priv->html_view, real_uri);
 
@@ -1705,6 +1707,10 @@ window_do_load_html (YelpWindow    *window,
     while ((g_input_stream_read_all
 	    ((GInputStream *)stream, buffer, BUFFER_SIZE, &n, NULL, NULL)) && n) {
 	gchar *tmp;
+
+	if (n == 0)
+		break;
+
 	tmp = g_utf8_strup (buffer, n);
 	if (strstr (tmp, "<FRAMESET")) {
 	    yelp_html_frames (priv->html_view, TRUE);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]