summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2020-02-11 11:01:01 +0100
committerBastien Nocera <hadess@hadess.net>2020-02-11 11:03:59 +0100
commit4c7af079f65a0d4da0a41cd18be0c8ace2c64725 (patch)
tree603a8224a0d8bd352b2839aef390cf40d0675518
parent9103f073a5b36d8e18dbc10f8df0008086f8c332 (diff)
downloadgvfs-4c7af079f65a0d4da0a41cd18be0c8ace2c64725.tar.gz
afc: Simplify setting error codes
We don't need to go to another function to get an error code when our switch function does that already. The "unhandled" AFC errors are now slightly less precise, but it's still possible to get the meaning of that code from the AFC headers directly (for developers), and not visible for end-users anyway.
-rw-r--r--daemon/gvfsbackendafc.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/daemon/gvfsbackendafc.c b/daemon/gvfsbackendafc.c
index d51b21e6..3169b792 100644
--- a/daemon/gvfsbackendafc.c
+++ b/daemon/gvfsbackendafc.c
@@ -200,40 +200,37 @@ g_vfs_backend_afc_close_connection (GVfsBackendAfc *self)
static int
g_vfs_backend_afc_check (afc_error_t cond, GVfsJob *job)
{
- GIOErrorEnum error;
-
if (G_LIKELY(cond == AFC_E_SUCCESS))
return 0;
- error = g_io_error_from_afc_error (cond);
switch (cond)
{
case AFC_E_INTERNAL_ERROR:
- g_vfs_job_failed (job, G_IO_ERROR, error,
+ g_vfs_job_failed (job, G_IO_ERROR, G_IO_ERROR_FAILED,
_("Internal Apple File Control error"));
break;
case AFC_E_OBJECT_NOT_FOUND:
- g_vfs_job_failed (job, G_IO_ERROR, error,
+ g_vfs_job_failed (job, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
_("File doesn’t exist"));
break;
case AFC_E_DIR_NOT_EMPTY:
- g_vfs_job_failed (job, G_IO_ERROR, error,
+ g_vfs_job_failed (job, G_IO_ERROR, G_IO_ERROR_NOT_EMPTY,
_("Directory not empty"));
break;
case AFC_E_OP_TIMEOUT:
- g_vfs_job_failed (job, G_IO_ERROR, error,
+ g_vfs_job_failed (job, G_IO_ERROR, G_IO_ERROR_TIMED_OUT,
_("The device did not respond"));
break;
case AFC_E_NOT_ENOUGH_DATA:
- g_vfs_job_failed (job, G_IO_ERROR, error,
+ g_vfs_job_failed (job, G_IO_ERROR, G_IO_ERROR_CLOSED,
_("The connection was interrupted"));
break;
case AFC_E_MUX_ERROR:
- g_vfs_job_failed (job, G_IO_ERROR, error,
+ g_vfs_job_failed (job, G_IO_ERROR, G_IO_ERROR_FAILED,
_("Invalid Apple File Control data received"));
break;
default:
- g_vfs_job_failed (job, G_IO_ERROR, error,
+ g_vfs_job_failed (job, G_IO_ERROR, G_IO_ERROR_FAILED,
_("Unhandled Apple File Control error (%d)"), cond);
break;
}