Floor Terra <[EMAIL PROTECTED]> writes:

> There are similar checks to prevent printing for example. You
> only need to put "return 1;" in OkToPrint()[1]. It's trivial
> to change the source and recompile if you need to.

That is much nicer.  Here's a new diff from brad that uses your
method.

Works for me with xpdf, pdf2ps, pdftotext and pdfimages.

anyone, ok?

Index: Makefile
===================================================================
RCS file: /cvs/ports/textproc/xpdf/Makefile,v
retrieving revision 1.61
diff -u -p -r1.61 Makefile
--- Makefile    19 Apr 2008 07:38:24 -0000      1.61
+++ Makefile    24 Apr 2008 23:06:43 -0000
@@ -4,8 +4,8 @@ COMMENT-main=   PDF viewer for X11
 COMMENT-utils= PDF conversion tools
 
 DISTNAME=      xpdf-3.02
-PKGNAME-main=  xpdf-3.02pl2p3
-PKGNAME-utils= xpdf-utils-3.02pl2p0
+PKGNAME-main=  xpdf-3.02pl2p4
+PKGNAME-utils= xpdf-utils-3.02pl2p1
 CATEGORIES=    textproc x11
 
 MASTER_SITES=  ftp://ftp.foolabs.com/pub/xpdf/ \
