mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 06:56:14 +01:00
gio: Use g_task_return_error_literal() where we don't need formatting
This commit is contained in:
parent
7c71090723
commit
81068e5c00
@ -721,8 +721,8 @@ g_app_info_launch_uris_async (GAppInfo *appinfo,
|
||||
|
||||
task = g_task_new (appinfo, cancellable, callback, user_data);
|
||||
g_task_set_source_tag (task, g_app_info_launch_uris_async);
|
||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
|
||||
"Operation not supported for the current backend.");
|
||||
g_task_return_new_error_literal (task, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
|
||||
"Operation not supported for the current backend.");
|
||||
g_object_unref (task);
|
||||
|
||||
return;
|
||||
|
@ -1828,7 +1828,7 @@ send_message_data_deliver_error (GTask *task,
|
||||
send_message_with_reply_cleanup (task, TRUE);
|
||||
CONNECTION_UNLOCK (connection);
|
||||
|
||||
g_task_return_new_error (task, domain, code, "%s", message);
|
||||
g_task_return_new_error_literal (task, domain, code, message);
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
@ -2386,10 +2386,10 @@ cancel_method_on_close (gpointer key, gpointer value, gpointer user_data)
|
||||
if (data->delivered)
|
||||
return FALSE;
|
||||
|
||||
g_task_return_new_error (task,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_CLOSED,
|
||||
_("The connection is closed"));
|
||||
g_task_return_new_error_literal (task,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_CLOSED,
|
||||
_("The connection is closed"));
|
||||
|
||||
/* Ask send_message_with_reply_cleanup not to remove the element from the
|
||||
* hash table - we're in the middle of a foreach; that would be unsafe.
|
||||
|
@ -1030,10 +1030,12 @@ write_message_continue_writing (MessageToWriteData *data)
|
||||
if (!(data->worker->capabilities & G_DBUS_CAPABILITY_FLAGS_UNIX_FD_PASSING))
|
||||
{
|
||||
GTask *task = g_steal_pointer (&data->task);
|
||||
g_task_return_new_error (task,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_FAILED,
|
||||
"Tried sending a file descriptor but remote peer does not support this capability");
|
||||
g_task_return_new_error_literal (task,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_FAILED,
|
||||
"Tried sending a file descriptor "
|
||||
"but remote peer does not support "
|
||||
"this capability");
|
||||
g_clear_object (&task);
|
||||
goto out;
|
||||
}
|
||||
|
14
gio/gfile.c
14
gio/gfile.c
@ -7721,9 +7721,9 @@ query_default_handler_query_app_info_for_type_cb (GObject *object,
|
||||
}
|
||||
else if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
|
||||
{
|
||||
g_task_return_new_error (task,
|
||||
G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
|
||||
"%s", error->message);
|
||||
g_task_return_new_error_literal (task,
|
||||
G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
|
||||
error->message);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -7774,10 +7774,10 @@ query_default_handler_query_info_cb (GObject *object,
|
||||
}
|
||||
else
|
||||
{
|
||||
g_task_return_new_error (task,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_NOT_SUPPORTED,
|
||||
_("No application is registered as handling this file"));
|
||||
g_task_return_new_error_literal (task,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_NOT_SUPPORTED,
|
||||
_("No application is registered as handling this file"));
|
||||
}
|
||||
|
||||
g_object_unref (info);
|
||||
|
@ -285,8 +285,9 @@ can_reach_async_got_address (GObject *object,
|
||||
else
|
||||
{
|
||||
/* Resolved all addresses, none matched */
|
||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_HOST_UNREACHABLE,
|
||||
_("Host unreachable"));
|
||||
g_task_return_new_error_literal (task, G_IO_ERROR,
|
||||
G_IO_ERROR_HOST_UNREACHABLE,
|
||||
_("Host unreachable"));
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
@ -321,8 +322,8 @@ g_network_monitor_base_can_reach_async (GNetworkMonitor *monitor,
|
||||
|
||||
if (g_hash_table_size (G_NETWORK_MONITOR_BASE (monitor)->priv->networks) == 0)
|
||||
{
|
||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NETWORK_UNREACHABLE,
|
||||
_("Network unreachable"));
|
||||
g_task_return_new_error_literal (task, G_IO_ERROR, G_IO_ERROR_NETWORK_UNREACHABLE,
|
||||
_("Network unreachable"));
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
|
@ -561,9 +561,9 @@ can_reach_done (GObject *source,
|
||||
if (reachable)
|
||||
g_task_return_boolean (task, TRUE);
|
||||
else
|
||||
g_task_return_new_error (task,
|
||||
G_IO_ERROR, G_IO_ERROR_HOST_UNREACHABLE,
|
||||
"Can't reach host");
|
||||
g_task_return_new_error_literal (task,
|
||||
G_IO_ERROR, G_IO_ERROR_HOST_UNREACHABLE,
|
||||
"Can't reach host");
|
||||
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
@ -182,11 +182,11 @@ response_received (GDBusConnection *connection,
|
||||
g_task_return_boolean (task, TRUE);
|
||||
break;
|
||||
case XDG_DESKTOP_PORTAL_CANCELLED:
|
||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_CANCELLED, "Launch cancelled");
|
||||
g_task_return_new_error_literal (task, G_IO_ERROR, G_IO_ERROR_CANCELLED, "Launch cancelled");
|
||||
break;
|
||||
case XDG_DESKTOP_PORTAL_FAILED:
|
||||
default:
|
||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED, "Launch failed");
|
||||
g_task_return_new_error_literal (task, G_IO_ERROR, G_IO_ERROR_FAILED, "Launch failed");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1764,9 +1764,9 @@ g_output_stream_splice_async (GOutputStream *stream,
|
||||
|
||||
if (g_input_stream_is_closed (source))
|
||||
{
|
||||
g_task_return_new_error (task,
|
||||
G_IO_ERROR, G_IO_ERROR_CLOSED,
|
||||
_("Source stream is already closed"));
|
||||
g_task_return_new_error_literal (task,
|
||||
G_IO_ERROR, G_IO_ERROR_CLOSED,
|
||||
_("Source stream is already closed"));
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
|
@ -343,9 +343,14 @@ complete_async (GTask *task)
|
||||
priv->last_error = NULL;
|
||||
}
|
||||
else if (!priv->ever_enumerated)
|
||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED, _("Unspecified proxy lookup failure"));
|
||||
{
|
||||
g_task_return_new_error_literal (task, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
_("Unspecified proxy lookup failure"));
|
||||
}
|
||||
else
|
||||
g_task_return_pointer (task, NULL, NULL);
|
||||
{
|
||||
g_task_return_pointer (task, NULL, NULL);
|
||||
}
|
||||
|
||||
priv->ever_enumerated = TRUE;
|
||||
|
||||
|
@ -724,10 +724,10 @@ nego_reply_read_cb (GObject *source,
|
||||
|
||||
if (read == 0)
|
||||
{
|
||||
g_task_return_new_error (task,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_CONNECTION_CLOSED,
|
||||
"Connection to SOCKSv5 proxy server lost");
|
||||
g_task_return_new_error_literal (task,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_CONNECTION_CLOSED,
|
||||
"Connection to SOCKSv5 proxy server lost");
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
@ -837,10 +837,10 @@ auth_reply_read_cb (GObject *source,
|
||||
|
||||
if (read == 0)
|
||||
{
|
||||
g_task_return_new_error (task,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_CONNECTION_CLOSED,
|
||||
"Connection to SOCKSv5 proxy server lost");
|
||||
g_task_return_new_error_literal (task,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_CONNECTION_CLOSED,
|
||||
"Connection to SOCKSv5 proxy server lost");
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
@ -949,10 +949,10 @@ connect_reply_read_cb (GObject *source,
|
||||
|
||||
if (read == 0)
|
||||
{
|
||||
g_task_return_new_error (task,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_CONNECTION_CLOSED,
|
||||
"Connection to SOCKSv5 proxy server lost");
|
||||
g_task_return_new_error_literal (task,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_CONNECTION_CLOSED,
|
||||
"Connection to SOCKSv5 proxy server lost");
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
@ -1019,10 +1019,10 @@ connect_addr_len_read_cb (GObject *source,
|
||||
|
||||
if (read == 0)
|
||||
{
|
||||
g_task_return_new_error (task,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_CONNECTION_CLOSED,
|
||||
"Connection to SOCKSv5 proxy server lost");
|
||||
g_task_return_new_error_literal (task,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_CONNECTION_CLOSED,
|
||||
"Connection to SOCKSv5 proxy server lost");
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
@ -1055,10 +1055,10 @@ connect_addr_read_cb (GObject *source,
|
||||
|
||||
if (read == 0)
|
||||
{
|
||||
g_task_return_new_error (task,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_CONNECTION_CLOSED,
|
||||
"Connection to SOCKSv5 proxy server lost");
|
||||
g_task_return_new_error_literal (task,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_CONNECTION_CLOSED,
|
||||
"Connection to SOCKSv5 proxy server lost");
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
|
@ -1448,8 +1448,10 @@ timeout_cb (gpointer user_data)
|
||||
g_mutex_unlock (&data->lock);
|
||||
|
||||
if (should_return)
|
||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_TIMED_OUT,
|
||||
_("Socket I/O timed out"));
|
||||
{
|
||||
g_task_return_new_error_literal (task, G_IO_ERROR, G_IO_ERROR_TIMED_OUT,
|
||||
_("Socket I/O timed out"));
|
||||
}
|
||||
|
||||
/* Signal completion of the task. */
|
||||
g_mutex_lock (&data->lock);
|
||||
|
@ -262,7 +262,7 @@ eject_unmount_done (GObject *source,
|
||||
{
|
||||
if (!g_subprocess_get_successful (subprocess))
|
||||
/* ...but bad exit code */
|
||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED, "%s", stderr_str);
|
||||
g_task_return_new_error_literal (task, G_IO_ERROR, G_IO_ERROR_FAILED, stderr_str);
|
||||
else
|
||||
/* ...and successful exit code */
|
||||
g_task_return_boolean (task, TRUE);
|
||||
|
@ -287,7 +287,7 @@ eject_mount_done (GObject *source,
|
||||
{
|
||||
if (!g_subprocess_get_successful (subprocess))
|
||||
/* ...but bad exit code */
|
||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED, "%s", stderr_str);
|
||||
g_task_return_new_error_literal (task, G_IO_ERROR, G_IO_ERROR_FAILED, stderr_str);
|
||||
else
|
||||
{
|
||||
/* ...and successful exit code */
|
||||
|
@ -797,9 +797,9 @@ g_fake_resolver_lookup_by_name_async (GResolver *resolver,
|
||||
}
|
||||
else
|
||||
{
|
||||
g_task_return_new_error (task,
|
||||
G_RESOLVER_ERROR, G_RESOLVER_ERROR_NOT_FOUND,
|
||||
"Not found");
|
||||
g_task_return_new_error_literal (task,
|
||||
G_RESOLVER_ERROR, G_RESOLVER_ERROR_NOT_FOUND,
|
||||
"Not found");
|
||||
}
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ test_interaction_ask_password_async_failure (GTlsInteraction *interaction,
|
||||
|
||||
task = g_task_new (self, cancellable, callback, user_data);
|
||||
|
||||
g_task_return_new_error (task, G_FILE_ERROR, G_FILE_ERROR_ACCES, "The message");
|
||||
g_task_return_new_error_literal (task, G_FILE_ERROR, G_FILE_ERROR_ACCES, "The message");
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
@ -348,7 +348,7 @@ test_interaction_request_certificate_async_failure (GTlsInteraction *interact
|
||||
|
||||
task = g_task_new (self, cancellable, callback, user_data);
|
||||
|
||||
g_task_return_new_error (task, G_FILE_ERROR, G_FILE_ERROR_NOENT, "Another message");
|
||||
g_task_return_new_error_literal (task, G_FILE_ERROR, G_FILE_ERROR_NOENT, "Another message");
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user