[PATCH] Modify parse_uri_substring



The attached modifies parse_uri_substring to simply use gnome_vfs_new,
which does scan for the method separator itself. Without this patch,
multi-chained URIs don't work properly.

-- 
Christian Neumair <chris gnome-de org>
Index: libgnomevfs/gnome-vfs-uri.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-uri.c,v
retrieving revision 1.134
diff -u -p -r1.134 gnome-vfs-uri.c
--- libgnomevfs/gnome-vfs-uri.c	20 Apr 2006 15:55:29 -0000	1.134
+++ libgnomevfs/gnome-vfs-uri.c	10 May 2006 07:59:53 -0000
@@ -439,51 +439,21 @@ get_method_string (const gchar *substrin
 static GnomeVFSURI *
 parse_uri_substring (const gchar *substring, GnomeVFSURI *parent)
 {
-	GnomeVFSMethod *method;
-	GnomeVFSURI *uri, *child_uri;
-	gchar *method_string;
-	const gchar *method_scanner;
-	const gchar *extension_scanner;
+	GnomeVFSURI *uri;
 
 	if (substring == NULL || *substring == '\0') {
 		return NULL;
 	}
-	
-	method_scanner = get_method_string (substring, &method_string);
 
-	method = gnome_vfs_method_get (method_string);
-	if (!method) {
-		g_free (method_string);
-		return NULL;
-	}
-
-	uri = g_new0 (GnomeVFSURI, 1);
-	uri->method = method;
-	uri->method_string = method_string;
-	uri->ref_count = 1;
-	uri->parent = parent;
-
-	extension_scanner = strchr (method_scanner, GNOME_VFS_URI_MAGIC_CHR);
-
-	if (extension_scanner == NULL) {
-		set_uri_element (uri, method_scanner, strlen (method_scanner));
-		return uri;
-	}
-
-	/* handle '#' */
-	set_uri_element (uri, method_scanner, extension_scanner - method_scanner);
-
-	if (strchr (extension_scanner, ':') == NULL) {
-		/* extension is a fragment identifier */
-		uri->fragment_id = g_strdup (extension_scanner + 1);
-		return uri;
-	}
+	uri = gnome_vfs_uri_new (substring);
+	if (uri != NULL) {
+		GnomeVFSToplevelURI *toplevel;
+		GnomeVFSURI *toplevel_uri;
 
-	/* extension is a uri chain */
-	child_uri = parse_uri_substring (extension_scanner + 1, uri);
+		toplevel = gnome_vfs_uri_get_toplevel (uri);
 
-	if (child_uri != NULL) {
-		return child_uri;
+		toplevel_uri = (GnomeVFSURI *) toplevel;
+		toplevel_uri->parent = parent;
 	}
 
 	return uri;


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