Re: About SwTable::CheckConsistency() (sw module)

2013-09-23 Thread Jan Holesovsky
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

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


About SwTable::CheckConsistency() (sw module)

2013-09-21 Thread julien2412
Hi,

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
?
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/)

See
http://opengrok.libreoffice.org/xref/core/sw/source/core/table/swnewtable.cxx#2095

Julien



--
View this message in context: 
http://nabble.documentfoundation.org/About-SwTable-CheckConsistency-sw-module-tp4074960.html
Sent from the Dev mailing list archive at Nabble.com.
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice