[REVIEW][3-5] fix STL assertion in vcl graphite code

Martin Hosken martin_hosken at sil.org
Mon Mar 19 07:22:50 PDT 2012


Dear Petr,

Thank you for the reminder of this issue. My apologies for not getting to it earlier.

> > 
> > I do not understand the code either. I just wonder if it would make
> > sense to check for:
> > 
> > 	while (++nCharIndex - mnMinCharPos <
> >                     static_cast<int>(mvChar2BaseGlyph.size()))
> > 
> > As the array is accessed as mvChar2BaseGlyph[nCharIndex-mnMinCharPos].
> > Otherwise, the cycle might end too early. 
> > 
> > Another conservative solution would be to combine it with the original
> > check:
> > 
> > while (++nCharIndex < static_cast<int>(mvGlyph2Char.size()) &&
> >        nCharIndex - mnMinCharPos <
> >                         static_cast<int>(mvChar2BaseGlyph.size()))
> 
> Any other opinion here, please?

I would go with the first of these. It makes no sense to compare a charIndex against a glyph->char mapping array, whose size is the number of glyphs, not characters. I think it is simply a bug.

Notice that I am not claiming authoritative understanding of this code since it was written by Keith, who unfortunately is no longer with us and so cannot comment. I am hoping that when I eventually get time to work on this code, and particularly the mac port, I can refactor the code and gain the necessary authoritative confidence.

Yours,
Martin


More information about the LibreOffice mailing list