[Kde-hardware-devel] Solid device action predicates
Will Stephenson
wstephenson at kde.org
Thu Jul 23 23:15:41 CEST 2009
On Friday 10 July 2009 11:26:44 Ozan Çağlayan wrote:
> Ozan Çağlayan wrote On 08-07-2009 14:47:
> > Okay I've found the problem in solid/solid/predicate.cpp:
> >
> > In Solid::Predicate::matches, a boolean expression is returned to
> > identify whether there was a match or not:
> >
> >
> > if (d->compOperator==Mask) {
> > bool v_ok;
> > int v = value.toInt(&v_ok);
> > bool e_ok;
> > int e = expected.toInt(&e_ok);
> >
> > return (e_ok && v_ok && (v &e));
> > } else {
> > return (value == expected);
> >
> > The problem is that when the expected value doesn't exist (e.g. foobar,
> > or a plain empty string '') e is equal to -1. So (v &e) masking returns
> > non-null because of the signedness of the variable e. I tried a very
> > quick hack and it fixed the issue. I replaced that expression with:
> >
> > return (e_ok && v_ok && (e+1) && (v &e));
> >
> >
> > I'm not quite familiar with boolean expressions so the optimal solution
> > is up to you.
>
> ping :)
Was this ever resolved?
Will
More information about the Kde-hardware-devel
mailing list