texlive[49491] Build/source/texk/web2c/xetexdir: Avoid modification

commits+kakuto at tug.org commits+kakuto at tug.org
Mon Dec 24 04:10:07 CET 2018


Revision: 49491
          http://tug.org/svn/texlive?view=revision&revision=49491
Author:   kakuto
Date:     2018-12-24 04:10:06 +0100 (Mon, 24 Dec 2018)
Log Message:
-----------
Avoid modification of internal poppler object (from Stefun)

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/xetexdir/ChangeLog
    trunk/Build/source/texk/web2c/xetexdir/pdfimage.cpp

Modified: trunk/Build/source/texk/web2c/xetexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/xetexdir/ChangeLog	2018-12-24 01:24:08 UTC (rev 49490)
+++ trunk/Build/source/texk/web2c/xetexdir/ChangeLog	2018-12-24 03:10:06 UTC (rev 49491)
@@ -1,3 +1,9 @@
+2018-12-24  Stefan Br\"uns  <stefan.bruens at rwth-aachen.de tug.org>
+
+	* pdfimage.cpp: Avoid modification of internal poppler object,
+	fix compilation with poppler 0.70.0 and newer ones.
+	Improve the change on 2018-10-22.
+
 2018-11-17  Joseph Wright  <joseph.wright at morningstar2.co.uk>
 
 	* xetex.web, xetex.defines: Support some primitives from
@@ -5,7 +11,7 @@
 
 2018-10-22  Akira Kakuto  <kakuto at fuk.kindai.ac.jp>
 
-	* pdfimage.cpp: Cast types to support poppler 0.70.0.
+	* pdfimage.cpp: Support poppler 0.70.0.
 
 2018-09-09  Karl Berry  <karl at tug.org>
 

Modified: trunk/Build/source/texk/web2c/xetexdir/pdfimage.cpp
===================================================================
--- trunk/Build/source/texk/web2c/xetexdir/pdfimage.cpp	2018-12-24 01:24:08 UTC (rev 49490)
+++ trunk/Build/source/texk/web2c/xetexdir/pdfimage.cpp	2018-12-24 03:10:06 UTC (rev 49491)
@@ -78,26 +78,27 @@
 
 	Page*		page = doc->getCatalog()->getPage(page_num);
 
-	PDFRectangle*	r;
+	const PDFRectangle*	r;
 	switch (pdf_box) {
 		default:
 		case pdfbox_crop:
-			r = (PDFRectangle *)page->getCropBox();
+			r = page->getCropBox();
 			break;
 		case pdfbox_media:
-			r = (PDFRectangle *)page->getMediaBox();
+			r = page->getMediaBox();
 			break;
 		case pdfbox_bleed:
-			r = (PDFRectangle *)page->getBleedBox();
+			r = page->getBleedBox();
 			break;
 		case pdfbox_trim:
-			r = (PDFRectangle *)page->getTrimBox();
+			r = page->getTrimBox();
 			break;
 		case pdfbox_art:
-			r = (PDFRectangle *)page->getArtBox();
+			r = page->getArtBox();
 			break;
 	}
 
+	PDFRectangle r2 = *r;
 	int RotAngle = 0;
 	RotAngle = (int)page->getRotate() % 360;
 	if (RotAngle < 0)
@@ -104,26 +105,26 @@
 		RotAngle += 360;
 	if (RotAngle == 90 || RotAngle == 270) {
 		double tmpvalue;
-		if (r->x1 > r->x2) {
-			tmpvalue = r->x1;
-			r->x1 = r->x2;
-			r->x2 = tmpvalue;
+		if (r2.x1 > r2.x2) {
+			tmpvalue = r2.x1;
+			r2.x1 = r2.x2;
+			r2.x2 = tmpvalue;
 		}
-		if (r->y1 > r->y2) {
-			tmpvalue = r->y1;
-			r->y1 = r->y2;
-			r->y2 = tmpvalue;
+		if (r2.y1 > r2.y2) {
+			tmpvalue = r2.y1;
+			r2.y1 = r2.y2;
+			r2.y2 = tmpvalue;
 		}
 
-		tmpvalue = r->x2;
-		r->x2 = r->x1 + r->y2 - r->y1;
-		r->y2 = r->y1 + tmpvalue - r->x1;
+		tmpvalue = r2.x2;
+		r2.x2 = r2.x1 + r2.y2 - r2.y1;
+		r2.y2 = r2.y1 + tmpvalue - r2.x1;
 	}
 
-	box->x  = 72.27 / 72 * my_fmin(r->x1, r->x2);
-	box->y  = 72.27 / 72 * my_fmin(r->y1, r->y2);
-	box->wd = 72.27 / 72 * fabs(r->x2 - r->x1);
-	box->ht = 72.27 / 72 * fabs(r->y2 - r->y1);
+	box->x  = 72.27 / 72 * my_fmin(r2.x1, r2.x2);
+	box->y  = 72.27 / 72 * my_fmin(r2.y1, r2.y2);
+	box->wd = 72.27 / 72 * fabs(r2.x2 - r2.x1);
+	box->ht = 72.27 / 72 * fabs(r2.y2 - r2.y1);
 
 	delete doc;
 



More information about the tex-live-commits mailing list