[glib] Fix compiler warnings
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Fix compiler warnings
- Date: Mon, 2 May 2011 15:50:51 +0000 (UTC)
commit bdc23c44e8fbb507e14056a05e38b92982df7a5f
Author: Dan Winship <danw gnome org>
Date: Mon May 2 11:45:52 2011 -0400
Fix compiler warnings
glib/gdate.c | 2 +-
glib/ghash.c | 2 +-
glib/gutf8.c | 4 ---
glib/tests/gvariant.c | 1 +
gobject/gclosure.c | 2 +
gobject/gobject.c | 52 ++++++++++++++++++++---------------------
gobject/testgobject.c | 2 +
gobject/tests/dynamictests.c | 3 ++
gobject/tests/threadtests.c | 7 ++---
tests/refcount/objects.c | 2 +-
tests/refcount/objects2.c | 2 +-
tests/refcount/properties.c | 4 ---
tests/refcount/properties2.c | 2 +-
tests/refcount/signals.c | 2 +-
14 files changed, 42 insertions(+), 45 deletions(-)
---
diff --git a/glib/gdate.c b/glib/gdate.c
index 2fab2f2..9b6fb4c 100644
--- a/glib/gdate.c
+++ b/glib/gdate.c
@@ -673,7 +673,7 @@ g_date_prepare_to_parse (const gchar *str,
++i;
}
-#ifdef G_ENABLE_DEBUG
+#if defined(G_ENABLE_DEBUG) && 0
DEBUG_MSG (("**GDate prepared a new set of locale-specific parse rules."));
i = 1;
while (i < 13)
diff --git a/glib/ghash.c b/glib/ghash.c
index 8b31a59..59382bf 100644
--- a/glib/ghash.c
+++ b/glib/ghash.c
@@ -350,7 +350,7 @@ g_hash_table_lookup_node (GHashTable *hash_table,
{
guint node_index;
guint hash_value;
- guint first_tombstone;
+ guint first_tombstone = 0;
gboolean have_tombstone = FALSE;
guint step = 0;
diff --git a/glib/gutf8.c b/glib/gutf8.c
index 98f4707..ed245dc 100644
--- a/glib/gutf8.c
+++ b/glib/gutf8.c
@@ -1292,13 +1292,11 @@ g_utf16_to_ucs4 (const gunichar2 *str,
while ((len < 0 || in - str < len) && *in)
{
gunichar2 c = *in;
- gunichar wc;
if (c >= 0xdc00 && c < 0xe000) /* low surrogate */
{
if (high_surrogate)
{
- wc = SURROGATE_VALUE (high_surrogate, c);
high_surrogate = 0;
}
else
@@ -1322,8 +1320,6 @@ g_utf16_to_ucs4 (const gunichar2 *str,
high_surrogate = c;
goto next1;
}
- else
- wc = c;
}
/********** DIFFERENT for UTF8/UCS4 **********/
diff --git a/glib/tests/gvariant.c b/glib/tests/gvariant.c
index 49860e4..190eb6a 100644
--- a/glib/tests/gvariant.c
+++ b/glib/tests/gvariant.c
@@ -3926,6 +3926,7 @@ test_bytestring (void)
untrusted_empty = g_variant_new_from_data (G_VARIANT_TYPE ("ay"), NULL, 0, FALSE, NULL, NULL);
value = g_variant_get_normal_form (untrusted_empty);
const_str = g_variant_get_bytestring (value);
+ (void) const_str;
g_variant_unref (value);
g_variant_unref (untrusted_empty);
}
diff --git a/gobject/gclosure.c b/gobject/gclosure.c
index 5305efd..0121fd9 100644
--- a/gobject/gclosure.c
+++ b/gobject/gclosure.c
@@ -29,7 +29,9 @@
#include <ffi.h>
#include "gclosure.h"
+#include "gboxed.h"
#include "gvalue.h"
+#include "gvaluetypes.h"
/**
diff --git a/gobject/gobject.c b/gobject/gobject.c
index c31ec52..7fa845f 100644
--- a/gobject/gobject.c
+++ b/gobject/gobject.c
@@ -2096,47 +2096,46 @@ g_object_connect (gpointer _object,
{
GCallback callback = va_arg (var_args, GCallback);
gpointer data = va_arg (var_args, gpointer);
- gulong sid;
if (strncmp (signal_spec, "signal::", 8) == 0)
- sid = g_signal_connect_data (object, signal_spec + 8,
- callback, data, NULL,
- 0);
+ g_signal_connect_data (object, signal_spec + 8,
+ callback, data, NULL,
+ 0);
else if (strncmp (signal_spec, "object_signal::", 15) == 0 ||
strncmp (signal_spec, "object-signal::", 15) == 0)
- sid = g_signal_connect_object (object, signal_spec + 15,
- callback, data,
- 0);
+ g_signal_connect_object (object, signal_spec + 15,
+ callback, data,
+ 0);
else if (strncmp (signal_spec, "swapped_signal::", 16) == 0 ||
strncmp (signal_spec, "swapped-signal::", 16) == 0)
- sid = g_signal_connect_data (object, signal_spec + 16,
- callback, data, NULL,
- G_CONNECT_SWAPPED);
+ g_signal_connect_data (object, signal_spec + 16,
+ callback, data, NULL,
+ G_CONNECT_SWAPPED);
else if (strncmp (signal_spec, "swapped_object_signal::", 23) == 0 ||
strncmp (signal_spec, "swapped-object-signal::", 23) == 0)
- sid = g_signal_connect_object (object, signal_spec + 23,
- callback, data,
- G_CONNECT_SWAPPED);
+ g_signal_connect_object (object, signal_spec + 23,
+ callback, data,
+ G_CONNECT_SWAPPED);
else if (strncmp (signal_spec, "signal_after::", 14) == 0 ||
strncmp (signal_spec, "signal-after::", 14) == 0)
- sid = g_signal_connect_data (object, signal_spec + 14,
- callback, data, NULL,
- G_CONNECT_AFTER);
+ g_signal_connect_data (object, signal_spec + 14,
+ callback, data, NULL,
+ G_CONNECT_AFTER);
else if (strncmp (signal_spec, "object_signal_after::", 21) == 0 ||
strncmp (signal_spec, "object-signal-after::", 21) == 0)
- sid = g_signal_connect_object (object, signal_spec + 21,
- callback, data,
- G_CONNECT_AFTER);
+ g_signal_connect_object (object, signal_spec + 21,
+ callback, data,
+ G_CONNECT_AFTER);
else if (strncmp (signal_spec, "swapped_signal_after::", 22) == 0 ||
strncmp (signal_spec, "swapped-signal-after::", 22) == 0)
- sid = g_signal_connect_data (object, signal_spec + 22,
- callback, data, NULL,
- G_CONNECT_SWAPPED | G_CONNECT_AFTER);
+ g_signal_connect_data (object, signal_spec + 22,
+ callback, data, NULL,
+ G_CONNECT_SWAPPED | G_CONNECT_AFTER);
else if (strncmp (signal_spec, "swapped_object_signal_after::", 29) == 0 ||
strncmp (signal_spec, "swapped-object-signal-after::", 29) == 0)
- sid = g_signal_connect_object (object, signal_spec + 29,
- callback, data,
- G_CONNECT_SWAPPED | G_CONNECT_AFTER);
+ g_signal_connect_object (object, signal_spec + 29,
+ callback, data,
+ G_CONNECT_SWAPPED | G_CONNECT_AFTER);
else
{
g_warning ("%s: invalid signal spec \"%s\"", G_STRFUNC, signal_spec);
@@ -2451,11 +2450,10 @@ g_object_ref_sink (gpointer _object)
void
g_object_force_floating (GObject *object)
{
- gboolean was_floating;
g_return_if_fail (G_IS_OBJECT (object));
g_return_if_fail (object->ref_count >= 1);
- was_floating = floating_flag_handler (object, +1);
+ floating_flag_handler (object, +1);
}
typedef struct {
diff --git a/gobject/testgobject.c b/gobject/testgobject.c
index 2723764..1861c3c 100644
--- a/gobject/testgobject.c
+++ b/gobject/testgobject.c
@@ -391,8 +391,10 @@ main (int argc,
/* test new fundamentals */
g_assert (G_TYPE_MAKE_FUNDAMENTAL (G_TYPE_RESERVED_USER_FIRST) == g_type_fundamental_next ());
type = g_type_register_fundamental (g_type_fundamental_next (), "FooShadow1", &info, &finfo, 0);
+ g_assert (type == G_TYPE_RESERVED_USER_FIRST);
g_assert (G_TYPE_MAKE_FUNDAMENTAL (G_TYPE_RESERVED_USER_FIRST + 1) == g_type_fundamental_next ());
type = g_type_register_fundamental (g_type_fundamental_next (), "FooShadow2", &info, &finfo, 0);
+ g_assert (type == G_TYPE_RESERVED_USER_FIRST + 1);
g_assert (G_TYPE_MAKE_FUNDAMENTAL (G_TYPE_RESERVED_USER_FIRST + 2) == g_type_fundamental_next ());
g_assert (g_type_from_name ("FooShadow1") == G_TYPE_MAKE_FUNDAMENTAL (G_TYPE_RESERVED_USER_FIRST));
g_assert (g_type_from_name ("FooShadow2") == G_TYPE_MAKE_FUNDAMENTAL (G_TYPE_RESERVED_USER_FIRST + 1));
diff --git a/gobject/tests/dynamictests.c b/gobject/tests/dynamictests.c
index e22ac06..bff92e2 100644
--- a/gobject/tests/dynamictests.c
+++ b/gobject/tests/dynamictests.c
@@ -198,6 +198,8 @@ test_multithreaded_dynamic_type_init (void)
guint i;
module = test_module_new (module_register);
+ g_assert (module != NULL);
+
/* Not loaded until we call ref for the first time */
class = g_type_class_peek (DYNAMIC_OBJECT_TYPE);
g_assert (class == NULL);
@@ -339,6 +341,7 @@ test_dynamic_interface_properties (void)
DynObj *obj;
module = test_module_new (mod_register);
+ g_assert (module != NULL);
obj = g_object_new (dyn_obj_get_type (), "foo", 1, NULL);
diff --git a/gobject/tests/threadtests.c b/gobject/tests/threadtests.c
index c3b0171..ae88750 100644
--- a/gobject/tests/threadtests.c
+++ b/gobject/tests/threadtests.c
@@ -107,13 +107,12 @@ tester_init_thread (gpointer data)
static void
test_threaded_class_init (void)
{
- GThread *threads[3] = { NULL, };
/* pause newly created threads */
g_mutex_lock (sync_mutex);
/* create threads */
- threads[0] = g_thread_create (tester_init_thread, (gpointer) my_tester0_get_type(), TRUE, NULL);
- threads[1] = g_thread_create (tester_init_thread, (gpointer) my_tester1_get_type(), TRUE, NULL);
- threads[2] = g_thread_create (tester_init_thread, (gpointer) my_tester2_get_type(), TRUE, NULL);
+ g_thread_create (tester_init_thread, (gpointer) my_tester0_get_type(), TRUE, NULL);
+ g_thread_create (tester_init_thread, (gpointer) my_tester1_get_type(), TRUE, NULL);
+ g_thread_create (tester_init_thread, (gpointer) my_tester2_get_type(), TRUE, NULL);
/* execute threads */
g_mutex_unlock (sync_mutex);
while (g_atomic_int_get (&mtsafe_call_counter) < (3 + 3 + 3 * 3) * NUM_COUNTER_INCREMENTS)
diff --git a/tests/refcount/objects.c b/tests/refcount/objects.c
index 9638045..3724c0e 100644
--- a/tests/refcount/objects.c
+++ b/tests/refcount/objects.c
@@ -81,7 +81,7 @@ my_test_dispose (GObject * object)
test = MY_TEST (object);
- g_print ("dispose %p!\n", object);
+ g_print ("dispose %p!\n", test);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
diff --git a/tests/refcount/objects2.c b/tests/refcount/objects2.c
index bbd4a82..39f580f 100644
--- a/tests/refcount/objects2.c
+++ b/tests/refcount/objects2.c
@@ -80,7 +80,7 @@ my_test_dispose (GObject * object)
test = MY_TEST (object);
- g_print ("dispose %p!\n", object);
+ g_print ("dispose %p!\n", test);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
diff --git a/tests/refcount/properties.c b/tests/refcount/properties.c
index c4c165c..87bb8b5 100644
--- a/tests/refcount/properties.c
+++ b/tests/refcount/properties.c
@@ -104,10 +104,6 @@ my_test_init (GTest * test)
static void
my_test_dispose (GObject * object)
{
- GTest *test;
-
- test = MY_TEST (object);
-
G_OBJECT_CLASS (parent_class)->dispose (object);
}
diff --git a/tests/refcount/properties2.c b/tests/refcount/properties2.c
index bb79105..862bd2f 100644
--- a/tests/refcount/properties2.c
+++ b/tests/refcount/properties2.c
@@ -105,7 +105,7 @@ my_test_dispose (GObject * object)
test = MY_TEST (object);
- g_print ("dispose %p!\n", object);
+ g_print ("dispose %p!\n", test);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
diff --git a/tests/refcount/signals.c b/tests/refcount/signals.c
index 1a2a2ba..2877995 100644
--- a/tests/refcount/signals.c
+++ b/tests/refcount/signals.c
@@ -136,7 +136,7 @@ my_test_dispose (GObject * object)
test = MY_TEST (object);
- g_print ("dispose %p!\n", object);
+ g_print ("dispose %p!\n", test);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]