From 2ed5aa240c2c7ceddf11f0121539e8e1422fa779 Mon Sep 17 00:00:00 2001 From: jim thornton <jthornton@parc.com> Date: Wed, 27 Mar 2002 04:29:46 +0000 Subject: [PATCH] "bugfix for intersecting int list with int range: the proper intersection should be those ints in the list that lie w... Original commit message from CVS: apply patch from jim thornton <jthornton@parc.com>: "bugfix for intersecting int list with int range: the proper intersection should be those ints in the list that lie within the range (rather than an empty intersection)." the reverse of this case doesn't exist, because if the entry1 is a list, the members are broken out and tested seperately, therefore the intersection would be int <-> int range, which does work. --- gst/gstprops.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/gst/gstprops.c b/gst/gstprops.c index 58a3acb2d4..265073110a 100644 --- a/gst/gstprops.c +++ b/gst/gstprops.c @@ -1145,11 +1145,38 @@ gst_props_entry_intersect (GstPropsEntry *entry1, GstPropsEntry *entry2) } break; } + case GST_PROPS_LIST_ID: + { + GList *entries = entry2->data.list_data.entries; + result = gst_props_alloc_entry (); + result->propid = entry1->propid; + result->propstype = GST_PROPS_LIST_ID; + result->data.list_data.entries = NULL; + while (entries) { + GstPropsEntry * this = (GstPropsEntry *)entries->data; + if (this->propstype != GST_PROPS_INT_ID) { + /* no hope, this list doesn't even contain ints! */ + gst_props_entry_destroy (result); + result = NULL; + break; + } + if (this->data.int_data >= entry1->data.int_range_data.min && + this->data.int_data <= entry1->data.int_range_data.max) { + result->data.list_data.entries = g_list_append (result->data.list_data.entries, + gst_props_entry_copy (this)); + } + entries = g_list_next (entries); + } + break; + } case GST_PROPS_INT_ID: + { if (entry1->data.int_range_data.min <= entry2->data.int_data && entry1->data.int_range_data.max >= entry2->data.int_data) { result = gst_props_entry_copy (entry2); } + break; + } default: break; }