diff options
author | Christian Persch <chpe@src.gnome.org> | 2008-08-02 11:00:07 +0000 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2008-08-02 11:00:07 +0000 |
commit | 4836abe602181cc92ce99ef7cb4a78ba9447a032 (patch) | |
tree | a624fc3742a2fd7dd37857c6127abc7e7ea4da7a /client | |
parent | ad7695f9ccd2435b034094ad03aa229b4d4ba60e (diff) | |
download | gvfs-4836abe602181cc92ce99ef7cb4a78ba9447a032.tar.gz |
Use g_set_error_literal where appropriate. Bug #539167.
svn path=/trunk/; revision=1847
Diffstat (limited to 'client')
-rw-r--r-- | client/gdaemonfile.c | 70 | ||||
-rw-r--r-- | client/gdaemonfileinputstream.c | 50 | ||||
-rw-r--r-- | client/gdaemonfileoutputstream.c | 40 | ||||
-rw-r--r-- | client/gvfsdaemondbus.c | 10 |
4 files changed, 81 insertions, 89 deletions
diff --git a/client/gdaemonfile.c b/client/gdaemonfile.c index b5477db4..9e055c21 100644 --- a/client/gdaemonfile.c +++ b/client/gdaemonfile.c @@ -478,8 +478,8 @@ do_sync_2_path_call (GFile *file1, { g_mount_info_unref (mount_info1); /* For copy this will cause the fallback code to be involved */ - g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, - "%s", _("Operation not supported, files on different mounts")); + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, + _("Operation not supported, files on different mounts")); return NULL; } } @@ -783,8 +783,8 @@ g_daemon_file_query_info (GFile *file, if (!dbus_message_iter_init (reply, &iter) || (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_STRUCT)) { - g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, - "%s", _("Invalid return value from get_info")); + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, + _("Invalid return value from get_info")); goto out; } @@ -992,8 +992,8 @@ g_daemon_file_read (GFile *file, DBUS_TYPE_INVALID)) { dbus_message_unref (reply); - g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, - "%s", _("Invalid return value from open")); + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, + _("Invalid return value from open")); return NULL; } @@ -1002,8 +1002,8 @@ g_daemon_file_read (GFile *file, fd = _g_dbus_connection_get_fd_sync (connection, fd_id); if (fd == -1) { - g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, - "%s", _("Didn't get stream file descriptor")); + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, + _("Didn't get stream file descriptor")); return NULL; } @@ -1051,8 +1051,8 @@ g_daemon_file_append_to (GFile *file, DBUS_TYPE_INVALID)) { dbus_message_unref (reply); - g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, - "%s", _("Invalid return value from open")); + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, + _("Invalid return value from open")); return NULL; } @@ -1061,8 +1061,8 @@ g_daemon_file_append_to (GFile *file, fd = _g_dbus_connection_get_fd_sync (connection, fd_id); if (fd == -1) { - g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, - "%s", _("Didn't get stream file descriptor")); + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, + _("Didn't get stream file descriptor")); return NULL; } @@ -1110,8 +1110,8 @@ g_daemon_file_create (GFile *file, DBUS_TYPE_INVALID)) { dbus_message_unref (reply); - g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, - "%s", _("Invalid return value from open")); + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, + _("Invalid return value from open")); return NULL; } @@ -1120,8 +1120,8 @@ g_daemon_file_create (GFile *file, fd = _g_dbus_connection_get_fd_sync (connection, fd_id); if (fd == -1) { - g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, - "%s", _("Didn't get stream file descriptor")); + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, + _("Didn't get stream file descriptor")); return NULL; } @@ -1172,8 +1172,8 @@ g_daemon_file_replace (GFile *file, DBUS_TYPE_INVALID)) { dbus_message_unref (reply); - g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, - "%s", _("Invalid return value from open")); + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, + _("Invalid return value from open")); return NULL; } @@ -1182,8 +1182,8 @@ g_daemon_file_replace (GFile *file, fd = _g_dbus_connection_get_fd_sync (connection, fd_id); if (fd == -1) { - g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, - "%s", _("Didn't get stream file descriptor")); + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, + _("Didn't get stream file descriptor")); return NULL; } @@ -1530,8 +1530,8 @@ g_daemon_file_query_filesystem_info (GFile *file, if (!dbus_message_iter_init (reply, &iter) || (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_STRUCT)) { - g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, - "%s", _("Invalid return value from get_filesystem_info")); + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, + _("Invalid return value from get_filesystem_info")); goto out; } @@ -1640,11 +1640,11 @@ g_daemon_file_find_enclosing_mount (GFile *file, return G_MOUNT (mount); } - g_set_error (error, G_IO_ERROR, - G_IO_ERROR_NOT_FOUND, + g_set_error_literal (error, G_IO_ERROR, + G_IO_ERROR_NOT_FOUND, /* translators: this is an error message when there is no user visible "mount" object corresponding to a particular path/uri */ - "%s", _("Could not find enclosing mount")); + _("Could not find enclosing mount")); return NULL; } @@ -1715,8 +1715,8 @@ g_daemon_file_set_display_name (GFile *file, G_DBUS_TYPE_CSTRING, &new_path, 0)) { - g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, - "%s", _("Invalid return value from query_filesystem_info")); + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, + _("Invalid return value from query_filesystem_info")); goto out; } @@ -1958,7 +1958,7 @@ g_daemon_file_copy (GFile *source, if (!G_IS_DAEMON_FILE (destination)) { /* Fall back to default move */ - g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, "%s", "Move not supported"); + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, "Move not supported"); return FALSE; } @@ -1975,8 +1975,8 @@ g_daemon_file_copy (GFile *source, if (local_path == NULL) { /* This will cause the fallback code to be involved */ - g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, - "%s", _("Operation not supported, files on different mounts")); + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, + _("Operation not supported, files on different mounts")); return FALSE; } } @@ -2048,7 +2048,7 @@ g_daemon_file_move (GFile *source, !G_IS_DAEMON_FILE (destination)) { /* Fall back to default move */ - g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, "%s", "Move not supported"); + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, "Move not supported"); return FALSE; } @@ -2120,8 +2120,8 @@ g_daemon_file_monitor_dir (GFile* file, { g_mount_info_unref (mount_info); dbus_message_unref (reply); - g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, - "%s", _("Invalid return value from monitor_dir")); + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, + _("Invalid return value from monitor_dir")); return NULL; } @@ -2169,8 +2169,8 @@ g_daemon_file_monitor_file (GFile* file, { g_mount_info_unref (mount_info); dbus_message_unref (reply); - g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, - "%s", _("Invalid return value from monitor_file")); + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, + _("Invalid return value from monitor_file")); return NULL; } diff --git a/client/gdaemonfileinputstream.c b/client/gdaemonfileinputstream.c index b89b76ce..8cdc3622 100644 --- a/client/gdaemonfileinputstream.c +++ b/client/gdaemonfileinputstream.c @@ -377,11 +377,10 @@ decode_reply (GString *buffer, GVfsDaemonSocketProtocolReply *reply_out) static void decode_error (GVfsDaemonSocketProtocolReply *reply, char *data, GError **error) { - g_set_error (error, - g_quark_from_string (data), - reply->arg1, - "%s", - data + strlen (data) + 1); + g_set_error_literal (error, + g_quark_from_string (data), + reply->arg1, + data + strlen (data) + 1); } @@ -513,10 +512,10 @@ iterate_read_state_machine (GDaemonFileInputStream *file, IOOperationData *io_op if (io_op->io_cancelled) { op->ret_val = -1; - g_set_error (&op->ret_error, - G_IO_ERROR, - G_IO_ERROR_CANCELLED, - "%s", _("Operation was cancelled")); + g_set_error_literal (&op->ret_error, + G_IO_ERROR, + G_IO_ERROR_CANCELLED, + _("Operation was cancelled")); return STATE_OP_DONE; } @@ -669,11 +668,10 @@ iterate_read_state_machine (GDaemonFileInputStream *file, IOOperationData *io_op if (io_op->io_cancelled) { op->ret_val = -1; - g_set_error (&op->ret_error, - G_IO_ERROR, - G_IO_ERROR_CANCELLED, - "%s", - _("Operation was cancelled")); + g_set_error_literal (&op->ret_error, + G_IO_ERROR, + G_IO_ERROR_CANCELLED, + _("Operation was cancelled")); return STATE_OP_DONE; } @@ -778,11 +776,10 @@ iterate_close_state_machine (GDaemonFileInputStream *file, IOOperationData *io_o if (io_op->io_cancelled) { op->ret_val = FALSE; - g_set_error (&op->ret_error, - G_IO_ERROR, - G_IO_ERROR_CANCELLED, - "%s", - _("Operation was cancelled")); + g_set_error_literal (&op->ret_error, + G_IO_ERROR, + G_IO_ERROR_CANCELLED, + _("Operation was cancelled")); return STATE_OP_DONE; } @@ -1029,11 +1026,10 @@ iterate_seek_state_machine (GDaemonFileInputStream *file, IOOperationData *io_op if (io_op->io_cancelled) { op->ret_val = -1; - g_set_error (&op->ret_error, - G_IO_ERROR, - G_IO_ERROR_CANCELLED, - "%s", - _("Operation was cancelled")); + g_set_error_literal (&op->ret_error, + G_IO_ERROR, + G_IO_ERROR_CANCELLED, + _("Operation was cancelled")); return STATE_OP_DONE; } @@ -1207,8 +1203,8 @@ g_daemon_file_input_stream_seek (GFileInputStream *stream, if (!file->can_seek) { - g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, - "%s", _("Seek not supported on stream")); + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, + _("Seek not supported on stream")); return FALSE; } @@ -1238,7 +1234,7 @@ g_daemon_file_input_stream_query_info (GFileInputStream *stream, GCancellable *cancellable, GError **error) { - g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, "%s", _("The query info operation is not supported")); + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, _("The query info operation is not supported")); return NULL; } diff --git a/client/gdaemonfileoutputstream.c b/client/gdaemonfileoutputstream.c index b816f136..32daea41 100644 --- a/client/gdaemonfileoutputstream.c +++ b/client/gdaemonfileoutputstream.c @@ -329,11 +329,10 @@ decode_reply (GString *buffer, GVfsDaemonSocketProtocolReply *reply_out) static void decode_error (GVfsDaemonSocketProtocolReply *reply, char *data, GError **error) { - g_set_error (error, - g_quark_from_string (data), - reply->arg1, - "%s", - data + strlen (data) + 1); + g_set_error_literal (error, + g_quark_from_string (data), + reply->arg1, + data + strlen (data) + 1); } @@ -453,11 +452,10 @@ iterate_write_state_machine (GDaemonFileOutputStream *file, IOOperationData *io_ if (io_op->io_cancelled) { op->ret_val = -1; - g_set_error (&op->ret_error, - G_IO_ERROR, - G_IO_ERROR_CANCELLED, - "%s", - _("Operation was cancelled")); + g_set_error_literal (&op->ret_error, + G_IO_ERROR, + G_IO_ERROR_CANCELLED, + _("Operation was cancelled")); return STATE_OP_DONE; } @@ -632,11 +630,10 @@ iterate_close_state_machine (GDaemonFileOutputStream *file, IOOperationData *io_ if (io_op->io_cancelled) { op->ret_val = FALSE; - g_set_error (&op->ret_error, - G_IO_ERROR, - G_IO_ERROR_CANCELLED, - "%s", - _("Operation was cancelled")); + g_set_error_literal (&op->ret_error, + G_IO_ERROR, + G_IO_ERROR_CANCELLED, + _("Operation was cancelled")); return STATE_OP_DONE; } @@ -828,11 +825,10 @@ iterate_seek_state_machine (GDaemonFileOutputStream *file, IOOperationData *io_o if (io_op->io_cancelled) { op->ret_val = -1; - g_set_error (&op->ret_error, - G_IO_ERROR, - G_IO_ERROR_CANCELLED, - "%s", - _("Operation was cancelled")); + g_set_error_literal (&op->ret_error, + G_IO_ERROR, + G_IO_ERROR_CANCELLED, + _("Operation was cancelled")); return STATE_OP_DONE; } @@ -942,8 +938,8 @@ g_daemon_file_output_stream_seek (GFileOutputStream *stream, if (!file->can_seek) { - g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, - "%s", _("Seek not supported on stream")); + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, + _("Seek not supported on stream")); return FALSE; } diff --git a/client/gvfsdaemondbus.c b/client/gvfsdaemondbus.c index c062cbdc..aabb8dea 100644 --- a/client/gvfsdaemondbus.c +++ b/client/gvfsdaemondbus.c @@ -881,10 +881,10 @@ invalidate_local_connection (const char *dbus_id, if (local) g_hash_table_remove (local->connections, dbus_id); - g_set_error (error, - G_VFS_ERROR, - G_VFS_ERROR_RETRY, - "Cache invalid, retry (internally handled)"); + g_set_error_literal (error, + G_VFS_ERROR, + G_VFS_ERROR_RETRY, + "Cache invalid, retry (internally handled)"); } DBusConnection * @@ -954,7 +954,7 @@ _g_dbus_connection_get_sync (const char *dbus_id, if (bus == NULL) { g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, - "Couldn't get main dbus connection: %s\n", + "Couldn't get main dbus connection: %s", derror.message); dbus_error_free (&derror); return NULL; |