summaryrefslogtreecommitdiff
path: root/devices
diff options
context:
space:
mode:
authorKen Sharp <ken.sharp@artifex.com>2022-10-02 11:28:19 +0100
committerKen Sharp <ken.sharp@artifex.com>2022-10-02 11:28:19 +0100
commit36b01018cf2d263dc9dac37cd464f5248e3852d4 (patch)
tree7f24717814bb41bc832ef41f08f8e3dfad1b326d /devices
parente581ab615a8ffaf47edfc92e2d313e7c5a145e3c (diff)
downloadghostpdl-36b01018cf2d263dc9dac37cd464f5248e3852d4.tar.gz
pdfwrite - fix Permissions on 64-bit Linux build
Bug #705951 "-dPermissions=<negative>: 32bit gs -> /P <negative>, 64bit gs -> /P <unsigned int>" The code in pdf_close to write out the Encrypt dictionary was writing the Permissions as a long, which is fine on Windows where it is always 32-bit, but doesn't work correctly on Linux because long is 64-bit on a 64-bit build on Linux. Change the print to use an int instead of a long, and also alter the structure member to be a 32-bit integer (not required but might as well be consistent).
Diffstat (limited to 'devices')
-rw-r--r--devices/vector/gdevpdf.c2
-rw-r--r--devices/vector/gdevpdfx.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/devices/vector/gdevpdf.c b/devices/vector/gdevpdf.c
index 40beb06a5..6c4908bc3 100644
--- a/devices/vector/gdevpdf.c
+++ b/devices/vector/gdevpdf.c
@@ -3115,7 +3115,7 @@ pdf_close(gx_device * dev)
pprintld1(s, "/V %ld ", pdev->EncryptionV);
pprintld1(s, "/Length %ld ", pdev->KeyLength);
pprintld1(s, "/R %ld ", pdev->EncryptionR);
- pprintld1(s, "/P %ld ", pdev->Permissions);
+ pprintd1(s, "/P %d ", pdev->Permissions);
stream_puts(s, "/O ");
pdf_put_string(pdev, pdev->EncryptionO, sizeof(pdev->EncryptionO));
stream_puts(s, "\n/U ");
diff --git a/devices/vector/gdevpdfx.h b/devices/vector/gdevpdfx.h
index 098fc4fc9..61a5c582c 100644
--- a/devices/vector/gdevpdfx.h
+++ b/devices/vector/gdevpdfx.h
@@ -641,7 +641,7 @@ struct gx_device_pdf_s {
gs_param_string OwnerPassword;
gs_param_string UserPassword;
uint KeyLength;
- uint Permissions;
+ int32_t Permissions;
uint EncryptionR;
gs_param_string NoEncrypt;
bool EncryptMetadata;