aboutsummaryrefslogtreecommitdiffstats
path: root/community/xpdf/xpdf-3.04-protection.patch
blob: 677db0009562ca433605f08a16c6d31e1f0667db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
Port Johannes Bauer's protection patch to 3.04.
This does NOT disable the error messages, since the user should
be aware of the author's intent.

Also, this does not deal with permission to print.

diff --git a/xpdf/PDFCore.cc b/xpdf/PDFCore.cc
index 34b6483..e93fe52 100644
--- a/xpdf/PDFCore.cc
+++ b/xpdf/PDFCore.cc
@@ -1677,9 +1677,6 @@ GString *PDFCore::extractText(int pg, double xMin, double yMin,
   int x0, y0, x1, y1, t;
   GString *s;
 
-  if (!doc->okToCopy()) {
-    return NULL;
-  }
   if ((page = findPage(pg))) {
     cvtUserToDev(pg, xMin, yMin, &x0, &y0);
     cvtUserToDev(pg, xMax, yMax, &x1, &y1);
diff --git a/xpdf/XPDFCore.cc b/xpdf/XPDFCore.cc
index 9a3725f..1562c7a 100644
--- a/xpdf/XPDFCore.cc
+++ b/xpdf/XPDFCore.cc
@@ -384,9 +384,8 @@ void XPDFCore::endSelection(int wx, int wy) {
 #ifndef NO_TEXT_SELECT
       if (selectULX != selectLRX &&
 	  selectULY != selectLRY) {
-	if (doc->okToCopy()) {
 	  copySelection();
-	} else {
+	if (!doc->okToCopy()) {
 	  error(errNotAllowed, -1,
 		"Copying of text from this document is not allowed.");
 	}
@@ -408,9 +407,6 @@ void XPDFCore::copySelection() {
   int pg;
   double ulx, uly, lrx, lry;
 
-  if (!doc->okToCopy()) {
-    return;
-  }
   if (getSelection(&pg, &ulx, &uly, &lrx, &lry)) {
     //~ for multithreading: need a mutex here
     if (currentSelection) {
diff --git a/xpdf/pdfimages.cc b/xpdf/pdfimages.cc
index dc79443..9aaa811 100644
--- a/xpdf/pdfimages.cc
+++ b/xpdf/pdfimages.cc
@@ -122,8 +122,6 @@ int main(int argc, char *argv[]) {
   if (!doc->okToCopy()) {
     error(errNotAllowed, -1,
 	  "Copying of images from this document is not allowed.");
-    exitCode = 3;
-    goto err1;
   }
 
   // get page range
diff --git a/xpdf/pdftohtml.cc b/xpdf/pdftohtml.cc
index f1fe691..824233e 100644
--- a/xpdf/pdftohtml.cc
+++ b/xpdf/pdftohtml.cc
@@ -134,8 +134,6 @@ int main(int argc, char *argv[]) {
   if (!doc->okToCopy()) {
     error(errNotAllowed, -1,
 	  "Copying of text from this document is not allowed.");
-    exitCode = 3;
-    goto err1;
   }
 
   // get page range
diff --git a/xpdf/pdftotext.cc b/xpdf/pdftotext.cc
index 758413e..e6779fa 100644
--- a/xpdf/pdftotext.cc
+++ b/xpdf/pdftotext.cc
@@ -192,8 +192,6 @@ int main(int argc, char *argv[]) {
   if (!doc->okToCopy()) {
     error(errNotAllowed, -1,
 	  "Copying of text from this document is not allowed.");
-    exitCode = 3;
-    goto err2;
   }
 
   // construct text file name