Index: patches/patch-xpdf_XPDFCore_cc
===================================================================
RCS file: patches/patch-xpdf_XPDFCore_cc
diff -N patches/patch-xpdf_XPDFCore_cc
--- patches/patch-xpdf_XPDFCore_cc      30 Mar 2007 04:09:42 -0000      1.4
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,13 +0,0 @@
-$OpenBSD: patch-xpdf_XPDFCore_cc,v 1.4 2007/03/30 04:09:42 ckuethe Exp $
---- xpdf/XPDFCore.cc.orig      Tue Feb 27 22:05:52 2007
-+++ xpdf/XPDFCore.cc   Fri Mar 30 00:31:19 2007
-@@ -407,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) {
Index: patches/patch-xpdf_XPDFViewer_cc
===================================================================
RCS file: patches/patch-xpdf_XPDFViewer_cc
diff -N patches/patch-xpdf_XPDFViewer_cc
--- patches/patch-xpdf_XPDFViewer_cc    30 Mar 2007 04:09:42 -0000      1.4
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,15 +0,0 @@
-$OpenBSD: patch-xpdf_XPDFViewer_cc,v 1.4 2007/03/30 04:09:42 ckuethe Exp $
---- xpdf/XPDFViewer.cc.orig    Tue Feb 27 22:05:52 2007
-+++ xpdf/XPDFViewer.cc Fri Mar 30 00:31:19 2007
-@@ -3406,11 +3406,6 @@ void XPDFViewer::printPrintCbk(Widget widget, XtPointe
-   PSOutputDev *psOut;
- 
-   doc = viewer->core->getDoc();
--  if (!doc->okToPrint()) {
--    error(-1, "Printing this document is not allowed.");
--    return;
--  }
--
-   viewer->core->setBusyCursor(gTrue);
- 
-   XtVaGetValues(viewer->printWithCmdBtn, XmNset, &withCmd, NULL);
Index: patches/patch-xpdf_XRef_cc
===================================================================
RCS file: patches/patch-xpdf_XRef_cc
diff -N patches/patch-xpdf_XRef_cc
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-xpdf_XRef_cc  24 Apr 2008 23:53:11 -0000
@@ -0,0 +1,27 @@
+$OpenBSD$
+--- xpdf/XRef.cc.orig  Thu Apr 24 19:13:00 2008
++++ xpdf/XRef.cc       Thu Apr 24 19:50:06 2008
+@@ -771,19 +771,19 @@ void XRef::setEncryption(int permFlagsA, GBool ownerPa
+ }
+ 
+ GBool XRef::okToPrint(GBool ignoreOwnerPW) {
+-  return (!ignoreOwnerPW && ownerPasswordOk) || (permFlags & permPrint);
++  return (1);
+ }
+ 
+ GBool XRef::okToChange(GBool ignoreOwnerPW) {
+-  return (!ignoreOwnerPW && ownerPasswordOk) || (permFlags & permChange);
++  return (1);
+ }
+ 
+ GBool XRef::okToCopy(GBool ignoreOwnerPW) {
+-  return (!ignoreOwnerPW && ownerPasswordOk) || (permFlags & permCopy);
++  return (1);
+ }
+ 
+ GBool XRef::okToAddNotes(GBool ignoreOwnerPW) {
+-  return (!ignoreOwnerPW && ownerPasswordOk) || (permFlags & permNotes);
++  return (1);
+ }
+ 
+ Object *XRef::fetch(int num, int gen, Object *obj) {
Index: patches/patch-xpdf_pdfimages_cc
===================================================================
RCS file: patches/patch-xpdf_pdfimages_cc
diff -N patches/patch-xpdf_pdfimages_cc
--- patches/patch-xpdf_pdfimages_cc     24 Oct 2003 19:31:57 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,17 +0,0 @@
-$OpenBSD: patch-xpdf_pdfimages_cc,v 1.1 2003/10/24 19:31:57 brad Exp $
---- xpdf/pdfimages.cc.orig     2003-10-23 22:57:28.000000000 -0700
-+++ xpdf/pdfimages.cc  2003-10-23 22:57:36.000000000 -0700
-@@ -118,13 +118,6 @@ int main(int argc, char *argv[]) {
-     goto err1;
-   }
- 
--  // check for copy permission
--  if (!doc->okToCopy()) {
--    error(-1, "Copying of images from this document is not allowed.");
--    exitCode = 3;
--    goto err1;
--  }
--
-   // get page range
-   if (firstPage < 1)
-     firstPage = 1;
Index: patches/patch-xpdf_pdftops_cc
===================================================================
RCS file: patches/patch-xpdf_pdftops_cc
diff -N patches/patch-xpdf_pdftops_cc
--- patches/patch-xpdf_pdftops_cc       30 Mar 2007 04:09:42 -0000      1.4
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,17 +0,0 @@
-$OpenBSD: patch-xpdf_pdftops_cc,v 1.4 2007/03/30 04:09:42 ckuethe Exp $
---- xpdf/pdftops.cc.orig       Tue Feb 27 22:05:52 2007
-+++ xpdf/pdftops.cc    Fri Mar 30 00:31:19 2007
-@@ -278,13 +278,6 @@ int main(int argc, char *argv[]) {
-     goto err1;
-   }
- 
--  // check for print permission
--  if (!doc->okToPrint()) {
--    error(-1, "Printing this document is not allowed.");
--    exitCode = 3;
--    goto err1;
--  }
--
-   // construct PostScript file name
-   if (argc == 3) {
-     psFileName = new GString(argv[2]);
Index: patches/patch-xpdf_pdftotext_cc
===================================================================
RCS file: patches/patch-xpdf_pdftotext_cc
diff -N patches/patch-xpdf_pdftotext_cc
--- patches/patch-xpdf_pdftotext_cc     25 Jan 2004 06:02:40 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,17 +0,0 @@
-$OpenBSD: patch-xpdf_pdftotext_cc,v 1.2 2004/01/25 06:02:40 brad Exp $
---- xpdf/pdftotext.cc.orig     2004-01-21 20:26:45.000000000 -0500
-+++ xpdf/pdftotext.cc  2004-01-24 23:34:15.000000000 -0500
-@@ -160,13 +160,6 @@ int main(int argc, char *argv[]) {
-     goto err2;
-   }
- 
--  // check for copy permission
--  if (!doc->okToCopy()) {
--    error(-1, "Copying of text from this document is not allowed.");
--    exitCode = 3;
--    goto err2;
--  }
--
-   // construct text file name
-   if (argc == 3) {
-     textFileName = new GString(argv[2]);

Reply via email to