summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'media-gfx/xfig/files/xfig-3.2.5b-pdfimport_mediabox.patch')
-rw-r--r--media-gfx/xfig/files/xfig-3.2.5b-pdfimport_mediabox.patch37
1 files changed, 37 insertions, 0 deletions
diff --git a/media-gfx/xfig/files/xfig-3.2.5b-pdfimport_mediabox.patch b/media-gfx/xfig/files/xfig-3.2.5b-pdfimport_mediabox.patch
new file mode 100644
index 000000000000..23de740f157d
--- /dev/null
+++ b/media-gfx/xfig/files/xfig-3.2.5b-pdfimport_mediabox.patch
@@ -0,0 +1,37 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 33_pdfimport_mediabox.dpatch by jsoula@univ-lille2.fr
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Fix reading "/MediaBox" when importing PDF (Closes: #530898).
+
+@DPATCH@
+diff -urNad xfig~/f_readeps.c xfig/f_readeps.c
+--- xfig~/f_readeps.c
++++ xfig/f_readeps.c
+@@ -77,11 +77,13 @@
+
+ /* look for /MediaBox for pdf file */
+ if (pdf_flag) {
+- if (!strncmp(buf, "/MediaBox", 8)) { /* look for the MediaBox spec */
++ char *s;
++ for(s=buf; (s=strchr(s,'/')); s++) {
++ if (!strncmp(s, "/MediaBox", 8)) { /* look for the MediaBox spec */
+ char *c;
+
+- c = strchr(buf, '[') + 1;
+- if (c && sscanf(c, "%d %d %d %d", &llx, &lly, &urx, &ury) < 4) {
++ c = strchr(s, '[');
++ if (c && sscanf(c+1, "%d %d %d %d", &llx, &lly, &urx, &ury) < 4) {
+ llx = lly = 0;
+ urx = paper_sizes[0].width * 72 / PIX_PER_INCH;
+ ury = paper_sizes[0].height * 72 / PIX_PER_INCH;
+@@ -89,7 +91,9 @@
+ appres.INCHES ? "Letter" : "A4");
+ app_flush();
+ }
++ break;
+ }
++ }
+ /* look for bounding box */
+ } else if (!nested && !strncmp(buf, "%%BoundingBox:", 14)) {
+ if (!strstr(buf, "(atend)")) { /* make sure doesn't say (atend) */