Re: new pd_Document.cpp patch

From: J.M. Maurer <uwog_at_uwog.net>
Date: Sat Oct 30 2010 - 12:16:33 CEST

On Tue, 2010-10-26 at 13:16 +0200, Jean Brefort wrote:
> Hi,
>
> I'm cleaning my tree which seems to contain a few patches. This is the
> first one. I might have already proposed it, I don't really remember.
> The points is that PD_Document::isEndFootnoteAtPos() and other such
> methods always return false.

Isn't that check basically already done?

/*bool bRes = */m_pPieceTable->getFragFromPosition(pos,&pf,&pOffset);
while(pf && (pf->getLength() == 0))
{
        pf = pf->getPrev();
}
if(!pf || pf->getPos() < pos)
{
        return false;
}

If getFragFromPosition() fails, then pf unchanged, which makes it skip
the while loop and return false in the statement below that. Your code
would be slightly more save though: your code handles the case where pf
would have been modified by getFragFromPosition() when it also returns
false.

Feel free to commit for that reason.

  Marc
Received on Sat Oct 30 12:17:05 2010

This archive was generated by hypermail 2.1.8 : Sat Oct 30 2010 - 12:17:05 CEST