[evolution-ews] Remove unused Camel utilities.



commit b00c581160edcaf23946dcef47783a11c38bbcee
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sun Aug 19 08:19:07 2012 -0400

    Remove unused Camel utilities.

 src/camel/camel-ews-utils.c |  259 -------------------------------------------
 src/camel/camel-ews-utils.h |   36 ------
 2 files changed, 0 insertions(+), 295 deletions(-)
---
diff --git a/src/camel/camel-ews-utils.c b/src/camel/camel-ews-utils.c
index bd84c83..2c4bf74 100644
--- a/src/camel/camel-ews-utils.c
+++ b/src/camel/camel-ews-utils.c
@@ -38,265 +38,6 @@
 #define SUBFOLDER_DIR_NAME     "subfolders"
 #define SUBFOLDER_DIR_NAME_LEN 10
 
-/**
- * e_path_to_physical:
- * @prefix: a prefix to prepend to the path, or %NULL
- * @path: the virtual path to convert to a filesystem path.
- *
- * This converts the "virtual" path @path into an expanded form that
- * allows a given name to refer to both a file and a directory. The
- * expanded path will have a "subfolders" directory inserted between
- * each path component. If the path ends with "/", the returned
- * physical path will end with "/subfolders"
- *
- * If @prefix is non-%NULL, it will be prepended to the returned path.
- *
- * Returns: the expanded path
- **/
-gchar *
-e_path_to_physical (const gchar *prefix,
-                    const gchar *vpath)
-{
-	const gchar *p, *newp;
-	gchar *dp;
-	gchar *ppath;
-	gint ppath_len;
-	gint prefix_len;
-
-	while (*vpath == '/')
-		vpath++;
-	if (!prefix)
-		prefix = "";
-
-	/* Calculate the length of the real path. */
-	ppath_len = strlen (vpath);
-	ppath_len++;	/* For the ending zero.  */
-
-	prefix_len = strlen (prefix);
-	ppath_len += prefix_len;
-	ppath_len++;	/* For the separating slash.  */
-
-	/* Take account of the fact that we need to translate every
-	 * separator into 'subfolders/'.
-	 */
-	p = vpath;
-	while (1) {
-		newp = strchr (p, '/');
-		if (newp == NULL)
-			break;
-
-		ppath_len += SUBFOLDER_DIR_NAME_LEN;
-		ppath_len++; /* For the separating slash.  */
-
-		/* Skip consecutive slashes.  */
-		while (*newp == '/')
-			newp++;
-
-		p = newp;
-	};
-
-	ppath = g_malloc (ppath_len);
-	dp = ppath;
-
-	memcpy (dp, prefix, prefix_len);
-	dp += prefix_len;
-	*(dp++) = '/';
-
-	/* Copy the mangled path.  */
-	p = vpath;
-	while (1) {
-		newp = strchr (p, '/');
-		if (newp == NULL) {
-			strcpy (dp, p);
-			break;
-		}
-
-		memcpy (dp, p, newp - p + 1); /* '+ 1' to copy the slash too.  */
-		dp += newp - p + 1;
-
-		memcpy (dp, SUBFOLDER_DIR_NAME, SUBFOLDER_DIR_NAME_LEN);
-		dp += SUBFOLDER_DIR_NAME_LEN;
-
-		*(dp++) = '/';
-
-		/* Skip consecutive slashes.  */
-		while (*newp == '/')
-			newp++;
-
-		p = newp;
-	}
-
-	return ppath;
-}
-
-static gboolean
-find_folders_recursive (const gchar *physical_path,
-                        const gchar *path,
-                        EPathFindFoldersCallback callback,
-                        gpointer data)
-{
-	GDir *dir;
-	gchar *subfolder_directory_path;
-	gboolean ok;
-
-	if (*path) {
-		if (!callback (physical_path, path, data))
-			return FALSE;
-
-		subfolder_directory_path = g_strdup_printf (
-			"%s/%s", physical_path, SUBFOLDER_DIR_NAME);
-	} else {
-		/* On the top level, we have no folders and,
-		 * consequently, no subfolder directory. */
-		subfolder_directory_path = g_strdup (physical_path);
-	}
-
-	/* Now scan the subfolders and load them. */
-	dir = g_dir_open (subfolder_directory_path, 0, NULL);
-	if (dir == NULL) {
-		g_free (subfolder_directory_path);
-		return TRUE;
-	}
-
-	ok = TRUE;
-	while (ok) {
-		struct stat file_stat;
-		const gchar *dirent;
-		gchar *file_path;
-		gchar *new_path;
-
-		dirent = g_dir_read_name (dir);
-		if (dirent == NULL)
-			break;
-
-		file_path = g_strdup_printf (
-			"%s/%s", subfolder_directory_path, dirent);
-
-		if (g_stat (file_path, &file_stat) < 0 ||
-		    !S_ISDIR (file_stat.st_mode)) {
-			g_free (file_path);
-			continue;
-		}
-
-		new_path = g_strdup_printf ("%s/%s", path, dirent);
-
-		ok = find_folders_recursive (
-			file_path, new_path, callback, data);
-
-		g_free (file_path);
-		g_free (new_path);
-	}
-
-	g_dir_close (dir);
-	g_free (subfolder_directory_path);
-
-	return ok;
-}
-
-/**
- * e_path_find_folders:
- * @prefix: directory to start from
- * @callback: Callback to invoke on each folder
- * @data: Data for @callback
- *
- * Walks the folder tree starting at @prefix and calls @callback
- * on each folder.
- *
- * Returns: %TRUE on success, %FALSE if an error occurs at any point
- **/
-gboolean
-e_path_find_folders (const gchar *prefix,
-                     EPathFindFoldersCallback callback,
-                     gpointer data)
-{
-	return find_folders_recursive (prefix, "", callback, data);
-}
-
-/**
- * e_path_rmdir:
- * @prefix: a prefix to prepend to the path, or %NULL
- * @path: the virtual path to convert to a filesystem path.
- *
- * This removes the directory pointed to by @prefix and @path
- * and attempts to remove its parent "subfolders" directory too
- * if it's empty.
- *
- * Returns: -1 (with errno set) if it failed to rmdir the
- * specified directory. 0 otherwise, whether or not it removed
- * the parent directory.
- **/
-gint
-e_path_rmdir (const gchar *prefix,
-              const gchar *vpath)
-{
-	gchar *physical_path, *p;
-
-	/* Remove the directory itself */
-	physical_path = e_path_to_physical (prefix, vpath);
-	if (g_rmdir (physical_path) == -1) {
-		g_free (physical_path);
-		return -1;
-	}
-
-	/* Attempt to remove its parent "subfolders" directory,
-	 * ignoring errors since it might not be empty.
-	 */
-
-	p = strrchr (physical_path, '/');
-	if (p[1] == '\0') {
-		g_free (physical_path);
-		return 0;
-	}
-	*p = '\0';
-	p = strrchr (physical_path, '/');
-	if (!p || strcmp (p + 1, SUBFOLDER_DIR_NAME) != 0) {
-		g_free (physical_path);
-		return 0;
-	}
-
-	g_rmdir (physical_path);
-	g_free (physical_path);
-	return 0;
-}
-
-void
-do_flags_diff (flags_diff_t *diff,
-               guint32 old,
-               guint32 _new)
-{
-	diff->changed = old ^ _new;
-	diff->bits = _new & diff->changed;
-}
-
-gchar *
-ews_concat (const gchar *prefix,
-            const gchar *suffix)
-{
-	gsize len;
-
-	len = strlen (prefix);
-	if (len == 0 || prefix[len - 1] == '/')
-		return g_strdup_printf ("%s%s", prefix, suffix);
-	else
-		return g_strdup_printf ("%s%c%s", prefix, '/', suffix);
-}
-
-void
-strip_lt_gt (gchar **string,
-             gint s_offset,
-             gint e_offset)
-{
-	gchar *temp = NULL;
-	gint len;
-
-	temp = g_strdup (*string);
-	len = strlen (*string);
-
-	*string = (gchar *)g_malloc0 (len-1);
-	*string = memcpy(*string, temp+s_offset, len-e_offset);
-	g_free (temp);
-}
-
 CamelFolderInfo *
 camel_ews_utils_build_folder_info (CamelEwsStore *store,
                                    const gchar *fid)
