diff options
author | olivier <olivier> | 2014-10-20 17:52:05 +0000 |
---|---|---|
committer | olivier <olivier> | 2014-10-20 17:52:05 +0000 |
commit | f6e635d02657672e63480de7d475c6c32245b20f (patch) | |
tree | 956b7acf1847c96db2da702a91555de4840d9ad8 | |
parent | 2384f3ef86fd69c47264c02eb39f1fd7efa3bc74 (diff) | |
download | libtiff-f6e635d02657672e63480de7d475c6c32245b20f.tar.gz |
* tools/tiff2pdf.c: Preserve input file directory order when pages
are tagged with the same page number.
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | tools/tiff2pdf.c | 12 |
2 files changed, 13 insertions, 3 deletions
@@ -1,3 +1,7 @@ +2014-10-20 Olivier Paquet <olivier.paquet@gmail.com> + * tools/tiff2pdf.c: Preserve input file directory order when pages + are tagged with the same page number. + 2014-08-31 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> * libtiff/tif_dirread.c (TIFFReadDirEntryOutputErr): Incorrect diff --git a/tools/tiff2pdf.c b/tools/tiff2pdf.c index e79c971c..b7e2d0e4 100644 --- a/tools/tiff2pdf.c +++ b/tools/tiff2pdf.c @@ -1,4 +1,4 @@ -/* $Id: tiff2pdf.c,v 1.73 2013-09-20 15:35:37 faxguy Exp $ +/* $Id: tiff2pdf.c,v 1.74 2014-10-20 17:52:05 olivier Exp $ * * tiff2pdf - converts a TIFF image to a PDF document * @@ -1197,12 +1197,18 @@ void t2p_read_tiff_init(T2P* t2p, TIFF* input){ /* * This function is used by qsort to sort a T2P_PAGE* array of page structures - * by page number. + * by page number. If the page numbers are the same, we fall back to comparing + * directory numbers to preserve the order of the input file. */ int t2p_cmp_t2p_page(const void* e1, const void* e2){ - return( ((T2P_PAGE*)e1)->page_number - ((T2P_PAGE*)e2)->page_number ); + int d; + d = (int32)(((T2P_PAGE*)e1)->page_number) - (int32)(((T2P_PAGE*)e2)->page_number); + if(d == 0){ + d = (int32)(((T2P_PAGE*)e1)->page_directory) - (int32)(((T2P_PAGE*)e2)->page_directory); + } + return d; } /* |