[gs-cvs] rev 6950 - trunk/gs/src

lpd at ghostscript.com lpd at ghostscript.com
Wed Aug 2 11:08:57 PDT 2006


Author: lpd
Date: 2006-08-02 11:08:56 -0700 (Wed, 02 Aug 2006)
New Revision: 6950

Modified:
   trunk/gs/src/iscan.c
Log:
Makes "(/) token" correctly return an empty name rather than causing a
syntaxerror.


Modified: trunk/gs/src/iscan.c
===================================================================
--- trunk/gs/src/iscan.c	2006-08-02 18:05:32 UTC (rev 6949)
+++ trunk/gs/src/iscan.c	2006-08-02 18:08:56 UTC (rev 6950)
@@ -422,9 +422,12 @@
     case '+': sign = 1; ptr++; break;\
     default: sign = 0;\
   }
+#define refill2_back(styp,nback)\
+  BEGIN sptr -= nback; scan_type = styp; goto pause; END
 #define ensure2_back(styp,nback)\
-  if ( sptr >= endptr ) { sptr -= nback; scan_type = styp; goto pause; }
+  if ( sptr >= endptr ) refill2_back(styp,nback)
 #define ensure2(styp) ensure2_back(styp, 1)
+#define refill2(styp) refill2_back(styp, 1)
     byte s1[2];
     const byte *const decoder = scan_char_decoder;
     int status;
@@ -675,7 +678,13 @@
 	    }
 	    break;
 	case '/':
-	    ensure2(scanning_none);
+	    /*
+	     * If the last thing in the input is a '/', don't try to read
+	     * any more data.
+	     */
+	    if (sptr >= endptr && s->end_status != EOFC) {
+		refill2(scanning_none);
+	    }
 	    c = scan_getc();
 	    if (!PDFScanRules && (c == '/')) {
 		name_type = 2;



More information about the gs-cvs mailing list