"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.
This commit is contained in:
jim thornton 2002-03-27 04:29:46 +00:00 committed by Andy Wingo
parent 862538e9ac
commit 2ed5aa240c

View file

@ -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;
}