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

ray at ghostscript.com ray at ghostscript.com
Mon Aug 21 13:37:49 PDT 2006


Author: ray
Date: 2006-08-21 13:37:48 -0700 (Mon, 21 Aug 2006)
New Revision: 7002

Modified:
   trunk/gs/src/gpmisc.c
Log:
Handle IODevice specifications in file name in gp_file_name_combine_generic
by detecting leading '%' and returning the filename unchanged. The file_name_
combine logic is platform dependent, but IODevices don't use the same rules,
so an IODevice prefix can't be meaningfully processed.

DETAILS:

IN theory, a %os% header should be treated differently, but for now handle
this as an IODevice case. This means that a %os% prefix can be used to avoid
processing such as changing A/../B to B.



Modified: trunk/gs/src/gpmisc.c
===================================================================
--- trunk/gs/src/gpmisc.c	2006-08-19 17:33:54 UTC (rev 7001)
+++ trunk/gs/src/gpmisc.c	2006-08-21 20:37:48 UTC (rev 7002)
@@ -120,6 +120,8 @@
  * directory references from the concatenation when possible.
  * The trailing zero byte is being added.
  *
+ * Also tolerates/skips leading IODevice specifiers such as %os% or %rom%
+ *
  * Examples : 
  *	"/gs/lib" + "../Resource/CMap/H" --> "/gs/Resource/CMap/H"
  *	"C:/gs/lib" + "../Resource/CMap/H" --> "C:/gs/Resource/CMap/H"
@@ -129,6 +131,8 @@
  *		"DUA1:[GHOSTSCRIPT.RESOURCE.CMAP]H"
  *      "\\server\share/a/b///c/../d.e/./" + "../x.e/././/../../y.z/v.v" --> 
  *		"\\server\share/a/y.z/v.v"
+ *	"%rom%lib/" + "gs_init.ps" --> "%rom%lib/gs_init.ps
+ *	"" + "%rom%lib/gs_init.ps" --> "%rom%lib/gs_init.ps"
  */
 gp_file_name_combine_result
 gp_file_name_combine_generic(const char *prefix, uint plen, const char *fname, uint flen, 
@@ -147,6 +151,15 @@
     uint rlen = gp_file_name_root(fname, flen);
     /* We need a special handling of infixes only immediately after a drive. */
 
+    if ( flen > 0 && fname[0] == '%') {
+    	/* IoDevice -- just return the fname as-is since this */
+	/* function only handles the default file system */
+	/* NOTE: %os% will subvert the normal processing of prefix and fname */
+	ip = fname;
+	if (!append(&bp, bpe, &ip, flen))
+	    return gp_combine_small_buffer;
+	return gp_combine_success;
+    }
     if (rlen != 0) {
         /* 'fname' is absolute, ignore the prefix. */
 	ip = fname;



More information about the gs-cvs mailing list