cssselector: Don't invoke undefined behavior

Avoid undefined behavior in the calculation of some
hash values. Found by gcc's undefined behavior sanitizer.
This commit is contained in:
Matthias Clasen 2016-02-26 14:48:21 -05:00
parent 2cabfcc801
commit 6108c646c5

View File

@ -842,7 +842,7 @@ match_pseudoclass_position (const GtkCssSelector *selector,
static guint
hash_pseudoclass_position (const GtkCssSelector *a)
{
return (((a->position.type << POSITION_NUMBER_BITS) | a->position.a) << POSITION_NUMBER_BITS) | a->position.b;
return (guint)(((((gulong)a->position.type) << POSITION_NUMBER_BITS) | a->position.a) << POSITION_NUMBER_BITS) | a->position.b;
}
static int