summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Deutschmann <whissi@gentoo.org>2021-03-30 10:59:39 +0200
committerThomas Deutschmann <whissi@gentoo.org>2021-04-01 00:04:14 +0200
commit5ff1d6955496b3cf9a35042c9ac35db43bc336b1 (patch)
tree6d470f7eb448f59f53e8df1010aec9dad8ce1f72 /Resource/Init/gs_frsd.ps
parentImport Ghostscript 9.53.1 (diff)
downloadghostscript-gpl-patches-5ff1d6955496b3cf9a35042c9ac35db43bc336b1.tar.gz
ghostscript-gpl-patches-5ff1d6955496b3cf9a35042c9ac35db43bc336b1.tar.bz2
ghostscript-gpl-patches-5ff1d6955496b3cf9a35042c9ac35db43bc336b1.zip
Import Ghostscript 9.54ghostscript-9.54
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
Diffstat (limited to 'Resource/Init/gs_frsd.ps')
-rw-r--r--Resource/Init/gs_frsd.ps24
1 files changed, 20 insertions, 4 deletions
diff --git a/Resource/Init/gs_frsd.ps b/Resource/Init/gs_frsd.ps
index 74c1dd27..80d39910 100644
--- a/Resource/Init/gs_frsd.ps
+++ b/Resource/Init/gs_frsd.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2020 Artifex Software, Inc.
+% Copyright (C) 2001-2021 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
@@ -61,13 +61,29 @@ level2dict begin
.currentglobal 1 index gcheck .setglobal exch
currentpacking //false setpacking exch
+ 2 dict begin /filelen 0 def % scratch dict for filelen and pos (below).
% Stack: dict filters parms CloseSource oldglobal oldpacking file
- [ exch { dup 40000 string readstring not { exit } if exch } loop
+ [ exch {
+ dup 40000 string readstring
+ /filelen 2 index length filelen add def % accumulate filelen
+ not { exit } if exch
+ } loop
exch pop
]
- % Stack: dict filters parms CloseSource oldglobal oldpacking [()...]
+ { filelen string } stopped { % try allocating a single string
+ pop % couldn't make a string - discard filelen value
+ } {
+ % transfer the array-of-strings to the single string.
+ % stack: ... [() ...] string
+ /pos 0 def exch {
+ 1 index exch pos exch putinterval /pos pos 40000 add def
+ } forall
+ } ifelse
+ % top of stack is either array of strings or one string == stream_data
+ end % done with scratch dict
+ % Stack: dict filters parms CloseSource oldglobal oldpacking stream_data
3 1 roll setpacking setglobal
- % Stack: dict filters parms CloseSource [()...]
+ % Stack: dict filters parms CloseSource stream_data
1 index .reusablestream
} if
% We created the stream successfully: clean up.