About SwTable::CheckConsistency() (sw module)
Jan Holesovsky
kendy at collabora.com
Mon Sep 23 01:24:13 PDT 2013
Hi Julien,
julien2412 píše v So 21. 09. 2013 v 03:55 -0700:
> I noticed some weird things in SwTable::CheckConsistency(), eg:
> 2102 std::list< RowSpanCheck > aRowSpanCells;
> 2103 std::list< RowSpanCheck >::iterator aIter = aRowSpanCells.end();
>
> then I see ++aIter several times some lines later.
> How can it work since:
> aRowSpanCells isn't initialized
> aIter is at the end of aRowSpanCells
> ?
The code is curious, so I'll just quickly answer without studying it
deeply :-) - I guess during the first pass the ++aIter is not accessed
at all. Then at the end of the 1st pass, it is initialized (aIter =
aRowSpanCells.begin(); at the end), and the we can do ++aIter as we
want...
> Just nitpicking but I think that this part:
> 2128 std::list< RowSpanCheck >::iterator aEraseIter =
> aIter;
> 2129 ++aIter;
> 2130 aRowSpanCells.erase( aEraseIter );
> could be replaced by:
> aIter = aRowSpanCells.erase(aIter);
> since "erase "returns an iterator even before C++11 standard (see
> http://www.cplusplus.com/reference/list/list/erase/)
Could work - but as I did not look well enough at this code, please
don't take it as 'go ahead & clean it up' :-) - some checking of the
history of that file could give you more clues about that I guess.
Thanks for looking into this!
All the best,
Kendy
More information about the LibreOffice
mailing list