diff options
author | joerg <joerg> | 2017-01-09 12:02:23 +0000 |
---|---|---|
committer | joerg <joerg> | 2017-01-09 12:02:23 +0000 |
commit | 7f87ad9b70ec66ea6b5b3946fb8f61f8b9c56edb (patch) | |
tree | 24247751fb29cf67738e8a5a9ca04b5a4ec168ee /print/py-Pdf/patches | |
parent | b08d55f877902e6740edc050368315dd3a7f9b29 (diff) | |
download | pkgsrc-7f87ad9b70ec66ea6b5b3946fb8f61f8b9c56edb.tar.gz |
Ensure that renaming on page merge actually creates unique names. Bump
revision.
Diffstat (limited to 'print/py-Pdf/patches')
-rw-r--r-- | print/py-Pdf/patches/patch-pyPdf_pdf.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/print/py-Pdf/patches/patch-pyPdf_pdf.py b/print/py-Pdf/patches/patch-pyPdf_pdf.py index 52f1674dd93..0aa4d62ed4d 100644 --- a/print/py-Pdf/patches/patch-pyPdf_pdf.py +++ b/print/py-Pdf/patches/patch-pyPdf_pdf.py @@ -1,6 +1,7 @@ -$NetBSD: patch-pyPdf_pdf.py,v 1.1 2014/01/23 14:38:42 wiz Exp $ +$NetBSD: patch-pyPdf_pdf.py,v 1.2 2017/01/09 12:02:23 joerg Exp $ python-3.x compatibility. +When renaming resources, make sure that the new name is actually new. --- pyPdf/pdf.py.orig 2010-12-04 22:49:56.000000000 +0000 +++ pyPdf/pdf.py @@ -51,3 +52,18 @@ python-3.x compatibility. user_password, key = self._authenticateUserPassword(password) if user_password: self._decryption_key = key +@@ -1062,7 +1062,13 @@ class PageObject(DictionaryObject): + renameRes = {} + for key in page2Res.keys(): + if newRes.has_key(key) and newRes[key] != page2Res[key]: +- newname = NameObject(key + "renamed") ++ base_newkey = key + "renamed" ++ newkey = base_newkey ++ counter = 0 ++ while newRes.has_key(newkey) or page2Res.has_key(newkey): ++ newkey = "%s%d" % (base_newkey, counter) ++ counter = counter + 1 ++ newname = NameObject(newkey) + renameRes[key] = newname + newRes[newname] = page2Res[key] + elif not newRes.has_key(key): |