[gs-cvs] rev 7900 - in trunk/gs: lib toolbin

alexcher at ghostscript.com alexcher at ghostscript.com
Sat May 5 12:20:35 PDT 2007


Author: alexcher
Date: 2007-05-05 12:20:34 -0700 (Sat, 05 May 2007)
New Revision: 7900

Modified:
   trunk/gs/lib/pdf_base.ps
   trunk/gs/toolbin/pdf_info.ps
Log:
Undefine /Length in the stream dictionary when the value is incorrect instead
of defining it as 0 to distinguish streams of 0 and unknown length.

DIFFERENCES:
None


Modified: trunk/gs/lib/pdf_base.ps
===================================================================
--- trunk/gs/lib/pdf_base.ps	2007-05-04 21:23:03 UTC (rev 7899)
+++ trunk/gs/lib/pdf_base.ps	2007-05-05 19:20:34 UTC (rev 7900)
@@ -779,7 +779,7 @@
   } if
   /endstream ne { 
     (   **** Warning: stream Length incorrect.\n) pdfformaterror
-    dup /Length 0 put	% prevent the use of the incorrect length.
+    dup /Length undef % prevent the use of the incorrect length.
     cvx endobj exit   % exit from .pdfrun now.
   } if
   cvx
@@ -906,34 +906,39 @@
     pdf_decrypt_stream
     applyfilters
   } {
-    exch dup /FilePosition .knownget {
-      1 index /File get exch setfileposition
-    } if
+    exch
+    dup /Length knownoget { 0 eq } { //false } ifelse {
+      () 0 () /SubFileDecode filter
+    } {
+      dup /FilePosition .knownget {
+        1 index /File get exch setfileposition
+      } if
 		% Stack: readdata? dict
-    /DecodeParms /Filter filterparms
+      /DecodeParms /Filter filterparms
 		% Stack: readdata? dict parms filternames
-    2 index /File get exch
+      2 index /File get exch
 		% Stack: readdata? dict parms file/string filternames
-    dup length 0 eq {
+      dup length 0 eq {
 		% All the PDF filters have EOD markers, but in this case
 		% there is no specified filter.
-      exch dup type /filetype eq 5 index or {
+        exch dup type /filetype eq 5 index or {
               % Use length for any files or reading data from any source.
-        3 index /Length knownoget not { 0 } if
+          3 index /Length knownoget not { 0 } if
+        } {
+        0       % Otherwise length of 0 for whole string
+        } ifelse
+        4 index /IDFlag known { pop } { () /SubFileDecode filter } ifelse
+        exch
+        pdf_decrypt_stream		% add decryption if needed
+        pop exch pop
       } {
-      0       % Otherwise length of 0 for whole string
+                % Stack: readdata? dict parms source filternames
+        exch 3 index /Length knownoget {
+          () /SubFileDecode filter
+        } if exch
+        pdf_decrypt_stream		% add decryption if needed
+        applyfilters
       } ifelse
-      4 index /IDFlag known { pop } { () /SubFileDecode filter } ifelse
-      exch
-      pdf_decrypt_stream		% add decryption if needed
-      pop exch pop
-    } {
-                % Stack: readdata? dict parms source filternames
-      exch 3 index /Length knownoget {
-        dup 0 ne { () /SubFileDecode filter } { pop } ifelse
-      } if exch
-      pdf_decrypt_stream		% add decryption if needed
-      applyfilters
     } ifelse
   } ifelse
 		% Stack: readdata? dict file

Modified: trunk/gs/toolbin/pdf_info.ps
===================================================================
--- trunk/gs/toolbin/pdf_info.ps	2007-05-04 21:23:03 UTC (rev 7899)
+++ trunk/gs/toolbin/pdf_info.ps	2007-05-05 19:20:34 UTC (rev 7900)
@@ -1,3 +1,21 @@
+%!PS
+% Copyright (C) 2007 artofcode LLC.  All rights reserved.
+% 
+% This software is provided AS-IS with no warranty, either express or
+% implied.
+% 
+% This software is distributed under license and may not be copied,
+% modified or distributed except as expressly authorized under the terms
+% of the license contained in the file LICENSE in this distribution.
+% 
+% For more information about licensing, please refer to
+% http://www.ghostscript.com/licensing/. For information on
+% commercial licensing, go to http://www.artifex.com/licensing/ or
+% contact Artifex Software, Inc., 101 Lucas Valley Road #110,
+% San Rafael, CA  94903, U.S.A., +1(415)492-9861.
+%
+% $Id: pdf_info.ps 6300 2005-12-28 19:56:24Z alexcher $
+
 % Dump some info from a PDF file
 
 % usage: gs -dNODISPLAY -q -sFile=____.pdf [-dDumpMediaSizes] [-dDumpFontsUsed [-dShowEmbeddedFonts] ] toolbin/pdf_info.ps



More information about the gs-cvs mailing list