diff --git a/src/camel/camel-ews-utils.h b/src/camel/camel-ews-utils.h
index 09f2532..6ed30d0 100644
--- a/src/camel/camel-ews-utils.h
+++ b/src/camel/camel-ews-utils.h
@@ -51,50 +51,14 @@
 
 G_BEGIN_DECLS
 
-/*for syncing flags back to server*/
-typedef struct {
-	guint32 changed;
-	guint32 bits;
-} flags_diff_t;
-
-/* FIXME: deprecated
- * This is used exclusively for the legacy imap cache code.
- * DO NOT use this in any new code. */
-
-typedef gboolean
-		(*EPathFindFoldersCallback)	(const gchar *physical_path,
-						 const gchar *path,
-						 gpointer user_data);
-
-gchar *		e_path_to_physical		(const gchar *prefix,
-						 const gchar *vpath);
-
-gboolean	e_path_find_folders		(const gchar *prefix,
-						 EPathFindFoldersCallback callback,
-						 gpointer data);
-
-gint		e_path_rmdir			(const gchar *prefix,
-						 const gchar *vpath);
-
-void		do_flags_diff			(flags_diff_t *diff,
-						 guint32 old,
-						 guint32 _new);
-gchar *		ews_concat			(const gchar *prefix,
-						 const gchar *suffix);
-void		strip_lt_gt			(gchar **string,
-						 gint s_offset,
-						 gint e_offset);
-
 void		ews_utils_sync_folders		(CamelEwsStore *ews_store,
 						 GSList *created_folders,
 						 GSList *deleted_folders,
 						 GSList *updated_folders);
-
 CamelFolderInfo *
 		camel_ews_utils_build_folder_info
 						(CamelEwsStore *store,
 						 const gchar *fid);
-
 void		camel_ews_utils_sync_deleted_items
 						(CamelEwsFolder *ews_folder,
 						 GSList *items_deleted);



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