mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-24 14:36:13 +01:00
Silence a bunch of -Wunused-but-set-variable warnings
Signed-off-by: David Zeuthen <davidz@redhat.com>
This commit is contained in:
parent
23818d1e61
commit
0729260141
@ -258,6 +258,25 @@ is_valid_nonce_tcp (const gchar *address_entry,
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (nonce_file == NULL)
|
||||
{
|
||||
g_set_error (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_INVALID_ARGUMENT,
|
||||
_("Error in address `%s' - missing noncefile attribute"),
|
||||
address_entry);
|
||||
goto out;
|
||||
}
|
||||
if (host == NULL)
|
||||
{
|
||||
g_set_error (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_INVALID_ARGUMENT,
|
||||
_("Error in address `%s' - missing host attribute"),
|
||||
address_entry);
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret= TRUE;
|
||||
|
||||
out:
|
||||
@ -332,6 +351,16 @@ is_valid_tcp (const gchar *address_entry,
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (host == NULL)
|
||||
{
|
||||
g_set_error (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_INVALID_ARGUMENT,
|
||||
_("Error in address `%s' - missing host attribute"),
|
||||
address_entry);
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret= TRUE;
|
||||
|
||||
out:
|
||||
|
@ -997,6 +997,7 @@ _g_dbus_auth_run_server (GDBusAuth *auth,
|
||||
{
|
||||
local_error = NULL;
|
||||
byte = g_data_input_stream_read_byte (dis, cancellable, &local_error);
|
||||
byte = byte; /* To avoid -Wunused-but-set-variable */
|
||||
if (local_error != NULL)
|
||||
{
|
||||
g_propagate_error (error, local_error);
|
||||
|
@ -426,6 +426,7 @@ keyring_lookup_entry (const gchar *cookie_context,
|
||||
}
|
||||
|
||||
line_when = g_ascii_strtoll (tokens[1], &endp, 10);
|
||||
line_when = line_when; /* To avoid -Wunused-but-set-variable */
|
||||
if (*endp != '\0')
|
||||
{
|
||||
g_set_error (error,
|
||||
@ -560,6 +561,7 @@ keyring_acquire_lock (const gchar *path,
|
||||
goto again;
|
||||
}
|
||||
#endif
|
||||
num_create_tries = num_create_tries; /* To avoid -Wunused-but-set-variable */
|
||||
g_set_error (error,
|
||||
G_IO_ERROR,
|
||||
g_io_error_from_errno (errno),
|
||||
@ -747,6 +749,8 @@ keyring_generate_entry (const gchar *cookie_context,
|
||||
g_strfreev (tokens);
|
||||
goto out;
|
||||
}
|
||||
line_when = line_when; /* To avoid -Wunused-but-set-variable */
|
||||
|
||||
|
||||
/* D-Bus spec says:
|
||||
*
|
||||
|
@ -2049,8 +2049,6 @@ on_worker_message_received (GDBusWorker *worker,
|
||||
{
|
||||
GDBusConnection *connection;
|
||||
FilterCallback *filters;
|
||||
gboolean consumed_by_filter;
|
||||
gboolean altered_by_filter;
|
||||
guint num_filters;
|
||||
guint n;
|
||||
gboolean alive;
|
||||
@ -2086,8 +2084,6 @@ on_worker_message_received (GDBusWorker *worker,
|
||||
CONNECTION_UNLOCK (connection);
|
||||
|
||||
/* then call the filters in order (without holding the lock) */
|
||||
consumed_by_filter = FALSE;
|
||||
altered_by_filter = FALSE;
|
||||
for (n = 0; n < num_filters; n++)
|
||||
{
|
||||
message = filters[n].func (connection,
|
||||
@ -4065,7 +4061,6 @@ invoke_get_all_properties_in_idle_cb (gpointer _data)
|
||||
{
|
||||
PropertyGetAllData *data = _data;
|
||||
GVariantBuilder builder;
|
||||
GError *error;
|
||||
GDBusMessage *reply;
|
||||
guint n;
|
||||
|
||||
@ -4082,8 +4077,6 @@ invoke_get_all_properties_in_idle_cb (gpointer _data)
|
||||
goto out;
|
||||
}
|
||||
|
||||
error = NULL;
|
||||
|
||||
/* TODO: Right now we never fail this call - we just omit values if
|
||||
* a get_property() call is failing.
|
||||
*
|
||||
@ -6061,7 +6054,6 @@ distribute_method_call (GDBusConnection *connection,
|
||||
const gchar *object_path;
|
||||
const gchar *interface_name;
|
||||
const gchar *member;
|
||||
const gchar *signature;
|
||||
const gchar *path;
|
||||
gchar *subtree_path;
|
||||
gchar *needle;
|
||||
@ -6070,7 +6062,6 @@ distribute_method_call (GDBusConnection *connection,
|
||||
|
||||
interface_name = g_dbus_message_get_interface (message);
|
||||
member = g_dbus_message_get_member (message);
|
||||
signature = g_dbus_message_get_signature (message);
|
||||
path = g_dbus_message_get_path (message);
|
||||
subtree_path = g_strdup (path);
|
||||
needle = strrchr (subtree_path, '/');
|
||||
@ -6101,14 +6092,6 @@ distribute_method_call (GDBusConnection *connection,
|
||||
_g_dbus_debug_print_unlock ();
|
||||
}
|
||||
|
||||
#if 0
|
||||
g_debug ("interface = `%s'", interface_name);
|
||||
g_debug ("member = `%s'", member);
|
||||
g_debug ("signature = `%s'", signature);
|
||||
g_debug ("path = `%s'", path);
|
||||
g_debug ("subtree_path = `%s'", subtree_path != NULL ? subtree_path : "N/A");
|
||||
#endif
|
||||
|
||||
object_path = g_dbus_message_get_path (message);
|
||||
g_assert (object_path != NULL);
|
||||
|
||||
|
@ -1525,6 +1525,8 @@ parse_value_from_blob (GMemoryInputStream *mis,
|
||||
g_free (s);
|
||||
}
|
||||
}
|
||||
#else
|
||||
is_leaf = is_leaf; /* To avoid -Wunused-but-set-variable */
|
||||
#endif /* DEBUG_SERIALIZER */
|
||||
|
||||
/* sink the reference */
|
||||
@ -2151,12 +2153,9 @@ append_body_to_blob (GVariant *value,
|
||||
GDataOutputStream *dos,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret;
|
||||
GVariant *item;
|
||||
GVariantIter iter;
|
||||
|
||||
ret = FALSE;
|
||||
|
||||
if (!g_variant_is_of_type (value, G_VARIANT_TYPE_TUPLE))
|
||||
{
|
||||
g_set_error (error,
|
||||
|
@ -1632,6 +1632,7 @@ _g_dbus_initialize (void)
|
||||
const gchar *debug;
|
||||
|
||||
g_dbus_error_domain = G_DBUS_ERROR;
|
||||
(g_dbus_error_domain); /* To avoid -Wunused-but-set-variable */
|
||||
|
||||
debug = g_getenv ("G_DBUS_DEBUG");
|
||||
if (debug != NULL)
|
||||
|
@ -643,8 +643,7 @@ g_dbus_proxy_get_cached_property (GDBusProxy *proxy,
|
||||
value = g_hash_table_lookup (proxy->priv->properties, property_name);
|
||||
if (value == NULL)
|
||||
{
|
||||
const GDBusPropertyInfo *info;
|
||||
info = lookup_property_info_or_warn (proxy, property_name);
|
||||
lookup_property_info_or_warn (proxy, property_name);
|
||||
/* no difference */
|
||||
goto out;
|
||||
}
|
||||
@ -823,7 +822,6 @@ on_properties_changed (GDBusConnection *connection,
|
||||
gpointer user_data)
|
||||
{
|
||||
GDBusProxy *proxy = G_DBUS_PROXY (user_data);
|
||||
GError *error;
|
||||
const gchar *interface_name_for_signal;
|
||||
GVariant *changed_properties;
|
||||
gchar **invalidated_properties;
|
||||
@ -832,7 +830,6 @@ on_properties_changed (GDBusConnection *connection,
|
||||
GVariant *value;
|
||||
guint n;
|
||||
|
||||
error = NULL;
|
||||
changed_properties = NULL;
|
||||
invalidated_properties = NULL;
|
||||
|
||||
|
@ -773,21 +773,18 @@ try_tcp (GDBusServer *server,
|
||||
gboolean ret;
|
||||
const gchar *host;
|
||||
const gchar *port;
|
||||
const gchar *family;
|
||||
gint port_num;
|
||||
GSocketAddress *address;
|
||||
GResolver *resolver;
|
||||
GList *resolved_addresses;
|
||||
GList *l;
|
||||
|
||||
ret = FALSE;
|
||||
address = NULL;
|
||||
resolver = NULL;
|
||||
resolved_addresses = NULL;
|
||||
|
||||
host = g_hash_table_lookup (key_value_pairs, "host");
|
||||
port = g_hash_table_lookup (key_value_pairs, "port");
|
||||
family = g_hash_table_lookup (key_value_pairs, "family");
|
||||
/* family = g_hash_table_lookup (key_value_pairs, "family"); */
|
||||
if (g_hash_table_lookup (key_value_pairs, "noncefile") != NULL)
|
||||
{
|
||||
g_set_error_literal (error,
|
||||
|
@ -125,7 +125,6 @@ g_dbus_is_name (const gchar *string)
|
||||
guint len;
|
||||
gboolean ret;
|
||||
const gchar *s;
|
||||
const gchar *end;
|
||||
|
||||
g_return_val_if_fail (string != NULL, FALSE);
|
||||
|
||||
@ -136,7 +135,6 @@ g_dbus_is_name (const gchar *string)
|
||||
goto out;
|
||||
|
||||
s = string;
|
||||
end = s + len;
|
||||
if (*s == ':')
|
||||
{
|
||||
/* handle unique name */
|
||||
@ -248,7 +246,6 @@ g_dbus_is_interface_name (const gchar *string)
|
||||
guint len;
|
||||
gboolean ret;
|
||||
const gchar *s;
|
||||
const gchar *end;
|
||||
|
||||
g_return_val_if_fail (string != NULL, FALSE);
|
||||
|
||||
@ -259,7 +256,6 @@ g_dbus_is_interface_name (const gchar *string)
|
||||
goto out;
|
||||
|
||||
s = string;
|
||||
end = s + len;
|
||||
if (G_UNLIKELY (*s == '.'))
|
||||
{
|
||||
/* can't start with a . */
|
||||
|
@ -124,7 +124,6 @@ g_icon_equal (GIcon *icon1,
|
||||
static gboolean
|
||||
g_icon_to_string_tokenized (GIcon *icon, GString *s)
|
||||
{
|
||||
char *ret;
|
||||
GPtrArray *tokens;
|
||||
gint version;
|
||||
GIconIface *icon_iface;
|
||||
@ -133,8 +132,6 @@ g_icon_to_string_tokenized (GIcon *icon, GString *s)
|
||||
g_return_val_if_fail (icon != NULL, FALSE);
|
||||
g_return_val_if_fail (G_IS_ICON (icon), FALSE);
|
||||
|
||||
ret = NULL;
|
||||
|
||||
icon_iface = G_ICON_GET_IFACE (icon);
|
||||
if (icon_iface->to_tokens == NULL)
|
||||
return FALSE;
|
||||
@ -383,6 +380,7 @@ ensure_builtin_icon_types (void)
|
||||
t = g_file_icon_get_type ();
|
||||
t = g_emblemed_icon_get_type ();
|
||||
t = g_emblem_get_type ();
|
||||
(t); /* To avoid -Wunused-but-set-variable */
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -414,6 +414,7 @@ g_inet_address_new_from_string (const gchar *string)
|
||||
|
||||
/* Make sure _g_networking_init() has been called */
|
||||
type = g_inet_address_get_type ();
|
||||
(type); /* To avoid -Wunused-but-set-variable */
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
memset (&sa, 0, sizeof (sa));
|
||||
|
@ -1442,9 +1442,6 @@ static void
|
||||
schema_state_end (SchemaState **state_ptr,
|
||||
GError **error)
|
||||
{
|
||||
SchemaState *state;
|
||||
|
||||
state = *state_ptr;
|
||||
*state_ptr = NULL;
|
||||
}
|
||||
|
||||
|
@ -90,6 +90,7 @@ g_resolver_class_init (GResolverClass *resolver_class)
|
||||
|
||||
/* Make sure _g_networking_init() has been called */
|
||||
type = g_inet_address_get_type ();
|
||||
(type); /* To avoid -Wunused-but-set-variable */
|
||||
|
||||
/* Initialize _g_resolver_addrinfo_hints */
|
||||
#ifdef AI_ADDRCONFIG
|
||||
@ -858,6 +859,7 @@ _g_resolver_targets_from_res_query (const gchar *rrname,
|
||||
GETSHORT (type, p);
|
||||
GETSHORT (qclass, p);
|
||||
GETLONG (ttl, p);
|
||||
ttl = ttl; /* To avoid -Wunused-but-set-variable */
|
||||
GETSHORT (rdlength, p);
|
||||
|
||||
if (type != T_SRV || qclass != C_IN)
|
||||
|
@ -678,6 +678,7 @@ g_socket_class_init (GSocketClass *klass)
|
||||
|
||||
/* Make sure winsock has been initialized */
|
||||
type = g_inet_address_get_type ();
|
||||
(type); /* To avoid -Wunused-but-set-variable */
|
||||
|
||||
#ifdef SIGPIPE
|
||||
/* There is no portable, thread-safe way to avoid having the process
|
||||
@ -3328,12 +3329,7 @@ g_socket_receive_message (GSocket *socket,
|
||||
/* decode control messages */
|
||||
{
|
||||
GPtrArray *my_messages = NULL;
|
||||
const gchar *scm_pointer;
|
||||
struct cmsghdr *cmsg;
|
||||
gsize scm_size;
|
||||
|
||||
scm_pointer = (const gchar *) msg.msg_control;
|
||||
scm_size = msg.msg_controllen;
|
||||
|
||||
for (cmsg = CMSG_FIRSTHDR (&msg); cmsg; cmsg = CMSG_NXTHDR (&msg, cmsg))
|
||||
{
|
||||
|
@ -448,6 +448,7 @@ init_builtin_types (void)
|
||||
a_type = g_unix_connection_get_type ();
|
||||
#endif
|
||||
a_type = g_tcp_connection_get_type ();
|
||||
(a_type); /* To avoid -Wunused-but-set-variable */
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -185,6 +185,7 @@ g_socket_control_message_deserialize (int level,
|
||||
#ifndef G_OS_WIN32
|
||||
a_type = g_unix_credentials_message_get_type ();
|
||||
a_type = g_unix_fd_message_get_type ();
|
||||
(a_type); /* To avoid -Wunused-but-set-variable */
|
||||
#endif
|
||||
|
||||
message_types = g_type_children (G_TYPE_SOCKET_CONTROL_MESSAGE, &n_message_types);
|
||||
|
@ -473,6 +473,7 @@ g_unix_connection_receive_credentials (GUnixConnection *connection,
|
||||
|
||||
/* ensure the type of GUnixCredentialsMessage has been registered with the type system */
|
||||
credentials_message_gtype = G_TYPE_UNIX_CREDENTIALS_MESSAGE;
|
||||
(credentials_message_gtype); /* To avoid -Wunused-but-set-variable */
|
||||
num_bytes_read = g_socket_receive_message (socket,
|
||||
NULL, /* GSocketAddress **address */
|
||||
NULL,
|
||||
|
@ -87,7 +87,6 @@ gvdb_table_setup_root (GvdbTable *file,
|
||||
{
|
||||
const struct gvdb_hash_header *header;
|
||||
guint32 n_bloom_words;
|
||||
guint32 bloom_shift;
|
||||
guint32 n_buckets;
|
||||
gsize size;
|
||||
|
||||
@ -100,7 +99,6 @@ gvdb_table_setup_root (GvdbTable *file,
|
||||
|
||||
n_bloom_words = guint32_from_le (header->n_bloom_words);
|
||||
n_buckets = guint32_from_le (header->n_buckets);
|
||||
bloom_shift = n_bloom_words >> 27;
|
||||
n_bloom_words &= (1u << 27) - 1;
|
||||
|
||||
if G_UNLIKELY (n_bloom_words * sizeof (guint32_le) > size)
|
||||
|
@ -92,14 +92,11 @@ g_expander_converter_convert (GConverter *converter,
|
||||
gsize *bytes_written,
|
||||
GError **error)
|
||||
{
|
||||
GExpanderConverter *conv;
|
||||
const guint8 *in, *in_end;
|
||||
guint8 v, *out;
|
||||
int i;
|
||||
gsize block_size;
|
||||
|
||||
conv = G_EXPANDER_CONVERTER (converter);
|
||||
|
||||
in = inbuf;
|
||||
out = outbuf;
|
||||
in_end = in + inbuf_size;
|
||||
@ -211,14 +208,11 @@ g_compressor_converter_convert (GConverter *converter,
|
||||
gsize *bytes_written,
|
||||
GError **error)
|
||||
{
|
||||
GCompressorConverter *conv;
|
||||
const guint8 *in, *in_end;
|
||||
guint8 v, *out;
|
||||
int i;
|
||||
gsize block_size;
|
||||
|
||||
conv = G_COMPRESSOR_CONVERTER (converter);
|
||||
|
||||
in = inbuf;
|
||||
out = outbuf;
|
||||
in_end = in + inbuf_size;
|
||||
|
@ -206,10 +206,9 @@ ipending_cb (GObject *source,
|
||||
{
|
||||
CreateDeleteData *data = user_data;
|
||||
GError *error;
|
||||
gssize size;
|
||||
|
||||
error = NULL;
|
||||
size = g_input_stream_read_finish (data->istream, res, &error);
|
||||
g_input_stream_read_finish (data->istream, res, &error);
|
||||
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_PENDING);
|
||||
g_error_free (error);
|
||||
}
|
||||
@ -334,10 +333,9 @@ opending_cb (GObject *source,
|
||||
{
|
||||
CreateDeleteData *data = user_data;
|
||||
GError *error;
|
||||
gssize size;
|
||||
|
||||
error = NULL;
|
||||
size = g_output_stream_write_finish (data->ostream, res, &error);
|
||||
g_output_stream_write_finish (data->ostream, res, &error);
|
||||
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_PENDING);
|
||||
g_error_free (error);
|
||||
}
|
||||
@ -512,11 +510,10 @@ replaced_cb (GObject *source,
|
||||
gpointer user_data)
|
||||
{
|
||||
ReplaceLoadData *data = user_data;
|
||||
gboolean ret;
|
||||
GError *error;
|
||||
|
||||
error = NULL;
|
||||
ret = g_file_replace_contents_finish (data->file, res, NULL, &error);
|
||||
g_file_replace_contents_finish (data->file, res, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_file_load_contents_async (data->file, NULL, loaded_cb, data);
|
||||
|
@ -72,6 +72,7 @@ handler (GThreadedSocketService *service,
|
||||
*tmp = 0;
|
||||
version = tmp + 1;
|
||||
}
|
||||
version = version; /* To avoid -Wunused-but-set-variable */
|
||||
|
||||
query = strchr (escaped, '?');
|
||||
if (query != NULL)
|
||||
|
@ -126,7 +126,6 @@ create_empty_file (GFile * parent, const char *filename,
|
||||
GFileCreateFlags create_flags)
|
||||
{
|
||||
GFile *child;
|
||||
gboolean res;
|
||||
GError *error;
|
||||
GFileOutputStream *outs;
|
||||
|
||||
@ -138,7 +137,7 @@ create_empty_file (GFile * parent, const char *filename,
|
||||
g_assert_no_error (error);
|
||||
g_assert (outs != NULL);
|
||||
error = NULL;
|
||||
res = g_output_stream_close (G_OUTPUT_STREAM (outs), NULL, &error);
|
||||
g_output_stream_close (G_OUTPUT_STREAM (outs), NULL, &error);
|
||||
g_object_unref (outs);
|
||||
return child;
|
||||
}
|
||||
|
@ -164,11 +164,8 @@ read_line (GDataInputStream *stream,
|
||||
GError **error)
|
||||
{
|
||||
gsize length;
|
||||
int eol_len;
|
||||
char *str;
|
||||
|
||||
eol_len = 1 + (eol[1] != '\0');
|
||||
|
||||
str = g_data_input_stream_read_line (stream, &length, NULL, error);
|
||||
|
||||
if (str == NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user