Doing more tests I found a mistake of mine on Fl_Help_View.cxx last sent:
This macro:
#define QCHAR_ENTRY(aname, i1, i2) { #aname, sizeof(#aname), ENC(i1,i2) }
Should be:
#define QCHAR_ENTRY(aname, i1, i2) { aname, sizeof(aname)-1, ENC(i1,i2) }
And there is room for a small improvement on binary search of colors and
quoted_char:
Colors:
while ( ifirst <= ilast ) {
int mid = ( ifirst + ilast ) / 2; // compute mid point.
//!!!!! call stncmp only once
int icmp = strcasecmp ( n, colors[mid].name );
if ( icmp > 0 ) {
ifirst = mid + 1; // repeat search in top
half.
} else if ( icmp < 0 ) {
ilast = mid - 1; // repeat search in bottom
half.
} else
// found it. return
{
return fl_rgb_color ( colors[mid].r,
colors[mid].g, colors[mid].b );
}
}
quoted_char:
while ( ifirst <= ilast ) {
int mid = ( ifirst + ilast ) / 2; // compute mid point.
nameptr = names + mid;
//!!!! call stncmp only once
int icmp = strncmp ( p, nameptr->name, nameptr->namelen );
if ( icmp > 0 ) {
ifirst = mid + 1; // repeat search in top half.
} else if ( icmp < 0 ) {
ilast = mid - 1; // repeat search in bottom half.
} else
// found it. return
{
return nameptr->code;
}
}
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev