[glib] GSettings test: fix unsafe GObject properties use
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] GSettings test: fix unsafe GObject properties use
- Date: Mon, 4 Oct 2010 02:56:13 +0000 (UTC)
commit 90822327acdcc0a10f0de41c591e4cee234811db
Author: Ryan Lortie <desrt desrt ca>
Date: Sun Oct 3 22:53:49 2010 -0400
GSettings test: fix unsafe GObject properties use
The test case was passing a guint16 to g_object_get() for a guint
property. That's invalid on all systems, although it works (more or
less) on little endian ones. On big endian it's a total no-go.
gio/tests/gsettings.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/gio/tests/gsettings.c b/gio/tests/gsettings.c
index 3313d38..f86a2f8 100644
--- a/gio/tests/gsettings.c
+++ b/gio/tests/gsettings.c
@@ -942,6 +942,8 @@ test_simple_binding (void)
gint i;
gint16 n;
guint16 q;
+ gint n2;
+ guint q2;
gint64 i64;
guint64 u64;
gdouble d;
@@ -991,9 +993,9 @@ test_simple_binding (void)
g_assert_cmpint (n, ==, 1234);
g_settings_set (settings, "int16", "n", 4321);
- n = 1111;
- g_object_get (obj, "int16", &n, NULL);
- g_assert_cmpint (n, ==, 4321);
+ n2 = 1111;
+ g_object_get (obj, "int16", &n2, NULL);
+ g_assert_cmpint (n2, ==, 4321);
g_settings_bind (settings, "uint16", obj, "uint16", G_SETTINGS_BIND_DEFAULT);
@@ -1003,9 +1005,9 @@ test_simple_binding (void)
g_assert_cmpuint (q, ==, G_MAXUINT16);
g_settings_set (settings, "uint16", "q", (guint16) G_MAXINT16);
- q = 1111;
- g_object_get (obj, "uint16", &q, NULL);
- g_assert_cmpuint (q, ==, (guint16) G_MAXINT16);
+ q2 = 1111;
+ g_object_get (obj, "uint16", &q2, NULL);
+ g_assert_cmpuint (q2, ==, (guint16) G_MAXINT16);
g_settings_bind (settings, "int", obj, "int", G_SETTINGS_BIND_DEFAULT);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]