summaryrefslogtreecommitdiff
path: root/gtk/gtkallocatedbitmask.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2015-02-25 00:35:45 +0100
committerBenjamin Otte <otte@redhat.com>2015-02-25 01:55:28 +0100
commit0ab48fcc4227ab112835f8fc1b922cfb21a7927f (patch)
treee2b3d0b8d860af641f873c01c376cde4c6e9c059 /gtk/gtkallocatedbitmask.c
parent9e50fe0aeba1dba5a151efcdf39b9f0142d26e3d (diff)
downloadgtk+-0ab48fcc4227ab112835f8fc1b922cfb21a7927f.tar.gz
css: Fix _gtk_bitmask_subtract()
We were doing the wrong thing *and* writing uninitialized memory while doing so. BAD. Also added tests exposing these. https://bugzilla.redhat.com/show_bug.cgi?id=1185585
Diffstat (limited to 'gtk/gtkallocatedbitmask.c')
-rw-r--r--gtk/gtkallocatedbitmask.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gtk/gtkallocatedbitmask.c b/gtk/gtkallocatedbitmask.c
index dff1189edf..2ebe0e14e2 100644
--- a/gtk/gtkallocatedbitmask.c
+++ b/gtk/gtkallocatedbitmask.c
@@ -207,7 +207,7 @@ _gtk_allocated_bitmask_subtract (GtkBitmask *mask,
const GtkBitmask *other)
{
GtkBitmask other_allocated;
- guint i;
+ guint i, len;
g_return_val_if_fail (mask != NULL, NULL);
g_return_val_if_fail (other != NULL, NULL);
@@ -215,9 +215,10 @@ _gtk_allocated_bitmask_subtract (GtkBitmask *mask,
mask = gtk_bitmask_ensure_allocated (mask);
ENSURE_ALLOCATED (other, other_allocated);
- for (i = 0; i < other->len; i++)
+ len = MIN (mask->len, other->len);
+ for (i = 0; i < len; i++)
{
- mask->data[i] |= ~other->data[i];
+ mask->data[i] &= ~other->data[i];
}
return gtk_allocated_bitmask_shrink (mask);