yelp r3212 - in trunk: . src



Author: jmouette
Date: Tue Dec 23 21:20:48 2008
New Revision: 3212
URL: http://svn.gnome.org/viewvc/yelp?rev=3212&view=rev

Log:
        * src/yelp-window.c: (window_do_load_html):
        - Load local files with g_file_new_for_path.
        - Do not loop endlessly over the end of file while
          reading it.
        Fixes bug #562137 - fails to load local HTML files


Modified:
   trunk/ChangeLog
   trunk/src/yelp-window.c

Modified: trunk/src/yelp-window.c
==============================================================================
--- trunk/src/yelp-window.c	(original)
+++ trunk/src/yelp-window.c	Tue Dec 23 21:20:48 2008
@@ -1631,7 +1631,10 @@
     
     window_setup_window (window, type, uri, frag_id, uri, priv->base_uri, need_history);
 
-    file   = g_file_new_for_uri (uri);
+    if (uri[0] == '/')
+	file = g_file_new_for_path (uri);
+    else
+	file = g_file_new_for_uri (uri);
     stream = g_file_read (file, NULL, NULL);
 
     if (stream == NULL) {
@@ -1667,7 +1670,7 @@
     }
 
     while ((g_input_stream_read_all
-	    ((GInputStream *)stream, buffer, BUFFER_SIZE, &n, NULL, NULL))) {
+	    ((GInputStream *)stream, buffer, BUFFER_SIZE, &n, NULL, NULL)) && n) {
 	gchar *tmp;
 	tmp = g_utf8_strup (buffer, n);
 	if (strstr (tmp, "<FRAMESET")) {



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