FW: Fix for 687625 Incorrect spot color behavior in tiffsep.

"Dan Coby" <[email protected]> Sun, 29 Aug 2004 23:38:14 -0700
Newsgroups gmane.comp.printing.ghostscript.patches
Message-ID <[email protected]>
I forgot to include the changes in the previous email.



Fix for 687625 Incorrect spot color behavior in tiffsep.  Garbage
text was being printed for the spot color names.

DETAILS:

The problem was with the allocation and GC enumeration logic for the
storage for the storage for the spot color names.  Thus the problem
was only apparent after the GC relocation logic had executed.

The fix involves adding enumeration logic for the gs_param_string
structure and correcting the allocation of storage for the data.

_______________________________________________
gs-code-review mailing list
[email protected]
http://www.ghostscript.com/mailman/listinfo/gs-code-review
687625.txt (text/plain, 1.8 KB)
Index: src/gdevdevn.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/gdevdevn.c,v
retrieving revision 1.21
diff -u -r1.21 gdevdevn.c
--- src/gdevdevn.c	1 Jul 2004 04:41:38 -0000	1.21
+++ src/gdevdevn.c	30 Aug 2004 06:27:44 -0000
@@ -30,6 +30,27 @@
 #include "gdevdevn.h"
 #include "gsequivc.h"
 
+private
+ENUM_PTRS_WITH(param_string_enum_ptrs, gs_param_string *pstr) return 0;
+case 0: return ENUM_CONST_STRING(pstr);
+ENUM_PTRS_END
+
+private
+RELOC_PTRS_WITH(param_string_reloc_ptrs, gs_param_string *pstr)
+{
+    gs_const_string str;
+
+    str.data = pstr->data, str.size = pstr->size;
+    RELOC_CONST_STRING_VAR(str);
+    pstr->data = str.data;
+}
+RELOC_PTRS_END
+
+/* Define a GC descriptor for gs_param_string. */
+/* This structure descriptor is only for non persistent gs_param_strings. */
+gs_private_st_composite(st_gs_param_string, gs_param_string, "gs_param_string",
+			param_string_enum_ptrs, param_string_reloc_ptrs);
+
 /*
  * Utility routines for common DeviceN related parameters:
  *   SeparationColorNames, SeparationOrder, and MaxSeparations
@@ -269,9 +290,9 @@
 	int sep_num = separations->num_separations++;
 
 	/* We have a new spot colorant */
-	pstr_param = (gs_param_string *)gs_alloc_bytes(dev->memory,
-			sizeof(gs_param_string), "devn_get_color_comp_index");
-	pseparation = (byte *)gs_alloc_bytes(dev->memory,
+	pstr_param = gs_alloc_struct(dev->memory, gs_param_string,
+			&st_gs_param_string, "devn_get_color_comp_index");
+	pseparation = gs_alloc_string(dev->memory,
 			name_size, "devn_get_color_comp_index");
 	memcpy(pseparation, pname, name_size);
 	pstr_param->data = pseparation;
@@ -571,6 +592,7 @@
 } spotcmyk_device;
 
 /* GC procedures */
+
 private 
 ENUM_PTRS_WITH(spotcmyk_device_enum_ptrs, spotcmyk_device *pdev)
 {