[poppler] FontScanner::scan()

Albert Astals Cid aacid at kde.org
Fri Jul 13 12:36:49 PDT 2007


A Dilluns 09 Juliol 2007, Pino Toscano va escriure:
> Hi,
>
> while testing some new okular feature, I discovered that scan(int) actually
> scans one page more than what was specified as argument.
> This is my explanation (of course correct me if I'm wrong):
> - FontScanner uses 1..n indeces for the pages, so in the constructor
> currentPage is initialized to 1
> line 41: lastPage = currentPage + nPages;
>   init the "last" page (or upper bound) of the scanning
>
> line 46: for (pg = currentPage; pg <= lastPage; ++pg) {
>   this scans either the current page, the pages between currentPage and
>   lastPage, but lastPage as well!
>   Example: currentPage = 3, and we request nPages = 2 (scan 2 pages),
>   it should scan the pages 3,4, while this for() would scan pages 3,4,5.
>
> line 66: currentPage = lastPage + 1;
>   the current page becomes the pages after the "last" page
>
> I propose two patches :)
> A: makes sure lastPage is always the page after the last page in every
> scanning
> B: lastPage is the past page to be actually scanned in each scanning
>
> What do you think?
> If possible, I'd like to have it fixed before the final release.

Commited, thanks for the patch.

Albert

>
> Thanks,




More information about the poppler mailing list