summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@gnome.org>2009-06-04 21:44:30 +0200
committerBenjamin Otte <otte@gnome.org>2009-06-11 10:05:40 +0200
commitb4e9f6a3241f072f6275a0a50b6909b8d1a6474b (patch)
treeb4ecb488a2da9bef63336e6fe5127dbfd73b3dee
parent099ec12159453b224957f36bef4271bfd9c326b3 (diff)
downloadgvfs-b4e9f6a3241f072f6275a0a50b6909b8d1a6474b.tar.gz
[FTP] whitespace changes
- replace tabs with 8 spaces - remove spaces at end of line
-rw-r--r--daemon/gvfsbackendftp.c432
-rw-r--r--daemon/gvfsbackendftp.h24
-rw-r--r--daemon/gvfsftpconnection.c64
-rw-r--r--daemon/gvfsftpconnection.h2
-rw-r--r--daemon/gvfsftpdircache.c54
-rw-r--r--daemon/gvfsftpdircache.h2
-rw-r--r--daemon/gvfsftpfile.c14
-rw-r--r--daemon/gvfsftpfile.h2
-rw-r--r--daemon/gvfsftptask.c316
-rw-r--r--daemon/gvfsftptask.h4
10 files changed, 457 insertions, 457 deletions
diff --git a/daemon/gvfsbackendftp.c b/daemon/gvfsbackendftp.c
index 4b7f8b97..c2bf7858 100644
--- a/daemon/gvfsbackendftp.c
+++ b/daemon/gvfsbackendftp.c
@@ -1,5 +1,5 @@
/* GIO - GLib Input, Output and Streaming Library
- *
+ *
* Copyright (C) 2008,2009 Benjamin Otte <otte@gnome.org>
* 2008,2009 Andreas Henriksson <andreas@fatal.se>
*
@@ -57,14 +57,14 @@
/*
* about filename interpretation in the ftp backend
*
- * As GVfs composes paths using a slash character, we cannot allow a slash as
- * part of a basename. Other critical characters are \r \n and sometimes the
- * space. We therefore g_uri_escape_string() filenames by default and concatenate
+ * As GVfs composes paths using a slash character, we cannot allow a slash as
+ * part of a basename. Other critical characters are \r \n and sometimes the
+ * space. We therefore g_uri_escape_string() filenames by default and concatenate
* paths using slashes. This should make GVfs happy.
*
- * Luckily, TVFS (see RFC 3xxx for details) is a specification that does exactly
- * what we want. It disallows slashes, \r and \n in filenames, so we can happily
- * use it without the need to escape. We also can operate on full paths as our
+ * Luckily, TVFS (see RFC 3xxx for details) is a specification that does exactly
+ * what we want. It disallows slashes, \r and \n in filenames, so we can happily
+ * use it without the need to escape. We also can operate on full paths as our
* paths exactly match those of a TVFS-using FTP server.
*/
@@ -74,8 +74,8 @@ static gboolean
gvfs_backend_ftp_determine_features (GVfsFtpTask *task)
{
const struct {
- const char * name; /* name of feature */
- GVfsFtpFeature enable; /* flags to enable with this feature */
+ const char * name; /* name of feature */
+ GVfsFtpFeature enable; /* flags to enable with this feature */
} features[] = {
{ "MDTM", G_VFS_FTP_FEATURE_MDTM },
{ "SIZE", G_VFS_FTP_FEATURE_SIZE },
@@ -95,7 +95,7 @@ gvfs_backend_ftp_determine_features (GVfsFtpTask *task)
char *feature = reply[i];
if (feature[0] != ' ')
- continue;
+ continue;
feature++;
/* There should just be one space according to RFC2389, but some
@@ -105,13 +105,13 @@ gvfs_backend_ftp_determine_features (GVfsFtpTask *task)
feature++;
for (j = 0; j < G_N_ELEMENTS (features); j++)
- {
- if (g_ascii_strcasecmp (feature, features[j].name) == 0)
- {
- g_debug ("# feature %s supported\n", features[j].name);
- task->backend->features |= 1 << features[j].enable;
- }
- }
+ {
+ if (g_ascii_strcasecmp (feature, features[j].name) == 0)
+ {
+ g_debug ("# feature %s supported\n", features[j].name);
+ task->backend->features |= 1 << features[j].enable;
+ }
+ }
}
g_strfreev (reply);
@@ -145,16 +145,16 @@ gvfs_backend_ftp_determine_system (GVfsFtpTask *task)
}
system_name = reply[0] + 4;
- for (i = 0; i < G_N_ELEMENTS (known_systems); i++)
+ for (i = 0; i < G_N_ELEMENTS (known_systems); i++)
{
- if (g_ascii_strncasecmp (system_name,
- known_systems[i].id,
- strlen (known_systems[i].id)) == 0)
- {
- task->backend->system = known_systems[i].system;
- g_debug ("# system is %s\n", known_systems[i].debug_name);
- break;
- }
+ if (g_ascii_strncasecmp (system_name,
+ known_systems[i].id,
+ strlen (known_systems[i].id)) == 0)
+ {
+ task->backend->system = known_systems[i].system;
+ g_debug ("# system is %s\n", known_systems[i].debug_name);
+ break;
+ }
}
g_strfreev (reply);
@@ -166,7 +166,7 @@ g_vfs_bacend_ftp_create_root_file_info (GVfsBackendFtp *ftp)
GFileInfo *info;
GIcon *icon;
char *display_name;
-
+
info = g_file_info_new ();
g_file_info_set_file_type (info, G_FILE_TYPE_DIRECTORY);
@@ -204,13 +204,13 @@ static gboolean
g_vfs_ftp_task_cd (GVfsFtpTask *task, const GVfsFtpFile *file)
{
guint response = g_vfs_ftp_task_send (task,
- G_VFS_FTP_PASS_550,
- "CWD %s", g_vfs_ftp_file_get_ftp_path (file));
+ G_VFS_FTP_PASS_550,
+ "CWD %s", g_vfs_ftp_file_get_ftp_path (file));
if (response == 550)
{
- g_set_error_literal (&task->error,
- G_IO_ERROR, G_IO_ERROR_NOT_DIRECTORY,
- _("The file is not a directory"));
+ g_set_error_literal (&task->error,
+ G_IO_ERROR, G_IO_ERROR_NOT_DIRECTORY,
+ _("The file is not a directory"));
response = 0;
}
@@ -228,7 +228,7 @@ g_vfs_ftp_task_try_cd (GVfsFtpTask *task, const GVfsFtpFile *file)
g_vfs_ftp_task_clear_error (task);
return FALSE;
}
-
+
return TRUE;
}
@@ -263,10 +263,10 @@ g_vfs_backend_ftp_init (GVfsBackendFtp *ftp)
static void
do_mount (GVfsBackend *backend,
- GVfsJobMount *job,
- GMountSpec *mount_spec,
- GMountSource *mount_source,
- gboolean is_automount)
+ GVfsJobMount *job,
+ GMountSpec *mount_spec,
+ GMountSource *mount_source,
+ gboolean is_automount)
{
GVfsBackendFtp *ftp = G_VFS_BACKEND_FTP (backend);
GVfsFtpTask task = G_VFS_FTP_TASK_INIT (ftp, G_VFS_JOB (job));
@@ -303,24 +303,24 @@ do_mount (GVfsBackend *backend,
username = NULL;
password = NULL;
break_on_fail = FALSE;
-
+
if (ftp->user != NULL && strcmp (ftp->user, "anonymous") == 0)
{
anonymous = TRUE;
break_on_fail = TRUE;
goto try_login;
}
-
+
if (g_vfs_keyring_lookup_password (ftp->user,
- g_network_address_get_hostname (addr),
- NULL,
- "ftp",
- NULL,
- NULL,
- port == 21 ? 0 : port,
- &username,
- NULL,
- &password))
+ g_network_address_get_hostname (addr),
+ NULL,
+ "ftp",
+ NULL,
+ NULL,
+ port == 21 ? 0 : port,
+ &username,
+ NULL,
+ &password))
{
anonymous = FALSE;
goto try_login;
@@ -330,41 +330,41 @@ do_mount (GVfsBackend *backend,
{
GAskPasswordFlags flags;
if (prompt == NULL)
- {
- if (ftp->has_initial_user)
- /* Translators: the first %s is the username, the second the host name */
- prompt = g_strdup_printf (_("Enter password for ftp as %s on %s"), ftp->user, ftp->host_display_name);
- else
- /* translators: %s here is the hostname */
- prompt = g_strdup_printf (_("Enter password for ftp on %s"), ftp->host_display_name);
- }
-
+ {
+ if (ftp->has_initial_user)
+ /* Translators: the first %s is the username, the second the host name */
+ prompt = g_strdup_printf (_("Enter password for ftp as %s on %s"), ftp->user, ftp->host_display_name);
+ else
+ /* translators: %s here is the hostname */
+ prompt = g_strdup_printf (_("Enter password for ftp on %s"), ftp->host_display_name);
+ }
+
flags = G_ASK_PASSWORD_NEED_PASSWORD;
-
+
if (!ftp->has_initial_user)
flags |= G_ASK_PASSWORD_NEED_USERNAME | G_ASK_PASSWORD_ANONYMOUS_SUPPORTED;
-
+
if (g_vfs_keyring_is_available ())
flags |= G_ASK_PASSWORD_SAVING_SUPPORTED;
-
+
if (!g_mount_source_ask_password (
- mount_source,
- prompt,
- ftp->user,
- NULL,
+ mount_source,
+ prompt,
+ ftp->user,
+ NULL,
flags,
- &aborted,
- &password,
- &username,
- NULL,
- &anonymous,
- &password_save) ||
- aborted)
- {
- g_set_error_literal (&task.error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
- _("Password dialog cancelled"));
- break;
- }
+ &aborted,
+ &password,
+ &username,
+ NULL,
+ &anonymous,
+ &password_save) ||
+ aborted)
+ {
+ g_set_error_literal (&task.error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
+ _("Password dialog cancelled"));
+ break;
+ }
/* NEED_USERNAME wasn't set */
if (ftp->has_initial_user)
@@ -372,38 +372,38 @@ do_mount (GVfsBackend *backend,
g_free (username);
username = g_strdup (ftp->user);
}
-
+
try_login:
g_free (ftp->user);
g_free (ftp->password);
if (anonymous)
- {
- if (g_vfs_ftp_task_login (&task, "anonymous", "") != 0)
- {
- ftp->user = g_strdup ("anonymous");
- ftp->password = g_strdup ("");
- break;
- }
- ftp->user = NULL;
- ftp->password = NULL;
- }
+ {
+ if (g_vfs_ftp_task_login (&task, "anonymous", "") != 0)
+ {
+ ftp->user = g_strdup ("anonymous");
+ ftp->password = g_strdup ("");
+ break;
+ }
+ ftp->user = NULL;
+ ftp->password = NULL;
+ }
else
- {
- ftp->user = username ? g_strdup (username) : g_strdup ("");
- ftp->password = g_strdup (password);
- if (g_vfs_ftp_task_login (&task, username, password) != 0)
- break;
- }
+ {
+ ftp->user = username ? g_strdup (username) : g_strdup ("");
+ ftp->password = g_strdup (password);
+ if (g_vfs_ftp_task_login (&task, username, password) != 0)
+ break;
+ }
g_free (username);
g_free (password);
-
+
if (break_on_fail ||
!g_error_matches (task.error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED))
- break;
+ break;
g_vfs_ftp_task_clear_error (&task);
}
-
+
/* send post-login commands */
if (g_vfs_backend_ftp_uses_workaround (ftp, G_VFS_FTP_WORKAROUND_FEAT_AFTER_LOGIN) &&
!g_vfs_ftp_task_is_in_error (&task))
@@ -420,7 +420,7 @@ try_login:
/* Save the address of the current connection, so that for future connections,
* we are sure to connect to the same machine.
- * The idea here is to avoid using mirrors that have a different state, which
+ * The idea here is to avoid using mirrors that have a different state, which
* might cause Heisenbugs.
*/
if (!g_vfs_ftp_task_is_in_error (&task))
@@ -469,7 +469,7 @@ try_login:
if (ftp->has_initial_user)
g_mount_spec_set (mount_spec, "user", ftp->user);
-
+
if (g_str_equal (ftp->user, "anonymous"))
display_name = g_strdup_printf (_("ftp on %s"), ftp->host_display_name);
else
@@ -487,17 +487,17 @@ try_login:
ftp->connections = 1;
ftp->max_connections = G_MAXUINT;
ftp->queue = g_queue_new ();
-
+
g_object_unref (addr);
g_vfs_ftp_task_done (&task);
}
static gboolean
try_mount (GVfsBackend *backend,
- GVfsJobMount *job,
- GMountSpec *mount_spec,
- GMountSource *mount_source,
- gboolean is_automount)
+ GVfsJobMount *job,
+ GMountSpec *mount_spec,
+ GMountSource *mount_source,
+ gboolean is_automount)
{
GVfsBackendFtp *ftp = G_VFS_BACKEND_FTP (backend);
const char *host, *port_str;
@@ -535,7 +535,7 @@ try_mount (GVfsBackend *backend,
static void
do_unmount (GVfsBackend * backend,
- GVfsJobUnmount *job)
+ GVfsJobUnmount *job)
{
GVfsBackendFtp *ftp = G_VFS_BACKEND_FTP (backend);
GVfsFtpConnection *conn;
@@ -557,7 +557,7 @@ static void
error_550_exists (GVfsFtpTask *task, gpointer file)
{
/* FIXME:
- * What we should do here is look at the cache to figure out if the file
+ * What we should do here is look at the cache to figure out if the file
* exists, but as cache access is only exposed via the backend
* structure (it should be properly abstracted into an opaque thread-safe
* structure and then be available per-connection), we could not do that.
@@ -582,13 +582,13 @@ error_550_exists (GVfsFtpTask *task, gpointer file)
static void
error_550_is_directory (GVfsFtpTask *task, gpointer file)
{
- if (g_vfs_ftp_task_send (task,
+ if (g_vfs_ftp_task_send (task,
G_VFS_FTP_PASS_550,
"CWD %s", g_vfs_ftp_file_get_ftp_path (file)))
{
- g_set_error_literal (&task->error, G_IO_ERROR,
- G_IO_ERROR_IS_DIRECTORY,
- _("File is directory"));
+ g_set_error_literal (&task->error, G_IO_ERROR,
+ G_IO_ERROR_IS_DIRECTORY,
+ _("File is directory"));
}
else
{
@@ -615,8 +615,8 @@ error_550_parent_not_found (GVfsFtpTask *task, gpointer file)
static void
do_open_for_read (GVfsBackend *backend,
- GVfsJobOpenForRead *job,
- const char *filename)
+ GVfsJobOpenForRead *job,
+ const char *filename)
{
GVfsBackendFtp *ftp = G_VFS_BACKEND_FTP (backend);
GVfsFtpTask task = G_VFS_FTP_TASK_INIT (ftp, G_VFS_JOB (job));
@@ -627,11 +627,11 @@ do_open_for_read (GVfsBackend *backend,
file = g_vfs_ftp_file_new_from_gvfs (ftp, filename);
g_vfs_ftp_task_send_and_check (&task,
- G_VFS_FTP_PASS_100 | G_VFS_FTP_FAIL_200,
- &open_read_handlers[0],
- file,
+ G_VFS_FTP_PASS_100 | G_VFS_FTP_FAIL_200,
+ &open_read_handlers[0],
+ file,
NULL,
- "RETR %s", g_vfs_ftp_file_get_ftp_path (file));
+ "RETR %s", g_vfs_ftp_file_get_ftp_path (file));
g_vfs_ftp_file_free (file);
if (!g_vfs_ftp_task_is_in_error (&task))
@@ -648,8 +648,8 @@ do_open_for_read (GVfsBackend *backend,
static void
do_close_read (GVfsBackend * backend,
- GVfsJobCloseRead *job,
- GVfsBackendHandle handle)
+ GVfsJobCloseRead *job,
+ GVfsBackendHandle handle)
{
GVfsBackendFtp *ftp = G_VFS_BACKEND_FTP (backend);
GVfsFtpTask task = G_VFS_FTP_TASK_INIT (ftp, G_VFS_JOB (job));
@@ -657,17 +657,17 @@ do_close_read (GVfsBackend * backend,
g_vfs_ftp_task_give_connection (&task, conn);
g_vfs_ftp_task_close_data_connection (&task);
- g_vfs_ftp_task_receive (&task, 0, NULL);
+ g_vfs_ftp_task_receive (&task, 0, NULL);
g_vfs_ftp_task_done (&task);
}
static void
do_read (GVfsBackend * backend,
- GVfsJobRead * job,
- GVfsBackendHandle handle,
- char * buffer,
- gsize bytes_requested)
+ GVfsJobRead * job,
+ GVfsBackendHandle handle,
+ char * buffer,
+ gsize bytes_requested)
{
GVfsBackendFtp *ftp = G_VFS_BACKEND_FTP (backend);
GVfsFtpTask task = G_VFS_FTP_TASK_INIT (ftp, G_VFS_JOB (job));
@@ -688,14 +688,14 @@ do_read (GVfsBackend * backend,
static void
do_start_write (GVfsFtpTask *task,
- GFileCreateFlags flags,
- const char *format,
- ...) G_GNUC_PRINTF (3, 4);
+ GFileCreateFlags flags,
+ const char *format,
+ ...) G_GNUC_PRINTF (3, 4);
static void
do_start_write (GVfsFtpTask *task,
- GFileCreateFlags flags,
- const char *format,
- ...)
+ GFileCreateFlags flags,
+ const char *format,
+ ...)
{
va_list varargs;
@@ -720,7 +720,7 @@ do_start_write (GVfsFtpTask *task,
}
}
-/* NB: This gets a file info for the given object, no matter if it's a dir
+/* NB: This gets a file info for the given object, no matter if it's a dir
* or a file */
static GFileInfo *
create_file_info (GVfsFtpTask *task, GVfsFtpFile *file, gboolean resolve_symlinks)
@@ -779,8 +779,8 @@ create_file_info (GVfsFtpTask *task, GVfsFtpFile *file, gboolean resolve_symlink
/* clear error from ftp_connection_send() in else if line above */
g_vfs_ftp_task_clear_error (task);
- /* note that there might still be a file/directory, we just have
- * no way to figure this out (in particular on ftp servers that
+ /* note that there might still be a file/directory, we just have
+ * no way to figure this out (in particular on ftp servers that
* don't support SIZE.
* If you have ways to improve file detection, patches are welcome. */
}
@@ -791,9 +791,9 @@ create_file_info (GVfsFtpTask *task, GVfsFtpFile *file, gboolean resolve_symlink
static void
do_create (GVfsBackend *backend,
- GVfsJobOpenForWrite *job,
- const char *filename,
- GFileCreateFlags flags)
+ GVfsJobOpenForWrite *job,
+ const char *filename,
+ GFileCreateFlags flags)
{
GVfsBackendFtp *ftp = G_VFS_BACKEND_FTP (backend);
GVfsFtpTask task = G_VFS_FTP_TASK_INIT (ftp, G_VFS_JOB (job));
@@ -806,9 +806,9 @@ do_create (GVfsBackend *backend,
{
g_object_unref (info);
g_set_error_literal (&task.error,
- G_IO_ERROR,
- G_IO_ERROR_EXISTS,
- _("Target file already exists"));
+ G_IO_ERROR,
+ G_IO_ERROR_EXISTS,
+ _("Target file already exists"));
g_vfs_ftp_file_free (file);
g_vfs_ftp_task_done (&task);
return;
@@ -822,9 +822,9 @@ do_create (GVfsBackend *backend,
static void
do_append (GVfsBackend *backend,
- GVfsJobOpenForWrite *job,
- const char *filename,
- GFileCreateFlags flags)
+ GVfsJobOpenForWrite *job,
+ const char *filename,
+ GFileCreateFlags flags)
{
GVfsBackendFtp *ftp = G_VFS_BACKEND_FTP (backend);
GVfsFtpTask task = G_VFS_FTP_TASK_INIT (ftp, G_VFS_JOB (job));
@@ -840,11 +840,11 @@ do_append (GVfsBackend *backend,
static void
do_replace (GVfsBackend *backend,
- GVfsJobOpenForWrite *job,
- const char *filename,
- const char *etag,
- gboolean make_backup,
- GFileCreateFlags flags)
+ GVfsJobOpenForWrite *job,
+ const char *filename,
+ const char *etag,
+ gboolean make_backup,
+ GFileCreateFlags flags)
{
GVfsBackendFtp *ftp = G_VFS_BACKEND_FTP (backend);
GVfsFtpTask task = G_VFS_FTP_TASK_INIT (ftp, G_VFS_JOB (job));
@@ -871,8 +871,8 @@ do_replace (GVfsBackend *backend,
static void
do_close_write (GVfsBackend *backend,
- GVfsJobCloseWrite *job,
- GVfsBackendHandle handle)
+ GVfsJobCloseWrite *job,
+ GVfsBackendHandle handle)
{
GVfsBackendFtp *ftp = G_VFS_BACKEND_FTP (backend);
GVfsFtpTask task = G_VFS_FTP_TASK_INIT (ftp, G_VFS_JOB (job));
@@ -880,17 +880,17 @@ do_close_write (GVfsBackend *backend,
g_vfs_ftp_task_give_connection (&task, handle);
g_vfs_ftp_task_close_data_connection (&task);
- g_vfs_ftp_task_receive (&task, 0, NULL);
+ g_vfs_ftp_task_receive (&task, 0, NULL);
g_vfs_ftp_task_done (&task);
}
static void
do_write (GVfsBackend *backend,
- GVfsJobWrite *job,
- GVfsBackendHandle handle,
- char *buffer,
- gsize buffer_size)
+ GVfsJobWrite *job,
+ GVfsBackendHandle handle,
+ char *buffer,
+ gsize buffer_size)
{
GVfsBackendFtp *ftp = G_VFS_BACKEND_FTP (backend);
GVfsFtpTask task = G_VFS_FTP_TASK_INIT (ftp, G_VFS_JOB (job));
@@ -903,7 +903,7 @@ do_write (GVfsBackend *backend,
buffer_size,
task.cancellable,
&task.error);
-
+
if (n_bytes >= 0)
g_vfs_job_write_set_written_size (job, n_bytes);
@@ -912,17 +912,17 @@ do_write (GVfsBackend *backend,
static void
do_query_info (GVfsBackend *backend,
- GVfsJobQueryInfo *job,
- const char *filename,
- GFileQueryInfoFlags query_flags,
- GFileInfo *info,
- GFileAttributeMatcher *matcher)
+ GVfsJobQueryInfo *job,
+ const char *filename,
+ GFileQueryInfoFlags query_flags,
+ GFileInfo *info,
+ GFileAttributeMatcher *matcher)
{
GVfsBackendFtp *ftp = G_VFS_BACKEND_FTP (backend);
GVfsFtpTask task = G_VFS_FTP_TASK_INIT (ftp, G_VFS_JOB (job));
GVfsFtpFile *file;
GFileInfo *real;
-
+
file = g_vfs_ftp_file_new_from_gvfs (ftp, filename);
real = create_file_info (&task, file, query_flags & G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS ? FALSE : TRUE);
@@ -944,10 +944,10 @@ do_query_info (GVfsBackend *backend,
static void
do_enumerate (GVfsBackend *backend,
- GVfsJobEnumerate *job,
- const char *dirname,
- GFileAttributeMatcher *matcher,
- GFileQueryInfoFlags query_flags)
+ GVfsJobEnumerate *job,
+ const char *dirname,
+ GFileAttributeMatcher *matcher,
+ GFileQueryInfoFlags query_flags)
{
GVfsBackendFtp *ftp = G_VFS_BACKEND_FTP (backend);
GVfsFtpTask task = G_VFS_FTP_TASK_INIT (ftp, G_VFS_JOB (job));
@@ -979,9 +979,9 @@ do_enumerate (GVfsBackend *backend,
static void
do_set_display_name (GVfsBackend *backend,
- GVfsJobSetDisplayName *job,
- const char *filename,
- const char *display_name)
+ GVfsJobSetDisplayName *job,
+ const char *filename,
+ const char *display_name)
{
GVfsBackendFtp *ftp = G_VFS_BACKEND_FTP (backend);
GVfsFtpTask task = G_VFS_FTP_TASK_INIT (ftp, G_VFS_JOB (job));
@@ -991,11 +991,11 @@ do_set_display_name (GVfsBackend *backend,
dir = g_vfs_ftp_file_new_parent (original);
now = g_vfs_ftp_file_new_child (dir, display_name, &task.error);
g_vfs_ftp_task_send (&task,
- G_VFS_FTP_PASS_300 | G_VFS_FTP_FAIL_200,
- "RNFR %s", g_vfs_ftp_file_get_ftp_path (original));
+ G_VFS_FTP_PASS_300 | G_VFS_FTP_FAIL_200,
+ "RNFR %s", g_vfs_ftp_file_get_ftp_path (original));
g_vfs_ftp_task_send (&task,
- 0,
- "RNTO %s", g_vfs_ftp_file_get_ftp_path (now));
+ 0,
+ "RNTO %s", g_vfs_ftp_file_get_ftp_path (now));
/* FIXME: parse result of RNTO here? */
g_vfs_job_set_display_name_set_new_path (job, g_vfs_ftp_file_get_gvfs_path (now));
@@ -1009,8 +1009,8 @@ do_set_display_name (GVfsBackend *backend,
static void
do_delete (GVfsBackend *backend,
- GVfsJobDelete *job,
- const char *filename)
+ GVfsJobDelete *job,
+ const char *filename)
{
GVfsBackendFtp *ftp = G_VFS_BACKEND_FTP (backend);
GVfsFtpTask task = G_VFS_FTP_TASK_INIT (ftp, G_VFS_JOB (job));
@@ -1021,35 +1021,35 @@ do_delete (GVfsBackend *backend,
* The file-first-then-directory order has been decided by coin-toss. */
file = g_vfs_ftp_file_new_from_gvfs (ftp, filename);
response = g_vfs_ftp_task_send (&task,
- G_VFS_FTP_PASS_500,
- "DELE %s", g_vfs_ftp_file_get_ftp_path (file));
+ G_VFS_FTP_PASS_500,
+ "DELE %s", g_vfs_ftp_file_get_ftp_path (file));
if (G_VFS_FTP_RESPONSE_GROUP (response) == 5)
{
response = g_vfs_ftp_task_send (&task,
- G_VFS_FTP_PASS_550,
- "RMD %s", g_vfs_ftp_file_get_ftp_path (file));
+ G_VFS_FTP_PASS_550,
+ "RMD %s", g_vfs_ftp_file_get_ftp_path (file));
if (response == 550)
- {
- GList *list = g_vfs_ftp_dir_cache_lookup_dir (ftp->dir_cache,
+ {
+ GList *list = g_vfs_ftp_dir_cache_lookup_dir (ftp->dir_cache,
&task,
file,
FALSE,
FALSE);
- if (list)
- {
- g_set_error_literal (&task.error,
- G_IO_ERROR,
- G_IO_ERROR_NOT_EMPTY,
- g_strerror (ENOTEMPTY));
+ if (list)
+ {
+ g_set_error_literal (&task.error,
+ G_IO_ERROR,
+ G_IO_ERROR_NOT_EMPTY,
+ g_strerror (ENOTEMPTY));
g_list_foreach (list, (GFunc) g_object_unref, NULL);
g_list_free (list);
- }
- else
+ }
+ else
{
g_vfs_ftp_task_clear_error (&task);
g_vfs_ftp_task_set_error_from_response (&task, response);
}
- }
+ }
}
g_vfs_ftp_dir_cache_purge_file (ftp->dir_cache, file);
@@ -1060,8 +1060,8 @@ do_delete (GVfsBackend *backend,
static void
do_make_directory (GVfsBackend *backend,
- GVfsJobMakeDirectory *job,
- const char *filename)
+ GVfsJobMakeDirectory *job,
+ const char *filename)
{
GVfsBackendFtp *ftp = G_VFS_BACKEND_FTP (backend);
GVfsFtpTask task = G_VFS_FTP_TASK_INIT (ftp, G_VFS_JOB (job));
@@ -1076,7 +1076,7 @@ do_make_directory (GVfsBackend *backend,
NULL,
"MKD %s", g_vfs_ftp_file_get_ftp_path (file));
- /* FIXME: Compare created file with name from server result to be sure
+ /* FIXME: Compare created file with name from server result to be sure
* it's correct and otherwise fail. */
g_vfs_ftp_dir_cache_purge_file (ftp->dir_cache, file);
g_vfs_ftp_file_free (file);
@@ -1086,12 +1086,12 @@ do_make_directory (GVfsBackend *backend,
static void
do_move (GVfsBackend *backend,
- GVfsJobMove *job,
- const char *source,
- const char *destination,
- GFileCopyFlags flags,
- GFileProgressCallback progress_callback,
- gpointer progress_callback_data)
+ GVfsJobMove *job,
+ const char *source,
+ const char *destination,
+ GFileCopyFlags flags,
+ GFileProgressCallback progress_callback,
+ gpointer progress_callback_data)
{
GVfsBackendFtp *ftp = G_VFS_BACKEND_FTP (backend);
GVfsFtpTask task = G_VFS_FTP_TASK_INIT (ftp, G_VFS_JOB (job));
@@ -1120,13 +1120,13 @@ do_move (GVfsBackend *backend,
g_free (basename);
if (real == NULL)
{
- goto out;
+ goto out;
}
else
- {
- g_vfs_ftp_file_free (destfile);
- destfile = real;
- }
+ {
+ g_vfs_ftp_file_free (destfile);
+ destfile = real;
+ }
}
if (!(flags & G_FILE_COPY_OVERWRITE))
@@ -1136,22 +1136,22 @@ do_move (GVfsBackend *backend,
FALSE);
if (info)
- {
- g_object_unref (info);
- g_set_error_literal (&task.error,
- G_IO_ERROR,
- G_IO_ERROR_EXISTS,
- _("Target file already exists"));
- goto out;
- }
+ {
+ g_object_unref (info);
+ g_set_error_literal (&task.error,
+ G_IO_ERROR,
+ G_IO_ERROR_EXISTS,
+ _("Target file already exists"));
+ goto out;
+ }
}
g_vfs_ftp_task_send (&task,
- G_VFS_FTP_PASS_300 | G_VFS_FTP_FAIL_200,
- "RNFR %s", g_vfs_ftp_file_get_ftp_path (srcfile));
+ G_VFS_FTP_PASS_300 | G_VFS_FTP_FAIL_200,
+ "RNFR %s", g_vfs_ftp_file_get_ftp_path (srcfile));
g_vfs_ftp_task_send (&task,
- 0,
- "RNTO %s", g_vfs_ftp_file_get_ftp_path (destfile));
+ 0,
+ "RNTO %s", g_vfs_ftp_file_get_ftp_path (destfile));
g_vfs_ftp_dir_cache_purge_file (ftp->dir_cache, srcfile);
g_vfs_ftp_dir_cache_purge_file (ftp->dir_cache, destfile);
@@ -1167,7 +1167,7 @@ g_vfs_backend_ftp_class_init (GVfsBackendFtpClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GVfsBackendClass *backend_class = G_VFS_BACKEND_CLASS (klass);
-
+
gobject_class->finalize = g_vfs_backend_ftp_finalize;
backend_class->mount = do_mount;
@@ -1238,7 +1238,7 @@ g_vfs_backend_ftp_uses_workaround (GVfsBackendFtp * ftp,
* @workaround: workaround to set
*
* Sets the given @workaround to be used on the backend. Workarounds are flags
- * set on the backend to ensure a special behavior in the client to work
+ * set on the backend to ensure a special behavior in the client to work
* around problems with servers. See the existing workarounds for examples.
**/
void
@@ -1253,6 +1253,6 @@ g_vfs_backend_ftp_use_workaround (GVfsBackendFtp * ftp,
set = 1 << workaround;
while (((cur = g_atomic_int_get (&ftp->workarounds)) & set) == 0 &&
!g_atomic_int_compare_and_exchange (&ftp->workarounds, cur, cur | set));
-
+
}
diff --git a/daemon/gvfsbackendftp.h b/daemon/gvfsbackendftp.h
index c29b53fa..ae58f7b4 100644
--- a/daemon/gvfsbackendftp.h
+++ b/daemon/gvfsbackendftp.h
@@ -1,5 +1,5 @@
/* GIO - GLib Input, Output and Streaming Library
- *
+ *
* Copyright (C) 2008 Benjamin Otte <otte@gnome.org>
*
* This library is free software; you can redistribute it and/or
@@ -47,10 +47,10 @@ typedef enum {
typedef enum {
/* Server advertises support for EPSV (or we assume that it supports it),
- * but it does fail to do so, we set this flag so we can fall back to
+ * but it does fail to do so, we set this flag so we can fall back to
* PASV. */
G_VFS_FTP_WORKAROUND_BROKEN_EPSV,
- /* Server replies with a wrong address in PASV, we use connection IP
+ /* Server replies with a wrong address in PASV, we use connection IP
* instead */
G_VFS_FTP_WORKAROUND_PASV_ADDR,
/* server does not allow querying features before login, so we try after
@@ -74,16 +74,16 @@ typedef struct _GVfsBackendFtpClass GVfsBackendFtpClass;
struct _GVfsBackendFtp
{
- GVfsBackend backend;
+ GVfsBackend backend;
GSocketConnectable * addr;
GSocketClient * connection_factory;
- char * user;
+ char * user;
gboolean has_initial_user;
- char * password; /* password or NULL for anonymous */
+ char * password; /* password or NULL for anonymous */
char * host_display_name;
- GVfsFtpSystem system; /* the system from the SYST response */
+ GVfsFtpSystem system; /* the system from the SYST response */
int features; /* GVfsFtpFeatures that are supported */
int workarounds; /* GVfsFtpWorkarounds in use - int because it's atomic */
@@ -92,11 +92,11 @@ struct _GVfsBackendFtp
GVfsFtpDirCache * dir_cache; /* directory cache */
/* connection collection - accessed from gvfsftptask.c */
- GMutex * mutex; /* mutex protecting the following variables */
- GCond * cond; /* cond used to signal tasks waiting on the mutex */
- GQueue * queue; /* queue containing the connections */
- guint connections; /* current number of connections */
- guint max_connections; /* upper server limit for number of connections - dynamically generated */
+ GMutex * mutex; /* mutex protecting the following variables */
+ GCond * cond; /* cond used to signal tasks waiting on the mutex */
+ GQueue * queue; /* queue containing the connections */
+ guint connections; /* current number of connections */
+ guint max_connections; /* upper server limit for number of connections - dynamically generated */
};
struct _GVfsBackendFtpClass
diff --git a/daemon/gvfsftpconnection.c b/daemon/gvfsftpconnection.c
index 9756e37f..81822584 100644
--- a/daemon/gvfsftpconnection.c
+++ b/daemon/gvfsftpconnection.c
@@ -1,5 +1,5 @@
/* GIO - GLib Input, Output and Streaming Library
- *
+ *
* Copyright (C) 2009 Benjamin Otte <otte@gnome.org>
*
* This library is free software; you can redistribute it and/or
@@ -34,10 +34,10 @@ struct _GVfsFtpConnection
{
GSocketClient * client; /* socket client used for opening connections */
- GIOStream * commands; /* ftp command stream */
+ GIOStream * commands; /* ftp command stream */
GDataInputStream * commands_in; /* wrapper around in stream to allow line-wise reading */
- GIOStream * data; /* ftp data stream or NULL if not in use */
+ GIOStream * data; /* ftp data stream or NULL if not in use */
int debug_id; /* unique id for debugging purposes */
};
@@ -151,37 +151,37 @@ g_vfs_ftp_connection_receive (GVfsFtpConnection *conn,
g_ptr_array_add (lines, line);
if (reply_state == FIRST_LINE)
- {
- if (line[0] <= '0' || line[0] > '5' ||
- line[1] < '0' || line[1] > '9' ||
- line[2] < '0' || line[2] > '9')
- {
- g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
- _("Invalid reply"));
+ {
+ if (line[0] <= '0' || line[0] > '5' ||
+ line[1] < '0' || line[1] > '9' ||
+ line[2] < '0' || line[2] > '9')
+ {
+ g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ _("Invalid reply"));
goto fail;
- }
- response = 100 * (line[0] - '0') +
- 10 * (line[1] - '0') +
- (line[2] - '0');
- if (line[3] == ' ')
- reply_state = DONE;
- else if (line[3] == '-')
- reply_state = MULTILINE;
- else
- {
- g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
- _("Invalid reply"));
+ }
+ response = 100 * (line[0] - '0') +
+ 10 * (line[1] - '0') +
+ (line[2] - '0');
+ if (line[3] == ' ')
+ reply_state = DONE;
+ else if (line[3] == '-')
+ reply_state = MULTILINE;
+ else
+ {
+ g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ _("Invalid reply"));
goto fail;
- }
- }
+ }
+ }
else
- {
- if (line[0] - '0' == response / 100 &&
+ {
+ if (line[0] - '0' == response / 100 &&
line[1] - '0' == (response / 10) % 10 &&
- line[2] - '0' == response % 10 &&
- line[3] == ' ')
- reply_state = DONE;
- }
+ line[2] - '0' == response % 10 &&
+ line[3] == ' ')
+ reply_state = DONE;
+ }
if (!lines)
g_free (line);
}
@@ -312,8 +312,8 @@ g_vfs_ftp_connection_read_contents (GVfsFtpConnection *conn,
* g_vfs_ftp_connection_is_usable:
* @conn: a connection
*
- * Checks if this connection can still be used to send new commands. For
- * example, if the connection was closed, this is not possible and this
+ * Checks if this connection can still be used to send new commands. For
+ * example, if the connection was closed, this is not possible and this
* function will return %FALSE.
*
* Returns: %TRUE if the connection is still usable
diff --git a/daemon/gvfsftpconnection.h b/daemon/gvfsftpconnection.h
index 7fd33870..534a176d 100644
--- a/daemon/gvfsftpconnection.h
+++ b/daemon/gvfsftpconnection.h
@@ -1,5 +1,5 @@
/* GIO - GLib Input, Output and Streaming Library
- *
+ *
* Copyright (C) 2009 Benjamin Otte <otte@gnome.org>
*
* This library is free software; you can redistribute it and/or
diff --git a/daemon/gvfsftpdircache.c b/daemon/gvfsftpdircache.c
index f77635e4..4b8c1ba0 100644
--- a/daemon/gvfsftpdircache.c
+++ b/daemon/gvfsftpdircache.c
@@ -1,5 +1,5 @@
/* GIO - GLib Input, Output and Streaming Library
- *
+ *
* Copyright (C) 2009 Benjamin Otte <otte@gnome.org>
*
* This library is free software; you can redistribute it and/or
@@ -73,10 +73,10 @@ g_vfs_ftp_dir_cache_entry_unref (GVfsFtpDirCacheEntry *entry)
* g_vfs_ftp_dir_cache_entry_add:
* @entry: the entry to add data to
* @file: the file to add. The function takes ownership of the argument.
- * @info: the file info of the @file. The function takes ownership of the
+ * @info: the file info of the @file. The function takes ownership of the
* reference.
*
- * Adds a new file entry to the directory belonging to @entry. This function
+ * Adds a new file entry to the directory belonging to @entry. This function
* must only be called from a @GVfsFtpListDirFunc.
**/
void
@@ -152,17 +152,17 @@ g_vfs_ftp_dir_cache_lookup_entry (GVfsFtpDirCache * cache,
return entry;
if (g_vfs_ftp_task_send (task,
- G_VFS_FTP_PASS_550,
- "CWD %s", g_vfs_ftp_file_get_ftp_path (dir)) == 550)
+ G_VFS_FTP_PASS_550,
+ "CWD %s", g_vfs_ftp_file_get_ftp_path (dir)) == 550)
{
- g_set_error_literal (&task->error,
- G_IO_ERROR, G_IO_ERROR_NOT_DIRECTORY,
- _("The file is not a directory"));
+ g_set_error_literal (&task->error,
+ G_IO_ERROR, G_IO_ERROR_NOT_DIRECTORY,
+ _("The file is not a directory"));
}
g_vfs_ftp_task_open_data_connection (task);
g_vfs_ftp_task_send (task,
- G_VFS_FTP_PASS_100 | G_VFS_FTP_FAIL_200,
+ G_VFS_FTP_PASS_100 | G_VFS_FTP_FAIL_200,
"%s", cache->funcs->command);
if (g_vfs_ftp_task_is_in_error (task))
return NULL;
@@ -183,8 +183,8 @@ g_vfs_ftp_dir_cache_lookup_entry (GVfsFtpDirCache * cache,
return NULL;
}
g_mutex_lock (cache->lock);
- g_hash_table_insert (cache->directories,
- g_vfs_ftp_file_copy (dir),
+ g_hash_table_insert (cache->directories,
+ g_vfs_ftp_file_copy (dir),
g_vfs_ftp_dir_cache_entry_ref (entry));
g_mutex_unlock (cache->lock);
return entry;
@@ -211,13 +211,13 @@ g_vfs_ftp_dir_cache_resolve_symlink (GVfsFtpDirCache * cache,
GVfsFtpFile *tmp, *link;
guint i, lookups = 0;
- if (!g_file_info_get_is_symlink (original) ||
+ if (!g_file_info_get_is_symlink (original) ||
g_vfs_ftp_task_is_in_error (task))
return original;
info = g_object_ref (original);
link = g_vfs_ftp_file_copy (file);
- do
+ do
{
/* This must not happen, as we use one of our own GFileInfos */
g_assert (g_file_info_get_symlink_target (info) != NULL);
@@ -271,16 +271,16 @@ g_vfs_ftp_dir_cache_resolve_symlink (GVfsFtpDirCache * cache,
gpointer value;
if (!g_file_info_get_attribute_data (original,
- copy_attributes[i],
- &type,
- &value,
- NULL))
- continue;
-
+ copy_attributes[i],
+ &type,
+ &value,
+ NULL))
+ continue;
+
g_file_info_set_attribute (result,
- copy_attributes[i],
- type,
- value);
+ copy_attributes[i],
+ type,
+ value);
}
g_object_unref (original);
@@ -389,10 +389,10 @@ g_vfs_ftp_dir_cache_purge_dir (GVfsFtpDirCache * cache,
void
g_vfs_ftp_dir_cache_purge_file (GVfsFtpDirCache * cache,
- const GVfsFtpFile *file)
+ const GVfsFtpFile *file)
{
GVfsFtpFile *dir;
-
+
g_return_if_fail (cache != NULL);
g_return_if_fail (file != NULL);
@@ -448,13 +448,13 @@ g_vfs_ftp_dir_cache_funcs_process (GInputStream * stream,
/* don't list . and .. directories
* Let's hope they're not important files on some ftp servers
*/
- if (result.fe_fnlen == 1 &&
+ if (result.fe_fnlen == 1 &&
result.fe_fname[0] == '.')
{
g_free (line);
continue;
}
- if (result.fe_fnlen == 2 &&
+ if (result.fe_fnlen == 2 &&
result.fe_fname[0] == '.' &&
result.fe_fname[1] == '.')
{
@@ -528,7 +528,7 @@ g_vfs_ftp_dir_cache_funcs_resolve_default (GVfsFtpTask * task,
g_return_val_if_fail (file != NULL, NULL);
g_return_val_if_fail (target != NULL, NULL);
-
+
if (target[0] == '/')
return g_vfs_ftp_file_new_from_ftp (task->backend, target);
diff --git a/daemon/gvfsftpdircache.h b/daemon/gvfsftpdircache.h
index efebec25..c007d07c 100644
--- a/daemon/gvfsftpdircache.h
+++ b/daemon/gvfsftpdircache.h
@@ -1,5 +1,5 @@
/* GIO - GLib Input, Output and Streaming Library
- *
+ *
* Copyright (C) 2009 Benjamin Otte <otte@gnome.org>
*
* This library is free software; you can redistribute it and/or
diff --git a/daemon/gvfsftpfile.c b/daemon/gvfsftpfile.c
index c16cc469..5509fe18 100644
--- a/daemon/gvfsftpfile.c
+++ b/daemon/gvfsftpfile.c
@@ -1,5 +1,5 @@
/* GIO - GLib Input, Output and Streaming Library
- *
+ *
* Copyright (C) 2009 Benjamin Otte <otte@gnome.org>
*
* This library is free software; you can redistribute it and/or
@@ -31,7 +31,7 @@
/**
* GVfsFtpFile:
*
- * This structure maps between GVfs paths and the actual paths as used on an
+ * This structure maps between GVfs paths and the actual paths as used on an
* FTP server. The mapping may not be a 1-to-1 mapping, so always use this
* structure if you need to do operations on paths.
*/
@@ -148,8 +148,8 @@ g_vfs_ftp_file_new_parent (const GVfsFtpFile *file)
* @display_name: the basename to use for the new file
* @error: location to take an eventual error or %NULL
*
- * Tries to create a new file for the given @display_name in the given @parent
- * directory. If the display name is invalid, @error is set and %NULL is
+ * Tries to create a new file for the given @display_name in the given @parent
+ * directory. If the display name is invalid, @error is set and %NULL is
* returned.
*
* Returns: a new file or %NULL on error
@@ -165,7 +165,7 @@ g_vfs_ftp_file_new_child (const GVfsFtpFile *parent, const char *display_name, G
if (strpbrk (display_name, "/\r\n"))
{
- g_set_error_literal (error,
+ g_set_error_literal (error,
G_IO_ERROR, G_IO_ERROR_INVALID_FILENAME,
_("Filename contains invalid characters."));
return NULL;
@@ -241,7 +241,7 @@ g_vfs_ftp_file_is_root (const GVfsFtpFile *file)
* Gets the string to refer to @file on the ftp server. This string may not be
* valid UTF-8.
*
- * Returns: the path to refer to @file on the FTP server.
+ * Returns: the path to refer to @file on the FTP server.
**/
const char *
g_vfs_ftp_file_get_ftp_path (const GVfsFtpFile *file)
@@ -272,7 +272,7 @@ g_vfs_ftp_file_get_gvfs_path (const GVfsFtpFile *file)
* @a: a #GVfsFtpFile
* @b: a #GVfsFtpFile
*
- * Compares @a and @b. If they reference the same file, %TRUE is returned.
+ * Compares @a and @b. If they reference the same file, %TRUE is returned.
* This function uses #gconstpointer arguments to the #GEqualFunc type.
*
* Returns: %TRUE if @a and @b reference the same file.
diff --git a/daemon/gvfsftpfile.h b/daemon/gvfsftpfile.h
index d924a7fa..e30d2db9 100644
--- a/daemon/gvfsftpfile.h
+++ b/daemon/gvfsftpfile.h
@@ -1,5 +1,5 @@
/* GIO - GLib Input, Output and Streaming Library
- *
+ *
* Copyright (C) 2009 Benjamin Otte <otte@gnome.org>
*
* This library is free software; you can redistribute it and/or
diff --git a/daemon/gvfsftptask.c b/daemon/gvfsftptask.c
index 0a6d4c20..e1fa92a2 100644
--- a/daemon/gvfsftptask.c
+++ b/daemon/gvfsftptask.c
@@ -1,5 +1,5 @@
/* GIO - GLib Input, Output and Streaming Library
- *
+ *
* Copyright (C) 2009 Benjamin Otte <otte@gnome.org>
*
* This library is free software; you can redistribute it and/or
@@ -40,7 +40,7 @@
* @G_VFS_FTP_PASS_550: Don't treat 550 responses, but return them
* @G_VFS_FTP_FAIL_200: Fail on a 2XX response
*
- * These flags can be passed to gvfs_ftp_task_receive() (and in
+ * These flags can be passed to gvfs_ftp_task_receive() (and in
* turn gvfs_ftp_task_send()) to influence the behavior of the functions.
*/
@@ -67,9 +67,9 @@
* @task: task to handle
* @data: data argument provided to g_vfs_ftp_task_send_and_check()
*
- * Function prototype for error checking functions used by
- * g_vfs_ftp_task_send_and_check(). When called, these functions are supposed
- * to check a specific error condition and if met, set an error on the passed
+ * Function prototype for error checking functions used by
+ * g_vfs_ftp_task_send_and_check(). When called, these functions are supposed
+ * to check a specific error condition and if met, set an error on the passed
* @task.
*/
@@ -91,21 +91,21 @@ g_vfs_ftp_task_login (GVfsFtpTask *task,
status = g_vfs_ftp_task_send (task, G_VFS_FTP_PASS_300,
"USER %s", username);
-
+
if (G_VFS_FTP_RESPONSE_GROUP (status) == 3)
{
/* rationale for choosing the default password:
* - some ftp servers expect something that looks like an email address
* - we don't want to send the user's name or address, as that would be
* a privacy problem
- * - we want to give ftp server administrators a chance to notify us of
+ * - we want to give ftp server administrators a chance to notify us of
* problems with our client.
* - we don't want to drown in spam.
*/
if (password == NULL || password[0] == 0)
- password = "gvfsd-ftp-" VERSION "@example.com";
+ password = "gvfsd-ftp-" VERSION "@example.com";
status = g_vfs_ftp_task_send (task, 0,
- "PASS %s", password);
+ "PASS %s", password);
}
return status;
@@ -133,21 +133,21 @@ g_vfs_ftp_task_setup_connection (GVfsFtpTask *task)
/* RFC 2428 suggests to send this to make NAT routers happy */
/* XXX: Disabled for the following reasons:
* - most ftp clients don't use it
- * - lots of broken ftp servers can't see the difference between
+ * - lots of broken ftp servers can't see the difference between
* "EPSV" and "EPSV ALL"
* - impossible to dynamically fall back to regular PASV in case
* EPSV doesn't work for some reason.
* If this makes your ftp connection fail, please file a bug and we will
- * try to invent a way to make this all work. Until then, we'll just
+ * try to invent a way to make this all work. Until then, we'll just
* ignore the RFC.
*/
- if (g_vfs_backend_ftp_has_feature (task->backend, g_VFS_FTP_FEATURE_EPSV))
+ if (g_vfs_backend_ftp_has_feature (task->backend, g_VFS_FTP_FEATURE_EPSV))
g_vfs_ftp_task_send (task, 0, "EPSV ALL");
g_vfs_ftp_task_clear_error (task);
#endif
/* instruct server that we'll give and assume we get utf8 */
- if (g_vfs_backend_ftp_has_feature (task->backend, G_VFS_FTP_FEATURE_UTF8))
+ if (g_vfs_backend_ftp_has_feature (task->backend, G_VFS_FTP_FEATURE_UTF8))
{
if (!g_vfs_ftp_task_send (task, 0, "OPTS UTF8 ON"))
g_vfs_ftp_task_clear_error (task);
@@ -168,12 +168,12 @@ do_broadcast (GCancellable *cancellable, GCond *cond)
* Acquires a new connection for use by this @task. This uses the connection
* pool of @task's backend, so it reuses previously opened connections and
* does not reopen new connections unnecessarily. If all connections are busy,
- * it waits %G_VFS_FTP_TIMEOUT_IN_SECONDS seconds for a new connection to
+ * it waits %G_VFS_FTP_TIMEOUT_IN_SECONDS seconds for a new connection to
* become available. Keep in mind that a newly acquired connection might have
* timed out and therefore closed by the FTP server. You must account for
* this when sending the first command to the server.
*
- * Returns: %TRUE if a connection could be acquired, %FALSE if an error
+ * Returns: %TRUE if a connection could be acquired, %FALSE if an error
* occured
**/
static gboolean
@@ -192,15 +192,15 @@ g_vfs_ftp_task_acquire_connection (GVfsFtpTask *task)
ftp = task->backend;
g_mutex_lock (ftp->mutex);
id = g_cancellable_connect (task->cancellable,
- G_CALLBACK (do_broadcast),
- ftp->cond, NULL);
+ G_CALLBACK (do_broadcast),
+ ftp->cond, NULL);
while (task->conn == NULL && ftp->queue != NULL)
{
if (g_cancellable_is_cancelled (task->cancellable))
{
- task->error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_CANCELLED,
- _("Operation was cancelled"));
- break;
+ task->error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_CANCELLED,
+ _("Operation was cancelled"));
+ break;
}
task->conn = g_queue_pop_head (ftp->queue);
@@ -208,17 +208,17 @@ g_vfs_ftp_task_acquire_connection (GVfsFtpTask *task)
break;
if (ftp->connections < ftp->max_connections)
- {
- /* Save current number of connections here, so we can limit maximum
- * connections later.
- * This is necessary for threading reasons (connections can be
- * opened or closed while we are still in the opening process. */
- guint maybe_max_connections = ftp->connections;
-
- ftp->connections++;
- g_mutex_unlock (ftp->mutex);
- task->conn = g_vfs_ftp_connection_new (ftp->addr, task->cancellable, &task->error);
- if (G_LIKELY (task->conn != NULL))
+ {
+ /* Save current number of connections here, so we can limit maximum
+ * connections later.
+ * This is necessary for threading reasons (connections can be
+ * opened or closed while we are still in the opening process. */
+ guint maybe_max_connections = ftp->connections;
+
+ ftp->connections++;
+ g_mutex_unlock (ftp->mutex);
+ task->conn = g_vfs_ftp_connection_new (ftp->addr, task->cancellable, &task->error);
+ if (G_LIKELY (task->conn != NULL))
{
g_vfs_ftp_task_receive (task, 0, NULL);
g_vfs_ftp_task_login (task, ftp->user, ftp->password);
@@ -227,30 +227,30 @@ g_vfs_ftp_task_acquire_connection (GVfsFtpTask *task)
break;
}
- g_vfs_ftp_task_clear_error (task);
- g_vfs_ftp_connection_free (task->conn);
- task->conn = NULL;
- g_mutex_lock (ftp->mutex);
- ftp->connections--;
- ftp->max_connections = MIN (ftp->max_connections, maybe_max_connections);
- if (ftp->max_connections == 0)
- {
- g_debug ("no more connections left, exiting...");
- /* FIXME: shut down properly */
- exit (0);
- }
-
- continue;
- }
+ g_vfs_ftp_task_clear_error (task);
+ g_vfs_ftp_connection_free (task->conn);
+ task->conn = NULL;
+ g_mutex_lock (ftp->mutex);
+ ftp->connections--;
+ ftp->max_connections = MIN (ftp->max_connections, maybe_max_connections);
+ if (ftp->max_connections == 0)
+ {
+ g_debug ("no more connections left, exiting...");
+ /* FIXME: shut down properly */
+ exit (0);
+ }
+
+ continue;
+ }
g_get_current_time (&now);
g_time_val_add (&now, G_VFS_FTP_TIMEOUT_IN_SECONDS * 1000 * 1000);
if (!g_cond_timed_wait (ftp->cond, ftp->mutex, &now))
- {
- task->error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_BUSY,
- _("The FTP server is busy. Try again later"));
- break;
- }
+ {
+ task->error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_BUSY,
+ _("The FTP server is busy. Try again later"));
+ break;
+ }
}
g_cancellable_disconnect (task->cancellable, id);
g_mutex_unlock (ftp->mutex);
@@ -295,8 +295,8 @@ g_vfs_ftp_task_release_connection (GVfsFtpTask *task)
* g_vfs_ftp_task_done:
* @task: the task to finalize
*
- * Finalizes the given task and clears all memory in use. It also marks the
- * associated job as success or failure depending on the error state of the
+ * Finalizes the given task and clears all memory in use. It also marks the
+ * associated job as success or failure depending on the error state of the
* task.
**/
void
@@ -323,7 +323,7 @@ g_vfs_ftp_task_done (GVfsFtpTask *task)
* @task: the task
* @response: the response code
*
- * Sets the @task into an error state. The exact error is determined from the
+ * Sets the @task into an error state. The exact error is determined from the
* @response code.
**/
void
@@ -341,62 +341,62 @@ g_vfs_ftp_task_set_error_from_response (GVfsFtpTask *task, guint response)
{
case 332: /* Need account for login. */
case 532: /* Need account for storing files. */
- /* FIXME: implement a sane way to handle accounts. */
- code = G_IO_ERROR_NOT_SUPPORTED;
- msg = _("Accounts are unsupported");
- break;
+ /* FIXME: implement a sane way to handle accounts. */
+ code = G_IO_ERROR_NOT_SUPPORTED;
+ msg = _("Accounts are unsupported");
+ break;
case 421: /* Service not available, closing control connection. */
- code = G_IO_ERROR_FAILED;
- msg = _("Host closed connection");
- break;
+ code = G_IO_ERROR_FAILED;
+ msg = _("Host closed connection");
+ break;
case 425: /* Can't open data connection. */
- code = G_IO_ERROR_CLOSED;
- msg = _("Cannot open data connection. Maybe your firewall prevents this?");
- break;
+ code = G_IO_ERROR_CLOSED;
+ msg = _("Cannot open data connection. Maybe your firewall prevents this?");
+ break;
case 426: /* Connection closed; transfer aborted. */
- code = G_IO_ERROR_CLOSED;
- msg = _("Data connection closed");
- break;
+ code = G_IO_ERROR_CLOSED;
+ msg = _("Data connection closed");
+ break;
case 450: /* Requested file action not taken. File unavailable (e.g., file busy). */
case 550: /* Requested action not taken. File unavailable (e.g., file not found, no access). */
- /* FIXME: This is a lot of different errors. So we have to pretend to
- * be smart here. */
- code = G_IO_ERROR_FAILED;
- msg = _("Operation failed");
- break;
+ /* FIXME: This is a lot of different errors. So we have to pretend to
+ * be smart here. */
+ code = G_IO_ERROR_FAILED;
+ msg = _("Operation failed");
+ break;
case 451: /* Requested action aborted: local error in processing. */
- code = G_IO_ERROR_FAILED;
- msg = _("Operation failed");
- break;
+ code = G_IO_ERROR_FAILED;
+ msg = _("Operation failed");
+ break;
case 452: /* Requested action not taken. Insufficient storage space in system. */
case 552:
- code = G_IO_ERROR_NO_SPACE;
- msg = _("No space left on server");
- break;
+ code = G_IO_ERROR_NO_SPACE;
+ msg = _("No space left on server");
+ break;
case 500: /* Syntax error, command unrecognized. */
case 501: /* Syntax error in parameters or arguments. */
case 502: /* Command not implemented. */
case 503: /* Bad sequence of commands. */
case 504: /* Command not implemented for that parameter. */
- code = G_IO_ERROR_NOT_SUPPORTED;
- msg = _("Operation unsupported");
- break;
+ code = G_IO_ERROR_NOT_SUPPORTED;
+ msg = _("Operation unsupported");
+ break;
case 530: /* Not logged in. */
- code = G_IO_ERROR_PERMISSION_DENIED;
- msg = _("Permission denied");
- break;
+ code = G_IO_ERROR_PERMISSION_DENIED;
+ msg = _("Permission denied");
+ break;
case 551: /* Requested action aborted: page type unknown. */
- code = G_IO_ERROR_FAILED;
- msg = _("Page type unknown");
- break;
+ code = G_IO_ERROR_FAILED;
+ msg = _("Page type unknown");
+ break;
case 553: /* Requested action not taken. File name not allowed. */
- code = G_IO_ERROR_INVALID_FILENAME;
- msg = _("Invalid filename");
- break;
+ code = G_IO_ERROR_INVALID_FILENAME;
+ msg = _("Invalid filename");
+ break;
default:
- code = G_IO_ERROR_FAILED;
- msg = _("Invalid reply");
- break;
+ code = G_IO_ERROR_FAILED;
+ msg = _("Invalid reply");
+ break;
}
g_set_error_literal (&task->error, G_IO_ERROR, code, msg);
@@ -407,8 +407,8 @@ g_vfs_ftp_task_set_error_from_response (GVfsFtpTask *task, guint response)
* @task: the task
* @conn: the connection that the @task should use
*
- * Forces a given @task to do I/O using the given connection. The @task must
- * not have a connection associated with itself. The @task will take
+ * Forces a given @task to do I/O using the given connection. The @task must
+ * not have a connection associated with itself. The @task will take
* ownership of @conn.
**/
void
@@ -429,7 +429,7 @@ g_vfs_ftp_task_give_connection (GVfsFtpTask * task,
* g_vfs_ftp_task_give_connection(). This or any other task will not use the
* connection anymore. The @task must have a connection in use.
*
- * Returns: The connection that @task was using. You acquire ownership of
+ * Returns: The connection that @task was using. You acquire ownership of
* the connection.
**/
GVfsFtpConnection *
@@ -450,11 +450,11 @@ g_vfs_ftp_task_take_connection (GVfsFtpTask *task)
* g_vfs_ftp_task_send:
* @task: the sending task
* @flags: response flags to use when sending
- * @format: format string to construct command from
+ * @format: format string to construct command from
* (without trailing \r\n)
* @...: arguments to format string
*
- * Shortcut to calling g_vfs_ftp_task_send_and_check() with the reply, funcs
+ * Shortcut to calling g_vfs_ftp_task_send_and_check() with the reply, funcs
* and data arguments set to %NULL. See that function for details.
*
* Returns: 0 on error or the received FTP code otherwise.
@@ -473,10 +473,10 @@ g_vfs_ftp_task_send (GVfsFtpTask * task,
va_start (varargs, format);
response = g_vfs_ftp_task_sendv (task,
- flags,
+ flags,
NULL,
- format,
- varargs);
+ format,
+ varargs);
va_end (varargs);
return response;
}
@@ -486,32 +486,32 @@ g_vfs_ftp_task_send (GVfsFtpTask * task,
* @task: the sending task
* @flags: response flags to use when sending
* @funcs: %NULL or %NULL-terminated array of functions used to determine the
- * exact failure case upon a "550 Operation Failed" reply. This is
- * often necessary
+ * exact failure case upon a "550 Operation Failed" reply. This is
+ * often necessary
* @data: data to pass to @funcs.
* @reply: %NULL or pointer to take a char array containing the full reply of
- * the ftp server upon successful reply. Use g_strfreev() to free
+ * the ftp server upon successful reply. Use g_strfreev() to free
* after use.
- * @format: format string to construct command from
+ * @format: format string to construct command from
* (without trailing \r\n)
* @...: arguments to format string
*
- * Takes an ftp command in printf-style @format, potentially acquires a
+ * Takes an ftp command in printf-style @format, potentially acquires a
* connection automatically, sends the command and waits for an answer from
* the ftp server. Without any @flags, FTP response codes other than 2xx cause
- * an error. If @reply is not %NULL, the full reply will be put into a
- * %NULL-terminated string array that must be freed with g_strfreev() after
- * use.
- * If @funcs is set, the 550 response code will cause all of these functions to
- * be called in order passing them the @task and @data arguments given to this
- * function until one of them sets an error on @task. This error will then be
+ * an error. If @reply is not %NULL, the full reply will be put into a
+ * %NULL-terminated string array that must be freed with g_strfreev() after
+ * use.
+ * If @funcs is set, the 550 response code will cause all of these functions to
+ * be called in order passing them the @task and @data arguments given to this
+ * function until one of them sets an error on @task. This error will then be
* returned from this function. If none of those functions sets an error, the
* generic error for the 550 response will be used.
* If an error has been set on @task previously, this function will do nothing.
*
* Returns: 0 on error or the received FTP code otherwise.
**/
-guint
+guint
g_vfs_ftp_task_send_and_check (GVfsFtpTask * task,
GVfsFtpResponseFlags flags,
const GVfsFtpErrorFunc *funcs,
@@ -535,10 +535,10 @@ g_vfs_ftp_task_send_and_check (GVfsFtpTask * task,
va_start (varargs, format);
response = g_vfs_ftp_task_sendv (task,
- flags,
+ flags,
reply,
- format,
- varargs);
+ format,
+ varargs);
va_end (varargs);
if (response == 550 && funcs)
@@ -560,13 +560,13 @@ g_vfs_ftp_task_send_and_check (GVfsFtpTask * task,
* g_vfs_ftp_task_sendv:
* @task: the sending task
* @flags: response flags to use when receiving the reply
- * @reply: %NULL or pointer to char array that takes the full reply from the
+ * @reply: %NULL or pointer to char array that takes the full reply from the
* server
- * @format: format string to construct command from
+ * @format: format string to construct command from
* (without trailing \r\n)
* @varargs: arguments to format string
*
- * This is the varargs version of g_vfs_ftp_task_send(). See that function
+ * This is the varargs version of g_vfs_ftp_task_send(). See that function
* for details.
*
* Returns: the received FTP code or 0 on error.
@@ -607,7 +607,7 @@ retry:
&task->error);
response = g_vfs_ftp_task_receive (task, flags, reply);
-
+
/* NB: requires adaption if we allow passing 4xx responses */
if (retry_on_timeout &&
g_vfs_ftp_task_is_in_error (task) &&
@@ -626,15 +626,15 @@ retry:
* g_vfs_ftp_task_receive:
* @task: the receiving task
* @flags: response flags to use
- * @reply: %NULL or pointer to char array that takes the full reply from the
+ * @reply: %NULL or pointer to char array that takes the full reply from the
* server
*
- * Unless @task is in an error state, this function receives a reply from
- * the @task's connection. The @task must have a connection set, which will
- * happen when either g_vfs_ftp_task_send() or
- * g_vfs_ftp_task_give_connection() have been called on the @task before.
- * Unless @flags are given, all reply codes not in the 200s cause an error.
- * If @task is in an error state when calling this function, nothing will
+ * Unless @task is in an error state, this function receives a reply from
+ * the @task's connection. The @task must have a connection set, which will
+ * happen when either g_vfs_ftp_task_send() or
+ * g_vfs_ftp_task_give_connection() have been called on the @task before.
+ * Unless @flags are given, all reply codes not in the 200s cause an error.
+ * If @task is in an error state when calling this function, nothing will
* happen and the function will just return.
*
* Returns: the received FTP code or 0 on error.
@@ -651,7 +651,7 @@ g_vfs_ftp_task_receive (GVfsFtpTask * task,
return 0;
g_return_val_if_fail (task->conn != NULL, 0);
- response = g_vfs_ftp_connection_receive (task->conn,
+ response = g_vfs_ftp_connection_receive (task->conn,
reply,
task->cancellable,
&task->error);
@@ -659,36 +659,36 @@ g_vfs_ftp_task_receive (GVfsFtpTask * task,
switch (G_VFS_FTP_RESPONSE_GROUP (response))
{
case 0:
- return 0;
+ return 0;
case 1:
- if (flags & G_VFS_FTP_PASS_100)
- break;
- g_vfs_ftp_task_set_error_from_response (task, response);
- return 0;
+ if (flags & G_VFS_FTP_PASS_100)
+ break;
+ g_vfs_ftp_task_set_error_from_response (task, response);
+ return 0;
case 2:
- if (flags & G_VFS_FTP_FAIL_200)
- {
- g_vfs_ftp_task_set_error_from_response (task, response);
- return 0;
- }
- break;
+ if (flags & G_VFS_FTP_FAIL_200)
+ {
+ g_vfs_ftp_task_set_error_from_response (task, response);
+ return 0;
+ }
+ break;
case 3:
- if (flags & G_VFS_FTP_PASS_300)
- break;
- g_vfs_ftp_task_set_error_from_response (task, response);
- return 0;
+ if (flags & G_VFS_FTP_PASS_300)
+ break;
+ g_vfs_ftp_task_set_error_from_response (task, response);
+ return 0;
case 4:
- g_vfs_ftp_task_set_error_from_response (task, response);
- return 0;
+ g_vfs_ftp_task_set_error_from_response (task, response);
+ return 0;
case 5:
- if ((flags & G_VFS_FTP_PASS_500) ||
+ if ((flags & G_VFS_FTP_PASS_500) ||
(response == 550 && (flags & G_VFS_FTP_PASS_550)))
- break;
- g_vfs_ftp_task_set_error_from_response (task, response);
- return 0;
+ break;
+ g_vfs_ftp_task_set_error_from_response (task, response);
+ return 0;
default:
- g_assert_not_reached ();
- break;
+ g_assert_not_reached ();
+ break;
}
return response;
@@ -753,7 +753,7 @@ g_vfs_ftp_task_open_data_connection_epsv (GVfsFtpTask *task)
g_vfs_ftp_task_clear_error (task);
return FALSE;
}
-
+
g_object_unref (addr);
return TRUE;
@@ -781,16 +781,16 @@ g_vfs_ftp_task_open_data_connection_pasv (GVfsFtpTask *task)
*/
for (s = reply[0]; *s; s++)
{
- if (sscanf (s, "%u,%u,%u,%u,%u,%u",
- &ip1, &ip2, &ip3, &ip4,
- &port1, &port2) == 6)
+ if (sscanf (s, "%u,%u,%u,%u,%u,%u",
+ &ip1, &ip2, &ip3, &ip4,
+ &port1, &port2) == 6)
break;
}
g_strfreev (reply);
if (*s == 0)
{
g_set_error_literal (&task->error, G_IO_ERROR, G_IO_ERROR_FAILED,
- _("Invalid reply"));
+ _("Invalid reply"));
return FALSE;
}
@@ -815,7 +815,7 @@ g_vfs_ftp_task_open_data_connection_pasv (GVfsFtpTask *task)
g_object_unref (addr);
return TRUE;
}
-
+
g_object_unref (addr);
/* set workaround flag (see below), so we don't try this again */
g_debug ("# Successfull PASV response but data connection failed. Enabling FTP_WORKAROUND_PASV_ADDR.\n");
@@ -827,7 +827,7 @@ g_vfs_ftp_task_open_data_connection_pasv (GVfsFtpTask *task)
* Various ftp servers aren't setup correctly when behind a NAT. They report
* their own IP address (like 10.0.0.4) and not the address in front of the
* NAT. But this is likely the same address that we connected to with our
- * command connetion. So if the address given by PASV fails, we fall back
+ * command connetion. So if the address given by PASV fails, we fall back
* to the address of the command stream.
*/
addr = g_vfs_ftp_task_create_remote_address (task, port1 << 8 | port2);
diff --git a/daemon/gvfsftptask.h b/daemon/gvfsftptask.h
index 2bd9bd20..d9bfce3b 100644
--- a/daemon/gvfsftptask.h
+++ b/daemon/gvfsftptask.h
@@ -1,5 +1,5 @@
/* GIO - GLib Input, Output and Streaming Library
- *
+ *
* Copyright (C) 2009 Benjamin Otte <otte@gnome.org>
*
* This library is free software; you can redistribute it and/or
@@ -78,7 +78,7 @@ guint g_vfs_ftp_task_sendv (GVfsFtpTask *
GVfsFtpResponseFlags flags,
char *** reply,
const char * format,
- va_list varargs);
+ va_list varargs);
guint g_vfs_ftp_task_receive (GVfsFtpTask * task,
GVfsFtpResponseFlags flags,
char *** reply);