Do We Care About Warnings Like...

Richard Kimberly Heck rikiheck at lyx.org
Sun Apr 19 17:23:03 UTC 2020


On 4/19/20 1:08 PM, Jean-Marc Lasgouttes wrote:
> Le 19/04/2020 à 17:39, Richard Kimberly Heck a écrit :
>> /cvs/lyx/lyx-devel/src/insets/InsetText.cpp:526: warning: implicit
>> conversion changes signedness:
>> 'lyx::RandomAccessList<lyx::Paragraph>::size_type' (aka 'unsigned long')
>> to 'lyx::pit_type' (aka 'long')
>
> It would be nice if pit_type could be unsigned instead. The
> justification I see is:
>
>     // FIXME: should be unsigned as well.
>     // however, simply changing it breaks a downward loop somewhere...
>
> This seems like something we can avoid, isn't it?
>
> One candidate is BufferView::updateMetrics
>
>
>         // Redo paragraphs above anchor if necessary.
>         int y1 = d->anchor_ypos_ - anchor_pm.ascent();
>         // We are now just above the anchor paragraph.
>         pit_type pit1 = d->anchor_pit_ - 1;
>         for (; pit1 >= 0 && y1 >= 0; --pit1) {
>                 tm.redoParagraph(pit1);
>                 ParagraphMetrics & pm = tm.par_metrics_[pit1];
>                 y1 -= pm.descent();
>                 // Save the paragraph position in the cache.
>                 pm.setPosition(y1);
>                 tm.updatePosCache(pit1);
>                 y1 -= pm.ascent();
>         }

Yes, that could be re-written in a variety of ways, I would suppose. But
checking that we don't break any such loops? That sounds difficult.

Riki




More information about the lyx-devel mailing list