From d6496254d647c4bcf13757da4a71a4bf64f406b0 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Wed, 30 Jul 2008 10:32:25 +0000 Subject: [PATCH] * clutter/clutter-model.c (clutter_model_set_sorting_column): This function is supposed to accept -1 to disable sorting. However it checks for whether the column is >= the number of columns, but clutter_model_get_n_columns() returns an unsigned int so the column number also gets promoted to unsigned for the comparison. Therefore -1 is always greater than the number of columns so it wouldn't let you set it. --- ChangeLog | 10 ++++++++++ clutter/clutter-model.c | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 32cec202b..0b1fb1c4d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-07-30 Neil Roberts + + * clutter/clutter-model.c (clutter_model_set_sorting_column): This + function is supposed to accept -1 to disable sorting. However it + checks for whether the column is >= the number of columns, but + clutter_model_get_n_columns() returns an unsigned int so the + column number also gets promoted to unsigned for the + comparison. Therefore -1 is always greater than the number of + columns so it wouldn't let you set it. + 2008-07-26 Neil Roberts * clutter/clutter-timeline.c (clutter_timeline_list_markers): When diff --git a/clutter/clutter-model.c b/clutter/clutter-model.c index ecfe9d6ce..c301d56cd 100644 --- a/clutter/clutter-model.c +++ b/clutter/clutter-model.c @@ -1220,7 +1220,9 @@ clutter_model_set_sorting_column (ClutterModel *model, g_return_if_fail (CLUTTER_IS_MODEL (model)); priv = model->priv; - if (column >= clutter_model_get_n_columns (model)) + /* The extra comparison for >= 0 is because column gets promoted to + unsigned in the second comparison */ + if (column >= 0 && column >= clutter_model_get_n_columns (model)) { g_warning ("%s: Invalid column id value %d\n", G_STRLOC, column); return;