pit_type as unsigned

Jean-Marc Lasgouttes lasgouttes at lyx.org
Mon May 11 11:00:31 UTC 2020


Le 03/05/2020 à 21:03, Richard Kimberly Heck a écrit :
> That said, there are now a lot of other warnings like this one:
> 
> /cvs/lyx/lyx-devel/src/Text.cpp:116: warning: implicit conversion
> changes signedness: 'unsigned long' to 'typename
> iterator_traits<_List_iterator<Paragraph> >::difference_type' (aka 'long')
> 
>      Paragraph & tmp = *pars.insert(lyx::next(pars.begin(), **pit + 1**),
>                         Paragraph());

What about the patch below? I find it ridiculous (and slow) to use 
next() to access our random access container. I am surprised though by 
this issue, since using 'begin() + i' in things like insert or erase is 
supposed to be normal.

> I'm not sure what to do about those. There are similar things in
> TextMetrics.cpp, and a lot of them. Enough to make me start to wonder
> whether this is worth it.

What do you have in TextMetrics?

> 
> * It is not clear that depth needs to be an int instead of a depth_type
>>
>> @@ -1635,7 +1635,7 @@ int TextMetrics::leftMargin(pit_type const pit,
>> pos_type const pos) const
>>           l_margin += bfm.signedWidth(tclass.leftmargin());
>>       }
>>
>> -    int depth = par.getDepth();
>> +    int depth = int(par.getDepth());
> 
> I can change it, but then it throws a different warning here:
> 
>      int nestmargin = depth * nestMargin();

Because nestMargin is naturally unsigned?

JMarc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Get-rid-of-lyx-next-uses-for-RandomAccessList.patch
Type: text/x-patch
Size: 12617 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20200511/11fc1336/attachment-0001.bin>


More information about the lyx-devel mailing list