file-roller r2205 - in trunk: . src



Author: paobac
Date: Tue Apr  1 15:00:05 2008
New Revision: 2205
URL: http://svn.gnome.org/viewvc/file-roller?rev=2205&view=rev

Log:
2008-04-01  Paolo Bacchilega  <paobac svn gnome org>

	* src/file-utils.c: use glib uri functions to escape/unescape an uri


Modified:
   trunk/ChangeLog
   trunk/src/file-utils.c

Modified: trunk/src/file-utils.c
==============================================================================
--- trunk/src/file-utils.c	(original)
+++ trunk/src/file-utils.c	Tue Apr  1 15:00:05 2008
@@ -940,42 +940,6 @@
 }
 
 
-char *
-escape_uri (const char *uri)
-{
-	const char *start = NULL;
-	const char *uri_no_method;
-	char       *method;
-	char       *epath, *euri;
-
-	if (uri == NULL)
-		return NULL;
-
-	start = strstr (uri, "://");
-	if (start != NULL) {
-		uri_no_method = start + strlen ("://");
-		method = g_strndup (uri, start - uri);
-	} 
-	else {
-		uri_no_method = uri;
-		method = NULL;
-	}
-
-	epath = gnome_vfs_escape_host_and_path_string (uri_no_method);
-
-	if (method != NULL) {
-		euri = g_strdup_printf ("%s://%s", method, epath);
-		g_free (epath);
-	} 
-	else
-		euri = epath;
-
-	g_free (method);
-
-	return euri;
-}
-
-
 gboolean
 check_permissions (const char *uri,
 		   int         mode)
@@ -1049,7 +1013,7 @@
 	char *escaped;
 	char *uri;
 
-	escaped = escape_uri (local_path);
+	escaped = g_uri_escape_string (local_path, G_URI_RESERVED_CHARS_ALLOWED_IN_PATH, FALSE);
 	if (escaped[0] == '/') {
 		uri = g_strconcat ("file://", escaped, NULL);
 		g_free (escaped);
@@ -1064,7 +1028,7 @@
 char *
 get_local_path_from_uri (const char *uri)
 {
-	return gnome_vfs_unescape_string (remove_host_from_uri (uri), NULL);
+	return g_uri_unescape_string (remove_host_from_uri (uri), NULL);
 }
 
 



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