[gvfs] [FTP] get rid of connection read/write functions
- From: Benjamin Otte <otte src gnome org>
- To: svn-commits-list gnome org
- Subject: [gvfs] [FTP] get rid of connection read/write functions
- Date: Thu, 11 Jun 2009 11:38:31 -0400 (EDT)
commit 883ebd74c283d873cb383709d50e1b4faf60e0f1
Author: Benjamin Otte <otte gnome org>
Date: Thu Jun 11 17:36:06 2009 +0200
[FTP] get rid of connection read/write functions
use get_data_stream() instead and call read/write on that manually.
Reduces the number of API.
daemon/gvfsbackendftp.c | 25 +++++++++++++---------
daemon/gvfsftpconnection.c | 48 --------------------------------------------
daemon/gvfsftpconnection.h | 15 -------------
3 files changed, 15 insertions(+), 73 deletions(-)
---
diff --git a/daemon/gvfsbackendftp.c b/daemon/gvfsbackendftp.c
index d137d6a..18c8a7e 100644
--- a/daemon/gvfsbackendftp.c
+++ b/daemon/gvfsbackendftp.c
@@ -672,13 +672,15 @@ do_read (GVfsBackend * backend,
GVfsBackendFtp *ftp = G_VFS_BACKEND_FTP (backend);
GVfsFtpTask task = G_VFS_FTP_TASK_INIT (ftp, G_VFS_JOB (job));
GVfsFtpConnection *conn = handle;
+ GInputStream *input;
gssize n_bytes;
- n_bytes = g_vfs_ftp_connection_read_data (conn,
- buffer,
- bytes_requested,
- task.cancellable,
- &task.error);
+ input = g_io_stream_get_input_stream (g_vfs_ftp_connection_get_data_stream (conn));
+ n_bytes = g_input_stream_read (input,
+ buffer,
+ bytes_requested,
+ task.cancellable,
+ &task.error);
if (n_bytes >= 0)
g_vfs_job_read_set_size (job, n_bytes);
@@ -826,14 +828,17 @@ do_write (GVfsBackend *backend,
GVfsBackendFtp *ftp = G_VFS_BACKEND_FTP (backend);
GVfsFtpTask task = G_VFS_FTP_TASK_INIT (ftp, G_VFS_JOB (job));
GVfsFtpConnection *conn = handle;
+ GOutputStream *output;
gssize n_bytes;
+ output = g_io_stream_get_output_stream (g_vfs_ftp_connection_get_data_stream (conn));
+
/* FIXME: use write_all here? */
- n_bytes = g_vfs_ftp_connection_write_data (conn,
- buffer,
- buffer_size,
- task.cancellable,
- &task.error);
+ n_bytes = g_output_stream_write (output,
+ buffer,
+ buffer_size,
+ task.cancellable,
+ &task.error);
if (n_bytes >= 0)
g_vfs_job_write_set_written_size (job, n_bytes);
diff --git a/daemon/gvfsftpconnection.c b/daemon/gvfsftpconnection.c
index 4c39874..ac5418f 100644
--- a/daemon/gvfsftpconnection.c
+++ b/daemon/gvfsftpconnection.c
@@ -274,54 +274,6 @@ g_vfs_ftp_connection_get_data_stream (GVfsFtpConnection *conn)
return conn->data;
}
-gssize
-g_vfs_ftp_connection_write_data (GVfsFtpConnection *conn,
- const char * data,
- gsize len,
- GCancellable * cancellable,
- GError ** error)
-{
- g_return_val_if_fail (conn != NULL, -1);
- g_return_val_if_fail (conn->data != NULL, -1);
-
- /* FIXME: use write_all here? */
- return g_output_stream_write (g_io_stream_get_output_stream (conn->data),
- data,
- len,
- cancellable,
- error);
-}
-
-gssize
-g_vfs_ftp_connection_read_data (GVfsFtpConnection *conn,
- char * data,
- gsize len,
- GCancellable * cancellable,
- GError ** error)
-{
- g_return_val_if_fail (conn != NULL, -1);
- g_return_val_if_fail (conn->data != NULL, -1);
-
- return g_input_stream_read (g_io_stream_get_input_stream (conn->data),
- data,
- len,
- cancellable,
- error);
-}
-
-gboolean
-g_vfs_ftp_connection_read_contents (GVfsFtpConnection *conn,
- char ** data,
- gsize * len,
- GCancellable * cancellable,
- GError ** error)
-{
- g_return_val_if_fail (conn != NULL, -1);
- g_return_val_if_fail (conn->data != NULL, -1);
-
- g_assert_not_reached ();
-}
-
/**
* g_vfs_ftp_connection_is_usable:
* @conn: a connection
diff --git a/daemon/gvfsftpconnection.h b/daemon/gvfsftpconnection.h
index 12e9025..3605f26 100644
--- a/daemon/gvfsftpconnection.h
+++ b/daemon/gvfsftpconnection.h
@@ -58,21 +58,6 @@ gboolean g_vfs_ftp_connection_open_data_connection
void g_vfs_ftp_connection_close_data_connection
(GVfsFtpConnection * conn);
GIOStream * g_vfs_ftp_connection_get_data_stream (GVfsFtpConnection * conn);
-gssize g_vfs_ftp_connection_write_data (GVfsFtpConnection * conn,
- const char * data,
- gsize len,
- GCancellable * cancellable,
- GError ** error);
-gssize g_vfs_ftp_connection_read_data (GVfsFtpConnection * conn,
- char * data,
- gsize len,
- GCancellable * cancellable,
- GError ** error);
-gboolean g_vfs_ftp_connection_read_contents (GVfsFtpConnection * conn,
- char ** data,
- gsize * len,
- GCancellable * cancellable,
- GError ** error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]