Re: tnkk - r31341 - abiword/branches/gsoc2012table_headers/src/text/fmt/xp

From: Hubert Figuière <hfiguiere_at_teaser.fr>
Date: Sat Jun 09 2012 - 20:35:53 CEST

On 09/06/12 11:29 AM, cvs@abisource.com wrote:
>
> Author: tnkk
> Date: 2012-06-09 20:29:29 +0200 (Sat, 09 Jun 2012)
> New Revision: 31341
>
> Modified:
> abiword/branches/gsoc2012table_headers/src/text/fmt/xp/fp_TableContainer.cpp
> Log:
> Delete header object.
> Correct height calculation.
>
>
> Modified: abiword/branches/gsoc2012table_headers/src/text/fmt/xp/fp_TableContainer.cpp
> ===================================================================
> --- abiword/branches/gsoc2012table_headers/src/text/fmt/xp/fp_TableContainer.cpp 2012-06-08 17:52:54 UTC (rev 31340)
> +++ abiword/branches/gsoc2012table_headers/src/text/fmt/xp/fp_TableContainer.cpp 2012-06-09 18:29:29 UTC (rev 31341)
> @@ -3253,6 +3253,10 @@
> setPrev(NULL);
> setNext(NULL);
> m_pMasterTable = NULL;
> + if(!isThisBroken())
> + {
> + delete(m_pTableHeader);
> + }
> }

delete is not a function. Syntax is delete m_pTableHeader.
Also since you delete it, you should set the value to NULL
(we have the DELETEP() macro for that)

>
> fp_Column * fp_TableContainer::getBrokenColumn(void)
> @@ -6628,15 +6632,15 @@
>
> void fp_TableHeader::populateCells(void)
> {
> - int i,noOfColumns=getNumCols(),j;
> + int i,noOfColumns=getNumCols();
> const std::vector<UT_sint32> & headerRowNum = getHeaderRowNos();
> - int totRows = headerRowNum.size();
> - for(j=0;j<totRows;j++)
> + std::vector<UT_sint32>::const_iterator itr = headerRowNum.begin();
> + for(;itr < headerRowNum.end() ; itr++)

The only comparison allowed here is != between the iterator and the
end() iterator.

Also please always use pre-increment on iterators.

> @@ -6667,13 +6671,12 @@
> const std::vector<UT_sint32> & headerRowNum = getHeaderRowNos();
> if(!headerRowNum.empty())
> {
> - int totRows = headerRowNum.size();
> - int i;
> xxx_UT_DEBUGMSG(("The total no of rows are %d\n",totRows));
> - for(i=0;i<totRows;i++)
> + std::vector<UT_sint32>::const_iterator itr = headerRowNum.begin();
> + for(;itr < headerRowNum.end() ; itr++)

same here

Hub
Received on Sat Jun 9 20:44:07 2012

This archive was generated by hypermail 2.1.8 : Sat Jun 09 2012 - 20:44:07 CEST