Commit a79f367c authored by Behdad Esfahbod's avatar Behdad Esfahbod

Fix range comparision operators implementation

parent 5bbdffd2
......@@ -96,9 +96,6 @@ FcRangePromote (double v, FcValuePromotionBuffer *vbuf)
FcBool
FcRangeIsInRange (const FcRange *a, const FcRange *b)
{
if (!a || !b)
return FcFalse;
return a->begin >= b->begin && a->end <= b->end;
}
......@@ -107,20 +104,22 @@ FcRangeCompare (FcOp op, const FcRange *a, const FcRange *b)
{
switch ((int) op) {
case FcOpEqual:
return a->begin == b->begin && a->end == b->end;
case FcOpContains:
case FcOpListing:
return FcRangeIsInRange (a, b);
case FcOpNotEqual:
return a->begin != b->begin || a->end != b->end;
case FcOpNotContains:
return !FcRangeIsInRange (a, b);
case FcOpLess:
return a->begin < b->begin;
return a->end < b->begin;
case FcOpLessEqual:
return a->begin <= b->begin;
return a->end <= b->begin;
case FcOpMore:
return a->end > b->end;
return a->begin > b->end;
case FcOpMoreEqual:
return a->end >= b->end;
return a->begin >= b->end;
default:
break;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment