[Kde-bindings] KDE/kdebindings/generator/generators/smoke

Richard Dale rdale at foton.es
Fri Dec 18 17:15:14 UTC 2009


On Friday 18 December 2009 04:53:14 pm Arno Rehn wrote:
> On Friday 18 December 2009 17:46:18 Richard Dale wrote:
> > On Friday 18 December 2009 03:27:28 pm Arno Rehn wrote:
> > > SVN commit 1063443 by arnorehn:
> > >
> > > Don't add one to the methodNames count - idMethodName() doesn't expect
> > > that and might crash.
> >
> > That sounds a bit 'sketchy' - do we treat the count of entries in all the
> > smoke tables in the same way? Was this one out of line with the rest?
> 
> Yes, we do. Excerpt from the generator code:
> 
> << "::classes, " << classCount << ",\n";
> << "::methods, " << methodCount << ",\n";
> << "::methodMaps, " << methodMapCount << ",\n";
> << "::methodNames, " << methodNames.count() << ",\n";
> << "::types, " << typeIndex.count() << ",\n";
> 
> Also in Smoke::idMethodName() it reads:
> 
>         Index imax = numMethodNames;
>         Index imin = 1;
>         Index icur = -1;
>         int icmp = -1;
> 
>         while (imax >= imin) {
>             icur = (imin + imax) / 2;
>             icmp = strcmp(methodNames[icur], m);
> 
> If numMethodNames is one more than the last index (i.e. as it was before),
> methodNames[icur] crashes if icur == numMethodNames.
> idClass() behaves the same way and we don't increase the count by one there
> either. So this change is in line with the rest.
Ah ok, that sounds fine..

-- Richard



More information about the Kde-bindings mailing list