[gs-cvs] gs/src

Igor Melichev igor at ghostscript.com
Tue Jul 26 13:50:25 PDT 2005


Update of /cvs/ghostscript/gs/src
In directory casper2:/tmp/cvs-serv10455/gs/src

Modified Files:
	gdevpdfc.c 
Log Message:
Fix (pdfwrite) : Delay the assignation of object id to a color space until its creation is completed.

DETAILS :

Bug 687712 "ps2pdf silently generates bad PDF in 1.2 mode".

The old code reserved an objewct id for a color space when starting its creation.
If the creation fails (for example, with CompatibilityLevel <= 1.2),
the related graphics is being converted into low level objects.
In that case the reserved object id doesn't appear in the output PDF,
causing an incorrect xerf.

EXPECTED DIFFERENCES :

None.


Index: gdevpdfc.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/gdevpdfc.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- gdevpdfc.c	4 Apr 2005 10:42:16 -0000	1.52
+++ gdevpdfc.c	26 Jul 2005 20:50:23 -0000	1.53
@@ -640,7 +640,6 @@
     pca = cos_array_alloc(pdev, "pdf_color_space");
     if (pca == 0)
 	return_error(gs_error_VMerror);
-    pca->id = pdf_obj_ref(pdev);
 
     switch (csi) {
 
@@ -863,13 +862,15 @@
 
 	if (code < 0 ||
 	    (code = pdf_alloc_resource(pdev, resourceColorSpace, pcs->id,
-				       &pres, pca->id)) < 0
+				       &pres, -1)) < 0
 	    ) {
 	    COS_FREE(pca, "pdf_color_space");
 	    return code;
 	}
+	pdf_reserve_object_id(pdev, pres, 0);
 	if (res_name != NULL) {
 	    int l = min(name_length, sizeof(pres->rname) - 1);
+	    
 	    memcpy(pres->rname, res_name, l);
 	    pres->rname[l] = 0;
 	}
@@ -898,7 +899,7 @@
 		*ppranges = copy_ranges;
 	} else
 	    ppcs->ranges = 0;
-	assert(pca->id == pres->object->id);
+	pca->id = pres->object->id;
 	COS_FREE(pres->object, "pdf_color_space");
 	pres->object = (cos_object_t *)pca;
 	cos_write_object(COS_OBJECT(pca), pdev);



More information about the gs-cvs mailing list