mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-09-27 17:52:58 +02:00
Fix array-bounds compiler warnings with GCC 12
GCC isn't smart enough to recognise that the assertion on the size of
N_PROPERTIES also affects the assertion on the GParamSpec array access,
so we need to coalesce the two checks into one to avoid an array-bounds
compiler warning.
(cherry-picked from commit 903c004b37
)
This commit is contained in:
committed by
Marco Trevisan (Treviño)
parent
df1e7dc5db
commit
8fb03af05d
@@ -104,8 +104,7 @@ test_object_set_property (GObject *gobject,
|
||||
TestObject *tobj = (TestObject *) gobject;
|
||||
|
||||
g_assert_cmpint (prop_id, !=, 0);
|
||||
g_assert_cmpint (prop_id, !=, N_PROPERTIES);
|
||||
g_assert (pspec == properties[prop_id]);
|
||||
g_assert_true (prop_id < N_PROPERTIES && pspec == properties[prop_id]);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
@@ -139,8 +138,7 @@ test_object_get_property (GObject *gobject,
|
||||
TestObject *tobj = (TestObject *) gobject;
|
||||
|
||||
g_assert_cmpint (prop_id, !=, 0);
|
||||
g_assert_cmpint (prop_id, !=, N_PROPERTIES);
|
||||
g_assert (pspec == properties[prop_id]);
|
||||
g_assert_true (prop_id < N_PROPERTIES && pspec == properties[prop_id]);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
|
Reference in New Issue
Block a user